aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog53
-rw-r--r--src/dispnew.c13
-rw-r--r--src/indent.c3
-rw-r--r--src/macgui.h8
-rw-r--r--src/macmenu.c5
-rw-r--r--src/macterm.c90
-rw-r--r--src/window.c3
7 files changed, 117 insertions, 58 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 2547e146e46..829ca27c585 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,43 @@
12006-02-23 Zhang Wei <id.brep@gmail.com> (tiny change)
2
3 * xfns.c (Fx_file_dialog): Return a decoded file name.
4
52006-02-23 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
6
7 * dispnew.c (update_text_area): Avoid needless redraw of rightmost
8 glyph whose face is extended to the text area end.
9
10 * macterm.c (x_set_toolkit_scroll_bar_thumb): Don't set control
11 values if control is not visible or values are not changed.
12
132006-02-22 Stefan Monnier <monnier@iro.umontreal.ca>
14
15 * window.c (Fwindow_list): Check `window' before doing XWINDOW.
16 The default `window' should not be "on a different frame".
17
182006-02-22 Kim F. Storm <storm@cua.dk>
19
20 * indent.c (Fvertical_motion): Only try to move back if we can.
21
222006-02-22 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
23
24 * macgui.h (struct _XGC) [!MAC_OSX || !USE_ATSUI]: New member
25 n_clip_rects.
26
27 * macmenu.c (digest_single_submenu): Apply 2006-02-19 change for
28 xmenu.c.
29
30 * macterm.c (GC_CLIP_REGION): Remove macro.
31 (mac_begin_clip, mac_end_clip): Take arg GC instead of REGION.
32 All uses changed. Don't do clipping if n_clip_rects is zero.
33 (mac_set_clip_rectangles): Use xassert instead of abort.
34 Set n_clip_rects. Don't make clip_region empty when number of
35 clipping rectangles is zero.
36 (mac_reset_clip_rectangles): Set n_clip_rects directly instead of
37 calling mac_set_clip_rectangles.
38 (x_set_toolkit_scroll_bar_thumb): Temporarily hide scroll bar to
39 avoid multiple redraws.
40
12006-02-22 Kim F. Storm <storm@cua.dk> 412006-02-22 Kim F. Storm <storm@cua.dk>
2 42
3 * fringe.c (draw_fringe_bitmap): Fix overlay-arrow display. 43 * fringe.c (draw_fringe_bitmap): Fix overlay-arrow display.
@@ -22,8 +62,8 @@
22 BG_WIDTH. All uses changed. Draw background if BG_WIDTH is not zero. 62 BG_WIDTH. All uses changed. Draw background if BG_WIDTH is not zero.
23 (mac_draw_image_string, mac_draw_image_string_16): New arg BG_WIDTH. 63 (mac_draw_image_string, mac_draw_image_string_16): New arg BG_WIDTH.
24 [USE_CG_TEXT_DRAWING] (mac_draw_image_string_cg): Rename from 64 [USE_CG_TEXT_DRAWING] (mac_draw_image_string_cg): Rename from
25 mac_draw_string_cg. New arg BG_WIDTH. All uses changed. Draw 65 mac_draw_string_cg. New arg BG_WIDTH. All uses changed.
26 background if BG_WIDTH is not zero. Use float constants as 66 Draw background if BG_WIDTH is not zero. Use float constants as
27 divisors instead of double. Use alloca instead of xmalloc/xfree. 67 divisors instead of double. Use alloca instead of xmalloc/xfree.
28 (x_draw_glyph_string_background, x_draw_glyph_string_foreground) 68 (x_draw_glyph_string_background, x_draw_glyph_string_foreground)
29 [!MAC_OS8 || USE_ATSUI]: Background may be drawn using 69 [!MAC_OS8 || USE_ATSUI]: Background may be drawn using
@@ -34,6 +74,11 @@
34 (mac_set_clip_rectangles): When resetting clip region, make it 74 (mac_set_clip_rectangles): When resetting clip region, make it
35 empty instead of disposing of it. 75 empty instead of disposing of it.
36 76
772006-02-20 Stefan Monnier <monnier@iro.umontreal.ca>
78
79 * keymap.c (store_in_keymap): Change `def' arg to not be `register'.
80 Seems to trigger a bug in gcc-amd64 4.0.2 20051125 (Red Hat 4.0.2-8).
81
372006-02-20 Kim F. Storm <storm@cua.dk> 822006-02-20 Kim F. Storm <storm@cua.dk>
38 83
39 * Makefile.in: Add fringe.elc to WINDOW_SUPPORT. 84 * Makefile.in: Add fringe.elc to WINDOW_SUPPORT.
@@ -59,10 +104,10 @@
59 (left_curly_arrow_bits): Rename from continuation_bits. 104 (left_curly_arrow_bits): Rename from continuation_bits.
60 (right_curly_arrow_bits): Rename from continued_bits. 105 (right_curly_arrow_bits): Rename from continued_bits.
61 (left_triangle_bits): Rename from ov_bits. 106 (left_triangle_bits): Rename from ov_bits.
62 (right_triangle_bits): Added. 107 (right_triangle_bits): Add.
63 (filled_rectangle_bits): Rename from filled_box_cursor_bits. 108 (filled_rectangle_bits): Rename from filled_box_cursor_bits.
64 (hollow_rectangle_bits): Rename from hollow_box_cursor_bits. 109 (hollow_rectangle_bits): Rename from hollow_box_cursor_bits.
65 (filled_square_bits): Added. 110 (filled_square_bits): Add.
66 (vertical_bar_bits): Rename from bar_cursor_bits. 111 (vertical_bar_bits): Rename from bar_cursor_bits.
67 (horizontal_bar_bits): Rename from hbar_cursor_bits. 112 (horizontal_bar_bits): Rename from hbar_cursor_bits.
68 (empty_line_bits): Rename from zv_bits. 113 (empty_line_bits): Rename from zv_bits.
diff --git a/src/dispnew.c b/src/dispnew.c
index 18f949ebe2d..999877001d2 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -4344,10 +4344,14 @@ update_text_area (w, vpos)
4344 int overlapping_glyphs_p = current_row->contains_overlapping_glyphs_p; 4344 int overlapping_glyphs_p = current_row->contains_overlapping_glyphs_p;
4345 int desired_stop_pos = desired_row->used[TEXT_AREA]; 4345 int desired_stop_pos = desired_row->used[TEXT_AREA];
4346 4346
4347 /* If the desired row extends its face to the text area end, 4347 /* If the desired row extends its face to the text area end, and
4348 unless the current row also does so at the same position,
4348 make sure we write at least one glyph, so that the face 4349 make sure we write at least one glyph, so that the face
4349 extension actually takes place. */ 4350 extension actually takes place. */
4350 if (MATRIX_ROW_EXTENDS_FACE_P (desired_row)) 4351 if (MATRIX_ROW_EXTENDS_FACE_P (desired_row)
4352 && (desired_stop_pos < current_row->used[TEXT_AREA]
4353 || (desired_stop_pos == current_row->used[TEXT_AREA]
4354 && !MATRIX_ROW_EXTENDS_FACE_P (current_row))))
4351 --desired_stop_pos; 4355 --desired_stop_pos;
4352 4356
4353 stop = min (current_row->used[TEXT_AREA], desired_stop_pos); 4357 stop = min (current_row->used[TEXT_AREA], desired_stop_pos);
@@ -4466,7 +4470,10 @@ update_text_area (w, vpos)
4466 has to be cleared, if and only if we did a write_glyphs 4470 has to be cleared, if and only if we did a write_glyphs
4467 above. This is made sure by setting desired_stop_pos 4471 above. This is made sure by setting desired_stop_pos
4468 appropriately above. */ 4472 appropriately above. */
4469 xassert (i < desired_row->used[TEXT_AREA]); 4473 xassert (i < desired_row->used[TEXT_AREA]
4474 || ((desired_row->used[TEXT_AREA]
4475 == current_row->used[TEXT_AREA])
4476 && MATRIX_ROW_EXTENDS_FACE_P (current_row)));
4470 } 4477 }
4471 else if (MATRIX_ROW_EXTENDS_FACE_P (current_row)) 4478 else if (MATRIX_ROW_EXTENDS_FACE_P (current_row))
4472 { 4479 {
diff --git a/src/indent.c b/src/indent.c
index 22b6fc37669..ae28fa3791d 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -2107,7 +2107,8 @@ whether or not it is currently displayed in some window. */)
2107 it.vpos = 0; 2107 it.vpos = 0;
2108 /* Do this even if LINES is 0, so that we move back 2108 /* Do this even if LINES is 0, so that we move back
2109 to the beginning of the current line as we ought. */ 2109 to the beginning of the current line as we ought. */
2110 move_it_by_lines (&it, XINT (lines), 0); 2110 if (XINT (lines) >= 0 || IT_CHARPOS (it) > 0)
2111 move_it_by_lines (&it, XINT (lines), 0);
2111 2112
2112 SET_PT_BOTH (IT_CHARPOS (it), IT_BYTEPOS (it)); 2113 SET_PT_BOTH (IT_CHARPOS (it), IT_BYTEPOS (it));
2113 } 2114 }
diff --git a/src/macgui.h b/src/macgui.h
index cfe35e82945..a84fea1ae91 100644
--- a/src/macgui.h
+++ b/src/macgui.h
@@ -217,13 +217,13 @@ typedef struct _XGC
217 RGBColor back_color; 217 RGBColor back_color;
218 218
219#define MAX_CLIP_RECTS 2 219#define MAX_CLIP_RECTS 2
220 /* QuickDraw clipping region. */ 220 /* Number of clipping rectangles. */
221 int n_clip_rects;
222
223 /* QuickDraw clipping region. Ignored if n_clip_rects == 0. */
221 RgnHandle clip_region; 224 RgnHandle clip_region;
222 225
223#if defined (MAC_OSX) && USE_ATSUI 226#if defined (MAC_OSX) && USE_ATSUI
224 /* Number of clipping rectangles used in Quartz 2D drawing. */
225 int n_clip_rects;
226
227 /* Clipping rectangles used in Quartz 2D drawing. The y-coordinate 227 /* Clipping rectangles used in Quartz 2D drawing. The y-coordinate
228 is in QuickDraw's. */ 228 is in QuickDraw's. */
229 CGRect clip_rects[MAX_CLIP_RECTS]; 229 CGRect clip_rects[MAX_CLIP_RECTS];
diff --git a/src/macmenu.c b/src/macmenu.c
index fccbbe6402c..8cce41114de 100644
--- a/src/macmenu.c
+++ b/src/macmenu.c
@@ -1257,8 +1257,11 @@ digest_single_submenu (start, end, top_level_items)
1257 wv->enabled = 1; 1257 wv->enabled = 1;
1258 wv->button_type = BUTTON_TYPE_NONE; 1258 wv->button_type = BUTTON_TYPE_NONE;
1259 wv->help = Qnil; 1259 wv->help = Qnil;
1260 save_wv = wv;
1260 } 1261 }
1261 save_wv = wv; 1262 else
1263 save_wv = first_wv;
1264
1262 prev_wv = 0; 1265 prev_wv = 0;
1263 i += MENU_ITEMS_PANE_LENGTH; 1266 i += MENU_ITEMS_PANE_LENGTH;
1264 } 1267 }
diff --git a/src/macterm.c b/src/macterm.c
index 78ea90bfc8b..5f7c5dac637 100644
--- a/src/macterm.c
+++ b/src/macterm.c
@@ -269,14 +269,13 @@ extern void menubar_selection_callback (FRAME_PTR, int);
269#define GC_FORE_COLOR(gc) (&(gc)->fore_color) 269#define GC_FORE_COLOR(gc) (&(gc)->fore_color)
270#define GC_BACK_COLOR(gc) (&(gc)->back_color) 270#define GC_BACK_COLOR(gc) (&(gc)->back_color)
271#define GC_FONT(gc) ((gc)->xgcv.font) 271#define GC_FONT(gc) ((gc)->xgcv.font)
272#define GC_CLIP_REGION(gc) ((gc)->clip_region)
273#define FRAME_NORMAL_GC(f) ((f)->output_data.mac->normal_gc) 272#define FRAME_NORMAL_GC(f) ((f)->output_data.mac->normal_gc)
274 273
275static RgnHandle saved_port_clip_region = NULL; 274static RgnHandle saved_port_clip_region = NULL;
276 275
277static void 276static void
278mac_begin_clip (region) 277mac_begin_clip (gc)
279 RgnHandle region; 278 GC gc;
280{ 279{
281 static RgnHandle new_region = NULL; 280 static RgnHandle new_region = NULL;
282 281
@@ -285,19 +284,19 @@ mac_begin_clip (region)
285 if (new_region == NULL) 284 if (new_region == NULL)
286 new_region = NewRgn (); 285 new_region = NewRgn ();
287 286
288 if (region && !EmptyRgn (region)) 287 if (gc->n_clip_rects)
289 { 288 {
290 GetClip (saved_port_clip_region); 289 GetClip (saved_port_clip_region);
291 SectRgn (saved_port_clip_region, region, new_region); 290 SectRgn (saved_port_clip_region, gc->clip_region, new_region);
292 SetClip (new_region); 291 SetClip (new_region);
293 } 292 }
294} 293}
295 294
296static void 295static void
297mac_end_clip (region) 296mac_end_clip (gc)
298 RgnHandle region; 297 GC gc;
299{ 298{
300 if (region && !EmptyRgn (region)) 299 if (gc->n_clip_rects)
301 SetClip (saved_port_clip_region); 300 SetClip (saved_port_clip_region);
302} 301}
303 302
@@ -325,10 +324,10 @@ mac_draw_line (f, gc, x1, y1, x2, y2)
325 324
326 RGBForeColor (GC_FORE_COLOR (gc)); 325 RGBForeColor (GC_FORE_COLOR (gc));
327 326
328 mac_begin_clip (GC_CLIP_REGION (gc)); 327 mac_begin_clip (gc);
329 MoveTo (x1, y1); 328 MoveTo (x1, y1);
330 LineTo (x2, y2); 329 LineTo (x2, y2);
331 mac_end_clip (GC_CLIP_REGION (gc)); 330 mac_end_clip (gc);
332} 331}
333 332
334void 333void
@@ -369,9 +368,9 @@ mac_erase_rectangle (f, gc, x, y, width, height)
369 RGBBackColor (GC_BACK_COLOR (gc)); 368 RGBBackColor (GC_BACK_COLOR (gc));
370 SetRect (&r, x, y, x + width, y + height); 369 SetRect (&r, x, y, x + width, y + height);
371 370
372 mac_begin_clip (GC_CLIP_REGION (gc)); 371 mac_begin_clip (gc);
373 EraseRect (&r); 372 EraseRect (&r);
374 mac_end_clip (GC_CLIP_REGION (gc)); 373 mac_end_clip (gc);
375 374
376 RGBBackColor (GC_BACK_COLOR (FRAME_NORMAL_GC (f))); 375 RGBBackColor (GC_BACK_COLOR (FRAME_NORMAL_GC (f)));
377} 376}
@@ -434,7 +433,7 @@ mac_draw_bitmap (f, gc, x, y, width, height, bits, overlay_p)
434 RGBBackColor (GC_BACK_COLOR (gc)); 433 RGBBackColor (GC_BACK_COLOR (gc));
435 SetRect (&r, x, y, x + width, y + height); 434 SetRect (&r, x, y, x + width, y + height);
436 435
437 mac_begin_clip (GC_CLIP_REGION (gc)); 436 mac_begin_clip (gc);
438#if TARGET_API_MAC_CARBON 437#if TARGET_API_MAC_CARBON
439 { 438 {
440 CGrafPtr port; 439 CGrafPtr port;
@@ -449,7 +448,7 @@ mac_draw_bitmap (f, gc, x, y, width, height, bits, overlay_p)
449 CopyBits (&bitmap, &(FRAME_MAC_WINDOW (f)->portBits), &(bitmap.bounds), &r, 448 CopyBits (&bitmap, &(FRAME_MAC_WINDOW (f)->portBits), &(bitmap.bounds), &r,
450 overlay_p ? srcOr : srcCopy, 0); 449 overlay_p ? srcOr : srcCopy, 0);
451#endif /* not TARGET_API_MAC_CARBON */ 450#endif /* not TARGET_API_MAC_CARBON */
452 mac_end_clip (GC_CLIP_REGION (gc)); 451 mac_end_clip (gc);
453 452
454 RGBBackColor (GC_BACK_COLOR (FRAME_NORMAL_GC (f))); 453 RGBBackColor (GC_BACK_COLOR (FRAME_NORMAL_GC (f)));
455} 454}
@@ -581,9 +580,9 @@ mac_fill_rectangle (f, gc, x, y, width, height)
581 RGBForeColor (GC_FORE_COLOR (gc)); 580 RGBForeColor (GC_FORE_COLOR (gc));
582 SetRect (&r, x, y, x + width, y + height); 581 SetRect (&r, x, y, x + width, y + height);
583 582
584 mac_begin_clip (GC_CLIP_REGION (gc)); 583 mac_begin_clip (gc);
585 PaintRect (&r); /* using foreground color of gc */ 584 PaintRect (&r); /* using foreground color of gc */
586 mac_end_clip (GC_CLIP_REGION (gc)); 585 mac_end_clip (gc);
587} 586}
588 587
589 588
@@ -603,9 +602,9 @@ mac_draw_rectangle (f, gc, x, y, width, height)
603 RGBForeColor (GC_FORE_COLOR (gc)); 602 RGBForeColor (GC_FORE_COLOR (gc));
604 SetRect (&r, x, y, x + width + 1, y + height + 1); 603 SetRect (&r, x, y, x + width + 1, y + height + 1);
605 604
606 mac_begin_clip (GC_CLIP_REGION (gc)); 605 mac_begin_clip (gc);
607 FrameRect (&r); /* using foreground color of gc */ 606 FrameRect (&r); /* using foreground color of gc */
608 mac_end_clip (GC_CLIP_REGION (gc)); 607 mac_end_clip (gc);
609} 608}
610 609
611 610
@@ -720,7 +719,7 @@ mac_draw_string_common (f, gc, x, y, buf, nchars, bg_width, bytes_per_char)
720 if (!mac_use_core_graphics) 719 if (!mac_use_core_graphics)
721 { 720 {
722#endif 721#endif
723 mac_begin_clip (GC_CLIP_REGION (gc)); 722 mac_begin_clip (gc);
724 RGBForeColor (GC_FORE_COLOR (gc)); 723 RGBForeColor (GC_FORE_COLOR (gc));
725 if (bg_width) 724 if (bg_width)
726 { 725 {
@@ -736,7 +735,7 @@ mac_draw_string_common (f, gc, x, y, buf, nchars, bg_width, bytes_per_char)
736 ATSUDrawText (text_layout, 735 ATSUDrawText (text_layout,
737 kATSUFromTextBeginning, kATSUToTextEnd, 736 kATSUFromTextBeginning, kATSUToTextEnd,
738 kATSUUseGrafPortPenLoc, kATSUUseGrafPortPenLoc); 737 kATSUUseGrafPortPenLoc, kATSUUseGrafPortPenLoc);
739 mac_end_clip (GC_CLIP_REGION (gc)); 738 mac_end_clip (gc);
740#ifdef MAC_OSX 739#ifdef MAC_OSX
741 } 740 }
742 else 741 else
@@ -809,7 +808,7 @@ mac_draw_string_common (f, gc, x, y, buf, nchars, bg_width, bytes_per_char)
809 if (mac_use_core_graphics) 808 if (mac_use_core_graphics)
810 savedFlags = SwapQDTextFlags (kQDUseCGTextRendering); 809 savedFlags = SwapQDTextFlags (kQDUseCGTextRendering);
811#endif 810#endif
812 mac_begin_clip (GC_CLIP_REGION (gc)); 811 mac_begin_clip (gc);
813 RGBForeColor (GC_FORE_COLOR (gc)); 812 RGBForeColor (GC_FORE_COLOR (gc));
814#ifdef MAC_OS8 813#ifdef MAC_OS8
815 if (bg_width) 814 if (bg_width)
@@ -845,7 +844,7 @@ mac_draw_string_common (f, gc, x, y, buf, nchars, bg_width, bytes_per_char)
845 DrawText (buf, 0, nchars * bytes_per_char); 844 DrawText (buf, 0, nchars * bytes_per_char);
846 if (bg_width) 845 if (bg_width)
847 RGBBackColor (GC_BACK_COLOR (FRAME_NORMAL_GC (f))); 846 RGBBackColor (GC_BACK_COLOR (FRAME_NORMAL_GC (f)));
848 mac_end_clip (GC_CLIP_REGION (gc)); 847 mac_end_clip (gc);
849 848
850#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1020 849#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1020
851 if (mac_use_core_graphics) 850 if (mac_use_core_graphics)
@@ -1187,7 +1186,7 @@ mac_copy_area (src, f, gc, src_x, src_y, width, height, dest_x, dest_y)
1187 ForeColor (blackColor); 1186 ForeColor (blackColor);
1188 BackColor (whiteColor); 1187 BackColor (whiteColor);
1189 1188
1190 mac_begin_clip (GC_CLIP_REGION (gc)); 1189 mac_begin_clip (gc);
1191 LockPixels (GetGWorldPixMap (src)); 1190 LockPixels (GetGWorldPixMap (src));
1192#if TARGET_API_MAC_CARBON 1191#if TARGET_API_MAC_CARBON
1193 { 1192 {
@@ -1205,7 +1204,7 @@ mac_copy_area (src, f, gc, src_x, src_y, width, height, dest_x, dest_y)
1205 &src_r, &dest_r, srcCopy, 0); 1204 &src_r, &dest_r, srcCopy, 0);
1206#endif /* not TARGET_API_MAC_CARBON */ 1205#endif /* not TARGET_API_MAC_CARBON */
1207 UnlockPixels (GetGWorldPixMap (src)); 1206 UnlockPixels (GetGWorldPixMap (src));
1208 mac_end_clip (GC_CLIP_REGION (gc)); 1207 mac_end_clip (gc);
1209 1208
1210 RGBBackColor (GC_BACK_COLOR (FRAME_NORMAL_GC (f))); 1209 RGBBackColor (GC_BACK_COLOR (FRAME_NORMAL_GC (f)));
1211} 1210}
@@ -1231,7 +1230,7 @@ mac_copy_area_with_mask (src, mask, f, gc, src_x, src_y,
1231 ForeColor (blackColor); 1230 ForeColor (blackColor);
1232 BackColor (whiteColor); 1231 BackColor (whiteColor);
1233 1232
1234 mac_begin_clip (GC_CLIP_REGION (gc)); 1233 mac_begin_clip (gc);
1235 LockPixels (GetGWorldPixMap (src)); 1234 LockPixels (GetGWorldPixMap (src));
1236 LockPixels (GetGWorldPixMap (mask)); 1235 LockPixels (GetGWorldPixMap (mask));
1237#if TARGET_API_MAC_CARBON 1236#if TARGET_API_MAC_CARBON
@@ -1251,7 +1250,7 @@ mac_copy_area_with_mask (src, mask, f, gc, src_x, src_y,
1251#endif /* not TARGET_API_MAC_CARBON */ 1250#endif /* not TARGET_API_MAC_CARBON */
1252 UnlockPixels (GetGWorldPixMap (mask)); 1251 UnlockPixels (GetGWorldPixMap (mask));
1253 UnlockPixels (GetGWorldPixMap (src)); 1252 UnlockPixels (GetGWorldPixMap (src));
1254 mac_end_clip (GC_CLIP_REGION (gc)); 1253 mac_end_clip (gc);
1255 1254
1256 RGBBackColor (GC_BACK_COLOR (FRAME_NORMAL_GC (f))); 1255 RGBBackColor (GC_BACK_COLOR (FRAME_NORMAL_GC (f)));
1257} 1256}
@@ -1289,9 +1288,9 @@ mac_scroll_area (f, gc, src_x, src_y, width, height, dest_x, dest_y)
1289 color mapping in CopyBits. Otherwise, it will be slow. */ 1288 color mapping in CopyBits. Otherwise, it will be slow. */
1290 ForeColor (blackColor); 1289 ForeColor (blackColor);
1291 BackColor (whiteColor); 1290 BackColor (whiteColor);
1292 mac_begin_clip (GC_CLIP_REGION (gc)); 1291 mac_begin_clip (gc);
1293 CopyBits (&(w->portBits), &(w->portBits), &src_r, &dest_r, srcCopy, 0); 1292 CopyBits (&(w->portBits), &(w->portBits), &src_r, &dest_r, srcCopy, 0);
1294 mac_end_clip (GC_CLIP_REGION (gc)); 1293 mac_end_clip (gc);
1295 1294
1296 RGBBackColor (GC_BACK_COLOR (FRAME_NORMAL_GC (f))); 1295 RGBBackColor (GC_BACK_COLOR (FRAME_NORMAL_GC (f)));
1297#endif /* not TARGET_API_MAC_CARBON */ 1296#endif /* not TARGET_API_MAC_CARBON */
@@ -1427,14 +1426,10 @@ mac_set_clip_rectangles (display, gc, rectangles, n)
1427{ 1426{
1428 int i; 1427 int i;
1429 1428
1430 if (n < 0 || n > MAX_CLIP_RECTS) 1429 xassert (n >= 0 && n <= MAX_CLIP_RECTS);
1431 abort (); 1430
1432 if (n == 0) 1431 gc->n_clip_rects = n;
1433 { 1432 if (n > 0)
1434 if (gc->clip_region)
1435 SetEmptyRgn (gc->clip_region);
1436 }
1437 else
1438 { 1433 {
1439 if (gc->clip_region == NULL) 1434 if (gc->clip_region == NULL)
1440 gc->clip_region = NewRgn (); 1435 gc->clip_region = NewRgn ();
@@ -1452,8 +1447,6 @@ mac_set_clip_rectangles (display, gc, rectangles, n)
1452 } 1447 }
1453 } 1448 }
1454#if defined (MAC_OSX) && USE_ATSUI 1449#if defined (MAC_OSX) && USE_ATSUI
1455 gc->n_clip_rects = n;
1456
1457 for (i = 0; i < n; i++) 1450 for (i = 0; i < n; i++)
1458 { 1451 {
1459 Rect *rect = rectangles + i; 1452 Rect *rect = rectangles + i;
@@ -1473,7 +1466,7 @@ mac_reset_clip_rectangles (display, gc)
1473 Display *display; 1466 Display *display;
1474 GC gc; 1467 GC gc;
1475{ 1468{
1476 mac_set_clip_rectangles (display, gc, NULL, 0); 1469 gc->n_clip_rects = 0;
1477} 1470}
1478 1471
1479 1472
@@ -4538,7 +4531,6 @@ x_set_toolkit_scroll_bar_thumb (bar, portion, position, whole)
4538 int portion, position, whole; 4531 int portion, position, whole;
4539{ 4532{
4540 ControlHandle ch = SCROLL_BAR_CONTROL_HANDLE (bar); 4533 ControlHandle ch = SCROLL_BAR_CONTROL_HANDLE (bar);
4541
4542 int value, viewsize, maximum; 4534 int value, viewsize, maximum;
4543 4535
4544 if (whole == 0 || XINT (bar->track_height) == 0) 4536 if (whole == 0 || XINT (bar->track_height) == 0)
@@ -4552,10 +4544,20 @@ x_set_toolkit_scroll_bar_thumb (bar, portion, position, whole)
4552 4544
4553 BLOCK_INPUT; 4545 BLOCK_INPUT;
4554 4546
4555 SetControl32BitMinimum (ch, 0); 4547 if (IsControlVisible (ch)
4556 SetControl32BitMaximum (ch, maximum); 4548 && (GetControlViewSize (ch) != viewsize
4557 SetControl32BitValue (ch, value); 4549 || GetControl32BitValue (ch) != value
4558 SetControlViewSize (ch, viewsize); 4550 || GetControl32BitMaximum (ch) != maximum))
4551 {
4552 /* Temporarily hide the scroll bar to avoid multiple redraws. */
4553 SetControlVisibility (ch, false, false);
4554
4555 SetControl32BitMaximum (ch, maximum);
4556 SetControl32BitValue (ch, value);
4557 SetControlViewSize (ch, viewsize);
4558
4559 SetControlVisibility (ch, true, true);
4560 }
4559 4561
4560 UNBLOCK_INPUT; 4562 UNBLOCK_INPUT;
4561} 4563}
diff --git a/src/window.c b/src/window.c
index bd5a393b599..e4c8d0612cb 100644
--- a/src/window.c
+++ b/src/window.c
@@ -1861,7 +1861,8 @@ MINIBUF neither nil nor t means never include the minibuffer window. */)
1861 Lisp_Object frame, minibuf, window; 1861 Lisp_Object frame, minibuf, window;
1862{ 1862{
1863 if (NILP (window)) 1863 if (NILP (window))
1864 window = selected_window; 1864 window = FRAMEP (frame) ? XFRAME (frame)->selected_window : selected_window;
1865 CHECK_WINDOW (window);
1865 if (NILP (frame)) 1866 if (NILP (frame))
1866 frame = selected_frame; 1867 frame = selected_frame;
1867 1868