aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKaroly Lorentey2005-05-09 16:13:15 +0000
committerKaroly Lorentey2005-05-09 16:13:15 +0000
commit85dc59a9ff65aaf6b8e6a0c4452f74b7dade88fd (patch)
tree85aebc58216ed19de18354b3d9974942eea621d5 /src
parentc25b55138a36cf5f334070baf79ce61c1e956eed (diff)
parentc7bda15b58de3efcf856786167f11f5b4175e30b (diff)
downloademacs-85dc59a9ff65aaf6b8e6a0c4452f74b7dade88fd.tar.gz
emacs-85dc59a9ff65aaf6b8e6a0c4452f74b7dade88fd.zip
Merged from miles@gnu.org--gnu-2005 (patch 292-295)
Patches applied: * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-292 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-293 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-294 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-295 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-342
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog147
-rw-r--r--src/Makefile.in2
-rw-r--r--src/dired.c2
-rw-r--r--src/eval.c2
-rw-r--r--src/fileio.c12
-rw-r--r--src/fns.c10
-rw-r--r--src/lread.c1
-rw-r--r--src/macselect.c16
-rw-r--r--src/macterm.c502
-rw-r--r--src/macterm.h6
-rw-r--r--src/sysselect.h6
-rw-r--r--src/xfns.c4
12 files changed, 580 insertions, 130 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 02a81fb7f7c..a8e248a1718 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,85 @@
12005-05-09 Juanma Barranquero <lekktu@gmail.com>
2
3 * fileio.c (Fexpand_file_name, Frename_file, Fadd_name_to_file)
4 (Fmake_symbolic_link, Faccess_file, Frecent_auto_save_p):
5 Doc fixes.
6
7 * dired.c (Ffile_name_completion): Make argument name
8 match its use in docstring.
9
102005-05-08 Luc Teirlinck <teirllm@auburn.edu>
11
12 * eval.c (Fdefvaralias): Remove any pre-existing
13 variable-documentation property of the alias.
14
152005-05-07 Thien-Thi Nguyen <ttn@gnu.org>
16
17 * xfns.c (start_hourglass): Do nothing when running on a tty.
18
192005-05-07 Juanma Barranquero <lekktu@gmail.com>
20
21 * fns.c (Fchar_table_range): Fix typos in docstring.
22
232005-05-06 Stefan Monnier <monnier@iro.umontreal.ca>
24
25 * fns.c (Fchar_table_range): Yet Another Int/Lisp_Object Mixup.
26
272005-05-06 Eli Zaretskii <eliz@gnu.org>
28
29 * lread.c (Flocate_file_internal): Doc fix.
30
31 * Makefile.in (lisp, shortlisp): Add jka-cmpr-hook.elc.
32
332005-05-06 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
34
35 * macselect.c (x_own_selection): Accept Lisp string as result of
36 selection converter function.
37 (x_clear_frame_selections): Don't call x-lost-selection-functions
38 if Emacs is not owner of the selection.
39 (Vmac_services_selection): Put variable and initialization in
40 #ifdef MAC_OSX.
41 (syms_of_macselect) [MAC_OSX]: Set default value of
42 Vmac_services_selection to PRIMARY.
43
44 * macterm.c (toolkit_scroll_bar_interaction): Remove unused variable.
45 (mac_handle_tool_bar_click): Remove unused function and declaration.
46 [USE_TOOLKIT_SCROLL_BARS] (scroll_bar_timer_callback)
47 (install_scroll_bar_timer, set_scroll_bar_timer)
48 (control_part_code_to_scroll_bar_part, construct_scroll_bar_click)
49 (get_control_part_bound, x_scroll_bar_handle_press)
50 (x_scroll_bar_handle_release, x_scroll_bar_handle_drag)
51 (x_set_toolkit_scroll_bar_thumb): New functions and declarations.
52 [USE_TOOLKIT_SCROLL_BARS] (last_scroll_bar_part, scroll_bar_timer)
53 (scroll_bar_timer_event_posted_p): New variables.
54 [USE_TOOLKIT_SCROLL_BARS] (SCROLL_BAR_FIRST_DELAY)
55 (SCROLL_BAR_CONTINUOUS_DELAY): New macros.
56 (x_scroll_bar_create): Set control reference with NewControl.
57 (x_scroll_bar_create) [USE_TOOLKIT_SCROLL_BARS]:
58 Initialize track_top and track_height to nil.
59 (x_scroll_bar_set_handle, x_scroll_bar_note_movement):
60 Put functions in #ifndef USE_TOOLKIT_SCROLL_BARS.
61 (XTset_vertical_scroll_bar): Don't make space between scroll bar
62 and associated window.
63 (XTset_vertical_scroll_bar) [MAC_OSX]: Get scroll bar area width
64 from window config.
65 (XTset_vertical_scroll_bar) [USE_TOOLKIT_SCROLL_BARS]:
66 Set track_top and track_height to nil when scroll bar size is changed.
67 Recalculate them if they are nil.
68 (XTread_socket) [MAC_OSX]: Use control kind to determine if the
69 clicked control is a scroll bar.
70 (XTread_socket) [USE_TOOLKIT_SCROLL_BARS]: Use toolkit scroll bar
71 event handler functions. Don't add modifiers to scroll bar click
72 events. Call scroll bar release handler when window is deactivated.
73 (mac_initialize): Remove unused code for X toolkit.
74 (syms_of_macterm) [!USE_TOOLKIT_SCROLL_BARS]:
75 Initialize Vx_toolkit_scroll_bars to nil.
76
77 * macterm.h (struct scroll_bar) [USE_TOOLKIT_SCROLL_BARS]:
78 New members track_top and track_height.
79
80 * sysselect.h [DARWIN || MAC_OSX]: Temporarily undefine
81 init_process when including sys/select.h.
82
12005-05-05 Luc Teirlinck <teirllm@auburn.edu> 832005-05-05 Luc Teirlinck <teirllm@auburn.edu>
2 84
3 * eval.c (Fdefvaralias): Doc fix. 85 * eval.c (Fdefvaralias): Doc fix.
@@ -61,7 +143,7 @@
612005-05-01 Kim F. Storm <storm@cua.dk> 1432005-05-01 Kim F. Storm <storm@cua.dk>
62 144
63 * xdisp.c (move_it_in_display_line_to): Stop if we move beyond 145 * xdisp.c (move_it_in_display_line_to): Stop if we move beyond
64 TO_CHARPOS. This may happen if last glyphs was an image or stretch 146 TO_CHARPOS. This may happen if last glyphs was an image or stretch
65 glyph. 147 glyph.
66 148
672005-05-01 Luc Teirlinck <teirllm@auburn.edu> 1492005-05-01 Luc Teirlinck <teirllm@auburn.edu>
@@ -73,7 +155,7 @@
73 * xmenu.c [not HAVE_X_TOOLKIT] (xmenu_show): 155 * xmenu.c [not HAVE_X_TOOLKIT] (xmenu_show):
74 If user cancels the menu, quit unless FOR_CLICK. 156 If user cancels the menu, quit unless FOR_CLICK.
75 157
76 * macros.c (Vexecuting_kbd_macro): Renamed from Vexecuting_macro. 158 * macros.c (Vexecuting_kbd_macro): Rename from Vexecuting_macro.
77 All uses changed. 159 All uses changed.
78 (syms_of_macros): Define only executing-kbd-macro, not executing-macro. 160 (syms_of_macros): Define only executing-kbd-macro, not executing-macro.
79 * keyboard.c: Change Vexecuting_macro to Vexecuting_kbd_macro. 161 * keyboard.c: Change Vexecuting_macro to Vexecuting_kbd_macro.
@@ -95,8 +177,7 @@
95 177
962005-04-29 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> 1782005-04-29 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
97 179
98 * mac.c: Don't include time.h. Include sysselect.h after 180 * mac.c: Don't include time.h. Include sysselect.h after systime.h.
99 systime.h.
100 181
101 * macfns.c (Fx_server_version): Add BLOCK_INPUT around Gestalt. 182 * macfns.c (Fx_server_version): Add BLOCK_INPUT around Gestalt.
102 183
@@ -159,13 +240,12 @@
159 (mac.o): Depend on ccl.h. 240 (mac.o): Depend on ccl.h.
160 (macselect.o): New target. 241 (macselect.o): New target.
161 242
162 * emacs.c (main) [MAC_OS8 || MAC_OSX && HAVE_CARBON]: Call 243 * emacs.c (main) [MAC_OS8 || MAC_OSX && HAVE_CARBON]:
163 syms_of_macselect. 244 Call syms_of_macselect.
164 245
165 * frame.c (Fdelete_frame) [MAC_OS]: Call x_clear_frame_selections. 246 * frame.c (Fdelete_frame) [MAC_OS]: Call x_clear_frame_selections.
166 247
167 * mac.c [!TARGET_API_MAC_CARBON]: Don't include charset.h or 248 * mac.c [!TARGET_API_MAC_CARBON]: Don't include charset.h or coding.h.
168 coding.h.
169 (QCLIPBOARD): Remove variable. 249 (QCLIPBOARD): Remove variable.
170 (syms_of_mac): Don't initialize it. 250 (syms_of_mac): Don't initialize it.
171 (Fmac_paste_function, Fmac_cut_function, Fx_selection_exists_p): 251 (Fmac_paste_function, Fmac_cut_function, Fx_selection_exists_p):
@@ -179,10 +259,10 @@
179 [TARGET_API_MAC_CARBON] (Fmac_code_convert_string): Likewise. 259 [TARGET_API_MAC_CARBON] (Fmac_code_convert_string): Likewise.
180 (syms_of_mac) [TARGET_API_MAC_CARBON]: Defsubr it. 260 (syms_of_mac) [TARGET_API_MAC_CARBON]: Defsubr it.
181 261
182 * macterm.c (handling_window_update, terminate_flag): Remove 262 * macterm.c (handling_window_update, terminate_flag):
183 variables. 263 Remove variables.
184 (do_window_update, do_ae_quit_application, XTread_socket): Don't 264 (do_window_update, do_ae_quit_application, XTread_socket):
185 use them. 265 Don't use them.
186 (WNE_SLEEP_AT_SUSPEND, WNE_SLEEP_AT_RESUME): Don't define. 266 (WNE_SLEEP_AT_SUSPEND, WNE_SLEEP_AT_RESUME): Don't define.
187 [USE_CARBON_EVENTS && MAC_OSX] (mac_handle_service_event) 267 [USE_CARBON_EVENTS && MAC_OSX] (mac_handle_service_event)
188 (init_service_handler): Move to macselect.c. Remove declarations. 268 (init_service_handler): Move to macselect.c. Remove declarations.
@@ -277,8 +357,8 @@
277 Make a sub-chartable with correct initial value. 357 Make a sub-chartable with correct initial value.
278 358
279 * fns.c (Fset_char_table_range): Don't set slots used as default 359 * fns.c (Fset_char_table_range): Don't set slots used as default
280 values for ascii, eight-bit-control, eight-bit-graphic. Don't 360 values for ascii, eight-bit-control, eight-bit-graphic.
281 call Faref with charset-id. 361 Don't call Faref with charset-id.
282 (Fset_char_table_default): Document how to treat normal character 362 (Fset_char_table_default): Document how to treat normal character
283 argument. Handle special slots used as default values of ascii, 363 argument. Handle special slots used as default values of ascii,
284 eight-bit-control, eight-bit-control. Make a sub chartable if 364 eight-bit-control, eight-bit-control. Make a sub chartable if
@@ -313,8 +393,8 @@
313 create_text_encoding_info_alist instead. 393 create_text_encoding_info_alist instead.
314 (init_font_name_table) [TARGET_API_MAC_CARBON]: Use Font Manager 394 (init_font_name_table) [TARGET_API_MAC_CARBON]: Use Font Manager
315 routines also on Mac OS Classic. 395 routines also on Mac OS Classic.
316 (init_font_name_table) [!TARGET_API_MAC_CARBON]: Use 396 (init_font_name_table) [!TARGET_API_MAC_CARBON]:
317 add_font_name_table_entry. 397 Use add_font_name_table_entry.
318 (mac_do_list_fonts): Regard 0 in XLFD scaleble fields as 398 (mac_do_list_fonts): Regard 0 in XLFD scaleble fields as
319 specified. Derive unspecified scalable fields from specified one. 399 specified. Derive unspecified scalable fields from specified one.
320 (x_list_fonts): Consider Valternate_fontname_alist. 400 (x_list_fonts): Consider Valternate_fontname_alist.
@@ -412,8 +492,7 @@
412 492
413 * mac.c: Include charset.h and coding.h. 493 * mac.c: Include charset.h and coding.h.
414 [TARGET_API_MAC_CARBON] (Qutf_8): Remove extern. 494 [TARGET_API_MAC_CARBON] (Qutf_8): Remove extern.
415 [TARGET_API_MAC_CARBON] (cfstring_create_with_string): New 495 [TARGET_API_MAC_CARBON] (cfstring_create_with_string): New function.
416 function.
417 [TARGET_API_MAC_CARBON] (Fmac_get_preference): Use it. 496 [TARGET_API_MAC_CARBON] (Fmac_get_preference): Use it.
418 497
419 * macfns.c [TARGET_API_MAC_CARBON] (Fx_file_dialog): Likewise. 498 * macfns.c [TARGET_API_MAC_CARBON] (Fx_file_dialog): Likewise.
@@ -422,8 +501,8 @@
422 501
423 * macterm.c (x_autoselect_window_p): Remove variable. 502 * macterm.c (x_autoselect_window_p): Remove variable.
424 (last_window): New variable. 503 (last_window): New variable.
425 (XTreassert_line_highlight, x_change_line_highlight): Remove 504 (XTreassert_line_highlight, x_change_line_highlight):
426 declarations. 505 Remove declarations.
427 (mac_focus_changed, x_detect_focus_change): New functions and 506 (mac_focus_changed, x_detect_focus_change): New functions and
428 declarations. 507 declarations.
429 (XTextExtents16, front_emacs_window): Remove function. 508 (XTextExtents16, front_emacs_window): Remove function.
@@ -436,8 +515,8 @@
436 (XTread_socket): Move its contents here. Generate select-window 515 (XTread_socket): Move its contents here. Generate select-window
437 event on mouse movement if needed. Use x_detect_focus_change on 516 event on mouse movement if needed. Use x_detect_focus_change on
438 activate/deactivate events. Don't deiconify frame or invalidate 517 activate/deactivate events. Don't deiconify frame or invalidate
439 window rectangle when dnd items are dropped. Don't 518 window rectangle when dnd items are dropped.
440 activate/deactivate root control. 519 Don't activate/deactivate root control.
441 (frame_highlight, frame_unhighlight): Activate/deactivate root 520 (frame_highlight, frame_unhighlight): Activate/deactivate root
442 control here. 521 control here.
443 (syms_of_macterm): Delete DEFVAR_BOOL for x_autoselect_window_p. 522 (syms_of_macterm): Delete DEFVAR_BOOL for x_autoselect_window_p.
@@ -453,17 +532,17 @@
453 532
4542005-04-14 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> 5332005-04-14 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
455 534
456 * mac.c [!TARGET_API_MAC_CARBON]: Include MacLocales.h. Don't 535 * mac.c [!TARGET_API_MAC_CARBON]: Include MacLocales.h.
457 include TextEncodingConverter.h. 536 Don't include TextEncodingConverter.h.
458 (mac_system_script_code, Vmac_system_locale): New variables. 537 (mac_system_script_code, Vmac_system_locale): New variables.
459 (syms_of_mac): Defvar them. 538 (syms_of_mac): Defvar them.
460 (mac_get_system_locale): New function. 539 (mac_get_system_locale): New function.
461 540
462 * macfns.c (x_set_name, x_set_title) [!TARGET_API_MAC_CARBON]: Use 541 * macfns.c (x_set_name, x_set_title) [!TARGET_API_MAC_CARBON]:
463 ENCODE_SYSTEM to encode title bar string. 542 Use ENCODE_SYSTEM to encode title bar string.
464 (x_create_tip_frame): Apply 2005-03-18 change for xfns.c. 543 (x_create_tip_frame): Apply 2005-03-18 change for xfns.c.
465 (Fx_file_dialog) [TARGET_API_MAC_CARBON && !MAC_OSX]: Use 544 (Fx_file_dialog) [TARGET_API_MAC_CARBON && !MAC_OSX]:
466 CFStringGetSystemEncoding to get system default string encoding. 545 Use CFStringGetSystemEncoding to get system default string encoding.
467 546
468 * macterm.c [!TARGET_API_MAC_CARBON]: Don't include 547 * macterm.c [!TARGET_API_MAC_CARBON]: Don't include
469 TextEncodingConverter.h. 548 TextEncodingConverter.h.
@@ -1080,7 +1159,7 @@
1080 * xdisp.c (init_from_display_pos): Don't read past end of 1159 * xdisp.c (init_from_display_pos): Don't read past end of
1081 it->overlay_strings array. 1160 it->overlay_strings array.
1082 1161
10832005-02-25 Stephan Stahl <stahl@eos.franken.de> (tiny change) 11622005-02-25 Stephan Stahl <stahl@eos.franken.de> (tiny change)
1084 1163
1085 * buffer.c (syms_of_buffer): Fix typo. 1164 * buffer.c (syms_of_buffer): Fix typo.
1086 1165
@@ -1110,7 +1189,7 @@
1110 I think those asserts are bogus if buffer contains invisible text 1189 I think those asserts are bogus if buffer contains invisible text
1111 or images. 1190 or images.
1112 1191
11132005-02-21 David Kastrup <dak@gnu.org> 11922005-02-21 David Kastrup <dak@gnu.org>
1114 1193
1115 * gtkutil.c (xg_create_frame_widgets): UNBLOCK_INPUT on error. 1194 * gtkutil.c (xg_create_frame_widgets): UNBLOCK_INPUT on error.
1116 1195
@@ -3710,7 +3789,7 @@
3710 compositions to encode. 3789 compositions to encode.
3711 (encode_coding_string): Likewise. Free composition data. 3790 (encode_coding_string): Likewise. Free composition data.
3712 3791
37132004-09-30 Florian Weimer <fw@deneb.enyo.de> 37922004-09-30 Florian Weimer <fw@deneb.enyo.de>
3714 3793
3715 * coding.c (code_convert_region): Free composition data. 3794 * coding.c (code_convert_region): Free composition data.
3716 3795
@@ -4248,7 +4327,7 @@
4248 * xfns.c (x_icon_verify): New function. 4327 * xfns.c (x_icon_verify): New function.
4249 (Fx_create_frame): Use it. 4328 (Fx_create_frame): Use it.
4250 4329
42512004-07-22 Barry Fishman <barry_fishman@att.net> (tiny change) 43302004-07-22 Barry Fishman <barry_fishman@att.net> (tiny change)
4252 4331
4253 * s/gnu-linux.h: Use GC_MARK_STACK if __amd64__ is defined. 4332 * s/gnu-linux.h: Use GC_MARK_STACK if __amd64__ is defined.
4254 4333
@@ -5911,7 +5990,7 @@
5911 * xdisp.c (note_mode_line_or_margin_highlight): Accept HEADER_LINE 5990 * xdisp.c (note_mode_line_or_margin_highlight): Accept HEADER_LINE
5912 when keymap and cursor are setup. 5991 when keymap and cursor are setup.
5913 5992
59142004-03-14 Steven Tamm <steventamm@mac.com> 59932004-03-14 Steven Tamm <steventamm@mac.com>
5915 5994
5916 * Makefile.in (XMENU_OBJ) [HAVE_CARBON]: Do not include xmenu.o. 5995 * Makefile.in (XMENU_OBJ) [HAVE_CARBON]: Do not include xmenu.o.
5917 5996
@@ -5973,7 +6052,7 @@
5973 (GTK_OBJ) [USE_GTK]: New declaration. 6052 (GTK_OBJ) [USE_GTK]: New declaration.
5974 (obj): Add $(GTK_OBJ) to list. 6053 (obj): Add $(GTK_OBJ) to list.
5975 6054
59762004-03-11 Steven Tamm <steventamm@mac.com> 60552004-03-11 Steven Tamm <steventamm@mac.com>
5977 6056
5978 * image.c [MAC_OSX]: Include sys/stat.h. 6057 * image.c [MAC_OSX]: Include sys/stat.h.
5979 6058
diff --git a/src/Makefile.in b/src/Makefile.in
index a7013ce4de5..3407f9024ef 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -784,6 +784,7 @@ lisp= \
784 ${lispsource}textmodes/paragraphs.elc \ 784 ${lispsource}textmodes/paragraphs.elc \
785 ${lispsource}textmodes/text-mode.elc \ 785 ${lispsource}textmodes/text-mode.elc \
786 ${lispsource}emacs-lisp/timer.elc \ 786 ${lispsource}emacs-lisp/timer.elc \
787 ${lispsource}jka-cmpr-hook.elc \
787 ${lispsource}vc-hooks.elc \ 788 ${lispsource}vc-hooks.elc \
788 ${lispsource}ediff-hook.elc \ 789 ${lispsource}ediff-hook.elc \
789 TOOLTIP_SUPPORT \ 790 TOOLTIP_SUPPORT \
@@ -878,6 +879,7 @@ shortlisp= \
878 ../lisp/textmodes/text-mode.elc \ 879 ../lisp/textmodes/text-mode.elc \
879 ../lisp/emacs-lisp/timer.elc \ 880 ../lisp/emacs-lisp/timer.elc \
880 ../lisp/vc-hooks.elc \ 881 ../lisp/vc-hooks.elc \
882 ../lisp/jka-cmpr-hook.elc \
881 ../lisp/ediff-hook.elc \ 883 ../lisp/ediff-hook.elc \
882 ../lisp/widget.elc \ 884 ../lisp/widget.elc \
883 ../lisp/window.elc \ 885 ../lisp/window.elc \
diff --git a/src/dired.c b/src/dired.c
index 87b48ba2d78..349154e1ac0 100644
--- a/src/dired.c
+++ b/src/dired.c
@@ -400,7 +400,7 @@ DEFUN ("file-name-completion", Ffile_name_completion, Sfile_name_completion,
400Returns the longest string 400Returns the longest string
401common to all file names in DIRECTORY that start with FILE. 401common to all file names in DIRECTORY that start with FILE.
402If there is only one and FILE matches it exactly, returns t. 402If there is only one and FILE matches it exactly, returns t.
403Returns nil if DIR contains no name starting with FILE. 403Returns nil if DIRECTORY contains no name starting with FILE.
404 404
405This function ignores some of the possible completions as 405This function ignores some of the possible completions as
406determined by the variable `completion-ignored-extensions', which see. */) 406determined by the variable `completion-ignored-extensions', which see. */)
diff --git a/src/eval.c b/src/eval.c
index 8b6c1885727..7f043daa555 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -747,6 +747,8 @@ The return value is ALIASED. */)
747 LOADHIST_ATTACH (symbol); 747 LOADHIST_ATTACH (symbol);
748 if (!NILP (docstring)) 748 if (!NILP (docstring))
749 Fput (symbol, Qvariable_documentation, docstring); 749 Fput (symbol, Qvariable_documentation, docstring);
750 else
751 Fput (symbol, Qvariable_documentation, Qnil);
750 752
751 return aliased; 753 return aliased;
752} 754}
diff --git a/src/fileio.c b/src/fileio.c
index d8a0a5a729f..b62dac5b3d7 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -1022,7 +1022,7 @@ DEFUN ("expand-file-name", Fexpand_file_name, Sexpand_file_name, 1, 2, 0,
1022 doc: /* Convert filename NAME to absolute, and canonicalize it. 1022 doc: /* Convert filename NAME to absolute, and canonicalize it.
1023Second arg DEFAULT-DIRECTORY is directory to start with if NAME is relative 1023Second arg DEFAULT-DIRECTORY is directory to start with if NAME is relative
1024\(does not start with slash); if DEFAULT-DIRECTORY is nil or missing, 1024\(does not start with slash); if DEFAULT-DIRECTORY is nil or missing,
1025the current buffer's value of default-directory is used. 1025the current buffer's value of `default-directory' is used.
1026File name components that are `.' are removed, and 1026File name components that are `.' are removed, and
1027so are file name components followed by `..', along with the `..' itself; 1027so are file name components followed by `..', along with the `..' itself;
1028note that these simplifications are done without checking the resulting 1028note that these simplifications are done without checking the resulting
@@ -2708,7 +2708,7 @@ internal_delete_file (filename)
2708 2708
2709DEFUN ("rename-file", Frename_file, Srename_file, 2, 3, 2709DEFUN ("rename-file", Frename_file, Srename_file, 2, 3,
2710 "fRename file: \nGRename %s to file: \np", 2710 "fRename file: \nGRename %s to file: \np",
2711 doc: /* Rename FILE as NEWNAME. Both args strings. 2711 doc: /* Rename FILE as NEWNAME. Both args must be strings.
2712If file has names other than FILE, it continues to have those names. 2712If file has names other than FILE, it continues to have those names.
2713Signals a `file-already-exists' error if a file NEWNAME already exists 2713Signals a `file-already-exists' error if a file NEWNAME already exists
2714unless optional third argument OK-IF-ALREADY-EXISTS is non-nil. 2714unless optional third argument OK-IF-ALREADY-EXISTS is non-nil.
@@ -2797,7 +2797,7 @@ This is what happens in interactive use with M-x. */)
2797 2797
2798DEFUN ("add-name-to-file", Fadd_name_to_file, Sadd_name_to_file, 2, 3, 2798DEFUN ("add-name-to-file", Fadd_name_to_file, Sadd_name_to_file, 2, 3,
2799 "fAdd name to file: \nGName to add to %s: \np", 2799 "fAdd name to file: \nGName to add to %s: \np",
2800 doc: /* Give FILE additional name NEWNAME. Both args strings. 2800 doc: /* Give FILE additional name NEWNAME. Both args must be strings.
2801Signals a `file-already-exists' error if a file NEWNAME already exists 2801Signals a `file-already-exists' error if a file NEWNAME already exists
2802unless optional third argument OK-IF-ALREADY-EXISTS is non-nil. 2802unless optional third argument OK-IF-ALREADY-EXISTS is non-nil.
2803A number as third arg means request confirmation if NEWNAME already exists. 2803A number as third arg means request confirmation if NEWNAME already exists.
@@ -2864,7 +2864,7 @@ This is what happens in interactive use with M-x. */)
2864#ifdef S_IFLNK 2864#ifdef S_IFLNK
2865DEFUN ("make-symbolic-link", Fmake_symbolic_link, Smake_symbolic_link, 2, 3, 2865DEFUN ("make-symbolic-link", Fmake_symbolic_link, Smake_symbolic_link, 2, 3,
2866 "FMake symbolic link to file: \nGMake symbolic link to file %s: \np", 2866 "FMake symbolic link to file: \nGMake symbolic link to file %s: \np",
2867 doc: /* Make a symbolic link to FILENAME, named LINKNAME. Both args strings. 2867 doc: /* Make a symbolic link to FILENAME, named LINKNAME. Both args must be strings.
2868Signals a `file-already-exists' error if a file LINKNAME already exists 2868Signals a `file-already-exists' error if a file LINKNAME already exists
2869unless optional third argument OK-IF-ALREADY-EXISTS is non-nil. 2869unless optional third argument OK-IF-ALREADY-EXISTS is non-nil.
2870A number as third arg means request confirmation if LINKNAME already exists. 2870A number as third arg means request confirmation if LINKNAME already exists.
@@ -3209,7 +3209,7 @@ DEFUN ("file-writable-p", Ffile_writable_p, Sfile_writable_p, 1, 1, 0,
3209DEFUN ("access-file", Faccess_file, Saccess_file, 2, 2, 0, 3209DEFUN ("access-file", Faccess_file, Saccess_file, 2, 2, 0,
3210 doc: /* Access file FILENAME, and get an error if that does not work. 3210 doc: /* Access file FILENAME, and get an error if that does not work.
3211The second argument STRING is used in the error message. 3211The second argument STRING is used in the error message.
3212If there is no error, we return nil. */) 3212If there is no error, returns nil. */)
3213 (filename, string) 3213 (filename, string)
3214 Lisp_Object filename, string; 3214 Lisp_Object filename, string;
3215{ 3215{
@@ -6038,7 +6038,7 @@ DEFUN ("clear-buffer-auto-save-failure", Fclear_buffer_auto_save_failure,
6038 6038
6039DEFUN ("recent-auto-save-p", Frecent_auto_save_p, Srecent_auto_save_p, 6039DEFUN ("recent-auto-save-p", Frecent_auto_save_p, Srecent_auto_save_p,
6040 0, 0, 0, 6040 0, 0, 0,
6041 doc: /* Return t if buffer has been auto-saved since last read in or saved. */) 6041 doc: /* Return t if current buffer has been auto-saved since last read in or saved. */)
6042 () 6042 ()
6043{ 6043{
6044 return (SAVE_MODIFF < current_buffer->auto_save_modified) ? Qt : Qnil; 6044 return (SAVE_MODIFF < current_buffer->auto_save_modified) ? Qt : Qnil;
diff --git a/src/fns.c b/src/fns.c
index f0dff278117..216852f893e 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -2536,19 +2536,19 @@ char_table_range (table, from, to, defalt)
2536 error ("Characters in the range have inconsistent values"); 2536 error ("Characters in the range have inconsistent values");
2537 } 2537 }
2538 return val; 2538 return val;
2539} 2539}
2540 2540
2541 2541
2542DEFUN ("char-table-range", Fchar_table_range, Schar_table_range, 2542DEFUN ("char-table-range", Fchar_table_range, Schar_table_range,
2543 2, 2, 0, 2543 2, 2, 0,
2544 doc: /* Return the value in CHAR-TABLE for a range of characters RANGE. 2544 doc: /* Return the value in CHAR-TABLE for a range of characters RANGE.
2545RANGE should be nil (for the default value) 2545RANGE should be nil (for the default value),
2546a vector which identifies a character set or a row of a character set, 2546a vector which identifies a character set or a row of a character set,
2547a character set name, or a character code. 2547a character set name, or a character code.
2548If the characters in the specified range have different values, 2548If the characters in the specified range have different values,
2549an error is signalled. 2549an error is signalled.
2550 2550
2551Note that this function doesn't check the parent of CHAR_TABLE. */) 2551Note that this function doesn't check the parent of CHAR-TABLE. */)
2552 (char_table, range) 2552 (char_table, range)
2553 Lisp_Object char_table, range; 2553 Lisp_Object char_table, range;
2554{ 2554{
@@ -2582,7 +2582,7 @@ Note that this function doesn't check the parent of CHAR_TABLE. */)
2582 { 2582 {
2583 size = ASIZE (range); 2583 size = ASIZE (range);
2584 if (size == 0) 2584 if (size == 0)
2585 args_out_of_range (range, 0); 2585 args_out_of_range (range, make_number (0));
2586 CHECK_NUMBER (AREF (range, 0)); 2586 CHECK_NUMBER (AREF (range, 0));
2587 charset_id = XINT (AREF (range, 0)); 2587 charset_id = XINT (AREF (range, 0));
2588 if (size > 1) 2588 if (size > 1)
@@ -2631,7 +2631,7 @@ Note that this function doesn't check the parent of CHAR_TABLE. */)
2631 current_default = XCHAR_TABLE (char_table)->contents[defalt]; 2631 current_default = XCHAR_TABLE (char_table)->contents[defalt];
2632 return char_table_range (char_table, from, to, current_default); 2632 return char_table_range (char_table, from, to, current_default);
2633 } 2633 }
2634 2634
2635 val = XCHAR_TABLE (char_table)->contents[128 + charset_id]; 2635 val = XCHAR_TABLE (char_table)->contents[128 + charset_id];
2636 if (! SUB_CHAR_TABLE_P (val)) 2636 if (! SUB_CHAR_TABLE_P (val))
2637 return (NILP (val) ? current_default : val); 2637 return (NILP (val) ? current_default : val);
diff --git a/src/lread.c b/src/lread.c
index 869e95a00e0..ffc7d87d977 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -1006,6 +1006,7 @@ complete_filename_p (pathname)
1006 1006
1007DEFUN ("locate-file-internal", Flocate_file_internal, Slocate_file_internal, 2, 4, 0, 1007DEFUN ("locate-file-internal", Flocate_file_internal, Slocate_file_internal, 2, 4, 0,
1008 doc: /* Search for FILENAME through PATH. 1008 doc: /* Search for FILENAME through PATH.
1009Returns the file's name in absolute form, or nil if not found.
1009If SUFFIXES is non-nil, it should be a list of suffixes to append to 1010If SUFFIXES is non-nil, it should be a list of suffixes to append to
1010file name when searching. 1011file name when searching.
1011If non-nil, PREDICATE is used instead of `file-readable-p'. 1012If non-nil, PREDICATE is used instead of `file-readable-p'.
diff --git a/src/macselect.c b/src/macselect.c
index 49246f7eddc..a115c9b3229 100644
--- a/src/macselect.c
+++ b/src/macselect.c
@@ -98,8 +98,10 @@ static Lisp_Object Vselection_converter_alist;
98 selection type with a scrap flavor type via `mac-ostype'. */ 98 selection type with a scrap flavor type via `mac-ostype'. */
99static Lisp_Object Qmac_scrap_name, Qmac_ostype; 99static Lisp_Object Qmac_scrap_name, Qmac_ostype;
100 100
101#ifdef MAC_OSX
101/* Selection name for communication via Services menu. */ 102/* Selection name for communication via Services menu. */
102static Lisp_Object Vmac_services_selection; 103static Lisp_Object Vmac_services_selection;
104#endif
103 105
104/* Get a reference to the scrap corresponding to the symbol SYM. The 106/* Get a reference to the scrap corresponding to the symbol SYM. The
105 reference is set to *SCRAP, and it becomes NULL if there's no 107 reference is set to *SCRAP, and it becomes NULL if there's no
@@ -455,9 +457,11 @@ x_own_selection (selection_name, selection_value)
455 value = call3 (handler_fn, selection_name, 457 value = call3 (handler_fn, selection_name,
456 type, selection_value); 458 type, selection_value);
457 459
458 if (CONSP (value) 460 if (STRINGP (value))
459 && EQ (XCAR (value), type) 461 err = put_scrap_string (scrap, type, value);
460 && STRINGP (XCDR (value))) 462 else if (CONSP (value)
463 && EQ (XCAR (value), type)
464 && STRINGP (XCDR (value)))
461 err = put_scrap_string (scrap, type, XCDR (value)); 465 err = put_scrap_string (scrap, type, XCDR (value));
462 } 466 }
463 467
@@ -622,7 +626,8 @@ x_clear_frame_selections (f)
622 hooks = Vx_lost_selection_functions; 626 hooks = Vx_lost_selection_functions;
623 selection_symbol = Fcar (Fcar (Vselection_alist)); 627 selection_symbol = Fcar (Fcar (Vselection_alist));
624 628
625 if (!EQ (hooks, Qunbound)) 629 if (!EQ (hooks, Qunbound)
630 && !NILP (Fx_selection_owner_p (selection_symbol)))
626 { 631 {
627 for (; CONSP (hooks); hooks = Fcdr (hooks)) 632 for (; CONSP (hooks); hooks = Fcdr (hooks))
628 call1 (Fcar (hooks), selection_symbol); 633 call1 (Fcar (hooks), selection_symbol);
@@ -646,7 +651,8 @@ x_clear_frame_selections (f)
646 hooks = Vx_lost_selection_functions; 651 hooks = Vx_lost_selection_functions;
647 selection_symbol = Fcar (Fcar (XCDR (rest))); 652 selection_symbol = Fcar (Fcar (XCDR (rest)));
648 653
649 if (!EQ (hooks, Qunbound)) 654 if (!EQ (hooks, Qunbound)
655 && !NILP (Fx_selection_owner_p (selection_symbol)))
650 { 656 {
651 for (; CONSP (hooks); hooks = Fcdr (hooks)) 657 for (; CONSP (hooks); hooks = Fcdr (hooks))
652 call1 (Fcar (hooks), selection_symbol); 658 call1 (Fcar (hooks), selection_symbol);
diff --git a/src/macterm.c b/src/macterm.c
index aeb990a80e7..1e8aba4e178 100644
--- a/src/macterm.c
+++ b/src/macterm.c
@@ -154,10 +154,6 @@ extern int waiting_for_input;
154 154
155struct frame *pending_autoraise_frame; 155struct frame *pending_autoraise_frame;
156 156
157/* Non-zero means user is interacting with a toolkit scroll bar. */
158
159static int toolkit_scroll_bar_interaction;
160
161/* Mouse movement. 157/* Mouse movement.
162 158
163 Formerly, we used PointerMotionHintMask (in standard_event_mask) 159 Formerly, we used PointerMotionHintMask (in standard_event_mask)
@@ -256,7 +252,6 @@ QDGlobals qd; /* QuickDraw global information structure. */
256struct frame * x_window_to_frame (struct mac_display_info *, WindowPtr); 252struct frame * x_window_to_frame (struct mac_display_info *, WindowPtr);
257struct mac_display_info *mac_display_info_for_display (Display *); 253struct mac_display_info *mac_display_info_for_display (Display *);
258static void x_update_window_end P_ ((struct window *, int, int)); 254static void x_update_window_end P_ ((struct window *, int, int));
259static void mac_handle_tool_bar_click P_ ((struct frame *, EventRecord *));
260static int x_io_error_quitter P_ ((Display *)); 255static int x_io_error_quitter P_ ((Display *));
261int x_catch_errors P_ ((Display *)); 256int x_catch_errors P_ ((Display *));
262void x_uncatch_errors P_ ((Display *, int)); 257void x_uncatch_errors P_ ((Display *, int));
@@ -4131,30 +4126,316 @@ XTmouse_position (fp, insist, bar_window, part, x, y, time)
4131} 4126}
4132 4127
4133 4128
4134/*********************************************************************** 4129/************************************************************************
4135 Tool-bars 4130 Toolkit scroll bars
4136 ***********************************************************************/ 4131 ************************************************************************/
4132
4133#ifdef USE_TOOLKIT_SCROLL_BARS
4134
4135static pascal void scroll_bar_timer_callback P_ ((EventLoopTimerRef, void *));
4136static OSStatus install_scroll_bar_timer P_ ((void));
4137static OSStatus set_scroll_bar_timer P_ ((EventTimerInterval));
4138static int control_part_code_to_scroll_bar_part P_((ControlPartCode));
4139static void construct_scroll_bar_click P_ ((struct scroll_bar *, int,
4140 unsigned long,
4141 struct input_event *));
4142static OSErr get_control_part_bound P_((ControlHandle, ControlPartCode,
4143 Rect *));
4144static void x_scroll_bar_handle_press P_ ((struct scroll_bar *,
4145 ControlPartCode,
4146 unsigned long,
4147 struct input_event *));
4148static void x_scroll_bar_handle_release P_ ((struct scroll_bar *,
4149 unsigned long,
4150 struct input_event *));
4151static void x_scroll_bar_handle_drag P_ ((WindowPtr, struct scroll_bar *,
4152 Point, unsigned long,
4153 struct input_event *));
4154static void x_set_toolkit_scroll_bar_thumb P_ ((struct scroll_bar *,
4155 int, int, int));
4156
4157/* Last scroll bar part sent in x_scroll_bar_handle_*. */
4158
4159static int last_scroll_bar_part;
4160
4161static EventLoopTimerRef scroll_bar_timer;
4162
4163static int scroll_bar_timer_event_posted_p;
4164
4165#define SCROLL_BAR_FIRST_DELAY 0.5
4166#define SCROLL_BAR_CONTINUOUS_DELAY (1.0 / 15)
4167
4168static pascal void
4169scroll_bar_timer_callback (timer, data)
4170 EventLoopTimerRef timer;
4171 void *data;
4172{
4173 EventRef event = NULL;
4174 OSErr err;
4175
4176 err = CreateEvent (NULL, kEventClassMouse, kEventMouseMoved, 0,
4177 kEventAttributeNone, &event);
4178 if (err == noErr)
4179 {
4180 Point mouse_pos;
4181
4182 GetMouse (&mouse_pos);
4183 LocalToGlobal (&mouse_pos);
4184 err = SetEventParameter (event, kEventParamMouseLocation, typeQDPoint,
4185 sizeof (Point), &mouse_pos);
4186 }
4187 if (err == noErr)
4188 {
4189 UInt32 modifiers = GetCurrentKeyModifiers ();
4190
4191 err = SetEventParameter (event, kEventParamKeyModifiers, typeUInt32,
4192 sizeof (UInt32), &modifiers);
4193 }
4194 if (err == noErr)
4195 err = PostEventToQueue (GetCurrentEventQueue (), event,
4196 kEventPriorityStandard);
4197 if (err == noErr)
4198 scroll_bar_timer_event_posted_p = 1;
4137 4199
4138/* Handle mouse button event on the tool-bar of frame F, at 4200 if (event)
4139 frame-relative coordinates X/Y. EVENT_TYPE is either ButtionPress 4201 ReleaseEvent (event);
4140 or ButtonRelase. */ 4202}
4203
4204static OSStatus
4205install_scroll_bar_timer ()
4206{
4207 static EventLoopTimerUPP scroll_bar_timer_callbackUPP = NULL;
4208
4209 if (scroll_bar_timer_callbackUPP == NULL)
4210 scroll_bar_timer_callbackUPP =
4211 NewEventLoopTimerUPP (scroll_bar_timer_callback);
4212
4213 if (scroll_bar_timer == NULL)
4214 /* Mac OS X and CarbonLib 1.5 and later allow us to specify
4215 kEventDurationForever as delays. */
4216 return
4217 InstallEventLoopTimer (GetCurrentEventLoop (),
4218 kEventDurationForever, kEventDurationForever,
4219 scroll_bar_timer_callbackUPP, NULL,
4220 &scroll_bar_timer);
4221}
4222
4223static OSStatus
4224set_scroll_bar_timer (delay)
4225 EventTimerInterval delay;
4226{
4227 if (scroll_bar_timer == NULL)
4228 install_scroll_bar_timer ();
4229
4230 scroll_bar_timer_event_posted_p = 0;
4231
4232 return SetEventLoopTimerNextFireTime (scroll_bar_timer, delay);
4233}
4234
4235static int
4236control_part_code_to_scroll_bar_part (part_code)
4237 ControlPartCode part_code;
4238{
4239 switch (part_code)
4240 {
4241 case kControlUpButtonPart: return scroll_bar_up_arrow;
4242 case kControlDownButtonPart: return scroll_bar_down_arrow;
4243 case kControlPageUpPart: return scroll_bar_above_handle;
4244 case kControlPageDownPart: return scroll_bar_below_handle;
4245 case kControlIndicatorPart: return scroll_bar_handle;
4246 }
4247
4248 return -1;
4249}
4141 4250
4142static void 4251static void
4143mac_handle_tool_bar_click (f, button_event) 4252construct_scroll_bar_click (bar, part, timestamp, bufp)
4144 struct frame *f; 4253 struct scroll_bar *bar;
4145 EventRecord *button_event; 4254 int part;
4255 unsigned long timestamp;
4256 struct input_event *bufp;
4257{
4258 bufp->kind = SCROLL_BAR_CLICK_EVENT;
4259 bufp->frame_or_window = bar->window;
4260 bufp->arg = Qnil;
4261 bufp->part = part;
4262 bufp->code = 0;
4263 bufp->timestamp = timestamp;
4264 XSETINT (bufp->x, 0);
4265 XSETINT (bufp->y, 0);
4266 bufp->modifiers = 0;
4267}
4268
4269static OSErr
4270get_control_part_bound (ch, part_code, rect)
4271 ControlHandle ch;
4272 ControlPartCode part_code;
4273 Rect *rect;
4274{
4275 RgnHandle region = NewRgn ();
4276 OSStatus err;
4277
4278 err = GetControlRegion (ch, part_code, region);
4279 if (err == noErr)
4280 GetRegionBounds (region, rect);
4281 DisposeRgn (region);
4282
4283 return err;
4284}
4285
4286static void
4287x_scroll_bar_handle_press (bar, part_code, timestamp, bufp)
4288 struct scroll_bar *bar;
4289 ControlPartCode part_code;
4290 unsigned long timestamp;
4291 struct input_event *bufp;
4292{
4293 int part = control_part_code_to_scroll_bar_part (part_code);
4294
4295 if (part < 0)
4296 return;
4297
4298 if (part != scroll_bar_handle)
4299 {
4300 construct_scroll_bar_click (bar, part, timestamp, bufp);
4301 HiliteControl (SCROLL_BAR_CONTROL_HANDLE (bar), part_code);
4302 set_scroll_bar_timer (SCROLL_BAR_FIRST_DELAY);
4303 }
4304
4305 last_scroll_bar_part = part;
4306 bar->dragging = Qnil;
4307 tracked_scroll_bar = bar;
4308}
4309
4310static void
4311x_scroll_bar_handle_release (bar, timestamp, bufp)
4312 struct scroll_bar *bar;
4313 unsigned long timestamp;
4314 struct input_event *bufp;
4315{
4316 if (last_scroll_bar_part != scroll_bar_handle
4317 || !GC_NILP (bar->dragging))
4318 construct_scroll_bar_click (bar, scroll_bar_end_scroll, timestamp, bufp);
4319
4320 HiliteControl (SCROLL_BAR_CONTROL_HANDLE (bar), 0);
4321 set_scroll_bar_timer (kEventDurationForever);
4322
4323 last_scroll_bar_part = -1;
4324 bar->dragging = Qnil;
4325 tracked_scroll_bar = NULL;
4326}
4327
4328static void
4329x_scroll_bar_handle_drag (win, bar, mouse_pos, timestamp, bufp)
4330 WindowPtr win;
4331 struct scroll_bar *bar;
4332 Point mouse_pos;
4333 unsigned long timestamp;
4334 struct input_event *bufp;
4335{
4336 ControlHandle ch = SCROLL_BAR_CONTROL_HANDLE (bar);
4337
4338 if (last_scroll_bar_part == scroll_bar_handle)
4339 {
4340 int top, top_range;
4341 Rect r;
4342
4343 get_control_part_bound (SCROLL_BAR_CONTROL_HANDLE (bar),
4344 kControlIndicatorPart, &r);
4345
4346 if (GC_NILP (bar->dragging))
4347 XSETINT (bar->dragging, mouse_pos.v - r.top);
4348
4349 top = mouse_pos.v - XINT (bar->dragging) - XINT (bar->track_top);
4350 top_range = (XINT (bar->track_height) - (r.bottom - r.top)) *
4351 (1.0 + (float) GetControlViewSize (ch) / GetControl32BitMaximum (ch))
4352 + .5;
4353
4354 if (top < 0)
4355 top = 0;
4356 if (top > top_range)
4357 top = top_range;
4358
4359 construct_scroll_bar_click (bar, scroll_bar_handle, timestamp, bufp);
4360 XSETINT (bufp->x, top);
4361 XSETINT (bufp->y, top_range);
4362 }
4363 else
4364 {
4365 ControlPartCode part_code;
4366 int unhilite_p = 0, part;
4367
4368 if (ch != FindControlUnderMouse (mouse_pos, win, &part_code))
4369 unhilite_p = 1;
4370 else
4371 {
4372 part = control_part_code_to_scroll_bar_part (part_code);
4373
4374 switch (last_scroll_bar_part)
4375 {
4376 case scroll_bar_above_handle:
4377 case scroll_bar_below_handle:
4378 if (part != scroll_bar_above_handle
4379 && part != scroll_bar_below_handle)
4380 unhilite_p = 1;
4381 break;
4382
4383 case scroll_bar_up_arrow:
4384 case scroll_bar_down_arrow:
4385 if (part != scroll_bar_up_arrow
4386 && part != scroll_bar_down_arrow)
4387 unhilite_p = 1;
4388 break;
4389 }
4390 }
4391
4392 if (unhilite_p)
4393 HiliteControl (SCROLL_BAR_CONTROL_HANDLE (bar), 0);
4394 else if (part != last_scroll_bar_part
4395 || scroll_bar_timer_event_posted_p)
4396 {
4397 construct_scroll_bar_click (bar, part, timestamp, bufp);
4398 last_scroll_bar_part = part;
4399 HiliteControl (SCROLL_BAR_CONTROL_HANDLE (bar), part_code);
4400 set_scroll_bar_timer (SCROLL_BAR_CONTINUOUS_DELAY);
4401 }
4402 }
4403}
4404
4405/* Set the thumb size and position of scroll bar BAR. We are currently
4406 displaying PORTION out of a whole WHOLE, and our position POSITION. */
4407
4408static void
4409x_set_toolkit_scroll_bar_thumb (bar, portion, position, whole)
4410 struct scroll_bar *bar;
4411 int portion, position, whole;
4146{ 4412{
4147 int x = button_event->where.h; 4413 ControlHandle ch = SCROLL_BAR_CONTROL_HANDLE (bar);
4148 int y = button_event->where.v;
4149 4414
4150 if (button_event->what == mouseDown) 4415 int value, viewsize, maximum;
4151 handle_tool_bar_click (f, x, y, 1, 0); 4416
4417 if (whole == 0 || XINT (bar->track_height) == 0)
4418 value = 0, viewsize = 1, maximum = 0;
4152 else 4419 else
4153 handle_tool_bar_click (f, x, y, 0, 4420 {
4154 x_mac_to_emacs_modifiers (FRAME_MAC_DISPLAY_INFO (f), 4421 value = position;
4155 button_event->modifiers)); 4422 viewsize = portion;
4423 maximum = max (0, whole - portion);
4424 }
4425
4426 BLOCK_INPUT;
4427
4428 SetControl32BitMinimum (ch, 0);
4429 SetControl32BitMaximum (ch, maximum);
4430 SetControl32BitValue (ch, value);
4431 SetControlViewSize (ch, viewsize);
4432
4433 UNBLOCK_INPUT;
4156} 4434}
4157 4435
4436#endif /* USE_TOOLKIT_SCROLL_BARS */
4437
4438
4158 4439
4159/************************************************************************ 4440/************************************************************************
4160 Scroll bars, general 4441 Scroll bars, general
@@ -4185,13 +4466,12 @@ x_scroll_bar_create (w, top, left, width, height, disp_top, disp_height)
4185 4466
4186#if TARGET_API_MAC_CARBON 4467#if TARGET_API_MAC_CARBON
4187 ch = NewControl (FRAME_MAC_WINDOW (f), &r, "\p", 1, 0, 0, 0, 4468 ch = NewControl (FRAME_MAC_WINDOW (f), &r, "\p", 1, 0, 0, 0,
4188 kControlScrollBarProc, 0L); 4469 kControlScrollBarProc, (long) bar);
4189#else 4470#else
4190 ch = NewControl (FRAME_MAC_WINDOW (f), &r, "\p", 1, 0, 0, 0, scrollBarProc, 4471 ch = NewControl (FRAME_MAC_WINDOW (f), &r, "\p", 1, 0, 0, 0,
4191 0L); 4472 scrollBarProc, (long) bar);
4192#endif 4473#endif
4193 SET_SCROLL_BAR_CONTROL_HANDLE (bar, ch); 4474 SET_SCROLL_BAR_CONTROL_HANDLE (bar, ch);
4194 SetControlReference (ch, (long) bar);
4195 4475
4196 XSETWINDOW (bar->window, w); 4476 XSETWINDOW (bar->window, w);
4197 XSETINT (bar->top, top); 4477 XSETINT (bar->top, top);
@@ -4201,6 +4481,10 @@ x_scroll_bar_create (w, top, left, width, height, disp_top, disp_height)
4201 XSETINT (bar->start, 0); 4481 XSETINT (bar->start, 0);
4202 XSETINT (bar->end, 0); 4482 XSETINT (bar->end, 0);
4203 bar->dragging = Qnil; 4483 bar->dragging = Qnil;
4484#ifdef USE_TOOLKIT_SCROLL_BARS
4485 bar->track_top = Qnil;
4486 bar->track_height = Qnil;
4487#endif
4204 4488
4205 /* Add bar to its frame's list of scroll bars. */ 4489 /* Add bar to its frame's list of scroll bars. */
4206 bar->next = FRAME_SCROLL_BARS (f); 4490 bar->next = FRAME_SCROLL_BARS (f);
@@ -4227,6 +4511,8 @@ x_scroll_bar_create (w, top, left, width, height, disp_top, disp_height)
4227 the bar's top is as far down as it goes; otherwise, there's no way 4511 the bar's top is as far down as it goes; otherwise, there's no way
4228 to move to the very end of the buffer. */ 4512 to move to the very end of the buffer. */
4229 4513
4514#ifndef USE_TOOLKIT_SCROLL_BARS
4515
4230static void 4516static void
4231x_scroll_bar_set_handle (bar, start, end, rebuild) 4517x_scroll_bar_set_handle (bar, start, end, rebuild)
4232 struct scroll_bar *bar; 4518 struct scroll_bar *bar;
@@ -4286,6 +4572,7 @@ x_scroll_bar_set_handle (bar, start, end, rebuild)
4286 UNBLOCK_INPUT; 4572 UNBLOCK_INPUT;
4287} 4573}
4288 4574
4575#endif /* !USE_TOOLKIT_SCROLL_BARS */
4289 4576
4290/* Destroy scroll bar BAR, and set its Emacs window's scroll bar to 4577/* Destroy scroll bar BAR, and set its Emacs window's scroll bar to
4291 nil. */ 4578 nil. */
@@ -4324,11 +4611,7 @@ XTset_vertical_scroll_bar (w, portion, whole, position)
4324 /* Get window dimensions. */ 4611 /* Get window dimensions. */
4325 window_box (w, -1, 0, &window_y, 0, &window_height); 4612 window_box (w, -1, 0, &window_y, 0, &window_height);
4326 top = window_y; 4613 top = window_y;
4327#ifdef MAC_OSX
4328 width = 16;
4329#else
4330 width = WINDOW_CONFIG_SCROLL_BAR_COLS (w) * FRAME_COLUMN_WIDTH (f); 4614 width = WINDOW_CONFIG_SCROLL_BAR_COLS (w) * FRAME_COLUMN_WIDTH (f);
4331#endif
4332 height = window_height; 4615 height = window_height;
4333 4616
4334 /* Compute the left edge of the scroll bar area. */ 4617 /* Compute the left edge of the scroll bar area. */
@@ -4343,9 +4626,9 @@ XTset_vertical_scroll_bar (w, portion, whole, position)
4343 4626
4344 /* Compute the left edge of the scroll bar. */ 4627 /* Compute the left edge of the scroll bar. */
4345 if (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w)) 4628 if (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w))
4346 sb_left = left + width - sb_width - (width - sb_width) / 2; 4629 sb_left = left;
4347 else 4630 else
4348 sb_left = left + (width - sb_width) / 2; 4631 sb_left = left + width - sb_width;
4349 4632
4350 /* Adjustments according to Inside Macintosh to make it look nice */ 4633 /* Adjustments according to Inside Macintosh to make it look nice */
4351 disp_top = top; 4634 disp_top = top;
@@ -4418,11 +4701,44 @@ XTset_vertical_scroll_bar (w, portion, whole, position)
4418 XSETINT (bar->top, top); 4701 XSETINT (bar->top, top);
4419 XSETINT (bar->width, sb_width); 4702 XSETINT (bar->width, sb_width);
4420 XSETINT (bar->height, height); 4703 XSETINT (bar->height, height);
4704#ifdef USE_TOOLKIT_SCROLL_BARS
4705 bar->track_top = Qnil;
4706 bar->track_height = Qnil;
4707#endif
4421 } 4708 }
4422 4709
4423 UNBLOCK_INPUT; 4710 UNBLOCK_INPUT;
4424 } 4711 }
4425 4712
4713#ifdef USE_TOOLKIT_SCROLL_BARS
4714 if (NILP (bar->track_top))
4715 {
4716 ControlHandle ch = SCROLL_BAR_CONTROL_HANDLE (bar);
4717 Rect r0, r1;
4718
4719 BLOCK_INPUT;
4720
4721 SetControl32BitMinimum (ch, 0);
4722 SetControl32BitMaximum (ch, 1);
4723 SetControlViewSize (ch, 1);
4724
4725 /* Move the scroll bar thumb to the top. */
4726 SetControl32BitValue (ch, 0);
4727 get_control_part_bound (ch, kControlIndicatorPart, &r0);
4728
4729 /* Move the scroll bar thumb to the bottom. */
4730 SetControl32BitValue (ch, 1);
4731 get_control_part_bound (ch, kControlIndicatorPart, &r1);
4732
4733 UnionRect (&r0, &r1, &r0);
4734 XSETINT (bar->track_top, r0.top);
4735 XSETINT (bar->track_height, r0.bottom - r0.top);
4736
4737 UNBLOCK_INPUT;
4738 }
4739
4740 x_set_toolkit_scroll_bar_thumb (bar, portion, position, whole);
4741#else /* not USE_TOOLKIT_SCROLL_BARS */
4426 /* Set the scroll bar's current state, unless we're currently being 4742 /* Set the scroll bar's current state, unless we're currently being
4427 dragged. */ 4743 dragged. */
4428 if (NILP (bar->dragging)) 4744 if (NILP (bar->dragging))
@@ -4438,6 +4754,7 @@ XTset_vertical_scroll_bar (w, portion, whole, position)
4438 x_scroll_bar_set_handle (bar, start, end, 0); 4754 x_scroll_bar_set_handle (bar, start, end, 0);
4439 } 4755 }
4440 } 4756 }
4757#endif /* not USE_TOOLKIT_SCROLL_BARS */
4441} 4758}
4442 4759
4443 4760
@@ -4619,6 +4936,7 @@ x_scroll_bar_handle_click (bar, part_code, er, bufp)
4619 XSETINT (bufp->y, top_range); 4936 XSETINT (bufp->y, top_range);
4620} 4937}
4621 4938
4939#ifndef USE_TOOLKIT_SCROLL_BARS
4622 4940
4623/* Handle some mouse motion while someone is dragging the scroll bar. 4941/* Handle some mouse motion while someone is dragging the scroll bar.
4624 4942
@@ -4653,6 +4971,7 @@ x_scroll_bar_note_movement (bar, y_pos, t)
4653 } 4971 }
4654} 4972}
4655 4973
4974#endif /* !USE_TOOLKIT_SCROLL_BARS */
4656 4975
4657/* Return information to the user about the current position of the 4976/* Return information to the user about the current position of the
4658 mouse on the scroll bar. */ 4977 mouse on the scroll bar. */
@@ -8657,6 +8976,9 @@ XTread_socket (sd, expected, hold_quit)
8657 SInt16 control_part_code; 8976 SInt16 control_part_code;
8658 ControlHandle ch; 8977 ControlHandle ch;
8659 Point mouse_loc = er.where; 8978 Point mouse_loc = er.where;
8979#ifdef MAC_OSX
8980 ControlKind control_kind;
8981#endif
8660 8982
8661 f = mac_window_to_frame (window_ptr); 8983 f = mac_window_to_frame (window_ptr);
8662 /* convert to local coordinates of new window */ 8984 /* convert to local coordinates of new window */
@@ -8666,6 +8988,10 @@ XTread_socket (sd, expected, hold_quit)
8666#if TARGET_API_MAC_CARBON 8988#if TARGET_API_MAC_CARBON
8667 ch = FindControlUnderMouse (mouse_loc, window_ptr, 8989 ch = FindControlUnderMouse (mouse_loc, window_ptr,
8668 &control_part_code); 8990 &control_part_code);
8991#ifdef MAC_OSX
8992 if (ch)
8993 GetControlKind (ch, &control_kind);
8994#endif
8669#else 8995#else
8670 control_part_code = FindControl (mouse_loc, window_ptr, 8996 control_part_code = FindControl (mouse_loc, window_ptr,
8671 &ch); 8997 &ch);
@@ -8684,19 +9010,42 @@ XTread_socket (sd, expected, hold_quit)
8684 /* ticks to milliseconds */ 9010 /* ticks to milliseconds */
8685 9011
8686 if (dpyinfo->grabbed && tracked_scroll_bar 9012 if (dpyinfo->grabbed && tracked_scroll_bar
9013 || ch != 0
9014#ifndef USE_TOOLKIT_SCROLL_BARS
8687 /* control_part_code becomes kControlNoPart if 9015 /* control_part_code becomes kControlNoPart if
8688 a progress indicator is clicked. */ 9016 a progress indicator is clicked. */
8689 || ch != 0 && control_part_code != kControlNoPart) 9017 && control_part_code != kControlNoPart
9018#else /* USE_TOOLKIT_SCROLL_BARS */
9019#ifdef MAC_OSX
9020 && control_kind.kind == kControlKindScrollBar
9021#endif /* MAC_OSX */
9022#endif /* USE_TOOLKIT_SCROLL_BARS */
9023 )
8690 { 9024 {
8691 struct scroll_bar *bar; 9025 struct scroll_bar *bar;
8692 9026
8693 if (dpyinfo->grabbed && tracked_scroll_bar) 9027 if (dpyinfo->grabbed && tracked_scroll_bar)
8694 { 9028 {
8695 bar = tracked_scroll_bar; 9029 bar = tracked_scroll_bar;
9030#ifndef USE_TOOLKIT_SCROLL_BARS
8696 control_part_code = kControlIndicatorPart; 9031 control_part_code = kControlIndicatorPart;
9032#endif
8697 } 9033 }
8698 else 9034 else
8699 bar = (struct scroll_bar *) GetControlReference (ch); 9035 bar = (struct scroll_bar *) GetControlReference (ch);
9036#ifdef USE_TOOLKIT_SCROLL_BARS
9037 /* Make the "Ctrl-Mouse-2 splits window" work
9038 for toolkit scroll bars. */
9039 if (er.modifiers & controlKey)
9040 x_scroll_bar_handle_click (bar, control_part_code,
9041 &er, &inev);
9042 else if (er.what == mouseDown)
9043 x_scroll_bar_handle_press (bar, control_part_code,
9044 inev.timestamp, &inev);
9045 else
9046 x_scroll_bar_handle_release (bar, inev.timestamp,
9047 &inev);
9048#else /* not USE_TOOLKIT_SCROLL_BARS */
8700 x_scroll_bar_handle_click (bar, control_part_code, 9049 x_scroll_bar_handle_click (bar, control_part_code,
8701 &er, &inev); 9050 &er, &inev);
8702 if (er.what == mouseDown 9051 if (er.what == mouseDown
@@ -8704,6 +9053,7 @@ XTread_socket (sd, expected, hold_quit)
8704 tracked_scroll_bar = bar; 9053 tracked_scroll_bar = bar;
8705 else 9054 else
8706 tracked_scroll_bar = NULL; 9055 tracked_scroll_bar = NULL;
9056#endif /* not USE_TOOLKIT_SCROLL_BARS */
8707 } 9057 }
8708 else 9058 else
8709 { 9059 {
@@ -8753,15 +9103,18 @@ XTread_socket (sd, expected, hold_quit)
8753 dpyinfo->grabbed &= ~(1 << inev.code); 9103 dpyinfo->grabbed &= ~(1 << inev.code);
8754 } 9104 }
8755 9105
8756 switch (er.what) 9106#ifdef USE_TOOLKIT_SCROLL_BARS
8757 { 9107 if (inev.kind == MOUSE_CLICK_EVENT)
8758 case mouseDown: 9108#endif
8759 inev.modifiers |= down_modifier; 9109 switch (er.what)
8760 break; 9110 {
8761 case mouseUp: 9111 case mouseDown:
8762 inev.modifiers |= up_modifier; 9112 inev.modifiers |= down_modifier;
8763 break; 9113 break;
8764 } 9114 case mouseUp:
9115 inev.modifiers |= up_modifier;
9116 break;
9117 }
8765 } 9118 }
8766 break; 9119 break;
8767 9120
@@ -8863,10 +9216,16 @@ XTread_socket (sd, expected, hold_quit)
8863 GlobalToLocal (&mouse_pos); 9216 GlobalToLocal (&mouse_pos);
8864 9217
8865 if (dpyinfo->grabbed && tracked_scroll_bar) 9218 if (dpyinfo->grabbed && tracked_scroll_bar)
9219#ifdef USE_TOOLKIT_SCROLL_BARS
9220 x_scroll_bar_handle_drag (wp, tracked_scroll_bar,
9221 mouse_pos, er.when * (1000 / 60),
9222 &inev);
9223#else /* not USE_TOOLKIT_SCROLL_BARS */
8866 x_scroll_bar_note_movement (tracked_scroll_bar, 9224 x_scroll_bar_note_movement (tracked_scroll_bar,
8867 mouse_pos.v 9225 mouse_pos.v
8868 - XINT (tracked_scroll_bar->top), 9226 - XINT (tracked_scroll_bar->top),
8869 TickCount() * (1000 / 60)); 9227 er.when * (1000 / 60));
9228#endif /* not USE_TOOLKIT_SCROLL_BARS */
8870 else 9229 else
8871 { 9230 {
8872 /* Generate SELECT_WINDOW_EVENTs when needed. */ 9231 /* Generate SELECT_WINDOW_EVENTs when needed. */
@@ -8941,6 +9300,23 @@ XTread_socket (sd, expected, hold_quit)
8941 else 9300 else
8942 { 9301 {
8943 /* A window has been deactivated */ 9302 /* A window has been deactivated */
9303#if USE_TOOLKIT_SCROLL_BARS
9304 if (dpyinfo->grabbed && tracked_scroll_bar)
9305 {
9306 struct input_event event;
9307
9308 EVENT_INIT (event);
9309 event.kind = NO_EVENT;
9310 x_scroll_bar_handle_release (tracked_scroll_bar,
9311 er.when * (1000 / 60),
9312 &event);
9313 if (event.kind != NO_EVENT)
9314 {
9315 kbd_buffer_store_event_hold (&event, hold_quit);
9316 count++;
9317 }
9318 }
9319#endif
8944 dpyinfo->grabbed = 0; 9320 dpyinfo->grabbed = 0;
8945 9321
8946 x_detect_focus_change (dpyinfo, &er, &inev); 9322 x_detect_focus_change (dpyinfo, &er, &inev);
@@ -9720,42 +10096,6 @@ mac_initialize ()
9720 /* Try to use interrupt input; if we can't, then start polling. */ 10096 /* Try to use interrupt input; if we can't, then start polling. */
9721 Fset_input_mode (Qt, Qnil, Qt, Qnil); 10097 Fset_input_mode (Qt, Qnil, Qt, Qnil);
9722 10098
9723#ifdef USE_X_TOOLKIT
9724 XtToolkitInitialize ();
9725 Xt_app_con = XtCreateApplicationContext ();
9726 XtAppSetFallbackResources (Xt_app_con, Xt_default_resources);
9727
9728 /* Install an asynchronous timer that processes Xt timeout events
9729 every 0.1s. This is necessary because some widget sets use
9730 timeouts internally, for example the LessTif menu bar, or the
9731 Xaw3d scroll bar. When Xt timouts aren't processed, these
9732 widgets don't behave normally. */
9733 {
9734 EMACS_TIME interval;
9735 EMACS_SET_SECS_USECS (interval, 0, 100000);
9736 start_atimer (ATIMER_CONTINUOUS, interval, x_process_timeouts, 0);
9737 }
9738#endif
9739
9740#if USE_TOOLKIT_SCROLL_BARS
9741 xaw3d_arrow_scroll = False;
9742 xaw3d_pick_top = True;
9743#endif
9744
9745#if 0
9746 /* Note that there is no real way portable across R3/R4 to get the
9747 original error handler. */
9748 XSetErrorHandler (x_error_handler);
9749 XSetIOErrorHandler (x_io_error_quitter);
9750
9751 /* Disable Window Change signals; they are handled by X events. */
9752#ifdef SIGWINCH
9753 signal (SIGWINCH, SIG_DFL);
9754#endif /* ! defined (SIGWINCH) */
9755
9756 signal (SIGPIPE, x_connection_signal);
9757#endif
9758
9759 BLOCK_INPUT; 10099 BLOCK_INPUT;
9760 10100
9761#if TARGET_API_MAC_CARBON 10101#if TARGET_API_MAC_CARBON
@@ -9832,7 +10172,11 @@ syms_of_macterm ()
9832 10172
9833 DEFVAR_LISP ("x-toolkit-scroll-bars", &Vx_toolkit_scroll_bars, 10173 DEFVAR_LISP ("x-toolkit-scroll-bars", &Vx_toolkit_scroll_bars,
9834 doc: /* If not nil, Emacs uses toolkit scroll bars. */); 10174 doc: /* If not nil, Emacs uses toolkit scroll bars. */);
10175#ifdef USE_TOOLKIT_SCROLL_BARS
9835 Vx_toolkit_scroll_bars = Qt; 10176 Vx_toolkit_scroll_bars = Qt;
10177#else
10178 Vx_toolkit_scroll_bars = Qnil;
10179#endif
9836 10180
9837 DEFVAR_BOOL ("x-use-underline-position-properties", 10181 DEFVAR_BOOL ("x-use-underline-position-properties",
9838 &x_use_underline_position_properties, 10182 &x_use_underline_position_properties,
diff --git a/src/macterm.h b/src/macterm.h
index 5c724aac7b2..79c78e3f0e0 100644
--- a/src/macterm.h
+++ b/src/macterm.h
@@ -492,6 +492,12 @@ struct scroll_bar {
492 place where the user grabbed it. If the handle isn't currently 492 place where the user grabbed it. If the handle isn't currently
493 being dragged, this is Qnil. */ 493 being dragged, this is Qnil. */
494 Lisp_Object dragging; 494 Lisp_Object dragging;
495
496#ifdef USE_TOOLKIT_SCROLL_BARS
497 /* The position and size of the scroll bar handle track area in
498 pixels, relative to the frame. */
499 Lisp_Object track_top, track_height;
500#endif
495}; 501};
496 502
497/* The number of elements a vector holding a struct scroll_bar needs. */ 503/* The number of elements a vector holding a struct scroll_bar needs. */
diff --git a/src/sysselect.h b/src/sysselect.h
index 4c52bba677a..866a65e9208 100644
--- a/src/sysselect.h
+++ b/src/sysselect.h
@@ -19,7 +19,13 @@ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19Boston, MA 02111-1307, USA. */ 19Boston, MA 02111-1307, USA. */
20 20
21#ifdef HAVE_SYS_SELECT_H 21#ifdef HAVE_SYS_SELECT_H
22#if defined (DARWIN) || defined (MAC_OSX)
23#undef init_process
24#endif
22#include <sys/select.h> 25#include <sys/select.h>
26#if defined (DARWIN) || defined (MAC_OSX)
27#define init_process emacs_init_process
28#endif
23#endif 29#endif
24 30
25#ifdef FD_SET 31#ifdef FD_SET
diff --git a/src/xfns.c b/src/xfns.c
index 666acfec773..4a5ff0894f1 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -4388,6 +4388,10 @@ start_hourglass ()
4388 EMACS_TIME delay; 4388 EMACS_TIME delay;
4389 int secs, usecs = 0; 4389 int secs, usecs = 0;
4390 4390
4391 /* Don't bother for ttys. */
4392 if (NILP (Vwindow_system))
4393 return;
4394
4391 cancel_hourglass (); 4395 cancel_hourglass ();
4392 4396
4393 if (INTEGERP (Vhourglass_delay) 4397 if (INTEGERP (Vhourglass_delay)