aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/.gdbinit20
-rw-r--r--src/ChangeLog183
-rw-r--r--src/Makefile.in2
-rw-r--r--src/callproc.c16
-rw-r--r--src/config.in15
-rw-r--r--src/dispextern.h6
-rw-r--r--src/doc.c6
-rw-r--r--src/fringe.c45
-rw-r--r--src/keyboard.c35
-rw-r--r--src/keyboard.h2
-rw-r--r--src/keymap.c3
-rw-r--r--src/mac.c48
-rw-r--r--src/macfns.c41
-rw-r--r--src/macgui.h2
-rw-r--r--src/macmenu.c4
-rw-r--r--src/macterm.c337
-rw-r--r--src/textprop.c6
-rw-r--r--src/unexmacosx.c5
-rw-r--r--src/w32term.c5
-rw-r--r--src/window.c15
-rw-r--r--src/xdisp.c19
-rw-r--r--src/xfns.c2
-rw-r--r--src/xterm.c53
-rw-r--r--src/xterm.h2
24 files changed, 585 insertions, 287 deletions
diff --git a/src/.gdbinit b/src/.gdbinit
index 943481d419e..adf2ccbf5f1 100644
--- a/src/.gdbinit
+++ b/src/.gdbinit
@@ -60,6 +60,16 @@ Print the emacs s-expression which is $.
60Works only when an inferior emacs is executing. 60Works only when an inferior emacs is executing.
61end 61end
62 62
63# Print out s-expressions
64define pp
65 set $tmp = $arg0
66 set debug_print ($tmp)
67end
68document pp
69Print the argument as an emacs s-expression
70Works only when an inferior emacs is executing.
71end
72
63define xtype 73define xtype
64 xgettype $ 74 xgettype $
65 output $type 75 output $type
@@ -452,6 +462,16 @@ document xreload
452end 462end
453xreload 463xreload
454 464
465# Flush display (X only)
466define ff
467 set x_flush (0)
468end
469document ff
470Flush pending X window display updates to screen.
471Works only when an inferior emacs is executing.
472end
473
474
455define hook-run 475define hook-run
456 xreload 476 xreload
457end 477end
diff --git a/src/ChangeLog b/src/ChangeLog
index e58ddb74284..9fedb52f42c 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,157 @@
12004-10-14 Kim F. Storm <storm@cua.dk>
2
3 * xterm.h: Include Xutil.h after keysym.h to work around bug
4 (incorrectly recognising AltGr key) in some X versions.
5
62004-10-13 Stefan Monnier <monnier@iro.umontreal.ca>
7
8 * keymap.c (get_keymap): An autoload form is not a keymap.
9
10 * textprop.c (syms_of_textprop): Make `syntax-table' nonsticky.
11
122004-10-13 Kim F. Storm <storm@cua.dk>
13
14 * callproc.c (Fcall_process): Simplify handling of display arg.
15 Resume `display_on_the_fly' once a coding system is determined.
16
17 * xdisp.c (redisplay_preserve_echo_area): Fix last change.
18
192004-10-12 Kim F. Storm <storm@cua.dk>
20
21 * xdisp.c (redisplay_preserve_echo_area): Flush display in case
22 caller, such as call-process, is not going to poll for input.
23 (calc_line_height_property): Handle case where it->object is nil.
24
25 * xterm.c (x_redisplay_interface): Fix flush_display_optional.
26
272004-10-12 Kenichi Handa <handa@m17n.org>
28
29 * xdisp.c (get_next_display_element):
30 If unibyte_display_via_language_environment is zero, display 8-bit
31 chars in octal in unibyte buffer.
32
332004-10-12 Kim F. Storm <storm@cua.dk>
34
35 * doc.c (Fsubstitute_command_keys): Ignore remappings unless there
36 are no ordinary bindings.
37
382004-10-11 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
39
40 * xfns.c (syms_of_xfns): Defsubr x-file-dialog for GTK also.
41
422004-10-10 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
43
44 * macterm.c (x_raise_frame): Add BLOCK_INPUT around SelectWindow.
45 (x_lower_frame): Add BLOCK_INPUT around SendBehind.
46 (make_mac_frame): Add BLOCK_INPUT around the making of a
47 terminal frame.
48 (mac_initialize): Add BLOCK_INPUT around carbon initialization.
49 * macgui.h (mktime): Use emacs_mktime.
50 * macfns.c (Fx_file_dialog): Add BLOCK_INPUT around more code.
51 Make a cancel file-open dialog be like C-g.
52 * mac.c (mktime): Use emacs_mktime.
53 (Fdo_applescript): Add BLOCK_INPUT around do_applescript.
54 (Fmac_paste_function): Add better error handling for carbon cut/paste.
55
562004-10-10 Kim F. Storm <storm@cua.dk>
57
58 * keyboard.c (timer_resume_idle): New function to resume idle
59 timer without resetting timers on the idle list.
60 (read_char): Use timer_resume_idle. Remove local var last_idle_start.
61 (timer_start_idle, timer_stop_idle): Declare static.
62 (read_key_sequence): Use timer_resume_idle instead of timer_start_idle.
63
64 * keyboard.h (timer_start_idle, timer_stop_idle): Remove prototypes.
65
662004-10-08 Steven Tamm <steventamm@mac.com>
67
68 * config.in (HAVE_MALLOC_MALLOC_H): Regenerate.
69 * macterm.c (mac_check_for_quit_char): Remove warning for using
70 NULL where 0 should be used.
71 * unexmacosx.c: Use malloc/malloc.h on Tiger instead of
72 objc/malloc.h
73 * mac.c: Include time.h for Tiger compatibility.
74
752004-10-07 Kim F. Storm <storm@cua.dk>
76
77 * xdisp.c (redisplay_window): Fix flicker on vertical line between
78 windows. Update vertical line after drawing window fringes, but
79 only if actually drawing any bitmaps--or there is no fringe.
80
81 * xterm.c (x_update_window_end): Likewise.
82 * macterm.c (x_update_window_end): Likewise.
83 * w32term.c (x_update_window_end): Likewise.
84
85 * fringe.c (draw_window_fringes): Return value now indicates if
86 any fringe bitmaps were redrawn (or there are no fringes).
87
88 * dispextern.h (draw_window_fringes): Update prototype.
89
902004-10-06 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
91
92 * macfns.c (mac_get_window_bounds): Add extern.
93 (x_real_positions): Use mac_get_window_bounds.
94
95 * macmenu.c (update_submenu_strings): Apply 2004-09-07 change for
96 xmenu.c (YAILOM).
97
98 * macterm.c [!MAC_OSX]: Include Windows.h.
99 (front_emacs_window): Rename from mac_front_window. All uses
100 changed. Return the frontmost non-tooltip emacs window.
101 (mac_get_window_bounds): New function.
102 (x_calc_absolute_position): Use the difference of width and height
103 between the inner and outer window.
104 (x_set_offset): Specify window position by the coordinae of the
105 outer window. Adjust the position if the title bar is completely
106 outside the screen.
107 (app_is_suspended, app_sleep_time): Remove unused variables.
108 (do_app_resume, do_app_suspend): Remove their contents because
109 window-activate/deactivate events will do the job.
110 (do_zoom_window): Remove unused variables. Make compliant to the
111 standard way of zooming. Set f->left_pos and f->top_pos.
112 (XTread_socket): Don't use argument `expected'. Don't use
113 FrontWindow to determine the clicked window. Exclude unprocessed
114 mouseUp cases in the early stage. Add parentheses to fix operator
115 precedence.
116 (XTread_socket) [TARGET_API_MAC_CARBON]: Don't specify drag area.
117
118
1192004-10-05 Jan Dj,Ad(Brv. <jan.h.d@swipnet.se>
120
121 * config.in: Regenerate.
122
123 * Makefile.in (RUN_TEMACS): Check HAVE_RANDOM_HEAPSTART instead of
124 HAVE_EXECSHIELD.
125
1262004-10-05 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
127
128 * xterm.c (x_find_modifier_meanings): Ignore any Super or Hyper for
129 a row if Alt or Meta has been found for that row. Also stop scanning
130 for Keysyms for that row.
131
1322004-10-04 Kim F. Storm <storm@cua.dk>
133
134 * fringe.c (Ffringe_bitmaps_at_pos): Change return value from cons
135 to list. Include overlay arrow bitmap in return value.
136
137 * xterm.c (XTset_vertical_scroll_bar): Improve handling of scroll
138 bars with fractional column width. If scroll bar separates two
139 windows, move it towards the window it belongs to. Only update
140 the padding area below the scroll bar widget when necessary,
141 i.e. when scroll bar widget is created, moved, or resized.
142
143 * xdisp.c (define_frame_cursor1): Do not change frame cursor
144 while tracking/dragging mouse.
145 (x_draw_vertical_border): Do not draw line if frame has scroll bars.
146
147 * window.c (coordinates_in_window): Relax check for cursor
148 on vertial border between mode lines.
149 (Fset_window_fringes): Do not allow negative widths.
150 (Fset_window_scroll_bars): Likewise.
151
152 * .gdbinit (pp): Shorthand for p ARG + pr.
153 (ff): New command: flush frame updates (X only).
154
12004-10-03 Michael Albinus <michael.albinus@gmx.de> 1552004-10-03 Michael Albinus <michael.albinus@gmx.de>
2 156
3 * fileio.c (auto_save_1) Call Ffile_modes for remote files. 157 * fileio.c (auto_save_1) Call Ffile_modes for remote files.
@@ -62,8 +216,8 @@
62 Change arg to Lisp_Object and fail if not an integer. 216 Change arg to Lisp_Object and fail if not an integer.
63 (get_fringe_bitmap_name, resolve_fringe_bitmap) 217 (get_fringe_bitmap_name, resolve_fringe_bitmap)
64 (destroy_fringe_bitmap): New functions. 218 (destroy_fringe_bitmap): New functions.
65 (Fdestroy_fringe_bitmap): Change arg to bitmap symbol. Use 219 (Fdestroy_fringe_bitmap): Change arg to bitmap symbol.
66 destroy_fringe_bitmap. Remove symbol from Vfringe_bitmaps and 220 Use destroy_fringe_bitmap. Remove symbol from Vfringe_bitmaps and
67 clear its fringe property. 221 clear its fringe property.
68 (init_fringe_bitmap): Use destroy_fringe_bitmap instead of 222 (init_fringe_bitmap): Use destroy_fringe_bitmap instead of
69 Fdestroy_fringe_bitmap. 223 Fdestroy_fringe_bitmap.
@@ -88,7 +242,7 @@
88 242
892004-09-25 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> 2432004-09-25 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
90 244
91 * config.in: Rebuild 245 * config.in: Rebuild.
92 246
932004-09-24 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> 2472004-09-24 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
94 248
@@ -108,7 +262,7 @@
108 Handle the case where we reach the old displayed text, 262 Handle the case where we reach the old displayed text,
109 out of sync with the old line boundary. 263 out of sync with the old line boundary.
110 264
1112004-09-14 Stefan <monnier@iro.umontreal.ca> 2652004-09-14 Stefan Monnier <monnier@iro.umontreal.ca>
112 266
113 * fileio.c (Finsert_file_contents): Fix case of replacement in a 267 * fileio.c (Finsert_file_contents): Fix case of replacement in a
114 narrowed buffer. 268 narrowed buffer.
@@ -130,7 +284,7 @@
130 (Fbyte_code): Remove dead code after `wrong_type_argument'. 284 (Fbyte_code): Remove dead code after `wrong_type_argument'.
131 285
132 * alloc.c (Fgarbage_collect): Mark keyboards, gtk data, and specpdl 286 * alloc.c (Fgarbage_collect): Mark keyboards, gtk data, and specpdl
133 before doing the mark_stack_check_gcpros since they are not on the stack. 287 before doing the mark_stack_check_gcpros since they're not on the stack.
134 288
1352004-09-12 Kim F. Storm <storm@cua.dk> 2892004-09-12 Kim F. Storm <storm@cua.dk>
136 290
@@ -149,8 +303,7 @@
149 blockinput.h. 303 blockinput.h.
150 (dosfns.o): Depend on blockinput.h, window.h, dispextern.h, 304 (dosfns.o): Depend on blockinput.h, window.h, dispextern.h,
151 charset.h, and coding.h 305 charset.h, and coding.h
152 (w16select.o): Depend on buffer.h, charset.h, coding.h, and 306 (w16select.o): Depend on buffer.h, charset.h, coding.h, and composite.h.
153 composite.h.
154 (term.o): Depend on window.h and keymap.h. 307 (term.o): Depend on window.h and keymap.h.
155 (abbrev.o): Depend on syntax.h. 308 (abbrev.o): Depend on syntax.h.
156 (callint.o): Depend on keymap.h. 309 (callint.o): Depend on keymap.h.
@@ -183,8 +336,8 @@
183 (lread.o): Depend on $(INTERVALS_SRC), termhooks.h, and coding.h. 336 (lread.o): Depend on $(INTERVALS_SRC), termhooks.h, and coding.h.
184 (intervals.o): Depend on keymap.h. 337 (intervals.o): Depend on keymap.h.
185 338
186 * msdos.c (msdos_set_cursor_shape, IT_display_cursor): Add 339 * msdos.c (msdos_set_cursor_shape, IT_display_cursor):
187 debugging print-out to termscript. 340 Add debugging print-out to termscript.
188 341
1892004-09-09 Richard M. Stallman <rms@gnu.org> 3422004-09-09 Richard M. Stallman <rms@gnu.org>
190 343
@@ -210,8 +363,8 @@
2102004-09-07 Luc Teirlinck <teirllm@auburn.edu> 3632004-09-07 Luc Teirlinck <teirllm@auburn.edu>
211 364
212 * buffer.h (struct buffer): Add auto_save_file_format field. 365 * buffer.h (struct buffer): Add auto_save_file_format field.
213 * buffer.c (reset_buffer, init_buffer_once): Handle 366 * buffer.c (reset_buffer, init_buffer_once):
214 auto_save_file_format field. 367 Handle auto_save_file_format field.
215 (syms_of_buffer): Add DEFVAR_PER_BUFFER for 368 (syms_of_buffer): Add DEFVAR_PER_BUFFER for
216 `buffer-auto-save-file-format'. 369 `buffer-auto-save-file-format'.
217 * fileio.c: Delete declaration for removed Vauto_save_file_format. 370 * fileio.c: Delete declaration for removed Vauto_save_file_format.
@@ -224,15 +377,15 @@
224 377
225 * w32term.h (AppendMenuW_Proc): Move declaration from w32menu.c. 378 * w32term.h (AppendMenuW_Proc): Move declaration from w32menu.c.
226 379
227 * w32fns.c (w32_wnd_proc) [WM_MEASUREITEM, WM_DRAWITEM]: Handle 380 * w32fns.c (w32_wnd_proc) [WM_MEASUREITEM, WM_DRAWITEM]:
228 Unicode menu titles. 381 Handle Unicode menu titles.
229 382
2302004-09-07 Kim F. Storm <storm@cua.dk> 3832004-09-07 Kim F. Storm <storm@cua.dk>
231 384
232 * xdisp.c (set_cursor_from_row): Fix last change. Only use 'cursor' 385 * xdisp.c (set_cursor_from_row): Fix last change. Only use 'cursor'
233 property from text property or overlay strings at point. 386 property from text property or overlay strings at point.
234 387
2352004-09-07 Stefan <monnier@iro.umontreal.ca> 3882004-09-07 Stefan Monnier <monnier@iro.umontreal.ca>
236 389
237 * xmenu.c (update_submenu_strings): YAILOM. 390 * xmenu.c (update_submenu_strings): YAILOM.
238 (set_frame_menubar): Make sure last_i is initialized. 391 (set_frame_menubar): Make sure last_i is initialized.
@@ -721,7 +874,7 @@
721 * w32select.c (Fw32_set_clipboard_data): Update `nbytes' correctly 874 * w32select.c (Fw32_set_clipboard_data): Update `nbytes' correctly
722 after getting a new string by pre-write-conversion. 875 after getting a new string by pre-write-conversion.
723 876
7242004-06-30 Stefan <monnier@iro.umontreal.ca> 8772004-06-30 Stefan Monnier <monnier@iro.umontreal.ca>
725 878
726 * xterm.c (x_detect_focus_change): Remove unused var `nr_events'. 879 * xterm.c (x_detect_focus_change): Remove unused var `nr_events'.
727 (x_calc_absolute_position): Remove unused var `child'. 880 (x_calc_absolute_position): Remove unused var `child'.
diff --git a/src/Makefile.in b/src/Makefile.in
index 950564f8fa4..08504dcf725 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -887,7 +887,7 @@ LIBES = $(LOADLIBES) $(LIBS) $(LIBX) $(LIBSOUND) \
887#define OBJECTS_MACHINE 887#define OBJECTS_MACHINE
888#endif 888#endif
889 889
890#ifdef HAVE_EXECSHIELD 890#ifdef HAVE_RANDOM_HEAPSTART
891#undef i386 891#undef i386
892RUN_TEMACS = @SETARCH@ i386 ./temacs 892RUN_TEMACS = @SETARCH@ i386 ./temacs
893#else 893#else
diff --git a/src/callproc.c b/src/callproc.c
index 7632d491944..d9f9a342575 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -216,7 +216,8 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
216 int nargs; 216 int nargs;
217 register Lisp_Object *args; 217 register Lisp_Object *args;
218{ 218{
219 Lisp_Object infile, buffer, current_dir, display, path; 219 Lisp_Object infile, buffer, current_dir, path;
220 int display_p;
220 int fd[2]; 221 int fd[2];
221 int filefd; 222 int filefd;
222 register int pid; 223 register int pid;
@@ -372,7 +373,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
372 UNGCPRO; 373 UNGCPRO;
373 } 374 }
374 375
375 display = nargs >= 4 ? args[3] : Qnil; 376 display_p = INTERACTIVE && nargs >= 4 && !NILP (args[3]);
376 377
377 filefd = emacs_open (SDATA (infile), O_RDONLY, 0); 378 filefd = emacs_open (SDATA (infile), O_RDONLY, 0);
378 if (filefd < 0) 379 if (filefd < 0)
@@ -739,7 +740,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
739 int first = 1; 740 int first = 1;
740 int total_read = 0; 741 int total_read = 0;
741 int carryover = 0; 742 int carryover = 0;
742 int display_on_the_fly = !NILP (display) && INTERACTIVE; 743 int display_on_the_fly = display_p;
743 struct coding_system saved_coding; 744 struct coding_system saved_coding;
744 745
745 saved_coding = process_coding; 746 saved_coding = process_coding;
@@ -803,6 +804,9 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
803 display_on_the_fly = 0; 804 display_on_the_fly = 0;
804 process_coding = saved_coding; 805 process_coding = saved_coding;
805 carryover = nread; 806 carryover = nread;
807 /* This is to make the above condition always
808 fails in the future. */
809 saved_coding.type = coding_type_no_conversion;
806 continue; 810 continue;
807 } 811 }
808 812
@@ -832,12 +836,16 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
832 bufptr = tempptr; 836 bufptr = tempptr;
833 } 837 }
834 838
835 if (!NILP (display) && INTERACTIVE) 839 if (display_p)
836 { 840 {
837 if (first) 841 if (first)
838 prepare_menu_bars (); 842 prepare_menu_bars ();
839 first = 0; 843 first = 0;
840 redisplay_preserve_echo_area (1); 844 redisplay_preserve_echo_area (1);
845 /* This variable might have been set to 0 for code
846 detection. In that case, we set it back to 1 because
847 we should have already detected a coding system. */
848 display_on_the_fly = 1;
841 } 849 }
842 immediate_quit = 1; 850 immediate_quit = 1;
843 QUIT; 851 QUIT;
diff --git a/src/config.in b/src/config.in
index d87d235fe55..49095ca4e5a 100644
--- a/src/config.in
+++ b/src/config.in
@@ -136,9 +136,6 @@ Boston, MA 02111-1307, USA. */
136/* Define to 1 if you have the `euidaccess' function. */ 136/* Define to 1 if you have the `euidaccess' function. */
137#undef HAVE_EUIDACCESS 137#undef HAVE_EUIDACCESS
138 138
139/* Define to 1 if this OS has exec shield and we can handle it. */
140#undef HAVE_EXECSHIELD
141
142/* Define to 1 if you have the <fcntl.h> header file. */ 139/* Define to 1 if you have the <fcntl.h> header file. */
143#undef HAVE_FCNTL_H 140#undef HAVE_FCNTL_H
144 141
@@ -355,6 +352,9 @@ Boston, MA 02111-1307, USA. */
355/* Define to 1 if you have the <maillock.h> header file. */ 352/* Define to 1 if you have the <maillock.h> header file. */
356#undef HAVE_MAILLOCK_H 353#undef HAVE_MAILLOCK_H
357 354
355/* Define to 1 if you have the <malloc/malloc.h> header file. */
356#undef HAVE_MALLOC_MALLOC_H
357
358/* Define to 1 if you have the `mblen' function. */ 358/* Define to 1 if you have the `mblen' function. */
359#undef HAVE_MBLEN 359#undef HAVE_MBLEN
360 360
@@ -432,6 +432,9 @@ Boston, MA 02111-1307, USA. */
432/* Define to 1 if you have the `random' function. */ 432/* Define to 1 if you have the `random' function. */
433#undef HAVE_RANDOM 433#undef HAVE_RANDOM
434 434
435/* Define to 1 if this OS randomizes the start address of the heap. */
436#undef HAVE_RANDOM_HEAPSTART
437
435/* Define to 1 if you have the `recvfrom' function. */ 438/* Define to 1 if you have the `recvfrom' function. */
436#undef HAVE_RECVFROM 439#undef HAVE_RECVFROM
437 440
@@ -754,9 +757,9 @@ Boston, MA 02111-1307, USA. */
754/* If using the C implementation of alloca, define if you know the 757/* If using the C implementation of alloca, define if you know the
755 direction of stack growth for your system; otherwise it will be 758 direction of stack growth for your system; otherwise it will be
756 automatically deduced at run-time. 759 automatically deduced at run-time.
757 STACK_DIRECTION > 0 => grows toward higher addresses 760 STACK_DIRECTION > 0 => grows toward higher addresses
758 STACK_DIRECTION < 0 => grows toward lower addresses 761 STACK_DIRECTION < 0 => grows toward lower addresses
759 STACK_DIRECTION = 0 => direction of growth unknown */ 762 STACK_DIRECTION = 0 => direction of growth unknown */
760#undef STACK_DIRECTION 763#undef STACK_DIRECTION
761 764
762/* Define to 1 if you have the ANSI C header files. */ 765/* Define to 1 if you have the ANSI C header files. */
diff --git a/src/dispextern.h b/src/dispextern.h
index f28b39f0c64..a87a38ce469 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -1961,8 +1961,8 @@ struct it
1961 1961
1962 /* Object and position where the current display element came from. 1962 /* Object and position where the current display element came from.
1963 Object can be a Lisp string in case the current display element 1963 Object can be a Lisp string in case the current display element
1964 comes from an overlay string, or it is buffer. Position is 1964 comes from an overlay string, or it is buffer. It may also be nil
1965 a position in object. */ 1965 during mode-line update. Position is a position in object. */
1966 Lisp_Object object; 1966 Lisp_Object object;
1967 struct text_pos position; 1967 struct text_pos position;
1968 1968
@@ -2637,7 +2637,7 @@ extern int x_intersect_rectangles P_ ((XRectangle *, XRectangle *,
2637int lookup_fringe_bitmap (Lisp_Object); 2637int lookup_fringe_bitmap (Lisp_Object);
2638void draw_fringe_bitmap P_ ((struct window *, struct glyph_row *, int)); 2638void draw_fringe_bitmap P_ ((struct window *, struct glyph_row *, int));
2639void draw_row_fringe_bitmaps P_ ((struct window *, struct glyph_row *)); 2639void draw_row_fringe_bitmaps P_ ((struct window *, struct glyph_row *));
2640void draw_window_fringes P_ ((struct window *)); 2640int draw_window_fringes P_ ((struct window *, int));
2641int update_window_fringes P_ ((struct window *, int)); 2641int update_window_fringes P_ ((struct window *, int));
2642void compute_fringe_widths P_ ((struct frame *, int)); 2642void compute_fringe_widths P_ ((struct frame *, int));
2643 2643
diff --git a/src/doc.c b/src/doc.c
index 8c116210cda..9a787e002d8 100644
--- a/src/doc.c
+++ b/src/doc.c
@@ -776,9 +776,13 @@ thus, \\=\\=\\=\\= puts \\=\\= into the output, and \\=\\=\\=\\[ puts \\=\\[ int
776 idx = strp - SDATA (string); 776 idx = strp - SDATA (string);
777 tem = Fintern (make_string (start, length_byte), Qnil); 777 tem = Fintern (make_string (start, length_byte), Qnil);
778 778
779 /* Ignore remappings unless there are no ordinary bindings. */
780 tem = Fwhere_is_internal (tem, keymap, Qt, Qnil, Qt);
781 if (NILP (tem))
782 tem = Fwhere_is_internal (tem, keymap, Qt, Qnil, Qnil);
783
779 /* Note the Fwhere_is_internal can GC, so we have to take 784 /* Note the Fwhere_is_internal can GC, so we have to take
780 relocation of string contents into account. */ 785 relocation of string contents into account. */
781 tem = Fwhere_is_internal (tem, keymap, Qt, Qnil, Qnil);
782 strp = SDATA (string) + idx; 786 strp = SDATA (string) + idx;
783 start = SDATA (string) + start_idx; 787 start = SDATA (string) + start_idx;
784 788
diff --git a/src/fringe.c b/src/fringe.c
index 0bf830cbd8c..ef4c7631e05 100644
--- a/src/fringe.c
+++ b/src/fringe.c
@@ -722,19 +722,35 @@ draw_row_fringe_bitmaps (w, row)
722} 722}
723 723
724/* Draw the fringes of window W. Only fringes for rows marked for 724/* Draw the fringes of window W. Only fringes for rows marked for
725 update in redraw_fringe_bitmaps_p are drawn. */ 725 update in redraw_fringe_bitmaps_p are drawn.
726 726
727void 727 Return >0 if left or right fringe was redrawn in any way.
728draw_window_fringes (w) 728
729 If NO_FRINGE is non-zero, also return >0 if either fringe has zero width.
730
731 A return value >0 indicates that the vertical line between windows
732 needs update (as it may be drawn in the fringe).
733*/
734
735int
736draw_window_fringes (w, no_fringe)
729 struct window *w; 737 struct window *w;
738 int no_fringe;
730{ 739{
731 struct glyph_row *row; 740 struct glyph_row *row;
732 int yb = window_text_bottom_y (w); 741 int yb = window_text_bottom_y (w);
733 int nrows = w->current_matrix->nrows; 742 int nrows = w->current_matrix->nrows;
734 int y = 0, rn; 743 int y = 0, rn;
744 int updated = 0;
735 745
736 if (w->pseudo_window_p) 746 if (w->pseudo_window_p)
737 return; 747 return 0;
748
749 /* Must draw line if no fringe */
750 if (no_fringe
751 && (WINDOW_LEFT_FRINGE_WIDTH (w) == 0
752 || WINDOW_RIGHT_FRINGE_WIDTH (w) == 0))
753 updated++;
738 754
739 for (y = 0, rn = 0, row = w->current_matrix->rows; 755 for (y = 0, rn = 0, row = w->current_matrix->rows;
740 y < yb && rn < nrows; 756 y < yb && rn < nrows;
@@ -744,7 +760,10 @@ draw_window_fringes (w)
744 continue; 760 continue;
745 draw_row_fringe_bitmaps (w, row); 761 draw_row_fringe_bitmaps (w, row);
746 row->redraw_fringe_bitmaps_p = 0; 762 row->redraw_fringe_bitmaps_p = 0;
763 updated++;
747 } 764 }
765
766 return updated;
748} 767}
749 768
750 769
@@ -950,11 +969,7 @@ update_window_fringes (w, force_p)
950 Typically, we add an equal amount (+/- 1 pixel) to each fringe, 969 Typically, we add an equal amount (+/- 1 pixel) to each fringe,
951 but a negative width value is taken literally (after negating it). 970 but a negative width value is taken literally (after negating it).
952 971
953 We never make the fringes narrower than specified. It is planned 972 We never make the fringes narrower than specified.
954 to make fringe bitmaps customizable and expandable, and at that
955 time, the user will typically specify the minimum number of pixels
956 needed for his bitmaps, so we shouldn't select anything less than
957 what is specified.
958*/ 973*/
959 974
960void 975void
@@ -1343,9 +1358,10 @@ DEFUN ("fringe-bitmaps-at-pos", Ffringe_bitmaps_at_pos, Sfringe_bitmaps_at_pos,
1343 0, 2, 0, 1358 0, 2, 0,
1344 doc: /* Return fringe bitmaps of row containing position POS in window WINDOW. 1359 doc: /* Return fringe bitmaps of row containing position POS in window WINDOW.
1345If WINDOW is nil, use selected window. If POS is nil, use value of point 1360If WINDOW is nil, use selected window. If POS is nil, use value of point
1346in that window. Return value is a cons (LEFT . RIGHT) where LEFT and RIGHT 1361in that window. Return value is a list (LEFT RIGHT OV), where LEFT
1347are the fringe bitmap numbers for the bitmaps in the left and right fringe, 1362is the symbol for the bitmap in the left fringe (or nil if no bitmap),
1348resp. If left or right fringe is empty, the corresponding element is nil. 1363RIGHT is similar for the right fringe, and OV is non-nil if there is an
1364overlay arrow in the left fringe.
1349Return nil if POS is not visible in WINDOW. */) 1365Return nil if POS is not visible in WINDOW. */)
1350 (pos, window) 1366 (pos, window)
1351 Lisp_Object pos, window; 1367 Lisp_Object pos, window;
@@ -1373,8 +1389,9 @@ Return nil if POS is not visible in WINDOW. */)
1373 row = MATRIX_FIRST_TEXT_ROW (w->current_matrix); 1389 row = MATRIX_FIRST_TEXT_ROW (w->current_matrix);
1374 row = row_containing_pos (w, textpos, row, NULL, 0); 1390 row = row_containing_pos (w, textpos, row, NULL, 0);
1375 if (row) 1391 if (row)
1376 return Fcons (get_fringe_bitmap_name (row->left_fringe_bitmap), 1392 return list3 (get_fringe_bitmap_name (row->left_fringe_bitmap),
1377 get_fringe_bitmap_name (row->right_fringe_bitmap)); 1393 get_fringe_bitmap_name (row->right_fringe_bitmap),
1394 (row->overlay_arrow_p ? Qt : Qnil));
1378 else 1395 else
1379 return Qnil; 1396 return Qnil;
1380} 1397}
diff --git a/src/keyboard.c b/src/keyboard.c
index 378350710b9..3360b11850e 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -676,6 +676,9 @@ static Lisp_Object apply_modifiers P_ ((int, Lisp_Object));
676static void clear_event P_ ((struct input_event *)); 676static void clear_event P_ ((struct input_event *));
677static void any_kboard_state P_ ((void)); 677static void any_kboard_state P_ ((void));
678static SIGTYPE interrupt_signal P_ ((int signalnum)); 678static SIGTYPE interrupt_signal P_ ((int signalnum));
679static void timer_start_idle P_ ((void));
680static void timer_stop_idle P_ ((void));
681static void timer_resume_idle P_ ((void));
679 682
680/* Nonzero means don't try to suspend even if the operating system seems 683/* Nonzero means don't try to suspend even if the operating system seems
681 to support it. */ 684 to support it. */
@@ -2387,7 +2390,6 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu)
2387 volatile Lisp_Object also_record; 2390 volatile Lisp_Object also_record;
2388 volatile int reread; 2391 volatile int reread;
2389 struct gcpro gcpro1, gcpro2; 2392 struct gcpro gcpro1, gcpro2;
2390 EMACS_TIME last_idle_start;
2391 int polling_stopped_here = 0; 2393 int polling_stopped_here = 0;
2392 2394
2393 also_record = Qnil; 2395 also_record = Qnil;
@@ -2894,9 +2896,6 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu)
2894 2896
2895 non_reread: 2897 non_reread:
2896 2898
2897 /* Record the last idle start time so that we can reset it
2898 should the next event read be a help-echo. */
2899 last_idle_start = timer_idleness_start_time;
2900 timer_stop_idle (); 2899 timer_stop_idle ();
2901 RESUME_POLLING; 2900 RESUME_POLLING;
2902 2901
@@ -2936,7 +2935,7 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu)
2936 prevents automatic window selection (under 2935 prevents automatic window selection (under
2937 mouse_autoselect_window from acting as a real input event, for 2936 mouse_autoselect_window from acting as a real input event, for
2938 example banishing the mouse under mouse-avoidance-mode. */ 2937 example banishing the mouse under mouse-avoidance-mode. */
2939 timer_idleness_start_time = last_idle_start; 2938 timer_resume_idle ();
2940 2939
2941 /* Resume allowing input from any kboard, if that was true before. */ 2940 /* Resume allowing input from any kboard, if that was true before. */
2942 if (!was_locked) 2941 if (!was_locked)
@@ -3134,7 +3133,7 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu)
3134 show_help_echo (help, window, object, position, 0); 3133 show_help_echo (help, window, object, position, 0);
3135 3134
3136 /* We stopped being idle for this event; undo that. */ 3135 /* We stopped being idle for this event; undo that. */
3137 timer_idleness_start_time = last_idle_start; 3136 timer_resume_idle ();
3138 goto retry; 3137 goto retry;
3139 } 3138 }
3140 3139
@@ -4251,7 +4250,7 @@ swallow_events (do_display)
4251/* Record the start of when Emacs is idle, 4250/* Record the start of when Emacs is idle,
4252 for the sake of running idle-time timers. */ 4251 for the sake of running idle-time timers. */
4253 4252
4254void 4253static void
4255timer_start_idle () 4254timer_start_idle ()
4256{ 4255{
4257 Lisp_Object timers; 4256 Lisp_Object timers;
@@ -4279,12 +4278,23 @@ timer_start_idle ()
4279 4278
4280/* Record that Emacs is no longer idle, so stop running idle-time timers. */ 4279/* Record that Emacs is no longer idle, so stop running idle-time timers. */
4281 4280
4282void 4281static void
4283timer_stop_idle () 4282timer_stop_idle ()
4284{ 4283{
4285 EMACS_SET_SECS_USECS (timer_idleness_start_time, -1, -1); 4284 EMACS_SET_SECS_USECS (timer_idleness_start_time, -1, -1);
4286} 4285}
4287 4286
4287/* Resume idle timer from last idle start time. */
4288
4289static void
4290timer_resume_idle ()
4291{
4292 if (! EMACS_TIME_NEG_P (timer_idleness_start_time))
4293 return;
4294
4295 timer_idleness_start_time = timer_last_idleness_start_time;
4296}
4297
4288/* This is only for debugging. */ 4298/* This is only for debugging. */
4289struct input_event last_timer_event; 4299struct input_event last_timer_event;
4290 4300
@@ -8846,14 +8856,7 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last,
8846 keymap may have changed, so replay the sequence. */ 8856 keymap may have changed, so replay the sequence. */
8847 if (BUFFERP (key)) 8857 if (BUFFERP (key))
8848 { 8858 {
8849 EMACS_TIME initial_idleness_start_time; 8859 timer_resume_idle ();
8850 EMACS_SET_SECS_USECS (initial_idleness_start_time,
8851 EMACS_SECS (timer_last_idleness_start_time),
8852 EMACS_USECS (timer_last_idleness_start_time));
8853
8854 /* Resume idle state, using the same start-time as before. */
8855 timer_start_idle ();
8856 timer_idleness_start_time = initial_idleness_start_time;
8857 8860
8858 mock_input = t; 8861 mock_input = t;
8859 /* Reset the current buffer from the selected window 8862 /* Reset the current buffer from the selected window
diff --git a/src/keyboard.h b/src/keyboard.h
index 4e14257359f..08cb934d3fe 100644
--- a/src/keyboard.h
+++ b/src/keyboard.h
@@ -326,8 +326,6 @@ extern void swallow_events P_ ((int));
326extern int help_char_p P_ ((Lisp_Object)); 326extern int help_char_p P_ ((Lisp_Object));
327extern void quit_throw_to_read_char P_ ((void)) NO_RETURN; 327extern void quit_throw_to_read_char P_ ((void)) NO_RETURN;
328extern void cmd_error_internal P_ ((Lisp_Object, char *)); 328extern void cmd_error_internal P_ ((Lisp_Object, char *));
329extern void timer_start_idle P_ ((void));
330extern void timer_stop_idle P_ ((void));
331extern int lucid_event_type_list_p P_ ((Lisp_Object)); 329extern int lucid_event_type_list_p P_ ((Lisp_Object));
332extern void kbd_buffer_store_event P_ ((struct input_event *)); 330extern void kbd_buffer_store_event P_ ((struct input_event *));
333extern void kbd_buffer_store_event_hold P_ ((struct input_event *, 331extern void kbd_buffer_store_event_hold P_ ((struct input_event *,
diff --git a/src/keymap.c b/src/keymap.c
index 5177ccfbf8d..1711e7fbc36 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -268,7 +268,8 @@ get_keymap (object, error, autoload)
268 268
269 /* Should we do an autoload? Autoload forms for keymaps have 269 /* Should we do an autoload? Autoload forms for keymaps have
270 Qkeymap as their fifth element. */ 270 Qkeymap as their fifth element. */
271 if ((autoload || !error) && EQ (XCAR (tem), Qautoload)) 271 if ((autoload || !error) && EQ (XCAR (tem), Qautoload)
272 && SYMBOLP (object))
272 { 273 {
273 Lisp_Object tail; 274 Lisp_Object tail;
274 275
diff --git a/src/mac.c b/src/mac.c
index 9740b3bf3f4..91d07372578 100644
--- a/src/mac.c
+++ b/src/mac.c
@@ -24,6 +24,7 @@ Boston, MA 02111-1307, USA. */
24 24
25#include <stdio.h> 25#include <stdio.h>
26#include <errno.h> 26#include <errno.h>
27#include <time.h>
27#include <utime.h> 28#include <utime.h>
28#include <dirent.h> 29#include <dirent.h>
29#include <sys/types.h> 30#include <sys/types.h>
@@ -46,6 +47,8 @@ Boston, MA 02111-1307, USA. */
46#undef realloc 47#undef realloc
47#undef init_process 48#undef init_process
48#include <Carbon/Carbon.h> 49#include <Carbon/Carbon.h>
50#undef mktime
51#define mktime emacs_mktime
49#undef free 52#undef free
50#define free unexec_free 53#define free unexec_free
51#undef malloc 54#undef malloc
@@ -72,6 +75,7 @@ Boston, MA 02111-1307, USA. */
72#include "process.h" 75#include "process.h"
73#include "sysselect.h" 76#include "sysselect.h"
74#include "systime.h" 77#include "systime.h"
78#include "blockinput.h"
75 79
76Lisp_Object QCLIPBOARD; 80Lisp_Object QCLIPBOARD;
77 81
@@ -2547,7 +2551,9 @@ component. */)
2547 2551
2548 CHECK_STRING (script); 2552 CHECK_STRING (script);
2549 2553
2554 BLOCK_INPUT;
2550 status = do_applescript (SDATA (script), &result); 2555 status = do_applescript (SDATA (script), &result);
2556 UNBLOCK_INPUT;
2551 if (status) 2557 if (status)
2552 { 2558 {
2553 if (!result) 2559 if (!result)
@@ -2617,26 +2623,23 @@ DEFUN ("mac-paste-function", Fmac_paste_function, Smac_paste_function, 0, 0, 0,
2617 () 2623 ()
2618{ 2624{
2619#if TARGET_API_MAC_CARBON 2625#if TARGET_API_MAC_CARBON
2626 OSStatus err;
2620 ScrapRef scrap; 2627 ScrapRef scrap;
2621 ScrapFlavorFlags sff; 2628 ScrapFlavorFlags sff;
2622 Size s; 2629 Size s;
2623 int i; 2630 int i;
2624 char *data; 2631 char *data;
2625 2632
2626 if (GetCurrentScrap (&scrap) != noErr) 2633 BLOCK_INPUT;
2627 return Qnil; 2634 err = GetCurrentScrap (&scrap);
2628 2635 if (err == noErr)
2629 if (GetScrapFlavorFlags (scrap, kScrapFlavorTypeText, &sff) != noErr) 2636 err = GetScrapFlavorFlags (scrap, kScrapFlavorTypeText, &sff);
2630 return Qnil; 2637 if (err == noErr)
2631 2638 err = GetScrapFlavorSize (scrap, kScrapFlavorTypeText, &s);
2632 if (GetScrapFlavorSize (scrap, kScrapFlavorTypeText, &s) != noErr) 2639 if (err == noErr && (data = (char*) alloca (s)))
2633 return Qnil; 2640 err = GetScrapFlavorData (scrap, kScrapFlavorTypeText, &s, data);
2634 2641 UNBLOCK_INPUT;
2635 if ((data = (char*) alloca (s)) == NULL) 2642 if (err != noErr || s == 0)
2636 return Qnil;
2637
2638 if (GetScrapFlavorData (scrap, kScrapFlavorTypeText, &s, data) != noErr
2639 || s == 0)
2640 return Qnil; 2643 return Qnil;
2641 2644
2642 /* Emacs expects clipboard contents have Unix-style eol's */ 2645 /* Emacs expects clipboard contents have Unix-style eol's */
@@ -2701,13 +2704,22 @@ DEFUN ("mac-cut-function", Fmac_cut_function, Smac_cut_function, 1, 2, 0,
2701#if TARGET_API_MAC_CARBON 2704#if TARGET_API_MAC_CARBON
2702 { 2705 {
2703 ScrapRef scrap; 2706 ScrapRef scrap;
2707
2708 BLOCK_INPUT;
2704 ClearCurrentScrap (); 2709 ClearCurrentScrap ();
2705 if (GetCurrentScrap (&scrap) != noErr) 2710 if (GetCurrentScrap (&scrap) != noErr)
2706 error ("cannot get current scrap"); 2711 {
2712 UNBLOCK_INPUT;
2713 error ("cannot get current scrap");
2714 }
2707 2715
2708 if (PutScrapFlavor (scrap, kScrapFlavorTypeText, kScrapFlavorMaskNone, len, 2716 if (PutScrapFlavor (scrap, kScrapFlavorTypeText, kScrapFlavorMaskNone, len,
2709 buf) != noErr) 2717 buf) != noErr)
2710 error ("cannot put to scrap"); 2718 {
2719 UNBLOCK_INPUT;
2720 error ("cannot put to scrap");
2721 }
2722 UNBLOCK_INPUT;
2711 } 2723 }
2712#else /* not TARGET_API_MAC_CARBON */ 2724#else /* not TARGET_API_MAC_CARBON */
2713 ZeroScrap (); 2725 ZeroScrap ();
@@ -2742,9 +2754,11 @@ and t is the same as `SECONDARY'. */)
2742 ScrapRef scrap; 2754 ScrapRef scrap;
2743 ScrapFlavorFlags sff; 2755 ScrapFlavorFlags sff;
2744 2756
2757 BLOCK_INPUT;
2745 if (GetCurrentScrap (&scrap) == noErr) 2758 if (GetCurrentScrap (&scrap) == noErr)
2746 if (GetScrapFlavorFlags (scrap, kScrapFlavorTypeText, &sff) == noErr) 2759 if (GetScrapFlavorFlags (scrap, kScrapFlavorTypeText, &sff) == noErr)
2747 val = Qt; 2760 val = Qt;
2761 UNBLOCK_INPUT;
2748#else /* not TARGET_API_MAC_CARBON */ 2762#else /* not TARGET_API_MAC_CARBON */
2749 Handle my_handle; 2763 Handle my_handle;
2750 long rc, scrap_offset; 2764 long rc, scrap_offset;
@@ -2769,8 +2783,6 @@ and t is the same as `SECONDARY'. */)
2769extern int inhibit_window_system; 2783extern int inhibit_window_system;
2770extern int noninteractive; 2784extern int noninteractive;
2771 2785
2772#include "blockinput.h"
2773
2774/* When Emacs is started from the Finder, SELECT always immediately 2786/* When Emacs is started from the Finder, SELECT always immediately
2775 returns as if input is present when file descriptor 0 is polled for 2787 returns as if input is present when file descriptor 0 is polled for
2776 input. Strangely, when Emacs is run as a GUI application from the 2788 input. Strangely, when Emacs is run as a GUI application from the
diff --git a/src/macfns.c b/src/macfns.c
index 3b09b344a55..88f975a65c8 100644
--- a/src/macfns.c
+++ b/src/macfns.c
@@ -312,6 +312,9 @@ static Lisp_Object x_default_scroll_bar_color_parameter P_ ((struct frame *,
312 Lisp_Object, 312 Lisp_Object,
313 char *, char *, 313 char *, char *,
314 int)); 314 int));
315
316extern void mac_get_window_bounds P_ ((struct frame *, Rect *, Rect *));
317
315/* Store the screen positions of frame F into XPTR and YPTR. 318/* Store the screen positions of frame F into XPTR and YPTR.
316 These are the positions of the containing window manager window, 319 These are the positions of the containing window manager window,
317 not Emacs's own window. */ 320 not Emacs's own window. */
@@ -321,33 +324,15 @@ x_real_positions (f, xptr, yptr)
321 FRAME_PTR f; 324 FRAME_PTR f;
322 int *xptr, *yptr; 325 int *xptr, *yptr;
323{ 326{
324 Point pt; 327 Rect inner, outer;
325 GrafPtr oldport;
326 328
327 GetPort (&oldport); 329 mac_get_window_bounds (f, &inner, &outer);
328 SetPortWindowPort (FRAME_MAC_WINDOW (f));
329 330
330#if TARGET_API_MAC_CARBON 331 f->x_pixels_diff = inner.left - outer.left;
331 { 332 f->y_pixels_diff = inner.top - outer.top;
332 Rect r;
333 333
334 GetWindowPortBounds (FRAME_MAC_WINDOW (f), &r); 334 *xptr = outer.left;
335 SetPt (&pt, r.left, r.top); 335 *yptr = outer.top;
336 }
337#else /* not TARGET_API_MAC_CARBON */
338 SetPt (&pt,
339 FRAME_MAC_WINDOW (f)->portRect.left,
340 FRAME_MAC_WINDOW (f)->portRect.top);
341#endif /* not TARGET_API_MAC_CARBON */
342 LocalToGlobal (&pt);
343 SetPort (oldport);
344
345 /* MAC has no frame pixel diff. */
346 f->x_pixels_diff = 0;
347 f->y_pixels_diff = 0;
348
349 *xptr = pt.h;
350 *yptr = pt.v;
351} 336}
352 337
353 338
@@ -4262,6 +4247,7 @@ specified. Ensure that file exists if MUSTMATCH is non-nil. */)
4262 NavUserAction userAction; 4247 NavUserAction userAction;
4263 CFStringRef message=NULL, client=NULL, saveName = NULL; 4248 CFStringRef message=NULL, client=NULL, saveName = NULL;
4264 4249
4250 BLOCK_INPUT;
4265 /* No need for a callback function because we are modal */ 4251 /* No need for a callback function because we are modal */
4266 NavGetDefaultDialogCreationOptions(&options); 4252 NavGetDefaultDialogCreationOptions(&options);
4267 options.modality = kWindowModalityAppModal; 4253 options.modality = kWindowModalityAppModal;
@@ -4332,9 +4318,7 @@ specified. Ensure that file exists if MUSTMATCH is non-nil. */)
4332 AEDisposeDesc(&defLocAed); 4318 AEDisposeDesc(&defLocAed);
4333 } 4319 }
4334 4320
4335 BLOCK_INPUT;
4336 status = NavDialogRun(dialogRef); 4321 status = NavDialogRun(dialogRef);
4337 UNBLOCK_INPUT;
4338 } 4322 }
4339 4323
4340 if (saveName) CFRelease(saveName); 4324 if (saveName) CFRelease(saveName);
@@ -4347,9 +4331,7 @@ specified. Ensure that file exists if MUSTMATCH is non-nil. */)
4347 { 4331 {
4348 case kNavUserActionNone: 4332 case kNavUserActionNone:
4349 case kNavUserActionCancel: 4333 case kNavUserActionCancel:
4350 NavDialogDispose(dialogRef); 4334 break; /* Treat cancel like C-g */
4351 Fsignal (Qquit, Qnil); /* Treat cancel like C-g */
4352 return;
4353 case kNavUserActionOpen: 4335 case kNavUserActionOpen:
4354 case kNavUserActionChoose: 4336 case kNavUserActionChoose:
4355 case kNavUserActionSaveAs: 4337 case kNavUserActionSaveAs:
@@ -4384,6 +4366,7 @@ specified. Ensure that file exists if MUSTMATCH is non-nil. */)
4384 dir, mustmatch, dir, Qfile_name_history, 4366 dir, mustmatch, dir, Qfile_name_history,
4385 default_filename, Qnil); 4367 default_filename, Qnil);
4386 } 4368 }
4369 UNBLOCK_INPUT;
4387 } 4370 }
4388 4371
4389 UNGCPRO; 4372 UNGCPRO;
diff --git a/src/macgui.h b/src/macgui.h
index 58081df52b4..e5ea665ac15 100644
--- a/src/macgui.h
+++ b/src/macgui.h
@@ -42,6 +42,8 @@ typedef unsigned long Time;
42#undef min 42#undef min
43#undef init_process 43#undef init_process
44#include <Carbon/Carbon.h> 44#include <Carbon/Carbon.h>
45#undef mktime
46#define mktime emacs_mktime
45#undef Z 47#undef Z
46#define Z (current_buffer->text->z) 48#define Z (current_buffer->text->z)
47#undef free 49#undef free
diff --git a/src/macmenu.c b/src/macmenu.c
index 740bda261d8..007fab15eab 100644
--- a/src/macmenu.c
+++ b/src/macmenu.c
@@ -1322,7 +1322,7 @@ update_submenu_strings (first_wv)
1322 1322
1323 for (wv = first_wv; wv; wv = wv->next) 1323 for (wv = first_wv; wv; wv = wv->next)
1324 { 1324 {
1325 if (wv->lname && ! NILP (wv->lname)) 1325 if (STRINGP (wv->lname))
1326 { 1326 {
1327 wv->name = SDATA (wv->lname); 1327 wv->name = SDATA (wv->lname);
1328 1328
@@ -1336,7 +1336,7 @@ update_submenu_strings (first_wv)
1336 } 1336 }
1337 } 1337 }
1338 1338
1339 if (wv->lkey && ! NILP (wv->lkey)) 1339 if (STRINGP (wv->lkey))
1340 wv->key = SDATA (wv->lkey); 1340 wv->key = SDATA (wv->lkey);
1341 1341
1342 if (wv->contents) 1342 if (wv->contents)
diff --git a/src/macterm.c b/src/macterm.c
index e1b8d49ddfa..2d09a2e93e9 100644
--- a/src/macterm.c
+++ b/src/macterm.c
@@ -50,6 +50,7 @@ Boston, MA 02111-1307, USA. */
50#include <TextUtils.h> 50#include <TextUtils.h>
51#include <LowMem.h> 51#include <LowMem.h>
52#include <Controls.h> 52#include <Controls.h>
53#include <Windows.h>
53#if defined (__MRC__) || (__MSL__ >= 0x6000) 54#if defined (__MRC__) || (__MSL__ >= 0x6000)
54#include <ControlDefinitions.h> 55#include <ControlDefinitions.h>
55#endif 56#endif
@@ -1292,9 +1293,8 @@ x_update_window_end (w, cursor_on_p, mouse_face_overwritten_p)
1292 output_cursor.vpos, 1293 output_cursor.vpos,
1293 output_cursor.x, output_cursor.y); 1294 output_cursor.x, output_cursor.y);
1294 1295
1295 x_draw_vertical_border (w); 1296 if (draw_window_fringes (w, 1))
1296 1297 x_draw_vertical_border (w);
1297 draw_window_fringes (w);
1298 1298
1299 UNBLOCK_INPUT; 1299 UNBLOCK_INPUT;
1300 } 1300 }
@@ -3893,18 +3893,21 @@ remember_mouse_glyph (f1, gx, gy)
3893 3893
3894 3894
3895static WindowPtr 3895static WindowPtr
3896mac_front_window () 3896front_emacs_window ()
3897{ 3897{
3898#if TARGET_API_MAC_CARBON 3898#if TARGET_API_MAC_CARBON
3899 return GetFrontWindowOfClass (kDocumentWindowClass, true); 3899 WindowPtr wp = GetFrontWindowOfClass (kDocumentWindowClass, true);
3900
3901 while (wp && !is_emacs_window (wp))
3902 wp = GetNextWindowOfClass (wp, kDocumentWindowClass, true);
3900#else 3903#else
3901 WindowPtr front_window = FrontWindow (); 3904 WindowPtr wp = FrontWindow ();
3902 3905
3903 if (tip_window && front_window == tip_window) 3906 while (wp && (wp == tip_window || !is_emacs_window (wp)))
3904 return GetNextWindow (front_window); 3907 wp = GetNextWindow (wp);
3905 else
3906 return front_window;
3907#endif 3908#endif
3909
3910 return wp;
3908} 3911}
3909 3912
3910#define mac_window_to_frame(wp) (((mac_output *) GetWRefCon (wp))->mFP) 3913#define mac_window_to_frame(wp) (((mac_output *) GetWRefCon (wp))->mFP)
@@ -3940,7 +3943,7 @@ XTmouse_position (fp, insist, bar_window, part, x, y, time)
3940{ 3943{
3941 Point mouse_pos; 3944 Point mouse_pos;
3942 int ignore1, ignore2; 3945 int ignore1, ignore2;
3943 WindowPtr wp = mac_front_window (); 3946 WindowPtr wp = front_emacs_window ();
3944 struct frame *f; 3947 struct frame *f;
3945 Lisp_Object frame, tail; 3948 Lisp_Object frame, tail;
3946 3949
@@ -4557,7 +4560,7 @@ x_scroll_bar_report_motion (fp, bar_window, part, x, y, time)
4557 unsigned long *time; 4560 unsigned long *time;
4558{ 4561{
4559 struct scroll_bar *bar = XSCROLL_BAR (last_mouse_scroll_bar); 4562 struct scroll_bar *bar = XSCROLL_BAR (last_mouse_scroll_bar);
4560 WindowPtr wp = mac_front_window (); 4563 WindowPtr wp = front_emacs_window ();
4561 Point mouse_pos; 4564 Point mouse_pos;
4562 struct frame *f = mac_window_to_frame (wp); 4565 struct frame *f = mac_window_to_frame (wp);
4563 int win_y, top_range; 4566 int win_y, top_range;
@@ -5053,6 +5056,26 @@ xim_close_dpy (dpyinfo)
5053 */ 5056 */
5054 5057
5055 5058
5059void
5060mac_get_window_bounds (f, inner, outer)
5061 struct frame *f;
5062 Rect *inner, *outer;
5063{
5064#if TARGET_API_MAC_CARBON
5065 GetWindowBounds (FRAME_MAC_WINDOW (f), kWindowContentRgn, inner);
5066 GetWindowBounds (FRAME_MAC_WINDOW (f), kWindowStructureRgn, outer);
5067#else /* not TARGET_API_MAC_CARBON */
5068 RgnHandle region = NewRgn ();
5069
5070 GetWindowRegion (FRAME_MAC_WINDOW (f), kWindowContentRgn, region);
5071 *inner = (*region)->rgnBBox;
5072 GetWindowRegion (FRAME_MAC_WINDOW (f), kWindowStructureRgn, region);
5073 *outer = (*region)->rgnBBox;
5074 DisposeRgn (region);
5075#endif /* not TARGET_API_MAC_CARBON */
5076}
5077
5078
5056/* Calculate the absolute position in frame F 5079/* Calculate the absolute position in frame F
5057 from its current recorded position values and gravity. */ 5080 from its current recorded position values and gravity. */
5058 5081
@@ -5060,47 +5083,36 @@ void
5060x_calc_absolute_position (f) 5083x_calc_absolute_position (f)
5061 struct frame *f; 5084 struct frame *f;
5062{ 5085{
5063 Point pt; 5086 int width_diff = 0, height_diff = 0;
5064 int flags = f->size_hint_flags; 5087 int flags = f->size_hint_flags;
5088 Rect inner, outer;
5065 5089
5066 pt.h = pt.v = 0; 5090 /* We have nothing to do if the current position
5091 is already for the top-left corner. */
5092 if (! ((flags & XNegative) || (flags & YNegative)))
5093 return;
5067 5094
5068 /* Find the position of the outside upper-left corner of 5095 /* Find the offsets of the outside upper-left corner of
5069 the inner window, with respect to the outer window. */ 5096 the inner window, with respect to the outer window. */
5070 if (f->output_data.mac->parent_desc != FRAME_MAC_DISPLAY_INFO (f)->root_window) 5097 mac_get_window_bounds (f, &inner, &outer);
5071 {
5072 GrafPtr savePort;
5073 GetPort (&savePort);
5074 5098
5075 SetPortWindowPort (FRAME_MAC_WINDOW (f)); 5099 width_diff = (outer.right - outer.left) - (inner.right - inner.left);
5076 5100 height_diff = (outer.bottom - outer.top) - (inner.bottom - inner.top);
5077#if TARGET_API_MAC_CARBON
5078 {
5079 Rect r;
5080
5081 GetWindowPortBounds (FRAME_MAC_WINDOW (f), &r);
5082 SetPt(&pt, r.left, r.top);
5083 }
5084#else /* not TARGET_API_MAC_CARBON */
5085 SetPt(&pt, FRAME_MAC_WINDOW (f)->portRect.left, FRAME_MAC_WINDOW (f)->portRect.top);
5086#endif /* not TARGET_API_MAC_CARBON */
5087 LocalToGlobal (&pt);
5088 SetPort (savePort);
5089 }
5090 5101
5091 /* Treat negative positions as relative to the leftmost bottommost 5102 /* Treat negative positions as relative to the leftmost bottommost
5092 position that fits on the screen. */ 5103 position that fits on the screen. */
5093 if (flags & XNegative) 5104 if (flags & XNegative)
5094 f->left_pos = (FRAME_MAC_DISPLAY_INFO (f)->width 5105 f->left_pos = (FRAME_MAC_DISPLAY_INFO (f)->width
5095 - 2 * f->border_width - pt.h 5106 - width_diff
5096 - FRAME_PIXEL_WIDTH (f) 5107 - FRAME_PIXEL_WIDTH (f)
5097 + f->left_pos); 5108 + f->left_pos);
5098 /* NTEMACS_TODO: Subtract menubar height? */ 5109
5099 if (flags & YNegative) 5110 if (flags & YNegative)
5100 f->top_pos = (FRAME_MAC_DISPLAY_INFO (f)->height 5111 f->top_pos = (FRAME_MAC_DISPLAY_INFO (f)->height
5101 - 2 * f->border_width - pt.v 5112 - height_diff
5102 - FRAME_PIXEL_HEIGHT (f) 5113 - FRAME_PIXEL_HEIGHT (f)
5103 + f->top_pos); 5114 + f->top_pos);
5115
5104 /* The left_pos and top_pos 5116 /* The left_pos and top_pos
5105 are now relative to the top and left screen edges, 5117 are now relative to the top and left screen edges,
5106 so the flags should correspond. */ 5118 so the flags should correspond. */
@@ -5119,8 +5131,6 @@ x_set_offset (f, xoff, yoff, change_gravity)
5119 register int xoff, yoff; 5131 register int xoff, yoff;
5120 int change_gravity; 5132 int change_gravity;
5121{ 5133{
5122 int modified_top, modified_left;
5123
5124 if (change_gravity > 0) 5134 if (change_gravity > 0)
5125 { 5135 {
5126 f->top_pos = yoff; 5136 f->top_pos = yoff;
@@ -5137,11 +5147,55 @@ x_set_offset (f, xoff, yoff, change_gravity)
5137 BLOCK_INPUT; 5147 BLOCK_INPUT;
5138 x_wm_set_size_hint (f, (long) 0, 0); 5148 x_wm_set_size_hint (f, (long) 0, 0);
5139 5149
5140 modified_left = f->left_pos; 5150#if TARGET_API_MAC_CARBON
5141 modified_top = f->top_pos; 5151 MoveWindowStructure (FRAME_MAC_WINDOW (f), f->left_pos, f->top_pos);
5142 5152 /* If the title bar is completely outside the screen, adjust the
5143 MoveWindow (FRAME_MAC_WINDOW (f), modified_left + 6, 5153 position. */
5144 modified_top + 42, false); 5154 ConstrainWindowToScreen (FRAME_MAC_WINDOW (f), kWindowTitleBarRgn,
5155 kWindowConstrainMoveRegardlessOfFit
5156 | kWindowConstrainAllowPartial, NULL, NULL);
5157 x_real_positions (f, &f->left_pos, &f->top_pos);
5158#else
5159 {
5160 Rect inner, outer, screen_rect, dummy;
5161 RgnHandle region = NewRgn ();
5162
5163 mac_get_window_bounds (f, &inner, &outer);
5164 f->x_pixels_diff = inner.left - outer.left;
5165 f->y_pixels_diff = inner.top - outer.top;
5166 MoveWindow (FRAME_MAC_WINDOW (f), f->left_pos + f->x_pixels_diff,
5167 f->top_pos + f->y_pixels_diff, false);
5168
5169 /* If the title bar is completely outside the screen, adjust the
5170 position. The variable `outer' holds the title bar rectangle.
5171 The variable `inner' holds slightly smaller one than `outer',
5172 so that the calculation of overlapping may not become too
5173 strict. */
5174 GetWindowRegion (FRAME_MAC_WINDOW (f), kWindowTitleBarRgn, region);
5175 outer = (*region)->rgnBBox;
5176 DisposeRgn (region);
5177 inner = outer;
5178 InsetRect (&inner, 8, 8);
5179 screen_rect = qd.screenBits.bounds;
5180 screen_rect.top += GetMBarHeight ();
5181
5182 if (!SectRect (&inner, &screen_rect, &dummy))
5183 {
5184 if (inner.right <= screen_rect.left)
5185 f->left_pos = screen_rect.left;
5186 else if (inner.left >= screen_rect.right)
5187 f->left_pos = screen_rect.right - (outer.right - outer.left);
5188
5189 if (inner.bottom <= screen_rect.top)
5190 f->top_pos = screen_rect.top;
5191 else if (inner.top >= screen_rect.bottom)
5192 f->top_pos = screen_rect.bottom - (outer.bottom - outer.top);
5193
5194 MoveWindow (FRAME_MAC_WINDOW (f), f->left_pos + f->x_pixels_diff,
5195 f->top_pos + f->y_pixels_diff, false);
5196 }
5197 }
5198#endif
5145 5199
5146 UNBLOCK_INPUT; 5200 UNBLOCK_INPUT;
5147} 5201}
@@ -5280,7 +5334,11 @@ x_raise_frame (f)
5280 struct frame *f; 5334 struct frame *f;
5281{ 5335{
5282 if (f->async_visible) 5336 if (f->async_visible)
5283 SelectWindow (FRAME_MAC_WINDOW (f)); 5337 {
5338 BLOCK_INPUT;
5339 SelectWindow (FRAME_MAC_WINDOW (f));
5340 UNBLOCK_INPUT;
5341 }
5284} 5342}
5285 5343
5286/* Lower frame F. */ 5344/* Lower frame F. */
@@ -5289,7 +5347,11 @@ x_lower_frame (f)
5289 struct frame *f; 5347 struct frame *f;
5290{ 5348{
5291 if (f->async_visible) 5349 if (f->async_visible)
5292 SendBehind (FRAME_MAC_WINDOW (f), nil); 5350 {
5351 BLOCK_INPUT;
5352 SendBehind (FRAME_MAC_WINDOW (f), nil);
5353 UNBLOCK_INPUT;
5354 }
5293} 5355}
5294 5356
5295static void 5357static void
@@ -6926,6 +6988,7 @@ x_find_ccl_program (fontp)
6926/* true when cannot handle any Mac OS events */ 6988/* true when cannot handle any Mac OS events */
6927static int handling_window_update = 0; 6989static int handling_window_update = 0;
6928 6990
6991#if 0
6929/* the flag appl_is_suspended is used both for determining the sleep 6992/* the flag appl_is_suspended is used both for determining the sleep
6930 time to be passed to WaitNextEvent and whether the cursor should be 6993 time to be passed to WaitNextEvent and whether the cursor should be
6931 drawn when updating the display. The cursor is turned off when 6994 drawn when updating the display. The cursor is turned off when
@@ -6935,6 +6998,7 @@ static int handling_window_update = 0;
6935 suspended. */ 6998 suspended. */
6936static Boolean app_is_suspended = false; 6999static Boolean app_is_suspended = false;
6937static long app_sleep_time = WNE_SLEEP_AT_RESUME; 7000static long app_sleep_time = WNE_SLEEP_AT_RESUME;
7001#endif
6938 7002
6939#define EXTRA_STACK_ALLOC (256 * 1024) 7003#define EXTRA_STACK_ALLOC (256 * 1024)
6940 7004
@@ -7261,11 +7325,13 @@ is_emacs_window (WindowPtr win)
7261static void 7325static void
7262do_app_resume () 7326do_app_resume ()
7263{ 7327{
7328 /* Window-activate events will do the job. */
7329#if 0
7264 WindowPtr wp; 7330 WindowPtr wp;
7265 struct frame *f; 7331 struct frame *f;
7266 7332
7267 wp = mac_front_window (); 7333 wp = front_emacs_window ();
7268 if (is_emacs_window (wp)) 7334 if (wp)
7269 { 7335 {
7270 f = mac_window_to_frame (wp); 7336 f = mac_window_to_frame (wp);
7271 7337
@@ -7278,16 +7344,19 @@ do_app_resume ()
7278 7344
7279 app_is_suspended = false; 7345 app_is_suspended = false;
7280 app_sleep_time = WNE_SLEEP_AT_RESUME; 7346 app_sleep_time = WNE_SLEEP_AT_RESUME;
7347#endif
7281} 7348}
7282 7349
7283static void 7350static void
7284do_app_suspend () 7351do_app_suspend ()
7285{ 7352{
7353 /* Window-deactivate events will do the job. */
7354#if 0
7286 WindowPtr wp; 7355 WindowPtr wp;
7287 struct frame *f; 7356 struct frame *f;
7288 7357
7289 wp = mac_front_window (); 7358 wp = front_emacs_window ();
7290 if (is_emacs_window (wp)) 7359 if (wp)
7291 { 7360 {
7292 f = mac_window_to_frame (wp); 7361 f = mac_window_to_frame (wp);
7293 7362
@@ -7300,6 +7369,7 @@ do_app_suspend ()
7300 7369
7301 app_is_suspended = true; 7370 app_is_suspended = true;
7302 app_sleep_time = WNE_SLEEP_AT_SUSPEND; 7371 app_sleep_time = WNE_SLEEP_AT_SUSPEND;
7372#endif
7303} 7373}
7304 7374
7305 7375
@@ -7308,10 +7378,10 @@ do_mouse_moved (mouse_pos, f)
7308 Point mouse_pos; 7378 Point mouse_pos;
7309 FRAME_PTR *f; 7379 FRAME_PTR *f;
7310{ 7380{
7311 WindowPtr wp = mac_front_window (); 7381 WindowPtr wp = front_emacs_window ();
7312 struct x_display_info *dpyinfo; 7382 struct x_display_info *dpyinfo;
7313 7383
7314 if (is_emacs_window (wp)) 7384 if (wp)
7315 { 7385 {
7316 *f = mac_window_to_frame (wp); 7386 *f = mac_window_to_frame (wp);
7317 dpyinfo = FRAME_MAC_DISPLAY_INFO (*f); 7387 dpyinfo = FRAME_MAC_DISPLAY_INFO (*f);
@@ -7373,7 +7443,7 @@ do_menu_choice (SInt32 menu_choice)
7373 7443
7374 default: 7444 default:
7375 { 7445 {
7376 struct frame *f = mac_window_to_frame (mac_front_window ()); 7446 struct frame *f = mac_window_to_frame (front_emacs_window ());
7377 MenuHandle menu = GetMenuHandle (menu_id); 7447 MenuHandle menu = GetMenuHandle (menu_id);
7378 if (menu) 7448 if (menu)
7379 { 7449 {
@@ -7426,41 +7496,43 @@ do_zoom_window (WindowPtr w, int zoom_in_or_out)
7426 GrafPtr save_port; 7496 GrafPtr save_port;
7427 Rect zoom_rect, port_rect; 7497 Rect zoom_rect, port_rect;
7428 Point top_left; 7498 Point top_left;
7429 int w_title_height, columns, rows, width, height, dummy, x, y; 7499 int w_title_height, columns, rows;
7430 struct frame *f = mac_window_to_frame (w); 7500 struct frame *f = mac_window_to_frame (w);
7431 7501
7432 GetPort (&save_port);
7433
7434 SetPortWindowPort (w);
7435
7436 /* Clear window to avoid flicker. */
7437#if TARGET_API_MAC_CARBON 7502#if TARGET_API_MAC_CARBON
7438 { 7503 {
7439 Rect r; 7504 Point standard_size;
7440 BitMap bm;
7441 7505
7442 GetWindowPortBounds (w, &r); 7506 standard_size.h = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, DEFAULT_NUM_COLS);
7443 EraseRect (&r); 7507 standard_size.v = FRAME_MAC_DISPLAY_INFO (f)->height;
7444 7508
7445 if (zoom_in_or_out == inZoomOut) 7509 if (IsWindowInStandardState (w, &standard_size, &zoom_rect))
7510 zoom_in_or_out = inZoomIn;
7511 else
7446 { 7512 {
7447 /* calculate height of window's title bar (hard card it for now). */ 7513 /* Adjust the standard size according to character boundaries. */
7448 w_title_height = 20 + GetMBarHeight (); 7514
7449 7515 columns = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, zoom_rect.right - zoom_rect.left);
7450 /* get maximum height of window into zoom_rect.bottom - 7516 rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, zoom_rect.bottom - zoom_rect.top);
7451 zoom_rect.top */ 7517 standard_size.h = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, columns);
7452 GetQDGlobalsScreenBits (&bm); 7518 standard_size.v = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, rows);
7453 zoom_rect = bm.bounds; 7519 GetWindowBounds (w, kWindowContentRgn, &port_rect);
7454 zoom_rect.top += w_title_height; 7520 if (IsWindowInStandardState (w, &standard_size, &zoom_rect)
7455 InsetRect (&zoom_rect, 8, 4); /* not too tight */ 7521 && port_rect.left == zoom_rect.left
7456 7522 && port_rect.top == zoom_rect.top)
7457 zoom_rect.right = zoom_rect.left 7523 zoom_in_or_out = inZoomIn;
7458 + FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, DEFAULT_NUM_COLS); 7524 else
7459 7525 zoom_in_or_out = inZoomOut;
7460 SetWindowStandardState (w, &zoom_rect);
7461 } 7526 }
7527
7528 ZoomWindowIdeal (w, zoom_in_or_out, &standard_size);
7462 } 7529 }
7463#else /* not TARGET_API_MAC_CARBON */ 7530#else /* not TARGET_API_MAC_CARBON */
7531 GetPort (&save_port);
7532
7533 SetPortWindowPort (w);
7534
7535 /* Clear window to avoid flicker. */
7464 EraseRect (&(w->portRect)); 7536 EraseRect (&(w->portRect));
7465 if (zoom_in_or_out == inZoomOut) 7537 if (zoom_in_or_out == inZoomOut)
7466 { 7538 {
@@ -7479,12 +7551,19 @@ do_zoom_window (WindowPtr w, int zoom_in_or_out)
7479 zoom_rect.right = zoom_rect.left 7551 zoom_rect.right = zoom_rect.left
7480 + FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, DEFAULT_NUM_COLS); 7552 + FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, DEFAULT_NUM_COLS);
7481 7553
7554 /* Adjust the standard size according to character boundaries. */
7555 rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, zoom_rect.bottom - zoom_rect.top);
7556 zoom_rect.bottom =
7557 zoom_rect.top + FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, rows);
7558
7482 (**((WStateDataHandle) ((WindowPeek) w)->dataHandle)).stdState 7559 (**((WStateDataHandle) ((WindowPeek) w)->dataHandle)).stdState
7483 = zoom_rect; 7560 = zoom_rect;
7484 } 7561 }
7485#endif /* not TARGET_API_MAC_CARBON */
7486 7562
7487 ZoomWindow (w, zoom_in_or_out, w == mac_front_window ()); 7563 ZoomWindow (w, zoom_in_or_out, w == front_emacs_window ());
7564
7565 SetPort (save_port);
7566#endif /* not TARGET_API_MAC_CARBON */
7488 7567
7489 /* retrieve window size and update application values */ 7568 /* retrieve window size and update application values */
7490#if TARGET_API_MAC_CARBON 7569#if TARGET_API_MAC_CARBON
@@ -7495,8 +7574,7 @@ do_zoom_window (WindowPtr w, int zoom_in_or_out)
7495 rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, port_rect.bottom - port_rect.top); 7574 rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, port_rect.bottom - port_rect.top);
7496 columns = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, port_rect.right - port_rect.left); 7575 columns = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, port_rect.right - port_rect.left);
7497 x_set_window_size (f, 0, columns, rows); 7576 x_set_window_size (f, 0, columns, rows);
7498 7577 x_real_positions (f, &f->left_pos, &f->top_pos);
7499 SetPort (save_port);
7500} 7578}
7501 7579
7502/* Initialize Drag And Drop to allow files to be dropped onto emacs frames */ 7580/* Initialize Drag And Drop to allow files to be dropped onto emacs frames */
@@ -8046,19 +8124,15 @@ XTread_socket (sd, expected, hold_quit)
8046 if (NILP (Fboundp (Qmac_ready_for_drag_n_drop))) 8124 if (NILP (Fboundp (Qmac_ready_for_drag_n_drop)))
8047 event_mask -= highLevelEventMask; 8125 event_mask -= highLevelEventMask;
8048 8126
8049 while (WaitNextEvent (event_mask, &er, 8127 while (WaitNextEvent (event_mask, &er, 0L, NULL))
8050 (expected ? app_sleep_time : 0L), NULL)) 8128#else /* USE_CARBON_EVENTS */
8051#else 8129 while (!ReceiveNextEvent (0, NULL, kEventDurationNoWait,
8052 while (!ReceiveNextEvent (0, NULL,
8053 (expected ? TicksToEventTime (app_sleep_time) : 0),
8054 kEventRemoveFromQueue, &eventRef)) 8130 kEventRemoveFromQueue, &eventRef))
8055#endif /* !USE_CARBON_EVENTS */ 8131#endif /* USE_CARBON_EVENTS */
8056 { 8132 {
8057 int do_help = 0; 8133 int do_help = 0;
8058 struct frame *f; 8134 struct frame *f;
8059 8135
8060 expected = 0;
8061
8062 /* It is necessary to set this (additional) argument slot of an 8136 /* It is necessary to set this (additional) argument slot of an
8063 event to nil because keyboard.c protects incompletely 8137 event to nil because keyboard.c protects incompletely
8064 processed event from being garbage collected by placing them 8138 processed event from being garbage collected by placing them
@@ -8073,7 +8147,7 @@ XTread_socket (sd, expected, hold_quit)
8073 switch (GetEventClass (eventRef)) 8147 switch (GetEventClass (eventRef))
8074 { 8148 {
8075 case kEventClassWindow: 8149 case kEventClassWindow:
8076 if (GetEventKind (eventRef) == kEventWindowBoundsChanged) 8150 if (GetEventKind (eventRef) == kEventWindowBoundsChanged)
8077 { 8151 {
8078 WindowPtr window_ptr; 8152 WindowPtr window_ptr;
8079 GetEventParameter(eventRef, kEventParamDirectObject, 8153 GetEventParameter(eventRef, kEventParamDirectObject,
@@ -8081,13 +8155,7 @@ XTread_socket (sd, expected, hold_quit)
8081 NULL, &window_ptr); 8155 NULL, &window_ptr);
8082 f = mac_window_to_frame (window_ptr); 8156 f = mac_window_to_frame (window_ptr);
8083 if (f && !f->async_iconified) 8157 if (f && !f->async_iconified)
8084 { 8158 x_real_positions (f, &f->left_pos, &f->top_pos);
8085 int x, y;
8086
8087 x_real_positions (f, &x, &y);
8088 f->left_pos = x;
8089 f->top_pos = y;
8090 }
8091 SendEventToEventTarget (eventRef, toolbox_dispatcher); 8159 SendEventToEventTarget (eventRef, toolbox_dispatcher);
8092 } 8160 }
8093 break; 8161 break;
@@ -8096,7 +8164,7 @@ XTread_socket (sd, expected, hold_quit)
8096 { 8164 {
8097 SInt32 delta; 8165 SInt32 delta;
8098 Point point; 8166 Point point;
8099 WindowPtr window_ptr = mac_front_window (); 8167 WindowPtr window_ptr = front_emacs_window ();
8100 8168
8101 if (!IsValidWindowPtr (window_ptr)) 8169 if (!IsValidWindowPtr (window_ptr))
8102 { 8170 {
@@ -8158,33 +8226,28 @@ XTread_socket (sd, expected, hold_quit)
8158 } 8226 }
8159 else 8227 else
8160 { 8228 {
8161 window_ptr = FrontWindow (); 8229 part_code = FindWindow (er.where, &window_ptr);
8162 if (tip_window && window_ptr == tip_window) 8230 if (tip_window && window_ptr == tip_window)
8163 { 8231 {
8164 HideWindow (tip_window); 8232 HideWindow (tip_window);
8165 window_ptr = FrontWindow (); 8233 part_code = FindWindow (er.where, &window_ptr);
8166 } 8234 }
8167
8168 if (!is_emacs_window (window_ptr))
8169 break;
8170
8171 part_code = FindWindow (er.where, &window_ptr);
8172 } 8235 }
8173 8236
8237 if (er.what != mouseDown && part_code != inContent)
8238 break;
8239
8174 switch (part_code) 8240 switch (part_code)
8175 { 8241 {
8176 case inMenuBar: 8242 case inMenuBar:
8177 if (er.what == mouseDown) 8243 f = mac_window_to_frame (front_emacs_window ());
8178 { 8244 saved_menu_event_location = er.where;
8179 f = mac_window_to_frame (mac_front_window ()); 8245 inev.kind = MENU_BAR_ACTIVATE_EVENT;
8180 saved_menu_event_location = er.where; 8246 XSETFRAME (inev.frame_or_window, f);
8181 inev.kind = MENU_BAR_ACTIVATE_EVENT;
8182 XSETFRAME (inev.frame_or_window, f);
8183 }
8184 break; 8247 break;
8185 8248
8186 case inContent: 8249 case inContent:
8187 if (window_ptr != mac_front_window ()) 8250 if (window_ptr != front_emacs_window ())
8188 SelectWindow (window_ptr); 8251 SelectWindow (window_ptr);
8189 else 8252 else
8190 { 8253 {
@@ -8281,7 +8344,7 @@ XTread_socket (sd, expected, hold_quit)
8281 } 8344 }
8282 else 8345 else
8283 { 8346 {
8284 if (dpyinfo->grabbed & (1 << inev.code) == 0) 8347 if ((dpyinfo->grabbed & (1 << inev.code)) == 0)
8285 /* If a button is released though it was not 8348 /* If a button is released though it was not
8286 previously pressed, that would be because 8349 previously pressed, that would be because
8287 of multi-button emulation. */ 8350 of multi-button emulation. */
@@ -8304,27 +8367,16 @@ XTread_socket (sd, expected, hold_quit)
8304 8367
8305 case inDrag: 8368 case inDrag:
8306#if TARGET_API_MAC_CARBON 8369#if TARGET_API_MAC_CARBON
8307 if (er.what == mouseDown) 8370 DragWindow (window_ptr, er.where, NULL);
8308 {
8309 BitMap bm;
8310
8311 GetQDGlobalsScreenBits (&bm);
8312 DragWindow (window_ptr, er.where, &bm.bounds);
8313 }
8314#else /* not TARGET_API_MAC_CARBON */ 8371#else /* not TARGET_API_MAC_CARBON */
8315 DragWindow (window_ptr, er.where, &qd.screenBits.bounds); 8372 DragWindow (window_ptr, er.where, &qd.screenBits.bounds);
8316#endif /* not TARGET_API_MAC_CARBON */ 8373#endif /* not TARGET_API_MAC_CARBON */
8317 /* Update the frame parameters. */ 8374 /* Update the frame parameters. */
8318 { 8375 {
8319 struct frame *f = mac_window_to_frame (window_ptr); 8376 struct frame *f = mac_window_to_frame (window_ptr);
8377
8320 if (f && !f->async_iconified) 8378 if (f && !f->async_iconified)
8321 { 8379 x_real_positions (f, &f->left_pos, &f->top_pos);
8322 int x, y;
8323
8324 x_real_positions (f, &x, &y);
8325 f->left_pos = x;
8326 f->top_pos = y;
8327 }
8328 } 8380 }
8329 break; 8381 break;
8330 8382
@@ -8339,11 +8391,8 @@ XTread_socket (sd, expected, hold_quit)
8339 8391
8340 /* window resize handling added --ben */ 8392 /* window resize handling added --ben */
8341 case inGrow: 8393 case inGrow:
8342 if (er.what == mouseDown) 8394 do_grow_window (window_ptr, &er);
8343 { 8395 break;
8344 do_grow_window(window_ptr, &er);
8345 break;
8346 }
8347 8396
8348 /* window zoom handling added --ben */ 8397 /* window zoom handling added --ben */
8349 case inZoomIn: 8398 case inZoomIn:
@@ -8415,7 +8464,7 @@ XTread_socket (sd, expected, hold_quit)
8415 8464
8416 if (!is_emacs_window (window_ptr)) 8465 if (!is_emacs_window (window_ptr))
8417 break; 8466 break;
8418 8467
8419 f = mac_window_to_frame (window_ptr); 8468 f = mac_window_to_frame (window_ptr);
8420 8469
8421 if ((er.modifiers & activeFlag) != 0) 8470 if ((er.modifiers & activeFlag) != 0)
@@ -8486,7 +8535,7 @@ XTread_socket (sd, expected, hold_quit)
8486#endif 8535#endif
8487 8536
8488#if TARGET_API_MAC_CARBON 8537#if TARGET_API_MAC_CARBON
8489 if (!IsValidWindowPtr (mac_front_window ())) 8538 if (!IsValidWindowPtr (front_emacs_window ()))
8490 { 8539 {
8491 SysBeep (1); 8540 SysBeep (1);
8492 break; 8541 break;
@@ -8590,7 +8639,7 @@ XTread_socket (sd, expected, hold_quit)
8590 inev.modifiers = mac_to_emacs_modifiers (er.modifiers); 8639 inev.modifiers = mac_to_emacs_modifiers (er.modifiers);
8591#endif 8640#endif
8592 XSETFRAME (inev.frame_or_window, 8641 XSETFRAME (inev.frame_or_window,
8593 mac_window_to_frame (mac_front_window ())); 8642 mac_window_to_frame (front_emacs_window ()));
8594 inev.timestamp = er.when * (1000 / 60); /* ticks to milliseconds */ 8643 inev.timestamp = er.when * (1000 / 60); /* ticks to milliseconds */
8595 break; 8644 break;
8596 8645
@@ -8607,16 +8656,16 @@ XTread_socket (sd, expected, hold_quit)
8607 WindowPtr wp; 8656 WindowPtr wp;
8608 Lisp_Object frame; 8657 Lisp_Object frame;
8609 8658
8610 wp = mac_front_window (); 8659 wp = front_emacs_window ();
8611 8660
8612 if (!wp) 8661 if (!wp)
8613 { 8662 {
8614 struct frame *f = XFRAME (XCAR (Vframe_list)); 8663 struct frame *f = XFRAME (XCAR (Vframe_list));
8615 CollapseWindow (FRAME_MAC_WINDOW (f), false); 8664 CollapseWindow (FRAME_MAC_WINDOW (f), false);
8616 wp = mac_front_window (); 8665 wp = front_emacs_window ();
8617 } 8666 }
8618 8667
8619 if (wp && is_emacs_window (wp)) 8668 if (wp)
8620 f = mac_window_to_frame (wp); 8669 f = mac_window_to_frame (wp);
8621 8670
8622 inev.kind = DRAG_N_DROP_EVENT; 8671 inev.kind = DRAG_N_DROP_EVENT;
@@ -8742,6 +8791,7 @@ make_mac_frame (FRAME_PTR fp)
8742 8791
8743 mwp = fp->output_data.mac; 8792 mwp = fp->output_data.mac;
8744 8793
8794 BLOCK_INPUT;
8745 if (making_terminal_window) 8795 if (making_terminal_window)
8746 { 8796 {
8747 if (!(mwp->mWP = GetNewCWindow (TERM_WINDOW_RESOURCE, NULL, 8797 if (!(mwp->mWP = GetNewCWindow (TERM_WINDOW_RESOURCE, NULL,
@@ -8769,9 +8819,8 @@ make_mac_frame (FRAME_PTR fp)
8769 /* so that update events can find this mac_output struct */ 8819 /* so that update events can find this mac_output struct */
8770 mwp->mFP = fp; /* point back to emacs frame */ 8820 mwp->mFP = fp; /* point back to emacs frame */
8771 8821
8772 SetPortWindowPort (mwp->mWP);
8773
8774 SizeWindow (mwp->mWP, FRAME_PIXEL_WIDTH (fp), FRAME_PIXEL_HEIGHT (fp), false); 8822 SizeWindow (mwp->mWP, FRAME_PIXEL_WIDTH (fp), FRAME_PIXEL_HEIGHT (fp), false);
8823 UNBLOCK_INPUT;
8775} 8824}
8776 8825
8777 8826
@@ -9073,7 +9122,7 @@ mac_check_for_quit_char ()
9073 e.arg = Qnil; 9122 e.arg = Qnil;
9074 e.modifiers = NULL; 9123 e.modifiers = NULL;
9075 e.timestamp = EventTimeToTicks (GetEventTime (event)) * (1000/60); 9124 e.timestamp = EventTimeToTicks (GetEventTime (event)) * (1000/60);
9076 XSETFRAME (e.frame_or_window, mac_window_to_frame (mac_front_window ())); 9125 XSETFRAME (e.frame_or_window, mac_window_to_frame (front_emacs_window ()));
9077 /* Remove event from queue to prevent looping. */ 9126 /* Remove event from queue to prevent looping. */
9078 RemoveEventFromQueue (GetMainEventQueue (), event); 9127 RemoveEventFromQueue (GetMainEventQueue (), event);
9079 ReleaseEvent (event); 9128 ReleaseEvent (event);
@@ -9194,6 +9243,7 @@ mac_initialize ()
9194 signal (SIGPIPE, x_connection_signal); 9243 signal (SIGPIPE, x_connection_signal);
9195#endif 9244#endif
9196 9245
9246 BLOCK_INPUT;
9197 mac_initialize_display_info (); 9247 mac_initialize_display_info ();
9198 9248
9199#if TARGET_API_MAC_CARBON 9249#if TARGET_API_MAC_CARBON
@@ -9212,6 +9262,7 @@ mac_initialize ()
9212 if (!inhibit_window_system) 9262 if (!inhibit_window_system)
9213 MakeMeTheFrontProcess (); 9263 MakeMeTheFrontProcess ();
9214#endif 9264#endif
9265 UNBLOCK_INPUT;
9215} 9266}
9216 9267
9217 9268
diff --git a/src/textprop.c b/src/textprop.c
index c8ec008dcbd..317f8fa6aa3 100644
--- a/src/textprop.c
+++ b/src/textprop.c
@@ -1,5 +1,5 @@
1/* Interface code for dealing with text properties. 1/* Interface code for dealing with text properties.
2 Copyright (C) 1993, 1994, 1995, 1997, 1999, 2000, 2001, 2002, 2003 2 Copyright (C) 1993, 1994, 1995, 1997, 1999, 2000, 2001, 2002, 2003, 2004
3 Free Software Foundation, Inc. 3 Free Software Foundation, Inc.
4 4
5This file is part of GNU Emacs. 5This file is part of GNU Emacs.
@@ -2233,7 +2233,9 @@ If a character in a buffer has PROPERTY, new text inserted adjacent to
2233the character doesn't inherit PROPERTY if NONSTICKINESS is non-nil, 2233the character doesn't inherit PROPERTY if NONSTICKINESS is non-nil,
2234inherits it if NONSTICKINESS is nil. The front-sticky and 2234inherits it if NONSTICKINESS is nil. The front-sticky and
2235rear-nonsticky properties of the character overrides NONSTICKINESS. */); 2235rear-nonsticky properties of the character overrides NONSTICKINESS. */);
2236 Vtext_property_default_nonsticky = Qnil; 2236 /* Text property `syntax-table' should be nonsticky by default. */
2237 Vtext_property_default_nonsticky
2238 = Fcons (Fcons (intern ("syntax-table"), Qt), Qnil);
2237 2239
2238 staticpro (&interval_insert_behind_hooks); 2240 staticpro (&interval_insert_behind_hooks);
2239 staticpro (&interval_insert_in_front_hooks); 2241 staticpro (&interval_insert_in_front_hooks);
diff --git a/src/unexmacosx.c b/src/unexmacosx.c
index b41c586d2e0..1f2b4c96620 100644
--- a/src/unexmacosx.c
+++ b/src/unexmacosx.c
@@ -99,7 +99,12 @@ Boston, MA 02111-1307, USA. */
99#if defined (__ppc__) 99#if defined (__ppc__)
100#include <mach-o/ppc/reloc.h> 100#include <mach-o/ppc/reloc.h>
101#endif 101#endif
102#if defined (HAVE_MALLOC_MALLOC_H)
103#include <malloc/malloc.h>
104#else
102#include <objc/malloc.h> 105#include <objc/malloc.h>
106#endif
107
103 108
104#define VERBOSE 1 109#define VERBOSE 1
105 110
diff --git a/src/w32term.c b/src/w32term.c
index 1d6b4ec7535..574457f727f 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -567,9 +567,8 @@ x_update_window_end (w, cursor_on_p, mouse_face_overwritten_p)
567 output_cursor.vpos, 567 output_cursor.vpos,
568 output_cursor.x, output_cursor.y); 568 output_cursor.x, output_cursor.y);
569 569
570 x_draw_vertical_border (w); 570 if (draw_window_fringes (w, 1))
571 571 x_draw_vertical_border (w);
572 draw_window_fringes (w);
573 572
574 UNBLOCK_INPUT; 573 UNBLOCK_INPUT;
575 } 574 }
diff --git a/src/window.c b/src/window.c
index e7246b7c657..55d7d7d2799 100644
--- a/src/window.c
+++ b/src/window.c
@@ -607,9 +607,6 @@ coordinates_in_window (w, x, y)
607 int grabbable_width = ux; 607 int grabbable_width = ux;
608 int lmargin_width, rmargin_width, text_left, text_right; 608 int lmargin_width, rmargin_width, text_left, text_right;
609 609
610 if (*x < x0 || *x >= x1)
611 return ON_NOTHING;
612
613 /* In what's below, we subtract 1 when computing right_x because we 610 /* In what's below, we subtract 1 when computing right_x because we
614 want the rightmost pixel, which is given by left_pixel+width-1. */ 611 want the rightmost pixel, which is given by left_pixel+width-1. */
615 if (w->pseudo_window_p) 612 if (w->pseudo_window_p)
@@ -659,6 +656,9 @@ coordinates_in_window (w, x, y)
659 return ON_VERTICAL_BORDER; 656 return ON_VERTICAL_BORDER;
660 } 657 }
661 658
659 if (*x < x0 || *x >= x1)
660 return ON_NOTHING;
661
662 /* Convert X and Y to window relative coordinates. 662 /* Convert X and Y to window relative coordinates.
663 Mode line starts at left edge of window. */ 663 Mode line starts at left edge of window. */
664 *x -= x0; 664 *x -= x0;
@@ -673,6 +673,9 @@ coordinates_in_window (w, x, y)
673 goto header_vertical_border_check; 673 goto header_vertical_border_check;
674 } 674 }
675 675
676 if (*x < x0 || *x >= x1)
677 return ON_NOTHING;
678
676 /* Outside any interesting column? */ 679 /* Outside any interesting column? */
677 if (*x < left_x || *x > right_x) 680 if (*x < left_x || *x > right_x)
678 return ON_SCROLL_BAR; 681 return ON_SCROLL_BAR;
@@ -6034,9 +6037,9 @@ display marginal areas and the text area. */)
6034 struct window *w = decode_window (window); 6037 struct window *w = decode_window (window);
6035 6038
6036 if (!NILP (left)) 6039 if (!NILP (left))
6037 CHECK_NUMBER (left); 6040 CHECK_NATNUM (left);
6038 if (!NILP (right)) 6041 if (!NILP (right))
6039 CHECK_NUMBER (right); 6042 CHECK_NATNUM (right);
6040 6043
6041 if (!EQ (w->left_fringe_width, left) 6044 if (!EQ (w->left_fringe_width, left)
6042 || !EQ (w->right_fringe_width, right) 6045 || !EQ (w->right_fringe_width, right)
@@ -6096,7 +6099,7 @@ If TYPE is t, use the frame's scroll-bar type. */)
6096 struct window *w = decode_window (window); 6099 struct window *w = decode_window (window);
6097 6100
6098 if (!NILP (width)) 6101 if (!NILP (width))
6099 CHECK_NUMBER (width); 6102 CHECK_NATNUM (width);
6100 6103
6101 if (XINT (width) == 0) 6104 if (XINT (width) == 0)
6102 vertical_type = Qnil; 6105 vertical_type = Qnil;
diff --git a/src/xdisp.c b/src/xdisp.c
index 04c313ef18b..008195eba73 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -216,6 +216,8 @@ extern int pending_menu_activation;
216extern int interrupt_input; 216extern int interrupt_input;
217extern int command_loop_level; 217extern int command_loop_level;
218 218
219extern Lisp_Object do_mouse_tracking;
220
219extern int minibuffer_auto_raise; 221extern int minibuffer_auto_raise;
220extern Lisp_Object Vminibuffer_list; 222extern Lisp_Object Vminibuffer_list;
221 223
@@ -10517,6 +10519,9 @@ redisplay_preserve_echo_area (from_where)
10517 } 10519 }
10518 else 10520 else
10519 redisplay_internal (1); 10521 redisplay_internal (1);
10522
10523 if (rif != NULL && rif->flush_display_optional)
10524 rif->flush_display_optional (NULL);
10520} 10525}
10521 10526
10522 10527
@@ -12320,7 +12325,8 @@ redisplay_window (window, just_this_one_p)
12320 { 12325 {
12321 update_begin (f); 12326 update_begin (f);
12322 BLOCK_INPUT; 12327 BLOCK_INPUT;
12323 draw_window_fringes (w); 12328 if (draw_window_fringes (w, 1))
12329 x_draw_vertical_border (w);
12324 UNBLOCK_INPUT; 12330 UNBLOCK_INPUT;
12325 update_end (f); 12331 update_end (f);
12326 } 12332 }
@@ -18800,8 +18806,10 @@ calc_line_height_property (it, prop, font, boff, total)
18800 18806
18801 if (STRINGP (it->object)) 18807 if (STRINGP (it->object))
18802 position = make_number (IT_STRING_CHARPOS (*it)); 18808 position = make_number (IT_STRING_CHARPOS (*it));
18803 else 18809 else if (BUFFERP (it->object))
18804 position = make_number (IT_CHARPOS (*it)); 18810 position = make_number (IT_CHARPOS (*it));
18811 else
18812 return Qnil;
18805 18813
18806 val = Fget_char_property (position, prop, it->object); 18814 val = Fget_char_property (position, prop, it->object);
18807 18815
@@ -20912,6 +20920,10 @@ define_frame_cursor1 (f, cursor, pointer)
20912 Cursor cursor; 20920 Cursor cursor;
20913 Lisp_Object pointer; 20921 Lisp_Object pointer;
20914{ 20922{
20923 /* Do not change cursor shape while dragging mouse. */
20924 if (!NILP (do_mouse_tracking))
20925 return;
20926
20915 if (!NILP (pointer)) 20927 if (!NILP (pointer))
20916 { 20928 {
20917 if (EQ (pointer, Qarrow)) 20929 if (EQ (pointer, Qarrow))
@@ -21773,6 +21785,9 @@ x_draw_vertical_border (w)
21773 do it for frames with vertical scroll bars because either the 21785 do it for frames with vertical scroll bars because either the
21774 right scroll bar of a window, or the left scroll bar of its 21786 right scroll bar of a window, or the left scroll bar of its
21775 neighbor will suffice as a border. */ 21787 neighbor will suffice as a border. */
21788 if (FRAME_HAS_VERTICAL_SCROLL_BARS (XFRAME (w->frame)))
21789 return;
21790
21776 if (!WINDOW_RIGHTMOST_P (w) 21791 if (!WINDOW_RIGHTMOST_P (w)
21777 && !WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w)) 21792 && !WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w))
21778 { 21793 {
diff --git a/src/xfns.c b/src/xfns.c
index b0864cbdffe..e41540a9942 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -5551,7 +5551,7 @@ Chinese, Japanese, and Korean. */);
5551 last_show_tip_args = Qnil; 5551 last_show_tip_args = Qnil;
5552 staticpro (&last_show_tip_args); 5552 staticpro (&last_show_tip_args);
5553 5553
5554#ifdef USE_MOTIF 5554#if defined (USE_MOTIF) || defined (USE_GTK)
5555 defsubr (&Sx_file_dialog); 5555 defsubr (&Sx_file_dialog);
5556#endif 5556#endif
5557} 5557}
diff --git a/src/xterm.c b/src/xterm.c
index cf7ec09cf46..ef469a2b82e 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -572,9 +572,8 @@ x_update_window_end (w, cursor_on_p, mouse_face_overwritten_p)
572 output_cursor.vpos, 572 output_cursor.vpos,
573 output_cursor.x, output_cursor.y); 573 output_cursor.x, output_cursor.y);
574 574
575 x_draw_vertical_border (w); 575 if (draw_window_fringes (w, 1))
576 576 x_draw_vertical_border (w);
577 draw_window_fringes (w);
578 577
579 UNBLOCK_INPUT; 578 UNBLOCK_INPUT;
580 } 579 }
@@ -3389,12 +3388,14 @@ x_find_modifier_meanings (dpyinfo)
3389 Alt keysyms are on. */ 3388 Alt keysyms are on. */
3390 { 3389 {
3391 int row, col; /* The row and column in the modifier table. */ 3390 int row, col; /* The row and column in the modifier table. */
3391 int found_alt_or_meta;
3392 3392
3393 for (row = 3; row < 8; row++) 3393 for (row = 3; row < 8; row++)
3394 {
3395 found_alt_or_meta = 0;
3394 for (col = 0; col < mods->max_keypermod; col++) 3396 for (col = 0; col < mods->max_keypermod; col++)
3395 { 3397 {
3396 KeyCode code 3398 KeyCode code = mods->modifiermap[(row * mods->max_keypermod) + col];
3397 = mods->modifiermap[(row * mods->max_keypermod) + col];
3398 3399
3399 /* Zeroes are used for filler. Skip them. */ 3400 /* Zeroes are used for filler. Skip them. */
3400 if (code == 0) 3401 if (code == 0)
@@ -3412,33 +3413,44 @@ x_find_modifier_meanings (dpyinfo)
3412 { 3413 {
3413 case XK_Meta_L: 3414 case XK_Meta_L:
3414 case XK_Meta_R: 3415 case XK_Meta_R:
3416 found_alt_or_meta = 1;
3415 dpyinfo->meta_mod_mask |= (1 << row); 3417 dpyinfo->meta_mod_mask |= (1 << row);
3416 break; 3418 break;
3417 3419
3418 case XK_Alt_L: 3420 case XK_Alt_L:
3419 case XK_Alt_R: 3421 case XK_Alt_R:
3422 found_alt_or_meta = 1;
3420 dpyinfo->alt_mod_mask |= (1 << row); 3423 dpyinfo->alt_mod_mask |= (1 << row);
3421 break; 3424 break;
3422 3425
3423 case XK_Hyper_L: 3426 case XK_Hyper_L:
3424 case XK_Hyper_R: 3427 case XK_Hyper_R:
3425 dpyinfo->hyper_mod_mask |= (1 << row); 3428 if (!found_alt_or_meta)
3429 dpyinfo->hyper_mod_mask |= (1 << row);
3430 code_col = syms_per_code;
3431 col = mods->max_keypermod;
3426 break; 3432 break;
3427 3433
3428 case XK_Super_L: 3434 case XK_Super_L:
3429 case XK_Super_R: 3435 case XK_Super_R:
3430 dpyinfo->super_mod_mask |= (1 << row); 3436 if (!found_alt_or_meta)
3437 dpyinfo->super_mod_mask |= (1 << row);
3438 code_col = syms_per_code;
3439 col = mods->max_keypermod;
3431 break; 3440 break;
3432 3441
3433 case XK_Shift_Lock: 3442 case XK_Shift_Lock:
3434 /* Ignore this if it's not on the lock modifier. */ 3443 /* Ignore this if it's not on the lock modifier. */
3435 if ((1 << row) == LockMask) 3444 if (!found_alt_or_meta && ((1 << row) == LockMask))
3436 dpyinfo->shift_lock_mask = LockMask; 3445 dpyinfo->shift_lock_mask = LockMask;
3446 code_col = syms_per_code;
3447 col = mods->max_keypermod;
3437 break; 3448 break;
3438 } 3449 }
3439 } 3450 }
3440 } 3451 }
3441 } 3452 }
3453 }
3442 } 3454 }
3443 3455
3444 /* If we couldn't find any meta keys, accept any alt keys as meta keys. */ 3456 /* If we couldn't find any meta keys, accept any alt keys as meta keys. */
@@ -5052,9 +5064,15 @@ XTset_vertical_scroll_bar (w, portion, whole, position)
5052 /* Compute the left edge of the scroll bar. */ 5064 /* Compute the left edge of the scroll bar. */
5053#ifdef USE_TOOLKIT_SCROLL_BARS 5065#ifdef USE_TOOLKIT_SCROLL_BARS
5054 if (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w)) 5066 if (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w))
5055 sb_left = left + width - sb_width - (width - sb_width) / 2; 5067 sb_left = (left +
5068 (WINDOW_RIGHTMOST_P (w)
5069 ? width - sb_width - (width - sb_width) / 2
5070 : 0));
5056 else 5071 else
5057 sb_left = left + (width - sb_width) / 2; 5072 sb_left = (left +
5073 (WINDOW_LEFTMOST_P (w)
5074 ? (width - sb_width) / 2
5075 : width - sb_width));
5058#else 5076#else
5059 if (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w)) 5077 if (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w))
5060 sb_left = left + width - sb_width; 5078 sb_left = left + width - sb_width;
@@ -5107,19 +5125,20 @@ XTset_vertical_scroll_bar (w, portion, whole, position)
5107 width); 5125 width);
5108#else /* not USE_GTK */ 5126#else /* not USE_GTK */
5109 5127
5110 /* Since toolkit scroll bars are smaller than the space reserved
5111 for them on the frame, we have to clear "under" them. */
5112 if (width > 0 && height > 0)
5113 x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
5114 left, top, width, height, False);
5115 /* Move/size the scroll bar widget. */ 5128 /* Move/size the scroll bar widget. */
5116 if (mask) 5129 if (mask)
5130 {
5131 /* Since toolkit scroll bars are smaller than the space reserved
5132 for them on the frame, we have to clear "under" them. */
5133 if (width > 0 && height > 0)
5134 x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
5135 left, top, width, height, False);
5117 XtConfigureWidget (SCROLL_BAR_X_WIDGET (FRAME_X_DISPLAY (f), bar), 5136 XtConfigureWidget (SCROLL_BAR_X_WIDGET (FRAME_X_DISPLAY (f), bar),
5118 sb_left + VERTICAL_SCROLL_BAR_WIDTH_TRIM, 5137 sb_left + VERTICAL_SCROLL_BAR_WIDTH_TRIM,
5119 top, 5138 top,
5120 sb_width - VERTICAL_SCROLL_BAR_WIDTH_TRIM * 2, 5139 sb_width - VERTICAL_SCROLL_BAR_WIDTH_TRIM * 2,
5121 max (height, 1), 0); 5140 max (height, 1), 0);
5122 5141 }
5123#endif /* not USE_GTK */ 5142#endif /* not USE_GTK */
5124#else /* not USE_TOOLKIT_SCROLL_BARS */ 5143#else /* not USE_TOOLKIT_SCROLL_BARS */
5125 5144
@@ -10918,7 +10937,7 @@ static struct redisplay_interface x_redisplay_interface =
10918 x_update_window_end, 10937 x_update_window_end,
10919 x_cursor_to, 10938 x_cursor_to,
10920 x_flush, 10939 x_flush,
10921#ifndef XFlush 10940#ifdef XFlush
10922 x_flush, 10941 x_flush,
10923#else 10942#else
10924 0, /* flush_display_optional */ 10943 0, /* flush_display_optional */
diff --git a/src/xterm.h b/src/xterm.h
index d87135e8bf6..76cba8a2517 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -21,8 +21,8 @@ Boston, MA 02111-1307, USA. */
21 21
22#include <X11/Xlib.h> 22#include <X11/Xlib.h>
23#include <X11/cursorfont.h> 23#include <X11/cursorfont.h>
24#include <X11/Xutil.h>
25#include <X11/keysym.h> 24#include <X11/keysym.h>
25#include <X11/Xutil.h>
26#include <X11/Xatom.h> 26#include <X11/Xatom.h>
27#include <X11/Xresource.h> 27#include <X11/Xresource.h>
28 28