diff options
| author | YAMAMOTO Mitsuharu | 2006-02-22 08:00:12 +0000 |
|---|---|---|
| committer | YAMAMOTO Mitsuharu | 2006-02-22 08:00:12 +0000 |
| commit | b6e3efe044c0afb0b0a0c01c1cb846dde058adbc (patch) | |
| tree | 0768f3e3b0f7317836a4869ffcf93b0e95f93cfd /src | |
| parent | e188aa29a937c53de32fd52c56e6c7fc8ca0c528 (diff) | |
| download | emacs-b6e3efe044c0afb0b0a0c01c1cb846dde058adbc.tar.gz emacs-b6e3efe044c0afb0b0a0c01c1cb846dde058adbc.zip | |
(GC_CLIP_REGION): Remove macro.
(mac_begin_clip, mac_end_clip): Take arg GC instead of REGION.
All uses changed. Don't do clipping if n_clip_rects is zero.
(mac_set_clip_rectangles): Use xassert instead of abort. Set
n_clip_rects. Don't make clip_region empty when number of
clipping rectangles is zero.
(mac_reset_clip_rectangles): Set n_clip_rects directly instead of
calling mac_set_clip_rectangles.
(x_set_toolkit_scroll_bar_thumb): Temporarily hide scroll bar to
avoid multiple redraws.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 19 | ||||
| -rw-r--r-- | src/macterm.c | 80 |
2 files changed, 58 insertions, 41 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 6df63457d77..d6a1ec83313 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,22 @@ | |||
| 1 | 2006-02-22 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | ||
| 2 | |||
| 3 | * macgui.h (struct _XGC) [!MAC_OSX || !USE_ATSUI]: New member | ||
| 4 | n_clip_rects. | ||
| 5 | |||
| 6 | * macmenu.c (digest_single_submenu): Apply 2006-02-19 change for | ||
| 7 | xmenu.c. | ||
| 8 | |||
| 9 | * macterm.c (GC_CLIP_REGION): Remove macro. | ||
| 10 | (mac_begin_clip, mac_end_clip): Take arg GC instead of REGION. | ||
| 11 | All uses changed. Don't do clipping if n_clip_rects is zero. | ||
| 12 | (mac_set_clip_rectangles): Use xassert instead of abort. Set | ||
| 13 | n_clip_rects. Don't make clip_region empty when number of | ||
| 14 | clipping rectangles is zero. | ||
| 15 | (mac_reset_clip_rectangles): Set n_clip_rects directly instead of | ||
| 16 | calling mac_set_clip_rectangles. | ||
| 17 | (x_set_toolkit_scroll_bar_thumb): Temporarily hide scroll bar to | ||
| 18 | avoid multiple redraws. | ||
| 19 | |||
| 1 | 2006-02-22 Kim F. Storm <storm@cua.dk> | 20 | 2006-02-22 Kim F. Storm <storm@cua.dk> |
| 2 | 21 | ||
| 3 | * fringe.c (draw_fringe_bitmap): Fix overlay-arrow display. | 22 | * fringe.c (draw_fringe_bitmap): Fix overlay-arrow display. |
diff --git a/src/macterm.c b/src/macterm.c index 40a20026bd2..5fd416be6b8 100644 --- a/src/macterm.c +++ b/src/macterm.c | |||
| @@ -267,14 +267,13 @@ extern void menubar_selection_callback (FRAME_PTR, int); | |||
| 267 | #define GC_FORE_COLOR(gc) (&(gc)->fore_color) | 267 | #define GC_FORE_COLOR(gc) (&(gc)->fore_color) |
| 268 | #define GC_BACK_COLOR(gc) (&(gc)->back_color) | 268 | #define GC_BACK_COLOR(gc) (&(gc)->back_color) |
| 269 | #define GC_FONT(gc) ((gc)->xgcv.font) | 269 | #define GC_FONT(gc) ((gc)->xgcv.font) |
| 270 | #define GC_CLIP_REGION(gc) ((gc)->clip_region) | ||
| 271 | #define FRAME_NORMAL_GC(f) ((f)->output_data.mac->normal_gc) | 270 | #define FRAME_NORMAL_GC(f) ((f)->output_data.mac->normal_gc) |
| 272 | 271 | ||
| 273 | static RgnHandle saved_port_clip_region = NULL; | 272 | static RgnHandle saved_port_clip_region = NULL; |
| 274 | 273 | ||
| 275 | static void | 274 | static void |
| 276 | mac_begin_clip (region) | 275 | mac_begin_clip (gc) |
| 277 | RgnHandle region; | 276 | GC gc; |
| 278 | { | 277 | { |
| 279 | static RgnHandle new_region = NULL; | 278 | static RgnHandle new_region = NULL; |
| 280 | 279 | ||
| @@ -283,19 +282,19 @@ mac_begin_clip (region) | |||
| 283 | if (new_region == NULL) | 282 | if (new_region == NULL) |
| 284 | new_region = NewRgn (); | 283 | new_region = NewRgn (); |
| 285 | 284 | ||
| 286 | if (region && !EmptyRgn (region)) | 285 | if (gc->n_clip_rects) |
| 287 | { | 286 | { |
| 288 | GetClip (saved_port_clip_region); | 287 | GetClip (saved_port_clip_region); |
| 289 | SectRgn (saved_port_clip_region, region, new_region); | 288 | SectRgn (saved_port_clip_region, gc->clip_region, new_region); |
| 290 | SetClip (new_region); | 289 | SetClip (new_region); |
| 291 | } | 290 | } |
| 292 | } | 291 | } |
| 293 | 292 | ||
| 294 | static void | 293 | static void |
| 295 | mac_end_clip (region) | 294 | mac_end_clip (gc) |
| 296 | RgnHandle region; | 295 | GC gc; |
| 297 | { | 296 | { |
| 298 | if (region && !EmptyRgn (region)) | 297 | if (gc->n_clip_rects) |
| 299 | SetClip (saved_port_clip_region); | 298 | SetClip (saved_port_clip_region); |
| 300 | } | 299 | } |
| 301 | 300 | ||
| @@ -323,10 +322,10 @@ mac_draw_line (f, gc, x1, y1, x2, y2) | |||
| 323 | 322 | ||
| 324 | RGBForeColor (GC_FORE_COLOR (gc)); | 323 | RGBForeColor (GC_FORE_COLOR (gc)); |
| 325 | 324 | ||
| 326 | mac_begin_clip (GC_CLIP_REGION (gc)); | 325 | mac_begin_clip (gc); |
| 327 | MoveTo (x1, y1); | 326 | MoveTo (x1, y1); |
| 328 | LineTo (x2, y2); | 327 | LineTo (x2, y2); |
| 329 | mac_end_clip (GC_CLIP_REGION (gc)); | 328 | mac_end_clip (gc); |
| 330 | } | 329 | } |
| 331 | 330 | ||
| 332 | void | 331 | void |
| @@ -367,9 +366,9 @@ mac_erase_rectangle (f, gc, x, y, width, height) | |||
| 367 | RGBBackColor (GC_BACK_COLOR (gc)); | 366 | RGBBackColor (GC_BACK_COLOR (gc)); |
| 368 | SetRect (&r, x, y, x + width, y + height); | 367 | SetRect (&r, x, y, x + width, y + height); |
| 369 | 368 | ||
| 370 | mac_begin_clip (GC_CLIP_REGION (gc)); | 369 | mac_begin_clip (gc); |
| 371 | EraseRect (&r); | 370 | EraseRect (&r); |
| 372 | mac_end_clip (GC_CLIP_REGION (gc)); | 371 | mac_end_clip (gc); |
| 373 | 372 | ||
| 374 | RGBBackColor (GC_BACK_COLOR (FRAME_NORMAL_GC (f))); | 373 | RGBBackColor (GC_BACK_COLOR (FRAME_NORMAL_GC (f))); |
| 375 | } | 374 | } |
| @@ -432,7 +431,7 @@ mac_draw_bitmap (f, gc, x, y, width, height, bits, overlay_p) | |||
| 432 | RGBBackColor (GC_BACK_COLOR (gc)); | 431 | RGBBackColor (GC_BACK_COLOR (gc)); |
| 433 | SetRect (&r, x, y, x + width, y + height); | 432 | SetRect (&r, x, y, x + width, y + height); |
| 434 | 433 | ||
| 435 | mac_begin_clip (GC_CLIP_REGION (gc)); | 434 | mac_begin_clip (gc); |
| 436 | #if TARGET_API_MAC_CARBON | 435 | #if TARGET_API_MAC_CARBON |
| 437 | { | 436 | { |
| 438 | CGrafPtr port; | 437 | CGrafPtr port; |
| @@ -447,7 +446,7 @@ mac_draw_bitmap (f, gc, x, y, width, height, bits, overlay_p) | |||
| 447 | CopyBits (&bitmap, &(FRAME_MAC_WINDOW (f)->portBits), &(bitmap.bounds), &r, | 446 | CopyBits (&bitmap, &(FRAME_MAC_WINDOW (f)->portBits), &(bitmap.bounds), &r, |
| 448 | overlay_p ? srcOr : srcCopy, 0); | 447 | overlay_p ? srcOr : srcCopy, 0); |
| 449 | #endif /* not TARGET_API_MAC_CARBON */ | 448 | #endif /* not TARGET_API_MAC_CARBON */ |
| 450 | mac_end_clip (GC_CLIP_REGION (gc)); | 449 | mac_end_clip (gc); |
| 451 | 450 | ||
| 452 | RGBBackColor (GC_BACK_COLOR (FRAME_NORMAL_GC (f))); | 451 | RGBBackColor (GC_BACK_COLOR (FRAME_NORMAL_GC (f))); |
| 453 | } | 452 | } |
| @@ -579,9 +578,9 @@ mac_fill_rectangle (f, gc, x, y, width, height) | |||
| 579 | RGBForeColor (GC_FORE_COLOR (gc)); | 578 | RGBForeColor (GC_FORE_COLOR (gc)); |
| 580 | SetRect (&r, x, y, x + width, y + height); | 579 | SetRect (&r, x, y, x + width, y + height); |
| 581 | 580 | ||
| 582 | mac_begin_clip (GC_CLIP_REGION (gc)); | 581 | mac_begin_clip (gc); |
| 583 | PaintRect (&r); /* using foreground color of gc */ | 582 | PaintRect (&r); /* using foreground color of gc */ |
| 584 | mac_end_clip (GC_CLIP_REGION (gc)); | 583 | mac_end_clip (gc); |
| 585 | } | 584 | } |
| 586 | 585 | ||
| 587 | 586 | ||
| @@ -601,9 +600,9 @@ mac_draw_rectangle (f, gc, x, y, width, height) | |||
| 601 | RGBForeColor (GC_FORE_COLOR (gc)); | 600 | RGBForeColor (GC_FORE_COLOR (gc)); |
| 602 | SetRect (&r, x, y, x + width + 1, y + height + 1); | 601 | SetRect (&r, x, y, x + width + 1, y + height + 1); |
| 603 | 602 | ||
| 604 | mac_begin_clip (GC_CLIP_REGION (gc)); | 603 | mac_begin_clip (gc); |
| 605 | FrameRect (&r); /* using foreground color of gc */ | 604 | FrameRect (&r); /* using foreground color of gc */ |
| 606 | mac_end_clip (GC_CLIP_REGION (gc)); | 605 | mac_end_clip (gc); |
| 607 | } | 606 | } |
| 608 | 607 | ||
| 609 | 608 | ||
| @@ -718,7 +717,7 @@ mac_draw_string_common (f, gc, x, y, buf, nchars, bg_width, bytes_per_char) | |||
| 718 | if (!mac_use_core_graphics) | 717 | if (!mac_use_core_graphics) |
| 719 | { | 718 | { |
| 720 | #endif | 719 | #endif |
| 721 | mac_begin_clip (GC_CLIP_REGION (gc)); | 720 | mac_begin_clip (gc); |
| 722 | RGBForeColor (GC_FORE_COLOR (gc)); | 721 | RGBForeColor (GC_FORE_COLOR (gc)); |
| 723 | if (bg_width) | 722 | if (bg_width) |
| 724 | { | 723 | { |
| @@ -734,7 +733,7 @@ mac_draw_string_common (f, gc, x, y, buf, nchars, bg_width, bytes_per_char) | |||
| 734 | ATSUDrawText (text_layout, | 733 | ATSUDrawText (text_layout, |
| 735 | kATSUFromTextBeginning, kATSUToTextEnd, | 734 | kATSUFromTextBeginning, kATSUToTextEnd, |
| 736 | kATSUUseGrafPortPenLoc, kATSUUseGrafPortPenLoc); | 735 | kATSUUseGrafPortPenLoc, kATSUUseGrafPortPenLoc); |
| 737 | mac_end_clip (GC_CLIP_REGION (gc)); | 736 | mac_end_clip (gc); |
| 738 | #ifdef MAC_OSX | 737 | #ifdef MAC_OSX |
| 739 | } | 738 | } |
| 740 | else | 739 | else |
| @@ -807,7 +806,7 @@ mac_draw_string_common (f, gc, x, y, buf, nchars, bg_width, bytes_per_char) | |||
| 807 | if (mac_use_core_graphics) | 806 | if (mac_use_core_graphics) |
| 808 | savedFlags = SwapQDTextFlags (kQDUseCGTextRendering); | 807 | savedFlags = SwapQDTextFlags (kQDUseCGTextRendering); |
| 809 | #endif | 808 | #endif |
| 810 | mac_begin_clip (GC_CLIP_REGION (gc)); | 809 | mac_begin_clip (gc); |
| 811 | RGBForeColor (GC_FORE_COLOR (gc)); | 810 | RGBForeColor (GC_FORE_COLOR (gc)); |
| 812 | #ifdef MAC_OS8 | 811 | #ifdef MAC_OS8 |
| 813 | if (bg_width) | 812 | if (bg_width) |
| @@ -843,7 +842,7 @@ mac_draw_string_common (f, gc, x, y, buf, nchars, bg_width, bytes_per_char) | |||
| 843 | DrawText (buf, 0, nchars * bytes_per_char); | 842 | DrawText (buf, 0, nchars * bytes_per_char); |
| 844 | if (bg_width) | 843 | if (bg_width) |
| 845 | RGBBackColor (GC_BACK_COLOR (FRAME_NORMAL_GC (f))); | 844 | RGBBackColor (GC_BACK_COLOR (FRAME_NORMAL_GC (f))); |
| 846 | mac_end_clip (GC_CLIP_REGION (gc)); | 845 | mac_end_clip (gc); |
| 847 | 846 | ||
| 848 | #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1020 | 847 | #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1020 |
| 849 | if (mac_use_core_graphics) | 848 | if (mac_use_core_graphics) |
| @@ -1185,7 +1184,7 @@ mac_copy_area (src, f, gc, src_x, src_y, width, height, dest_x, dest_y) | |||
| 1185 | ForeColor (blackColor); | 1184 | ForeColor (blackColor); |
| 1186 | BackColor (whiteColor); | 1185 | BackColor (whiteColor); |
| 1187 | 1186 | ||
| 1188 | mac_begin_clip (GC_CLIP_REGION (gc)); | 1187 | mac_begin_clip (gc); |
| 1189 | LockPixels (GetGWorldPixMap (src)); | 1188 | LockPixels (GetGWorldPixMap (src)); |
| 1190 | #if TARGET_API_MAC_CARBON | 1189 | #if TARGET_API_MAC_CARBON |
| 1191 | { | 1190 | { |
| @@ -1203,7 +1202,7 @@ mac_copy_area (src, f, gc, src_x, src_y, width, height, dest_x, dest_y) | |||
| 1203 | &src_r, &dest_r, srcCopy, 0); | 1202 | &src_r, &dest_r, srcCopy, 0); |
| 1204 | #endif /* not TARGET_API_MAC_CARBON */ | 1203 | #endif /* not TARGET_API_MAC_CARBON */ |
| 1205 | UnlockPixels (GetGWorldPixMap (src)); | 1204 | UnlockPixels (GetGWorldPixMap (src)); |
| 1206 | mac_end_clip (GC_CLIP_REGION (gc)); | 1205 | mac_end_clip (gc); |
| 1207 | 1206 | ||
| 1208 | RGBBackColor (GC_BACK_COLOR (FRAME_NORMAL_GC (f))); | 1207 | RGBBackColor (GC_BACK_COLOR (FRAME_NORMAL_GC (f))); |
| 1209 | } | 1208 | } |
| @@ -1229,7 +1228,7 @@ mac_copy_area_with_mask (src, mask, f, gc, src_x, src_y, | |||
| 1229 | ForeColor (blackColor); | 1228 | ForeColor (blackColor); |
| 1230 | BackColor (whiteColor); | 1229 | BackColor (whiteColor); |
| 1231 | 1230 | ||
| 1232 | mac_begin_clip (GC_CLIP_REGION (gc)); | 1231 | mac_begin_clip (gc); |
| 1233 | LockPixels (GetGWorldPixMap (src)); | 1232 | LockPixels (GetGWorldPixMap (src)); |
| 1234 | LockPixels (GetGWorldPixMap (mask)); | 1233 | LockPixels (GetGWorldPixMap (mask)); |
| 1235 | #if TARGET_API_MAC_CARBON | 1234 | #if TARGET_API_MAC_CARBON |
| @@ -1249,7 +1248,7 @@ mac_copy_area_with_mask (src, mask, f, gc, src_x, src_y, | |||
| 1249 | #endif /* not TARGET_API_MAC_CARBON */ | 1248 | #endif /* not TARGET_API_MAC_CARBON */ |
| 1250 | UnlockPixels (GetGWorldPixMap (mask)); | 1249 | UnlockPixels (GetGWorldPixMap (mask)); |
| 1251 | UnlockPixels (GetGWorldPixMap (src)); | 1250 | UnlockPixels (GetGWorldPixMap (src)); |
| 1252 | mac_end_clip (GC_CLIP_REGION (gc)); | 1251 | mac_end_clip (gc); |
| 1253 | 1252 | ||
| 1254 | RGBBackColor (GC_BACK_COLOR (FRAME_NORMAL_GC (f))); | 1253 | RGBBackColor (GC_BACK_COLOR (FRAME_NORMAL_GC (f))); |
| 1255 | } | 1254 | } |
| @@ -1287,9 +1286,9 @@ mac_scroll_area (f, gc, src_x, src_y, width, height, dest_x, dest_y) | |||
| 1287 | color mapping in CopyBits. Otherwise, it will be slow. */ | 1286 | color mapping in CopyBits. Otherwise, it will be slow. */ |
| 1288 | ForeColor (blackColor); | 1287 | ForeColor (blackColor); |
| 1289 | BackColor (whiteColor); | 1288 | BackColor (whiteColor); |
| 1290 | mac_begin_clip (GC_CLIP_REGION (gc)); | 1289 | mac_begin_clip (gc); |
| 1291 | CopyBits (&(w->portBits), &(w->portBits), &src_r, &dest_r, srcCopy, 0); | 1290 | CopyBits (&(w->portBits), &(w->portBits), &src_r, &dest_r, srcCopy, 0); |
| 1292 | mac_end_clip (GC_CLIP_REGION (gc)); | 1291 | mac_end_clip (gc); |
| 1293 | 1292 | ||
| 1294 | RGBBackColor (GC_BACK_COLOR (FRAME_NORMAL_GC (f))); | 1293 | RGBBackColor (GC_BACK_COLOR (FRAME_NORMAL_GC (f))); |
| 1295 | #endif /* not TARGET_API_MAC_CARBON */ | 1294 | #endif /* not TARGET_API_MAC_CARBON */ |
| @@ -1425,14 +1424,10 @@ mac_set_clip_rectangles (display, gc, rectangles, n) | |||
| 1425 | { | 1424 | { |
| 1426 | int i; | 1425 | int i; |
| 1427 | 1426 | ||
| 1428 | if (n < 0 || n > MAX_CLIP_RECTS) | 1427 | xassert (n >= 0 && n <= MAX_CLIP_RECTS); |
| 1429 | abort (); | 1428 | |
| 1430 | if (n == 0) | 1429 | gc->n_clip_rects = n; |
| 1431 | { | 1430 | if (n > 0) |
| 1432 | if (gc->clip_region) | ||
| 1433 | SetEmptyRgn (gc->clip_region); | ||
| 1434 | } | ||
| 1435 | else | ||
| 1436 | { | 1431 | { |
| 1437 | if (gc->clip_region == NULL) | 1432 | if (gc->clip_region == NULL) |
| 1438 | gc->clip_region = NewRgn (); | 1433 | gc->clip_region = NewRgn (); |
| @@ -1450,8 +1445,6 @@ mac_set_clip_rectangles (display, gc, rectangles, n) | |||
| 1450 | } | 1445 | } |
| 1451 | } | 1446 | } |
| 1452 | #if defined (MAC_OSX) && USE_ATSUI | 1447 | #if defined (MAC_OSX) && USE_ATSUI |
| 1453 | gc->n_clip_rects = n; | ||
| 1454 | |||
| 1455 | for (i = 0; i < n; i++) | 1448 | for (i = 0; i < n; i++) |
| 1456 | { | 1449 | { |
| 1457 | Rect *rect = rectangles + i; | 1450 | Rect *rect = rectangles + i; |
| @@ -1471,7 +1464,7 @@ mac_reset_clip_rectangles (display, gc) | |||
| 1471 | Display *display; | 1464 | Display *display; |
| 1472 | GC gc; | 1465 | GC gc; |
| 1473 | { | 1466 | { |
| 1474 | mac_set_clip_rectangles (display, gc, NULL, 0); | 1467 | gc->n_clip_rects = 0; |
| 1475 | } | 1468 | } |
| 1476 | 1469 | ||
| 1477 | 1470 | ||
| @@ -4536,8 +4529,7 @@ x_set_toolkit_scroll_bar_thumb (bar, portion, position, whole) | |||
| 4536 | int portion, position, whole; | 4529 | int portion, position, whole; |
| 4537 | { | 4530 | { |
| 4538 | ControlHandle ch = SCROLL_BAR_CONTROL_HANDLE (bar); | 4531 | ControlHandle ch = SCROLL_BAR_CONTROL_HANDLE (bar); |
| 4539 | 4532 | int value, viewsize, maximum, visible_p; | |
| 4540 | int value, viewsize, maximum; | ||
| 4541 | 4533 | ||
| 4542 | if (whole == 0 || XINT (bar->track_height) == 0) | 4534 | if (whole == 0 || XINT (bar->track_height) == 0) |
| 4543 | value = 0, viewsize = 1, maximum = 0; | 4535 | value = 0, viewsize = 1, maximum = 0; |
| @@ -4550,11 +4542,17 @@ x_set_toolkit_scroll_bar_thumb (bar, portion, position, whole) | |||
| 4550 | 4542 | ||
| 4551 | BLOCK_INPUT; | 4543 | BLOCK_INPUT; |
| 4552 | 4544 | ||
| 4545 | /* Temporarily hide the scroll bar to avoid multiple redraws. */ | ||
| 4546 | visible_p = IsControlVisible (ch); | ||
| 4547 | SetControlVisibility (ch, false, false); | ||
| 4548 | |||
| 4553 | SetControl32BitMinimum (ch, 0); | 4549 | SetControl32BitMinimum (ch, 0); |
| 4554 | SetControl32BitMaximum (ch, maximum); | 4550 | SetControl32BitMaximum (ch, maximum); |
| 4555 | SetControl32BitValue (ch, value); | 4551 | SetControl32BitValue (ch, value); |
| 4556 | SetControlViewSize (ch, viewsize); | 4552 | SetControlViewSize (ch, viewsize); |
| 4557 | 4553 | ||
| 4554 | SetControlVisibility (ch, visible_p, true); | ||
| 4555 | |||
| 4558 | UNBLOCK_INPUT; | 4556 | UNBLOCK_INPUT; |
| 4559 | } | 4557 | } |
| 4560 | 4558 | ||