aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKaroly Lorentey2004-10-07 16:52:19 +0000
committerKaroly Lorentey2004-10-07 16:52:19 +0000
commitc5f80d9d13d6033e5ee75d65bb5383d4d75dc427 (patch)
tree1aa58eeabb309b4460144425f6e5a2ca0ad81eaf /src
parent04ccca970d4a21222cd1f58c7c41983461f009fc (diff)
parenteb6a2b61401ca737487aa7770389c01c0e962cb0 (diff)
downloademacs-c5f80d9d13d6033e5ee75d65bb5383d4d75dc427.tar.gz
emacs-c5f80d9d13d6033e5ee75d65bb5383d4d75dc427.zip
Merged in changes from CVS trunk.
Patches applied: * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-593 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-594 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-595 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-596 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-597 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-598 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-599 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-600 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-601 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-602 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-603 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-42 Update from CVS * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-43 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-44 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-253
Diffstat (limited to 'src')
-rw-r--r--src/.gdbinit20
-rw-r--r--src/ChangeLog69
-rw-r--r--src/Makefile.in2
-rw-r--r--src/config.in6
-rw-r--r--src/fileio.c3
-rw-r--r--src/fringe.c12
-rw-r--r--src/macfns.c33
-rw-r--r--src/macmenu.c4
-rw-r--r--src/macterm.c310
-rw-r--r--src/window.c15
-rw-r--r--src/xdisp.c9
-rw-r--r--src/xterm.c46
12 files changed, 341 insertions, 188 deletions
diff --git a/src/.gdbinit b/src/.gdbinit
index 3af7e369923..b7716f0e904 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
@@ -429,6 +439,16 @@ document xreload
429end 439end
430xreload 440xreload
431 441
442# Flush display (X only)
443define ff
444 set x_flush (0)
445end
446document ff
447Flush pending X window display updates to screen.
448Works only when an inferior emacs is executing.
449end
450
451
432define hook-run 452define hook-run
433 xreload 453 xreload
434end 454end
diff --git a/src/ChangeLog b/src/ChangeLog
index 73fb09883eb..99be23b4df8 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,72 @@
12004-10-06 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
2
3 * macfns.c (mac_get_window_bounds): Add extern.
4 (x_real_positions): Use mac_get_window_bounds.
5
6 * macmenu.c (update_submenu_strings): Apply 2004-09-07 change for
7 xmenu.c (YAILOM).
8
9 * macterm.c [!MAC_OSX]: Include Windows.h.
10 (front_emacs_window): Rename from mac_front_window. All uses
11 changed. Return the frontmost non-tooltip emacs window.
12 (mac_get_window_bounds): New function.
13 (x_calc_absolute_position): Use the difference of width and height
14 between the inner and outer window.
15 (x_set_offset): Specify window position by the coordinae of the
16 outer window. Adjust the position if the title bar is completely
17 outside the screen.
18 (app_is_suspended, app_sleep_time): Remove unused variables.
19 (do_app_resume, do_app_suspend): Remove their contents because
20 window-activate/deactivate events will do the job.
21 (do_zoom_window): Remove unused variables. Make compliant to the
22 standard way of zooming. Set f->left_pos and f->top_pos.
23 (XTread_socket): Don't use argument `expected'. Don't use
24 FrontWindow to determine the clicked window. Exclude unprocessed
25 mouseUp cases in the early stage. Add parentheses to fix operator
26 precedence.
27 (XTread_socket) [TARGET_API_MAC_CARBON]: Don't specify drag area.
28
29
302004-10-05 Jan Dj,Ad(Brv. <jan.h.d@swipnet.se>
31
32 * config.in: Regenerate.
33
34 * Makefile.in (RUN_TEMACS): Check HAVE_RANDOM_HEAPSTART instead of
35 HAVE_EXECSHIELD.
36
372004-10-05 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
38
39 * xterm.c (x_find_modifier_meanings): Ignore any Super or Hyper for
40 a row if Alt or Meta has been found for that row. Also stop scanning
41 for Keysyms for that row.
42
432004-10-04 Kim F. Storm <storm@cua.dk>
44
45 * fringe.c (Ffringe_bitmaps_at_pos): Change return value from cons
46 to list. Include overlay arrow bitmap in return value.
47
48 * xterm.c (XTset_vertical_scroll_bar): Improve handling of scroll
49 bars with fractional column width. If scroll bar separates two
50 windows, move it towards the window it belongs to. Only update
51 the padding area below the scroll bar widget when necessary,
52 i.e. when scroll bar widget is created, moved, or resized.
53
54 * xdisp.c (define_frame_cursor1): Do not change frame cursor
55 while tracking/dragging mouse.
56 (x_draw_vertical_border): Do not draw line if frame has scroll bars.
57
58 * window.c (coordinates_in_window): Relax check for cursor
59 on vertial border between mode lines.
60 (Fset_window_fringes): Do not allow negative widths.
61 (Fset_window_scroll_bars): Likewise.
62
63 * .gdbinit (pp): Shorthand for p ARG + pr.
64 (ff): New command: flush frame updates (X only).
65
662004-10-03 Michael Albinus <michael.albinus@gmx.de>
67
68 * fileio.c (auto_save_1) Call Ffile_modes for remote files.
69
12004-09-30 Kenichi Handa <handa@m17n.org> 702004-09-30 Kenichi Handa <handa@m17n.org>
2 71
3 * process.c (send_process): Free composition data. 72 * process.c (send_process): Free composition data.
diff --git a/src/Makefile.in b/src/Makefile.in
index dc8964a42ca..f85811c970a 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -909,7 +909,7 @@ LIBES = $(LOADLIBES) $(LIBS) $(LIBX) $(LIBSOUND) \
909#define OBJECTS_MACHINE 909#define OBJECTS_MACHINE
910#endif 910#endif
911 911
912#ifdef HAVE_EXECSHIELD 912#ifdef HAVE_RANDOM_HEAPSTART
913#undef i386 913#undef i386
914RUN_TEMACS = @SETARCH@ i386 ./temacs 914RUN_TEMACS = @SETARCH@ i386 ./temacs
915#else 915#else
diff --git a/src/config.in b/src/config.in
index e5d112ee81c..6e6d61b4e02 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
@@ -432,6 +429,9 @@ Boston, MA 02111-1307, USA. */
432/* Define to 1 if you have the `random' function. */ 429/* Define to 1 if you have the `random' function. */
433#undef HAVE_RANDOM 430#undef HAVE_RANDOM
434 431
432/* Define to 1 if this OS randomizes the start address of the heap. */
433#undef HAVE_RANDOM_HEAPSTART
434
435/* Define to 1 if you have the `recvfrom' function. */ 435/* Define to 1 if you have the `recvfrom' function. */
436#undef HAVE_RECVFROM 436#undef HAVE_RECVFROM
437 437
diff --git a/src/fileio.c b/src/fileio.c
index 0cfea99b469..ece909ea8b3 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -5720,6 +5720,9 @@ auto_save_1 ()
5720 && stat (SDATA (current_buffer->filename), &st) >= 0) 5720 && stat (SDATA (current_buffer->filename), &st) >= 0)
5721 /* But make sure we can overwrite it later! */ 5721 /* But make sure we can overwrite it later! */
5722 auto_save_mode_bits = st.st_mode | 0600; 5722 auto_save_mode_bits = st.st_mode | 0600;
5723 else if (! NILP (current_buffer->filename))
5724 /* Remote files don't cooperate with stat. */
5725 auto_save_mode_bits = XINT (Ffile_modes (current_buffer->filename)) | 0600;
5723 else 5726 else
5724 auto_save_mode_bits = 0666; 5727 auto_save_mode_bits = 0666;
5725 5728
diff --git a/src/fringe.c b/src/fringe.c
index 529004c7ed8..2da5439b039 100644
--- a/src/fringe.c
+++ b/src/fringe.c
@@ -1348,9 +1348,10 @@ DEFUN ("fringe-bitmaps-at-pos", Ffringe_bitmaps_at_pos, Sfringe_bitmaps_at_pos,
1348 0, 2, 0, 1348 0, 2, 0,
1349 doc: /* Return fringe bitmaps of row containing position POS in window WINDOW. 1349 doc: /* Return fringe bitmaps of row containing position POS in window WINDOW.
1350If WINDOW is nil, use selected window. If POS is nil, use value of point 1350If WINDOW is nil, use selected window. If POS is nil, use value of point
1351in that window. Return value is a cons (LEFT . RIGHT) where LEFT and RIGHT 1351in that window. Return value is a list (LEFT RIGHT OV), where LEFT
1352are the fringe bitmap numbers for the bitmaps in the left and right fringe, 1352is the symbol for the bitmap in the left fringe (or nil if no bitmap),
1353resp. If left or right fringe is empty, the corresponding element is nil. 1353RIGHT is similar for the right fringe, and OV is non-nil if there is an
1354overlay arrow in the left fringe.
1354Return nil if POS is not visible in WINDOW. */) 1355Return nil if POS is not visible in WINDOW. */)
1355 (pos, window) 1356 (pos, window)
1356 Lisp_Object pos, window; 1357 Lisp_Object pos, window;
@@ -1377,8 +1378,9 @@ Return nil if POS is not visible in WINDOW. */)
1377 row = MATRIX_FIRST_TEXT_ROW (w->current_matrix); 1378 row = MATRIX_FIRST_TEXT_ROW (w->current_matrix);
1378 row = row_containing_pos (w, textpos, row, NULL, 0); 1379 row = row_containing_pos (w, textpos, row, NULL, 0);
1379 if (row) 1380 if (row)
1380 return Fcons (get_fringe_bitmap_name (row->left_fringe_bitmap), 1381 return list3 (get_fringe_bitmap_name (row->left_fringe_bitmap),
1381 get_fringe_bitmap_name (row->right_fringe_bitmap)); 1382 get_fringe_bitmap_name (row->right_fringe_bitmap),
1383 (row->overlay_arrow_p ? Qt : Qnil));
1382 else 1384 else
1383 return Qnil; 1385 return Qnil;
1384} 1386}
diff --git a/src/macfns.c b/src/macfns.c
index 3b09b344a55..f7594e9c6c2 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
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 4f721fff304..56c4653bf43 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
@@ -3887,18 +3888,21 @@ remember_mouse_glyph (f1, gx, gy)
3887 3888
3888 3889
3889static WindowPtr 3890static WindowPtr
3890mac_front_window () 3891front_emacs_window ()
3891{ 3892{
3892#if TARGET_API_MAC_CARBON 3893#if TARGET_API_MAC_CARBON
3893 return GetFrontWindowOfClass (kDocumentWindowClass, true); 3894 WindowPtr wp = GetFrontWindowOfClass (kDocumentWindowClass, true);
3895
3896 while (wp && !is_emacs_window (wp))
3897 wp = GetNextWindowOfClass (wp, kDocumentWindowClass, true);
3894#else 3898#else
3895 WindowPtr front_window = FrontWindow (); 3899 WindowPtr wp = FrontWindow ();
3896 3900
3897 if (tip_window && front_window == tip_window) 3901 while (wp && (wp == tip_window || !is_emacs_window (wp)))
3898 return GetNextWindow (front_window); 3902 wp = GetNextWindow (wp);
3899 else
3900 return front_window;
3901#endif 3903#endif
3904
3905 return wp;
3902} 3906}
3903 3907
3904#define mac_window_to_frame(wp) (((mac_output *) GetWRefCon (wp))->mFP) 3908#define mac_window_to_frame(wp) (((mac_output *) GetWRefCon (wp))->mFP)
@@ -3934,7 +3938,7 @@ XTmouse_position (fp, insist, bar_window, part, x, y, time)
3934{ 3938{
3935 Point mouse_pos; 3939 Point mouse_pos;
3936 int ignore1, ignore2; 3940 int ignore1, ignore2;
3937 WindowPtr wp = mac_front_window (); 3941 WindowPtr wp = front_emacs_window ();
3938 struct frame *f; 3942 struct frame *f;
3939 Lisp_Object frame, tail; 3943 Lisp_Object frame, tail;
3940 3944
@@ -4551,7 +4555,7 @@ x_scroll_bar_report_motion (fp, bar_window, part, x, y, time)
4551 unsigned long *time; 4555 unsigned long *time;
4552{ 4556{
4553 struct scroll_bar *bar = XSCROLL_BAR (last_mouse_scroll_bar); 4557 struct scroll_bar *bar = XSCROLL_BAR (last_mouse_scroll_bar);
4554 WindowPtr wp = mac_front_window (); 4558 WindowPtr wp = front_emacs_window ();
4555 Point mouse_pos; 4559 Point mouse_pos;
4556 struct frame *f = mac_window_to_frame (wp); 4560 struct frame *f = mac_window_to_frame (wp);
4557 int win_y, top_range; 4561 int win_y, top_range;
@@ -5036,6 +5040,26 @@ xim_close_dpy (dpyinfo)
5036 */ 5040 */
5037 5041
5038 5042
5043void
5044mac_get_window_bounds (f, inner, outer)
5045 struct frame *f;
5046 Rect *inner, *outer;
5047{
5048#if TARGET_API_MAC_CARBON
5049 GetWindowBounds (FRAME_MAC_WINDOW (f), kWindowContentRgn, inner);
5050 GetWindowBounds (FRAME_MAC_WINDOW (f), kWindowStructureRgn, outer);
5051#else /* not TARGET_API_MAC_CARBON */
5052 RgnHandle region = NewRgn ();
5053
5054 GetWindowRegion (FRAME_MAC_WINDOW (f), kWindowContentRgn, region);
5055 *inner = (*region)->rgnBBox;
5056 GetWindowRegion (FRAME_MAC_WINDOW (f), kWindowStructureRgn, region);
5057 *outer = (*region)->rgnBBox;
5058 DisposeRgn (region);
5059#endif /* not TARGET_API_MAC_CARBON */
5060}
5061
5062
5039/* Calculate the absolute position in frame F 5063/* Calculate the absolute position in frame F
5040 from its current recorded position values and gravity. */ 5064 from its current recorded position values and gravity. */
5041 5065
@@ -5043,47 +5067,36 @@ void
5043x_calc_absolute_position (f) 5067x_calc_absolute_position (f)
5044 struct frame *f; 5068 struct frame *f;
5045{ 5069{
5046 Point pt; 5070 int width_diff = 0, height_diff = 0;
5047 int flags = f->size_hint_flags; 5071 int flags = f->size_hint_flags;
5072 Rect inner, outer;
5048 5073
5049 pt.h = pt.v = 0; 5074 /* We have nothing to do if the current position
5075 is already for the top-left corner. */
5076 if (! ((flags & XNegative) || (flags & YNegative)))
5077 return;
5050 5078
5051 /* Find the position of the outside upper-left corner of 5079 /* Find the offsets of the outside upper-left corner of
5052 the inner window, with respect to the outer window. */ 5080 the inner window, with respect to the outer window. */
5053 if (f->output_data.mac->parent_desc != FRAME_MAC_DISPLAY_INFO (f)->root_window) 5081 mac_get_window_bounds (f, &inner, &outer);
5054 {
5055 GrafPtr savePort;
5056 GetPort (&savePort);
5057
5058 SetPortWindowPort (FRAME_MAC_WINDOW (f));
5059 5082
5060#if TARGET_API_MAC_CARBON 5083 width_diff = (outer.right - outer.left) - (inner.right - inner.left);
5061 { 5084 height_diff = (outer.bottom - outer.top) - (inner.bottom - inner.top);
5062 Rect r;
5063
5064 GetWindowPortBounds (FRAME_MAC_WINDOW (f), &r);
5065 SetPt(&pt, r.left, r.top);
5066 }
5067#else /* not TARGET_API_MAC_CARBON */
5068 SetPt(&pt, FRAME_MAC_WINDOW (f)->portRect.left, FRAME_MAC_WINDOW (f)->portRect.top);
5069#endif /* not TARGET_API_MAC_CARBON */
5070 LocalToGlobal (&pt);
5071 SetPort (savePort);
5072 }
5073 5085
5074 /* Treat negative positions as relative to the leftmost bottommost 5086 /* Treat negative positions as relative to the leftmost bottommost
5075 position that fits on the screen. */ 5087 position that fits on the screen. */
5076 if (flags & XNegative) 5088 if (flags & XNegative)
5077 f->left_pos = (FRAME_MAC_DISPLAY_INFO (f)->width 5089 f->left_pos = (FRAME_MAC_DISPLAY_INFO (f)->width
5078 - 2 * f->border_width - pt.h 5090 - width_diff
5079 - FRAME_PIXEL_WIDTH (f) 5091 - FRAME_PIXEL_WIDTH (f)
5080 + f->left_pos); 5092 + f->left_pos);
5081 /* NTEMACS_TODO: Subtract menubar height? */ 5093
5082 if (flags & YNegative) 5094 if (flags & YNegative)
5083 f->top_pos = (FRAME_MAC_DISPLAY_INFO (f)->height 5095 f->top_pos = (FRAME_MAC_DISPLAY_INFO (f)->height
5084 - 2 * f->border_width - pt.v 5096 - height_diff
5085 - FRAME_PIXEL_HEIGHT (f) 5097 - FRAME_PIXEL_HEIGHT (f)
5086 + f->top_pos); 5098 + f->top_pos);
5099
5087 /* The left_pos and top_pos 5100 /* The left_pos and top_pos
5088 are now relative to the top and left screen edges, 5101 are now relative to the top and left screen edges,
5089 so the flags should correspond. */ 5102 so the flags should correspond. */
@@ -5102,8 +5115,6 @@ x_set_offset (f, xoff, yoff, change_gravity)
5102 register int xoff, yoff; 5115 register int xoff, yoff;
5103 int change_gravity; 5116 int change_gravity;
5104{ 5117{
5105 int modified_top, modified_left;
5106
5107 if (change_gravity > 0) 5118 if (change_gravity > 0)
5108 { 5119 {
5109 f->top_pos = yoff; 5120 f->top_pos = yoff;
@@ -5120,11 +5131,55 @@ x_set_offset (f, xoff, yoff, change_gravity)
5120 BLOCK_INPUT; 5131 BLOCK_INPUT;
5121 x_wm_set_size_hint (f, (long) 0, 0); 5132 x_wm_set_size_hint (f, (long) 0, 0);
5122 5133
5123 modified_left = f->left_pos; 5134#if TARGET_API_MAC_CARBON
5124 modified_top = f->top_pos; 5135 MoveWindowStructure (FRAME_MAC_WINDOW (f), f->left_pos, f->top_pos);
5125 5136 /* If the title bar is completely outside the screen, adjust the
5126 MoveWindow (FRAME_MAC_WINDOW (f), modified_left + 6, 5137 position. */
5127 modified_top + 42, false); 5138 ConstrainWindowToScreen (FRAME_MAC_WINDOW (f), kWindowTitleBarRgn,
5139 kWindowConstrainMoveRegardlessOfFit
5140 | kWindowConstrainAllowPartial, NULL, NULL);
5141 x_real_positions (f, &f->left_pos, &f->top_pos);
5142#else
5143 {
5144 Rect inner, outer, screen_rect, dummy;
5145 RgnHandle region = NewRgn ();
5146
5147 mac_get_window_bounds (f, &inner, &outer);
5148 f->x_pixels_diff = inner.left - outer.left;
5149 f->y_pixels_diff = inner.top - outer.top;
5150 MoveWindow (FRAME_MAC_WINDOW (f), f->left_pos + f->x_pixels_diff,
5151 f->top_pos + f->y_pixels_diff, false);
5152
5153 /* If the title bar is completely outside the screen, adjust the
5154 position. The variable `outer' holds the title bar rectangle.
5155 The variable `inner' holds slightly smaller one than `outer',
5156 so that the calculation of overlapping may not become too
5157 strict. */
5158 GetWindowRegion (FRAME_MAC_WINDOW (f), kWindowTitleBarRgn, region);
5159 outer = (*region)->rgnBBox;
5160 DisposeRgn (region);
5161 inner = outer;
5162 InsetRect (&inner, 8, 8);
5163 screen_rect = qd.screenBits.bounds;
5164 screen_rect.top += GetMBarHeight ();
5165
5166 if (!SectRect (&inner, &screen_rect, &dummy))
5167 {
5168 if (inner.right <= screen_rect.left)
5169 f->left_pos = screen_rect.left;
5170 else if (inner.left >= screen_rect.right)
5171 f->left_pos = screen_rect.right - (outer.right - outer.left);
5172
5173 if (inner.bottom <= screen_rect.top)
5174 f->top_pos = screen_rect.top;
5175 else if (inner.top >= screen_rect.bottom)
5176 f->top_pos = screen_rect.bottom - (outer.bottom - outer.top);
5177
5178 MoveWindow (FRAME_MAC_WINDOW (f), f->left_pos + f->x_pixels_diff,
5179 f->top_pos + f->y_pixels_diff, false);
5180 }
5181 }
5182#endif
5128 5183
5129 UNBLOCK_INPUT; 5184 UNBLOCK_INPUT;
5130} 5185}
@@ -6900,6 +6955,7 @@ x_find_ccl_program (fontp)
6900/* true when cannot handle any Mac OS events */ 6955/* true when cannot handle any Mac OS events */
6901static int handling_window_update = 0; 6956static int handling_window_update = 0;
6902 6957
6958#if 0
6903/* the flag appl_is_suspended is used both for determining the sleep 6959/* the flag appl_is_suspended is used both for determining the sleep
6904 time to be passed to WaitNextEvent and whether the cursor should be 6960 time to be passed to WaitNextEvent and whether the cursor should be
6905 drawn when updating the display. The cursor is turned off when 6961 drawn when updating the display. The cursor is turned off when
@@ -6909,6 +6965,7 @@ static int handling_window_update = 0;
6909 suspended. */ 6965 suspended. */
6910static Boolean app_is_suspended = false; 6966static Boolean app_is_suspended = false;
6911static long app_sleep_time = WNE_SLEEP_AT_RESUME; 6967static long app_sleep_time = WNE_SLEEP_AT_RESUME;
6968#endif
6912 6969
6913#define EXTRA_STACK_ALLOC (256 * 1024) 6970#define EXTRA_STACK_ALLOC (256 * 1024)
6914 6971
@@ -7235,11 +7292,13 @@ is_emacs_window (WindowPtr win)
7235static void 7292static void
7236do_app_resume () 7293do_app_resume ()
7237{ 7294{
7295 /* Window-activate events will do the job. */
7296#if 0
7238 WindowPtr wp; 7297 WindowPtr wp;
7239 struct frame *f; 7298 struct frame *f;
7240 7299
7241 wp = mac_front_window (); 7300 wp = front_emacs_window ();
7242 if (is_emacs_window (wp)) 7301 if (wp)
7243 { 7302 {
7244 f = mac_window_to_frame (wp); 7303 f = mac_window_to_frame (wp);
7245 7304
@@ -7252,16 +7311,19 @@ do_app_resume ()
7252 7311
7253 app_is_suspended = false; 7312 app_is_suspended = false;
7254 app_sleep_time = WNE_SLEEP_AT_RESUME; 7313 app_sleep_time = WNE_SLEEP_AT_RESUME;
7314#endif
7255} 7315}
7256 7316
7257static void 7317static void
7258do_app_suspend () 7318do_app_suspend ()
7259{ 7319{
7320 /* Window-deactivate events will do the job. */
7321#if 0
7260 WindowPtr wp; 7322 WindowPtr wp;
7261 struct frame *f; 7323 struct frame *f;
7262 7324
7263 wp = mac_front_window (); 7325 wp = front_emacs_window ();
7264 if (is_emacs_window (wp)) 7326 if (wp)
7265 { 7327 {
7266 f = mac_window_to_frame (wp); 7328 f = mac_window_to_frame (wp);
7267 7329
@@ -7274,6 +7336,7 @@ do_app_suspend ()
7274 7336
7275 app_is_suspended = true; 7337 app_is_suspended = true;
7276 app_sleep_time = WNE_SLEEP_AT_SUSPEND; 7338 app_sleep_time = WNE_SLEEP_AT_SUSPEND;
7339#endif
7277} 7340}
7278 7341
7279 7342
@@ -7282,10 +7345,10 @@ do_mouse_moved (mouse_pos, f)
7282 Point mouse_pos; 7345 Point mouse_pos;
7283 FRAME_PTR *f; 7346 FRAME_PTR *f;
7284{ 7347{
7285 WindowPtr wp = mac_front_window (); 7348 WindowPtr wp = front_emacs_window ();
7286 struct x_display_info *dpyinfo; 7349 struct x_display_info *dpyinfo;
7287 7350
7288 if (is_emacs_window (wp)) 7351 if (wp)
7289 { 7352 {
7290 *f = mac_window_to_frame (wp); 7353 *f = mac_window_to_frame (wp);
7291 dpyinfo = FRAME_MAC_DISPLAY_INFO (*f); 7354 dpyinfo = FRAME_MAC_DISPLAY_INFO (*f);
@@ -7347,7 +7410,7 @@ do_menu_choice (SInt32 menu_choice)
7347 7410
7348 default: 7411 default:
7349 { 7412 {
7350 struct frame *f = mac_window_to_frame (mac_front_window ()); 7413 struct frame *f = mac_window_to_frame (front_emacs_window ());
7351 MenuHandle menu = GetMenuHandle (menu_id); 7414 MenuHandle menu = GetMenuHandle (menu_id);
7352 if (menu) 7415 if (menu)
7353 { 7416 {
@@ -7400,41 +7463,43 @@ do_zoom_window (WindowPtr w, int zoom_in_or_out)
7400 GrafPtr save_port; 7463 GrafPtr save_port;
7401 Rect zoom_rect, port_rect; 7464 Rect zoom_rect, port_rect;
7402 Point top_left; 7465 Point top_left;
7403 int w_title_height, columns, rows, width, height, dummy, x, y; 7466 int w_title_height, columns, rows;
7404 struct frame *f = mac_window_to_frame (w); 7467 struct frame *f = mac_window_to_frame (w);
7405 7468
7406 GetPort (&save_port);
7407
7408 SetPortWindowPort (w);
7409
7410 /* Clear window to avoid flicker. */
7411#if TARGET_API_MAC_CARBON 7469#if TARGET_API_MAC_CARBON
7412 { 7470 {
7413 Rect r; 7471 Point standard_size;
7414 BitMap bm;
7415 7472
7416 GetWindowPortBounds (w, &r); 7473 standard_size.h = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, DEFAULT_NUM_COLS);
7417 EraseRect (&r); 7474 standard_size.v = FRAME_MAC_DISPLAY_INFO (f)->height;
7418 7475
7419 if (zoom_in_or_out == inZoomOut) 7476 if (IsWindowInStandardState (w, &standard_size, &zoom_rect))
7477 zoom_in_or_out = inZoomIn;
7478 else
7420 { 7479 {
7421 /* calculate height of window's title bar (hard card it for now). */ 7480 /* Adjust the standard size according to character boundaries. */
7422 w_title_height = 20 + GetMBarHeight (); 7481
7423 7482 columns = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, zoom_rect.right - zoom_rect.left);
7424 /* get maximum height of window into zoom_rect.bottom - 7483 rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, zoom_rect.bottom - zoom_rect.top);
7425 zoom_rect.top */ 7484 standard_size.h = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, columns);
7426 GetQDGlobalsScreenBits (&bm); 7485 standard_size.v = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, rows);
7427 zoom_rect = bm.bounds; 7486 GetWindowBounds (w, kWindowContentRgn, &port_rect);
7428 zoom_rect.top += w_title_height; 7487 if (IsWindowInStandardState (w, &standard_size, &zoom_rect)
7429 InsetRect (&zoom_rect, 8, 4); /* not too tight */ 7488 && port_rect.left == zoom_rect.left
7430 7489 && port_rect.top == zoom_rect.top)
7431 zoom_rect.right = zoom_rect.left 7490 zoom_in_or_out = inZoomIn;
7432 + FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, DEFAULT_NUM_COLS); 7491 else
7433 7492 zoom_in_or_out = inZoomOut;
7434 SetWindowStandardState (w, &zoom_rect);
7435 } 7493 }
7494
7495 ZoomWindowIdeal (w, zoom_in_or_out, &standard_size);
7436 } 7496 }
7437#else /* not TARGET_API_MAC_CARBON */ 7497#else /* not TARGET_API_MAC_CARBON */
7498 GetPort (&save_port);
7499
7500 SetPortWindowPort (w);
7501
7502 /* Clear window to avoid flicker. */
7438 EraseRect (&(w->portRect)); 7503 EraseRect (&(w->portRect));
7439 if (zoom_in_or_out == inZoomOut) 7504 if (zoom_in_or_out == inZoomOut)
7440 { 7505 {
@@ -7453,12 +7518,19 @@ do_zoom_window (WindowPtr w, int zoom_in_or_out)
7453 zoom_rect.right = zoom_rect.left 7518 zoom_rect.right = zoom_rect.left
7454 + FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, DEFAULT_NUM_COLS); 7519 + FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, DEFAULT_NUM_COLS);
7455 7520
7521 /* Adjust the standard size according to character boundaries. */
7522 rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, zoom_rect.bottom - zoom_rect.top);
7523 zoom_rect.bottom =
7524 zoom_rect.top + FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, rows);
7525
7456 (**((WStateDataHandle) ((WindowPeek) w)->dataHandle)).stdState 7526 (**((WStateDataHandle) ((WindowPeek) w)->dataHandle)).stdState
7457 = zoom_rect; 7527 = zoom_rect;
7458 } 7528 }
7459#endif /* not TARGET_API_MAC_CARBON */
7460 7529
7461 ZoomWindow (w, zoom_in_or_out, w == mac_front_window ()); 7530 ZoomWindow (w, zoom_in_or_out, w == front_emacs_window ());
7531
7532 SetPort (save_port);
7533#endif /* not TARGET_API_MAC_CARBON */
7462 7534
7463 /* retrieve window size and update application values */ 7535 /* retrieve window size and update application values */
7464#if TARGET_API_MAC_CARBON 7536#if TARGET_API_MAC_CARBON
@@ -7469,8 +7541,7 @@ do_zoom_window (WindowPtr w, int zoom_in_or_out)
7469 rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, port_rect.bottom - port_rect.top); 7541 rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, port_rect.bottom - port_rect.top);
7470 columns = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, port_rect.right - port_rect.left); 7542 columns = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, port_rect.right - port_rect.left);
7471 x_set_window_size (f, 0, columns, rows); 7543 x_set_window_size (f, 0, columns, rows);
7472 7544 x_real_positions (f, &f->left_pos, &f->top_pos);
7473 SetPort (save_port);
7474} 7545}
7475 7546
7476/* Initialize Drag And Drop to allow files to be dropped onto emacs frames */ 7547/* Initialize Drag And Drop to allow files to be dropped onto emacs frames */
@@ -8020,19 +8091,15 @@ XTread_socket (sd, expected, hold_quit)
8020 if (NILP (Fboundp (Qmac_ready_for_drag_n_drop))) 8091 if (NILP (Fboundp (Qmac_ready_for_drag_n_drop)))
8021 event_mask -= highLevelEventMask; 8092 event_mask -= highLevelEventMask;
8022 8093
8023 while (WaitNextEvent (event_mask, &er, 8094 while (WaitNextEvent (event_mask, &er, 0L, NULL))
8024 (expected ? app_sleep_time : 0L), NULL)) 8095#else /* USE_CARBON_EVENTS */
8025#else 8096 while (!ReceiveNextEvent (0, NULL, kEventDurationNoWait,
8026 while (!ReceiveNextEvent (0, NULL,
8027 (expected ? TicksToEventTime (app_sleep_time) : 0),
8028 kEventRemoveFromQueue, &eventRef)) 8097 kEventRemoveFromQueue, &eventRef))
8029#endif /* !USE_CARBON_EVENTS */ 8098#endif /* USE_CARBON_EVENTS */
8030 { 8099 {
8031 int do_help = 0; 8100 int do_help = 0;
8032 struct frame *f; 8101 struct frame *f;
8033 8102
8034 expected = 0;
8035
8036 /* It is necessary to set this (additional) argument slot of an 8103 /* It is necessary to set this (additional) argument slot of an
8037 event to nil because keyboard.c protects incompletely 8104 event to nil because keyboard.c protects incompletely
8038 processed event from being garbage collected by placing them 8105 processed event from being garbage collected by placing them
@@ -8055,13 +8122,7 @@ XTread_socket (sd, expected, hold_quit)
8055 NULL, &window_ptr); 8122 NULL, &window_ptr);
8056 f = mac_window_to_frame (window_ptr); 8123 f = mac_window_to_frame (window_ptr);
8057 if (f && !f->async_iconified) 8124 if (f && !f->async_iconified)
8058 { 8125 x_real_positions (f, &f->left_pos, &f->top_pos);
8059 int x, y;
8060
8061 x_real_positions (f, &x, &y);
8062 f->left_pos = x;
8063 f->top_pos = y;
8064 }
8065 SendEventToEventTarget (eventRef, toolbox_dispatcher); 8126 SendEventToEventTarget (eventRef, toolbox_dispatcher);
8066 } 8127 }
8067 break; 8128 break;
@@ -8070,7 +8131,7 @@ XTread_socket (sd, expected, hold_quit)
8070 { 8131 {
8071 SInt32 delta; 8132 SInt32 delta;
8072 Point point; 8133 Point point;
8073 WindowPtr window_ptr = mac_front_window (); 8134 WindowPtr window_ptr = front_emacs_window ();
8074 8135
8075 if (!IsValidWindowPtr (window_ptr)) 8136 if (!IsValidWindowPtr (window_ptr))
8076 { 8137 {
@@ -8132,33 +8193,28 @@ XTread_socket (sd, expected, hold_quit)
8132 } 8193 }
8133 else 8194 else
8134 { 8195 {
8135 window_ptr = FrontWindow (); 8196 part_code = FindWindow (er.where, &window_ptr);
8136 if (tip_window && window_ptr == tip_window) 8197 if (tip_window && window_ptr == tip_window)
8137 { 8198 {
8138 HideWindow (tip_window); 8199 HideWindow (tip_window);
8139 window_ptr = FrontWindow (); 8200 part_code = FindWindow (er.where, &window_ptr);
8140 } 8201 }
8141
8142 if (!is_emacs_window (window_ptr))
8143 break;
8144
8145 part_code = FindWindow (er.where, &window_ptr);
8146 } 8202 }
8147 8203
8204 if (er.what != mouseDown && part_code != inContent)
8205 break;
8206
8148 switch (part_code) 8207 switch (part_code)
8149 { 8208 {
8150 case inMenuBar: 8209 case inMenuBar:
8151 if (er.what == mouseDown) 8210 f = mac_window_to_frame (front_emacs_window ());
8152 { 8211 saved_menu_event_location = er.where;
8153 f = mac_window_to_frame (mac_front_window ()); 8212 inev.kind = MENU_BAR_ACTIVATE_EVENT;
8154 saved_menu_event_location = er.where; 8213 XSETFRAME (inev.frame_or_window, f);
8155 inev.kind = MENU_BAR_ACTIVATE_EVENT;
8156 XSETFRAME (inev.frame_or_window, f);
8157 }
8158 break; 8214 break;
8159 8215
8160 case inContent: 8216 case inContent:
8161 if (window_ptr != mac_front_window ()) 8217 if (window_ptr != front_emacs_window ())
8162 SelectWindow (window_ptr); 8218 SelectWindow (window_ptr);
8163 else 8219 else
8164 { 8220 {
@@ -8255,7 +8311,7 @@ XTread_socket (sd, expected, hold_quit)
8255 } 8311 }
8256 else 8312 else
8257 { 8313 {
8258 if (dpyinfo->grabbed & (1 << inev.code) == 0) 8314 if ((dpyinfo->grabbed & (1 << inev.code)) == 0)
8259 /* If a button is released though it was not 8315 /* If a button is released though it was not
8260 previously pressed, that would be because 8316 previously pressed, that would be because
8261 of multi-button emulation. */ 8317 of multi-button emulation. */
@@ -8278,27 +8334,16 @@ XTread_socket (sd, expected, hold_quit)
8278 8334
8279 case inDrag: 8335 case inDrag:
8280#if TARGET_API_MAC_CARBON 8336#if TARGET_API_MAC_CARBON
8281 if (er.what == mouseDown) 8337 DragWindow (window_ptr, er.where, NULL);
8282 {
8283 BitMap bm;
8284
8285 GetQDGlobalsScreenBits (&bm);
8286 DragWindow (window_ptr, er.where, &bm.bounds);
8287 }
8288#else /* not TARGET_API_MAC_CARBON */ 8338#else /* not TARGET_API_MAC_CARBON */
8289 DragWindow (window_ptr, er.where, &qd.screenBits.bounds); 8339 DragWindow (window_ptr, er.where, &qd.screenBits.bounds);
8290#endif /* not TARGET_API_MAC_CARBON */ 8340#endif /* not TARGET_API_MAC_CARBON */
8291 /* Update the frame parameters. */ 8341 /* Update the frame parameters. */
8292 { 8342 {
8293 struct frame *f = mac_window_to_frame (window_ptr); 8343 struct frame *f = mac_window_to_frame (window_ptr);
8344
8294 if (f && !f->async_iconified) 8345 if (f && !f->async_iconified)
8295 { 8346 x_real_positions (f, &f->left_pos, &f->top_pos);
8296 int x, y;
8297
8298 x_real_positions (f, &x, &y);
8299 f->left_pos = x;
8300 f->top_pos = y;
8301 }
8302 } 8347 }
8303 break; 8348 break;
8304 8349
@@ -8313,11 +8358,8 @@ XTread_socket (sd, expected, hold_quit)
8313 8358
8314 /* window resize handling added --ben */ 8359 /* window resize handling added --ben */
8315 case inGrow: 8360 case inGrow:
8316 if (er.what == mouseDown) 8361 do_grow_window (window_ptr, &er);
8317 { 8362 break;
8318 do_grow_window(window_ptr, &er);
8319 break;
8320 }
8321 8363
8322 /* window zoom handling added --ben */ 8364 /* window zoom handling added --ben */
8323 case inZoomIn: 8365 case inZoomIn:
@@ -8460,7 +8502,7 @@ XTread_socket (sd, expected, hold_quit)
8460#endif 8502#endif
8461 8503
8462#if TARGET_API_MAC_CARBON 8504#if TARGET_API_MAC_CARBON
8463 if (!IsValidWindowPtr (mac_front_window ())) 8505 if (!IsValidWindowPtr (front_emacs_window ()))
8464 { 8506 {
8465 SysBeep (1); 8507 SysBeep (1);
8466 break; 8508 break;
@@ -8564,7 +8606,7 @@ XTread_socket (sd, expected, hold_quit)
8564 inev.modifiers = mac_to_emacs_modifiers (er.modifiers); 8606 inev.modifiers = mac_to_emacs_modifiers (er.modifiers);
8565#endif 8607#endif
8566 XSETFRAME (inev.frame_or_window, 8608 XSETFRAME (inev.frame_or_window,
8567 mac_window_to_frame (mac_front_window ())); 8609 mac_window_to_frame (front_emacs_window ()));
8568 inev.timestamp = er.when * (1000 / 60); /* ticks to milliseconds */ 8610 inev.timestamp = er.when * (1000 / 60); /* ticks to milliseconds */
8569 break; 8611 break;
8570 8612
@@ -8581,16 +8623,16 @@ XTread_socket (sd, expected, hold_quit)
8581 WindowPtr wp; 8623 WindowPtr wp;
8582 Lisp_Object frame; 8624 Lisp_Object frame;
8583 8625
8584 wp = mac_front_window (); 8626 wp = front_emacs_window ();
8585 8627
8586 if (!wp) 8628 if (!wp)
8587 { 8629 {
8588 struct frame *f = XFRAME (XCAR (Vframe_list)); 8630 struct frame *f = XFRAME (XCAR (Vframe_list));
8589 CollapseWindow (FRAME_MAC_WINDOW (f), false); 8631 CollapseWindow (FRAME_MAC_WINDOW (f), false);
8590 wp = mac_front_window (); 8632 wp = front_emacs_window ();
8591 } 8633 }
8592 8634
8593 if (wp && is_emacs_window (wp)) 8635 if (wp)
8594 f = mac_window_to_frame (wp); 8636 f = mac_window_to_frame (wp);
8595 8637
8596 inev.kind = DRAG_N_DROP_EVENT; 8638 inev.kind = DRAG_N_DROP_EVENT;
@@ -9047,7 +9089,7 @@ mac_check_for_quit_char ()
9047 e.arg = Qnil; 9089 e.arg = Qnil;
9048 e.modifiers = NULL; 9090 e.modifiers = NULL;
9049 e.timestamp = EventTimeToTicks (GetEventTime (event)) * (1000/60); 9091 e.timestamp = EventTimeToTicks (GetEventTime (event)) * (1000/60);
9050 XSETFRAME (e.frame_or_window, mac_window_to_frame (mac_front_window ())); 9092 XSETFRAME (e.frame_or_window, mac_window_to_frame (front_emacs_window ()));
9051 /* Remove event from queue to prevent looping. */ 9093 /* Remove event from queue to prevent looping. */
9052 RemoveEventFromQueue (GetMainEventQueue (), event); 9094 RemoveEventFromQueue (GetMainEventQueue (), event);
9053 ReleaseEvent (event); 9095 ReleaseEvent (event);
diff --git a/src/window.c b/src/window.c
index c64e8557b56..22ca145b206 100644
--- a/src/window.c
+++ b/src/window.c
@@ -609,9 +609,6 @@ coordinates_in_window (w, x, y)
609 int grabbable_width = ux; 609 int grabbable_width = ux;
610 int lmargin_width, rmargin_width, text_left, text_right; 610 int lmargin_width, rmargin_width, text_left, text_right;
611 611
612 if (*x < x0 || *x >= x1)
613 return ON_NOTHING;
614
615 /* In what's below, we subtract 1 when computing right_x because we 612 /* In what's below, we subtract 1 when computing right_x because we
616 want the rightmost pixel, which is given by left_pixel+width-1. */ 613 want the rightmost pixel, which is given by left_pixel+width-1. */
617 if (w->pseudo_window_p) 614 if (w->pseudo_window_p)
@@ -661,6 +658,9 @@ coordinates_in_window (w, x, y)
661 return ON_VERTICAL_BORDER; 658 return ON_VERTICAL_BORDER;
662 } 659 }
663 660
661 if (*x < x0 || *x >= x1)
662 return ON_NOTHING;
663
664 /* Convert X and Y to window relative coordinates. 664 /* Convert X and Y to window relative coordinates.
665 Mode line starts at left edge of window. */ 665 Mode line starts at left edge of window. */
666 *x -= x0; 666 *x -= x0;
@@ -675,6 +675,9 @@ coordinates_in_window (w, x, y)
675 goto header_vertical_border_check; 675 goto header_vertical_border_check;
676 } 676 }
677 677
678 if (*x < x0 || *x >= x1)
679 return ON_NOTHING;
680
678 /* Outside any interesting column? */ 681 /* Outside any interesting column? */
679 if (*x < left_x || *x > right_x) 682 if (*x < left_x || *x > right_x)
680 return ON_SCROLL_BAR; 683 return ON_SCROLL_BAR;
@@ -6036,9 +6039,9 @@ display marginal areas and the text area. */)
6036 struct window *w = decode_window (window); 6039 struct window *w = decode_window (window);
6037 6040
6038 if (!NILP (left)) 6041 if (!NILP (left))
6039 CHECK_NUMBER (left); 6042 CHECK_NATNUM (left);
6040 if (!NILP (right)) 6043 if (!NILP (right))
6041 CHECK_NUMBER (right); 6044 CHECK_NATNUM (right);
6042 6045
6043 if (!EQ (w->left_fringe_width, left) 6046 if (!EQ (w->left_fringe_width, left)
6044 || !EQ (w->right_fringe_width, right) 6047 || !EQ (w->right_fringe_width, right)
@@ -6098,7 +6101,7 @@ If TYPE is t, use the frame's scroll-bar type. */)
6098 struct window *w = decode_window (window); 6101 struct window *w = decode_window (window);
6099 6102
6100 if (!NILP (width)) 6103 if (!NILP (width))
6101 CHECK_NUMBER (width); 6104 CHECK_NATNUM (width);
6102 6105
6103 if (XINT (width) == 0) 6106 if (XINT (width) == 0)
6104 vertical_type = Qnil; 6107 vertical_type = Qnil;
diff --git a/src/xdisp.c b/src/xdisp.c
index 3d52e60c12f..0e25b0a3de3 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -215,6 +215,8 @@ extern int pending_menu_activation;
215extern int interrupt_input; 215extern int interrupt_input;
216extern int command_loop_level; 216extern int command_loop_level;
217 217
218extern Lisp_Object do_mouse_tracking;
219
218extern int minibuffer_auto_raise; 220extern int minibuffer_auto_raise;
219extern Lisp_Object Vminibuffer_list; 221extern Lisp_Object Vminibuffer_list;
220 222
@@ -20762,6 +20764,10 @@ define_frame_cursor1 (f, cursor, pointer)
20762 Cursor cursor; 20764 Cursor cursor;
20763 Lisp_Object pointer; 20765 Lisp_Object pointer;
20764{ 20766{
20767 /* Do not change cursor shape while dragging mouse. */
20768 if (!NILP (do_mouse_tracking))
20769 return;
20770
20765 if (!NILP (pointer)) 20771 if (!NILP (pointer))
20766 { 20772 {
20767 if (EQ (pointer, Qarrow)) 20773 if (EQ (pointer, Qarrow))
@@ -21625,6 +21631,9 @@ x_draw_vertical_border (w)
21625 do it for frames with vertical scroll bars because either the 21631 do it for frames with vertical scroll bars because either the
21626 right scroll bar of a window, or the left scroll bar of its 21632 right scroll bar of a window, or the left scroll bar of its
21627 neighbor will suffice as a border. */ 21633 neighbor will suffice as a border. */
21634 if (FRAME_HAS_VERTICAL_SCROLL_BARS (XFRAME (w->frame)))
21635 return;
21636
21628 if (!WINDOW_RIGHTMOST_P (w) 21637 if (!WINDOW_RIGHTMOST_P (w)
21629 && !WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w)) 21638 && !WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w))
21630 { 21639 {
diff --git a/src/xterm.c b/src/xterm.c
index 17efe655410..69e04de2eb8 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -3380,12 +3380,14 @@ x_find_modifier_meanings (dpyinfo)
3380 Alt keysyms are on. */ 3380 Alt keysyms are on. */
3381 { 3381 {
3382 int row, col; /* The row and column in the modifier table. */ 3382 int row, col; /* The row and column in the modifier table. */
3383 int found_alt_or_meta;
3383 3384
3384 for (row = 3; row < 8; row++) 3385 for (row = 3; row < 8; row++)
3386 {
3387 found_alt_or_meta = 0;
3385 for (col = 0; col < mods->max_keypermod; col++) 3388 for (col = 0; col < mods->max_keypermod; col++)
3386 { 3389 {
3387 KeyCode code 3390 KeyCode code = mods->modifiermap[(row * mods->max_keypermod) + col];
3388 = mods->modifiermap[(row * mods->max_keypermod) + col];
3389 3391
3390 /* Zeroes are used for filler. Skip them. */ 3392 /* Zeroes are used for filler. Skip them. */
3391 if (code == 0) 3393 if (code == 0)
@@ -3403,33 +3405,44 @@ x_find_modifier_meanings (dpyinfo)
3403 { 3405 {
3404 case XK_Meta_L: 3406 case XK_Meta_L:
3405 case XK_Meta_R: 3407 case XK_Meta_R:
3408 found_alt_or_meta = 1;
3406 dpyinfo->meta_mod_mask |= (1 << row); 3409 dpyinfo->meta_mod_mask |= (1 << row);
3407 break; 3410 break;
3408 3411
3409 case XK_Alt_L: 3412 case XK_Alt_L:
3410 case XK_Alt_R: 3413 case XK_Alt_R:
3414 found_alt_or_meta = 1;
3411 dpyinfo->alt_mod_mask |= (1 << row); 3415 dpyinfo->alt_mod_mask |= (1 << row);
3412 break; 3416 break;
3413 3417
3414 case XK_Hyper_L: 3418 case XK_Hyper_L:
3415 case XK_Hyper_R: 3419 case XK_Hyper_R:
3416 dpyinfo->hyper_mod_mask |= (1 << row); 3420 if (!found_alt_or_meta)
3421 dpyinfo->hyper_mod_mask |= (1 << row);
3422 code_col = syms_per_code;
3423 col = mods->max_keypermod;
3417 break; 3424 break;
3418 3425
3419 case XK_Super_L: 3426 case XK_Super_L:
3420 case XK_Super_R: 3427 case XK_Super_R:
3421 dpyinfo->super_mod_mask |= (1 << row); 3428 if (!found_alt_or_meta)
3429 dpyinfo->super_mod_mask |= (1 << row);
3430 code_col = syms_per_code;
3431 col = mods->max_keypermod;
3422 break; 3432 break;
3423 3433
3424 case XK_Shift_Lock: 3434 case XK_Shift_Lock:
3425 /* Ignore this if it's not on the lock modifier. */ 3435 /* Ignore this if it's not on the lock modifier. */
3426 if ((1 << row) == LockMask) 3436 if (!found_alt_or_meta && ((1 << row) == LockMask))
3427 dpyinfo->shift_lock_mask = LockMask; 3437 dpyinfo->shift_lock_mask = LockMask;
3438 code_col = syms_per_code;
3439 col = mods->max_keypermod;
3428 break; 3440 break;
3429 } 3441 }
3430 } 3442 }
3431 } 3443 }
3432 } 3444 }
3445 }
3433 } 3446 }
3434 3447
3435 /* If we couldn't find any meta keys, accept any alt keys as meta keys. */ 3448 /* If we couldn't find any meta keys, accept any alt keys as meta keys. */
@@ -5050,9 +5063,15 @@ XTset_vertical_scroll_bar (w, portion, whole, position)
5050 /* Compute the left edge of the scroll bar. */ 5063 /* Compute the left edge of the scroll bar. */
5051#ifdef USE_TOOLKIT_SCROLL_BARS 5064#ifdef USE_TOOLKIT_SCROLL_BARS
5052 if (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w)) 5065 if (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w))
5053 sb_left = left + width - sb_width - (width - sb_width) / 2; 5066 sb_left = (left +
5067 (WINDOW_RIGHTMOST_P (w)
5068 ? width - sb_width - (width - sb_width) / 2
5069 : 0));
5054 else 5070 else
5055 sb_left = left + (width - sb_width) / 2; 5071 sb_left = (left +
5072 (WINDOW_LEFTMOST_P (w)
5073 ? (width - sb_width) / 2
5074 : width - sb_width));
5056#else 5075#else
5057 if (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w)) 5076 if (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w))
5058 sb_left = left + width - sb_width; 5077 sb_left = left + width - sb_width;
@@ -5105,19 +5124,20 @@ XTset_vertical_scroll_bar (w, portion, whole, position)
5105 width); 5124 width);
5106#else /* not USE_GTK */ 5125#else /* not USE_GTK */
5107 5126
5108 /* Since toolkit scroll bars are smaller than the space reserved
5109 for them on the frame, we have to clear "under" them. */
5110 if (width > 0 && height > 0)
5111 x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
5112 left, top, width, height, False);
5113 /* Move/size the scroll bar widget. */ 5127 /* Move/size the scroll bar widget. */
5114 if (mask) 5128 if (mask)
5129 {
5130 /* Since toolkit scroll bars are smaller than the space reserved
5131 for them on the frame, we have to clear "under" them. */
5132 if (width > 0 && height > 0)
5133 x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
5134 left, top, width, height, False);
5115 XtConfigureWidget (SCROLL_BAR_X_WIDGET (FRAME_X_DISPLAY (f), bar), 5135 XtConfigureWidget (SCROLL_BAR_X_WIDGET (FRAME_X_DISPLAY (f), bar),
5116 sb_left + VERTICAL_SCROLL_BAR_WIDTH_TRIM, 5136 sb_left + VERTICAL_SCROLL_BAR_WIDTH_TRIM,
5117 top, 5137 top,
5118 sb_width - VERTICAL_SCROLL_BAR_WIDTH_TRIM * 2, 5138 sb_width - VERTICAL_SCROLL_BAR_WIDTH_TRIM * 2,
5119 max (height, 1), 0); 5139 max (height, 1), 0);
5120 5140 }
5121#endif /* not USE_GTK */ 5141#endif /* not USE_GTK */
5122#else /* not USE_TOOLKIT_SCROLL_BARS */ 5142#else /* not USE_TOOLKIT_SCROLL_BARS */
5123 5143