diff options
| author | Miles Bader | 2006-02-24 08:08:56 +0000 |
|---|---|---|
| committer | Miles Bader | 2006-02-24 08:08:56 +0000 |
| commit | 5432dcf9e0da4e2c38dee53fbe8423ff5f06bed6 (patch) | |
| tree | 94e98550d534fbb93def22ee0d458518ebe6c7f1 /src/macterm.c | |
| parent | e2a3e3535794bf99969d8f93018a85f4d8678c3d (diff) | |
| parent | 5f4264e54bb59b9b0590a113fbd015c3c0920f7a (diff) | |
| download | emacs-5432dcf9e0da4e2c38dee53fbe8423ff5f06bed6.tar.gz emacs-5432dcf9e0da4e2c38dee53fbe8423ff5f06bed6.zip | |
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-23
Merge from emacs--devo--0
Patches applied:
* emacs--devo--0 (patch 113-118)
- Update from CVS
- Merge from gnus--rel--5.10
* gnus--rel--5.10 (patch 38-39)
- Update from CVS
Diffstat (limited to 'src/macterm.c')
| -rw-r--r-- | src/macterm.c | 90 |
1 files changed, 46 insertions, 44 deletions
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 | ||
| 275 | static RgnHandle saved_port_clip_region = NULL; | 274 | static RgnHandle saved_port_clip_region = NULL; |
| 276 | 275 | ||
| 277 | static void | 276 | static void |
| 278 | mac_begin_clip (region) | 277 | mac_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 | ||
| 296 | static void | 295 | static void |
| 297 | mac_end_clip (region) | 296 | mac_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 | ||
| 334 | void | 333 | void |
| @@ -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 | } |