Mercurial > emacs
comparison src/macterm.c @ 60623:5a3fa411c713
(activate_scroll_bars, deactivate_scroll_bars): Remove functions and
declarations.
(mac_set_colors): Take argument for saving background color. All
callers changed.
(XDrawLine, XClearArea, mac_draw_bitmap, XFillRectangle)
(mac_draw_rectangle, mac_draw_string_common): Save and Restore
background color.
(x_update_end, mac_do_track_drag): Don't reset background color.
(mac_define_frame_cursor) [!TARGET_API_MAC_CARBON]: Use
SetThemeCursor.
(x_set_window_size) [TARGET_API_MAC_CARBON]: Move progress indicator
control to the upper-right corner of the window.
(arrow_cursor) [!TARGET_API_MAC_CARBON]: Remove variable.
(do_init_managers) [!TARGET_API_MAC_CARBON]: Don't initialize it.
(do_window_update): Update controls after updating content area.
(mac_handle_window_event): Remove unused extern.
(XTread_socket): Check both control handle and control part code to
determine whether a scroll bar is clicked. Activate/deactivate root
control instead of contained scroll bar controls.
(make_mac_terminal_frame): Use ThemeCursor constants.
author | YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> |
---|---|
date | Wed, 16 Mar 2005 03:29:13 +0000 |
parents | 4536f307a219 |
children | e45b939c1d93 |
comparison
equal
deleted
inserted
replaced
60622:005d5b72126b | 60623:5a3fa411c713 |
---|---|
288 static void x_flush P_ ((struct frame *f)); | 288 static void x_flush P_ ((struct frame *f)); |
289 static void x_update_begin P_ ((struct frame *)); | 289 static void x_update_begin P_ ((struct frame *)); |
290 static void x_update_window_begin P_ ((struct window *)); | 290 static void x_update_window_begin P_ ((struct window *)); |
291 static void x_after_update_window_line P_ ((struct glyph_row *)); | 291 static void x_after_update_window_line P_ ((struct glyph_row *)); |
292 | 292 |
293 void activate_scroll_bars (FRAME_PTR); | |
294 void deactivate_scroll_bars (FRAME_PTR); | |
295 | |
296 static int is_emacs_window (WindowPtr); | 293 static int is_emacs_window (WindowPtr); |
297 | 294 |
298 int x_bitmap_icon (struct frame *, Lisp_Object); | 295 int x_bitmap_icon (struct frame *, Lisp_Object); |
299 void x_make_frame_visible (struct frame *); | 296 void x_make_frame_visible (struct frame *); |
300 | 297 |
348 | 345 |
349 /* Set foreground and background color for subsequent QuickDraw | 346 /* Set foreground and background color for subsequent QuickDraw |
350 commands. Assume that the graphic port has already been set. */ | 347 commands. Assume that the graphic port has already been set. */ |
351 | 348 |
352 static void | 349 static void |
353 mac_set_colors (GC gc) | 350 mac_set_colors (gc, bg_save) |
354 { | 351 GC gc; |
352 RGBColor *bg_save; | |
353 { | |
354 if (bg_save) | |
355 GetBackColor (bg_save); | |
355 mac_set_forecolor (gc->foreground); | 356 mac_set_forecolor (gc->foreground); |
356 mac_set_backcolor (gc->background); | 357 mac_set_backcolor (gc->background); |
357 } | 358 } |
358 | 359 |
359 /* Mac version of XDrawLine. */ | 360 /* Mac version of XDrawLine. */ |
363 Display *display; | 364 Display *display; |
364 WindowPtr w; | 365 WindowPtr w; |
365 GC gc; | 366 GC gc; |
366 int x1, y1, x2, y2; | 367 int x1, y1, x2, y2; |
367 { | 368 { |
369 RGBColor old_bg; | |
370 | |
368 SetPortWindowPort (w); | 371 SetPortWindowPort (w); |
369 | 372 |
370 mac_set_colors (gc); | 373 mac_set_colors (gc, &old_bg); |
371 | 374 |
372 MoveTo (x1, y1); | 375 MoveTo (x1, y1); |
373 LineTo (x2, y2); | 376 LineTo (x2, y2); |
377 | |
378 RGBBackColor (&old_bg); | |
374 } | 379 } |
375 | 380 |
376 void | 381 void |
377 mac_draw_line_to_pixmap (display, p, gc, x1, y1, x2, y2) | 382 mac_draw_line_to_pixmap (display, p, gc, x1, y1, x2, y2) |
378 Display *display; | 383 Display *display; |
384 GDHandle old_gdh; | 389 GDHandle old_gdh; |
385 | 390 |
386 GetGWorld (&old_port, &old_gdh); | 391 GetGWorld (&old_port, &old_gdh); |
387 SetGWorld (p, NULL); | 392 SetGWorld (p, NULL); |
388 | 393 |
389 mac_set_colors (gc); | 394 mac_set_colors (gc, NULL); |
390 | 395 |
391 LockPixels (GetGWorldPixMap (p)); | 396 LockPixels (GetGWorldPixMap (p)); |
392 MoveTo (x1, y1); | 397 MoveTo (x1, y1); |
393 LineTo (x2, y2); | 398 LineTo (x2, y2); |
394 UnlockPixels (GetGWorldPixMap (p)); | 399 UnlockPixels (GetGWorldPixMap (p)); |
407 int exposures; | 412 int exposures; |
408 { | 413 { |
409 struct mac_output *mwp = (mac_output *) GetWRefCon (w); | 414 struct mac_output *mwp = (mac_output *) GetWRefCon (w); |
410 Rect r; | 415 Rect r; |
411 XGCValues xgc; | 416 XGCValues xgc; |
417 RGBColor old_bg; | |
412 | 418 |
413 xgc.foreground = mwp->x_compatible.foreground_pixel; | 419 xgc.foreground = mwp->x_compatible.foreground_pixel; |
414 xgc.background = mwp->x_compatible.background_pixel; | 420 xgc.background = mwp->x_compatible.background_pixel; |
415 | 421 |
416 SetPortWindowPort (w); | 422 SetPortWindowPort (w); |
417 | 423 |
418 mac_set_colors (&xgc); | 424 mac_set_colors (&xgc, &old_bg); |
419 SetRect (&r, x, y, x + width, y + height); | 425 SetRect (&r, x, y, x + width, y + height); |
420 | 426 |
421 EraseRect (&r); | 427 EraseRect (&r); |
428 | |
429 RGBBackColor (&old_bg); | |
422 } | 430 } |
423 | 431 |
424 /* Mac version of XClearWindow. */ | 432 /* Mac version of XClearWindow. */ |
425 | 433 |
426 static void | 434 static void |
434 xgc.foreground = mwp->x_compatible.foreground_pixel; | 442 xgc.foreground = mwp->x_compatible.foreground_pixel; |
435 xgc.background = mwp->x_compatible.background_pixel; | 443 xgc.background = mwp->x_compatible.background_pixel; |
436 | 444 |
437 SetPortWindowPort (w); | 445 SetPortWindowPort (w); |
438 | 446 |
439 mac_set_colors (&xgc); | 447 mac_set_colors (&xgc, NULL); |
440 | 448 |
441 #if TARGET_API_MAC_CARBON | 449 #if TARGET_API_MAC_CARBON |
442 { | 450 { |
443 Rect r; | 451 Rect r; |
444 | 452 |
462 unsigned short *bits; | 470 unsigned short *bits; |
463 int overlay_p; | 471 int overlay_p; |
464 { | 472 { |
465 BitMap bitmap; | 473 BitMap bitmap; |
466 Rect r; | 474 Rect r; |
475 RGBColor old_bg; | |
467 | 476 |
468 bitmap.rowBytes = sizeof(unsigned short); | 477 bitmap.rowBytes = sizeof(unsigned short); |
469 bitmap.baseAddr = (char *)bits; | 478 bitmap.baseAddr = (char *)bits; |
470 SetRect (&(bitmap.bounds), 0, 0, width, height); | 479 SetRect (&(bitmap.bounds), 0, 0, width, height); |
471 | 480 |
472 SetPortWindowPort (w); | 481 SetPortWindowPort (w); |
473 | 482 |
474 mac_set_colors (gc); | 483 mac_set_colors (gc, &old_bg); |
475 SetRect (&r, x, y, x + width, y + height); | 484 SetRect (&r, x, y, x + width, y + height); |
476 | 485 |
477 #if TARGET_API_MAC_CARBON | 486 #if TARGET_API_MAC_CARBON |
478 LockPortBits (GetWindowPort (w)); | 487 LockPortBits (GetWindowPort (w)); |
479 CopyBits (&bitmap, GetPortBitMapForCopyBits (GetWindowPort (w)), | 488 CopyBits (&bitmap, GetPortBitMapForCopyBits (GetWindowPort (w)), |
481 UnlockPortBits (GetWindowPort (w)); | 490 UnlockPortBits (GetWindowPort (w)); |
482 #else /* not TARGET_API_MAC_CARBON */ | 491 #else /* not TARGET_API_MAC_CARBON */ |
483 CopyBits (&bitmap, &(w->portBits), &(bitmap.bounds), &r, | 492 CopyBits (&bitmap, &(w->portBits), &(bitmap.bounds), &r, |
484 overlay_p ? srcOr : srcCopy, 0); | 493 overlay_p ? srcOr : srcCopy, 0); |
485 #endif /* not TARGET_API_MAC_CARBON */ | 494 #endif /* not TARGET_API_MAC_CARBON */ |
495 | |
496 RGBBackColor (&old_bg); | |
486 } | 497 } |
487 | 498 |
488 | 499 |
489 /* Mac replacement for XSetClipRectangles. */ | 500 /* Mac replacement for XSetClipRectangles. */ |
490 | 501 |
629 GC gc; | 640 GC gc; |
630 int x, y; | 641 int x, y; |
631 unsigned int width, height; | 642 unsigned int width, height; |
632 { | 643 { |
633 Rect r; | 644 Rect r; |
645 RGBColor old_bg; | |
634 | 646 |
635 SetPortWindowPort (w); | 647 SetPortWindowPort (w); |
636 | 648 |
637 mac_set_colors (gc); | 649 mac_set_colors (gc, &old_bg); |
638 SetRect (&r, x, y, x + width, y + height); | 650 SetRect (&r, x, y, x + width, y + height); |
639 | 651 |
640 PaintRect (&r); /* using foreground color of gc */ | 652 PaintRect (&r); /* using foreground color of gc */ |
653 | |
654 RGBBackColor (&old_bg); | |
641 } | 655 } |
642 | 656 |
643 | 657 |
644 #if 0 /* TODO: figure out if we need to do this on Mac. */ | 658 #if 0 /* TODO: figure out if we need to do this on Mac. */ |
645 static void | 659 static void |
654 GDHandle old_gdh; | 668 GDHandle old_gdh; |
655 Rect r; | 669 Rect r; |
656 | 670 |
657 GetGWorld (&old_port, &old_gdh); | 671 GetGWorld (&old_port, &old_gdh); |
658 SetGWorld (p, NULL); | 672 SetGWorld (p, NULL); |
659 mac_set_colors (gc); | 673 mac_set_colors (gc, NULL); |
660 SetRect (&r, x, y, x + width, y + height); | 674 SetRect (&r, x, y, x + width, y + height); |
661 | 675 |
662 LockPixels (GetGWorldPixMap (p)); | 676 LockPixels (GetGWorldPixMap (p)); |
663 PaintRect (&r); /* using foreground color of gc */ | 677 PaintRect (&r); /* using foreground color of gc */ |
664 UnlockPixels (GetGWorldPixMap (p)); | 678 UnlockPixels (GetGWorldPixMap (p)); |
677 GC gc; | 691 GC gc; |
678 int x, y; | 692 int x, y; |
679 unsigned int width, height; | 693 unsigned int width, height; |
680 { | 694 { |
681 Rect r; | 695 Rect r; |
696 RGBColor old_bg; | |
682 | 697 |
683 SetPortWindowPort (w); | 698 SetPortWindowPort (w); |
684 | 699 |
685 mac_set_colors (gc); | 700 mac_set_colors (gc, &old_bg); |
686 SetRect (&r, x, y, x + width + 1, y + height + 1); | 701 SetRect (&r, x, y, x + width + 1, y + height + 1); |
687 | 702 |
688 FrameRect (&r); /* using foreground color of gc */ | 703 FrameRect (&r); /* using foreground color of gc */ |
704 | |
705 RGBBackColor (&old_bg); | |
689 } | 706 } |
690 | 707 |
691 | 708 |
692 #if 0 /* TODO: figure out if we need to do this on Mac. */ | 709 #if 0 /* TODO: figure out if we need to do this on Mac. */ |
693 /* Mac replacement for XDrawRectangle: dest is a Pixmap. */ | 710 /* Mac replacement for XDrawRectangle: dest is a Pixmap. */ |
704 GDHandle old_gdh; | 721 GDHandle old_gdh; |
705 Rect r; | 722 Rect r; |
706 | 723 |
707 GetGWorld (&old_port, &old_gdh); | 724 GetGWorld (&old_port, &old_gdh); |
708 SetGWorld (p, NULL); | 725 SetGWorld (p, NULL); |
709 mac_set_colors (gc); | 726 mac_set_colors (gc, NULL); |
710 SetRect (&r, x, y, x + width + 1, y + height + 1); | 727 SetRect (&r, x, y, x + width + 1, y + height + 1); |
711 | 728 |
712 LockPixels (GetGWorldPixMap (p)); | 729 LockPixels (GetGWorldPixMap (p)); |
713 FrameRect (&r); /* using foreground color of gc */ | 730 FrameRect (&r); /* using foreground color of gc */ |
714 UnlockPixels (GetGWorldPixMap (p)); | 731 UnlockPixels (GetGWorldPixMap (p)); |
726 GC gc; | 743 GC gc; |
727 int x, y; | 744 int x, y; |
728 char *buf; | 745 char *buf; |
729 int nchars, mode, bytes_per_char; | 746 int nchars, mode, bytes_per_char; |
730 { | 747 { |
748 RGBColor old_bg; | |
749 | |
731 SetPortWindowPort (w); | 750 SetPortWindowPort (w); |
732 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1020 | 751 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1020 |
733 UInt32 textFlags, savedFlags; | 752 UInt32 textFlags, savedFlags; |
734 if (!NILP(Vmac_use_core_graphics)) { | 753 if (!NILP(Vmac_use_core_graphics)) { |
735 textFlags = kQDUseCGTextRendering; | 754 textFlags = kQDUseCGTextRendering; |
736 savedFlags = SwapQDTextFlags(textFlags); | 755 savedFlags = SwapQDTextFlags(textFlags); |
737 } | 756 } |
738 #endif | 757 #endif |
739 | 758 |
740 mac_set_colors (gc); | 759 mac_set_colors (gc, &old_bg); |
741 | 760 |
742 TextFont (gc->font->mac_fontnum); | 761 TextFont (gc->font->mac_fontnum); |
743 TextSize (gc->font->mac_fontsize); | 762 TextSize (gc->font->mac_fontsize); |
744 TextFace (gc->font->mac_fontface); | 763 TextFace (gc->font->mac_fontface); |
745 TextMode (mode); | 764 TextMode (mode); |
746 | 765 |
747 MoveTo (x, y); | 766 MoveTo (x, y); |
748 DrawText (buf, 0, nchars * bytes_per_char); | 767 DrawText (buf, 0, nchars * bytes_per_char); |
768 | |
769 RGBBackColor (&old_bg); | |
749 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1020 | 770 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1020 |
750 if (!NILP(Vmac_use_core_graphics)) | 771 if (!NILP(Vmac_use_core_graphics)) |
751 SwapQDTextFlags(savedFlags); | 772 SwapQDTextFlags(savedFlags); |
752 #endif | 773 #endif |
753 } | 774 } |
931 #else /* not TARGET_API_MAC_CARBON */ | 952 #else /* not TARGET_API_MAC_CARBON */ |
932 Rect src_r, dest_r; | 953 Rect src_r, dest_r; |
933 | 954 |
934 SetPort (w); | 955 SetPort (w); |
935 #if 0 | 956 #if 0 |
936 mac_set_colors (gc); | 957 mac_set_colors (gc, NULL); |
937 #endif | 958 #endif |
938 | 959 |
939 SetRect (&src_r, src_x, src_y, src_x + width, src_y + height); | 960 SetRect (&src_r, src_x, src_y, src_x + width, src_y + height); |
940 SetRect (&dest_r, dest_x, dest_y, dest_x + width, dest_y + height); | 961 SetRect (&dest_r, dest_x, dest_y, dest_x + width, dest_y + height); |
941 | 962 |
953 color mapping in CopyBits. Otherwise, it will be slow. */ | 974 color mapping in CopyBits. Otherwise, it will be slow. */ |
954 ForeColor (blackColor); | 975 ForeColor (blackColor); |
955 BackColor (whiteColor); | 976 BackColor (whiteColor); |
956 CopyBits (&(w->portBits), &(w->portBits), &src_r, &dest_r, srcCopy, 0); | 977 CopyBits (&(w->portBits), &(w->portBits), &src_r, &dest_r, srcCopy, 0); |
957 | 978 |
958 mac_set_colors (gc); | 979 mac_set_colors (gc, NULL); |
959 #endif | 980 #endif |
960 #endif /* not TARGET_API_MAC_CARBON */ | 981 #endif /* not TARGET_API_MAC_CARBON */ |
961 } | 982 } |
962 | 983 |
963 | 984 |
1393 { | 1414 { |
1394 /* Mouse highlight may be displayed again. */ | 1415 /* Mouse highlight may be displayed again. */ |
1395 FRAME_MAC_DISPLAY_INFO (f)->mouse_face_defer = 0; | 1416 FRAME_MAC_DISPLAY_INFO (f)->mouse_face_defer = 0; |
1396 | 1417 |
1397 BLOCK_INPUT; | 1418 BLOCK_INPUT; |
1398 /* Reset the background color of Mac OS Window to that of the frame after | |
1399 update so that it is used by Mac Toolbox to clear the update region before | |
1400 an update event is generated. */ | |
1401 SetPortWindowPort (FRAME_MAC_WINDOW (f)); | |
1402 | |
1403 mac_set_backcolor (FRAME_BACKGROUND_PIXEL (f)); | |
1404 | |
1405 #if TARGET_API_MAC_CARBON | 1419 #if TARGET_API_MAC_CARBON |
1406 EnableScreenUpdates (); | 1420 EnableScreenUpdates (); |
1407 #endif | 1421 #endif |
1408 XFlush (FRAME_MAC_DISPLAY (f)); | 1422 XFlush (FRAME_MAC_DISPLAY (f)); |
1409 UNBLOCK_INPUT; | 1423 UNBLOCK_INPUT; |
4469 /* Now there should be no references to the condemned scroll bars, | 4483 /* Now there should be no references to the condemned scroll bars, |
4470 and they should get garbage-collected. */ | 4484 and they should get garbage-collected. */ |
4471 } | 4485 } |
4472 | 4486 |
4473 | 4487 |
4474 void | |
4475 activate_scroll_bars (frame) | |
4476 FRAME_PTR frame; | |
4477 { | |
4478 Lisp_Object bar; | |
4479 ControlHandle ch; | |
4480 | |
4481 bar = FRAME_SCROLL_BARS (frame); | |
4482 while (! NILP (bar)) | |
4483 { | |
4484 ch = SCROLL_BAR_CONTROL_HANDLE (XSCROLL_BAR (bar)); | |
4485 #if 1 /* TARGET_API_MAC_CARBON */ | |
4486 ActivateControl (ch); | |
4487 #else | |
4488 SetControlMaximum (ch, | |
4489 VERTICAL_SCROLL_BAR_TOP_RANGE (frame, | |
4490 XINT (XSCROLL_BAR (bar) | |
4491 ->height)) - 1); | |
4492 #endif | |
4493 bar = XSCROLL_BAR (bar)->next; | |
4494 } | |
4495 } | |
4496 | |
4497 | |
4498 void | |
4499 deactivate_scroll_bars (frame) | |
4500 FRAME_PTR frame; | |
4501 { | |
4502 Lisp_Object bar; | |
4503 ControlHandle ch; | |
4504 | |
4505 bar = FRAME_SCROLL_BARS (frame); | |
4506 while (! NILP (bar)) | |
4507 { | |
4508 ch = SCROLL_BAR_CONTROL_HANDLE (XSCROLL_BAR (bar)); | |
4509 #if 1 /* TARGET_API_MAC_CARBON */ | |
4510 DeactivateControl (ch); | |
4511 #else | |
4512 SetControlMaximum (ch, -1); | |
4513 #endif | |
4514 bar = XSCROLL_BAR (bar)->next; | |
4515 } | |
4516 } | |
4517 | |
4518 /* Handle a mouse click on the scroll bar BAR. If *EMACS_EVENT's kind | 4488 /* Handle a mouse click on the scroll bar BAR. If *EMACS_EVENT's kind |
4519 is set to something other than NO_EVENT, it is enqueued. | 4489 is set to something other than NO_EVENT, it is enqueued. |
4520 | 4490 |
4521 This may be called from a signal handler, so we have to ignore GC | 4491 This may be called from a signal handler, so we have to ignore GC |
4522 mark bits. */ | 4492 mark bits. */ |
4843 static void | 4813 static void |
4844 mac_define_frame_cursor (f, cursor) | 4814 mac_define_frame_cursor (f, cursor) |
4845 struct frame *f; | 4815 struct frame *f; |
4846 Cursor cursor; | 4816 Cursor cursor; |
4847 { | 4817 { |
4848 #if TARGET_API_MAC_CARBON | |
4849 SetThemeCursor (cursor); | 4818 SetThemeCursor (cursor); |
4850 #else | |
4851 SetCursor (*cursor); | |
4852 #endif | |
4853 } | 4819 } |
4854 | 4820 |
4855 | 4821 |
4856 /* RIF: Clear area on frame F. */ | 4822 /* RIF: Clear area on frame F. */ |
4857 | 4823 |
5272 | 5238 |
5273 f->win_gravity = NorthWestGravity; | 5239 f->win_gravity = NorthWestGravity; |
5274 x_wm_set_size_hint (f, (long) 0, 0); | 5240 x_wm_set_size_hint (f, (long) 0, 0); |
5275 | 5241 |
5276 SizeWindow (FRAME_MAC_WINDOW (f), pixelwidth, pixelheight, 0); | 5242 SizeWindow (FRAME_MAC_WINDOW (f), pixelwidth, pixelheight, 0); |
5243 #if TARGET_API_MAC_CARBON | |
5244 if (f->output_data.mac->hourglass_control) | |
5245 MoveControl (f->output_data.mac->hourglass_control, | |
5246 pixelwidth - HOURGLASS_WIDTH, 0); | |
5247 #endif | |
5277 | 5248 |
5278 /* Now, strictly speaking, we can't be sure that this is accurate, | 5249 /* Now, strictly speaking, we can't be sure that this is accurate, |
5279 but the window manager will get around to dealing with the size | 5250 but the window manager will get around to dealing with the size |
5280 change request eventually, and we'll hear how it went when the | 5251 change request eventually, and we'll hear how it went when the |
5281 ConfigureNotify event gets here. | 5252 ConfigureNotify event gets here. |
7183 | 7154 |
7184 Lisp_Object drag_and_drop_file_list; | 7155 Lisp_Object drag_and_drop_file_list; |
7185 | 7156 |
7186 Point saved_menu_event_location; | 7157 Point saved_menu_event_location; |
7187 | 7158 |
7188 #if !TARGET_API_MAC_CARBON | |
7189 /* Place holder for the default arrow cursor. */ | |
7190 CursPtr arrow_cursor; | |
7191 #endif | |
7192 | |
7193 /* Apple Events */ | 7159 /* Apple Events */ |
7194 static void init_required_apple_events (void); | 7160 static void init_required_apple_events (void); |
7195 static pascal OSErr | 7161 static pascal OSErr |
7196 do_ae_open_application (const AppleEvent *, AppleEvent *, long); | 7162 do_ae_open_application (const AppleEvent *, AppleEvent *, long); |
7197 static pascal OSErr | 7163 static pascal OSErr |
7390 InitDialogs (NULL); | 7356 InitDialogs (NULL); |
7391 #endif /* !TARGET_API_MAC_CARBON */ | 7357 #endif /* !TARGET_API_MAC_CARBON */ |
7392 InitCursor (); | 7358 InitCursor (); |
7393 | 7359 |
7394 #if !TARGET_API_MAC_CARBON | 7360 #if !TARGET_API_MAC_CARBON |
7395 arrow_cursor = &qd.arrow; | |
7396 | |
7397 /* set up some extra stack space for use by emacs */ | 7361 /* set up some extra stack space for use by emacs */ |
7398 SetApplLimit ((Ptr) ((long) GetApplLimit () - EXTRA_STACK_ALLOC)); | 7362 SetApplLimit ((Ptr) ((long) GetApplLimit () - EXTRA_STACK_ALLOC)); |
7399 | 7363 |
7400 /* MaxApplZone must be called for AppleScript to execute more | 7364 /* MaxApplZone must be called for AppleScript to execute more |
7401 complicated scripts */ | 7365 complicated scripts */ |
7452 #if TARGET_API_MAC_CARBON | 7416 #if TARGET_API_MAC_CARBON |
7453 { | 7417 { |
7454 RgnHandle region = NewRgn (); | 7418 RgnHandle region = NewRgn (); |
7455 | 7419 |
7456 GetPortVisibleRegion (GetWindowPort (win), region); | 7420 GetPortVisibleRegion (GetWindowPort (win), region); |
7421 GetRegionBounds (region, &r); | |
7422 expose_frame (f, r.left, r.top, r.right - r.left, r.bottom - r.top); | |
7457 UpdateControls (win, region); | 7423 UpdateControls (win, region); |
7458 GetRegionBounds (region, &r); | |
7459 DisposeRgn (region); | 7424 DisposeRgn (region); |
7460 } | 7425 } |
7461 #else | 7426 #else |
7427 r = (*win->visRgn)->rgnBBox; | |
7428 expose_frame (f, r.left, r.top, r.right - r.left, r.bottom - r.top); | |
7462 UpdateControls (win, win->visRgn); | 7429 UpdateControls (win, win->visRgn); |
7463 r = (*win->visRgn)->rgnBBox; | 7430 #endif |
7464 #endif | |
7465 expose_frame (f, r.left, r.top, r.right - r.left, r.bottom - r.top); | |
7466 | 7431 |
7467 handling_window_update = 0; | 7432 handling_window_update = 0; |
7468 } | 7433 } |
7469 } | 7434 } |
7470 | 7435 |
7953 mac_handle_window_event (next_handler, event, data) | 7918 mac_handle_window_event (next_handler, event, data) |
7954 EventHandlerCallRef next_handler; | 7919 EventHandlerCallRef next_handler; |
7955 EventRef event; | 7920 EventRef event; |
7956 void *data; | 7921 void *data; |
7957 { | 7922 { |
7958 extern Lisp_Object Qcontrol; | |
7959 | |
7960 WindowPtr wp; | 7923 WindowPtr wp; |
7961 OSStatus result; | 7924 OSStatus result; |
7962 UInt32 attributes; | 7925 UInt32 attributes; |
7963 XSizeHints *size_hints; | 7926 XSizeHints *size_hints; |
7964 | 7927 |
8224 { | 8187 { |
8225 RgnHandle hilite_rgn = NewRgn (); | 8188 RgnHandle hilite_rgn = NewRgn (); |
8226 Rect r; | 8189 Rect r; |
8227 struct frame *f = mac_window_to_frame (window); | 8190 struct frame *f = mac_window_to_frame (window); |
8228 | 8191 |
8229 mac_set_backcolor (FRAME_BACKGROUND_PIXEL (f)); | |
8230 GetWindowPortBounds (window, &r); | 8192 GetWindowPortBounds (window, &r); |
8231 OffsetRect (&r, -r.left, -r.top); | 8193 OffsetRect (&r, -r.left, -r.top); |
8232 RectRgn (hilite_rgn, &r); | 8194 RectRgn (hilite_rgn, &r); |
8233 ShowDragHilite (theDrag, hilite_rgn, true); | 8195 ShowDragHilite (theDrag, hilite_rgn, true); |
8234 DisposeRgn (hilite_rgn); | 8196 DisposeRgn (hilite_rgn); |
8242 case kDragTrackingLeaveWindow: | 8204 case kDragTrackingLeaveWindow: |
8243 if (can_accept) | 8205 if (can_accept) |
8244 { | 8206 { |
8245 struct frame *f = mac_window_to_frame (window); | 8207 struct frame *f = mac_window_to_frame (window); |
8246 | 8208 |
8247 mac_set_backcolor (FRAME_BACKGROUND_PIXEL (f)); | |
8248 HideDragHilite (theDrag); | 8209 HideDragHilite (theDrag); |
8249 SetThemeCursor (kThemeArrowCursor); | 8210 SetThemeCursor (kThemeArrowCursor); |
8250 } | 8211 } |
8251 break; | 8212 break; |
8252 | 8213 |
8734 XSETINT (inev.y, mouse_loc.v); | 8695 XSETINT (inev.y, mouse_loc.v); |
8735 inev.timestamp = er.when * (1000 / 60); | 8696 inev.timestamp = er.when * (1000 / 60); |
8736 /* ticks to milliseconds */ | 8697 /* ticks to milliseconds */ |
8737 | 8698 |
8738 if (dpyinfo->grabbed && tracked_scroll_bar | 8699 if (dpyinfo->grabbed && tracked_scroll_bar |
8739 #if TARGET_API_MAC_CARBON | 8700 /* control_part_code becomes kControlNoPart if |
8740 || ch != 0 | 8701 a progress indicator is clicked. */ |
8741 #else | 8702 || ch != 0 && control_part_code != kControlNoPart) |
8742 || control_part_code != 0 | |
8743 #endif | |
8744 ) | |
8745 { | 8703 { |
8746 struct scroll_bar *bar; | 8704 struct scroll_bar *bar; |
8747 | 8705 |
8748 if (dpyinfo->grabbed && tracked_scroll_bar) | 8706 if (dpyinfo->grabbed && tracked_scroll_bar) |
8749 { | 8707 { |
8908 break; | 8866 break; |
8909 | 8867 |
8910 case activateEvt: | 8868 case activateEvt: |
8911 { | 8869 { |
8912 WindowPtr window_ptr = (WindowPtr) er.message; | 8870 WindowPtr window_ptr = (WindowPtr) er.message; |
8871 ControlRef root_control; | |
8913 | 8872 |
8914 #if USE_CARBON_EVENTS | 8873 #if USE_CARBON_EVENTS |
8915 if (SendEventToEventTarget (eventRef, toolbox_dispatcher) | 8874 if (SendEventToEventTarget (eventRef, toolbox_dispatcher) |
8916 != eventNotHandledErr) | 8875 != eventNotHandledErr) |
8917 break; | 8876 break; |
8924 | 8883 |
8925 if (!is_emacs_window (window_ptr)) | 8884 if (!is_emacs_window (window_ptr)) |
8926 break; | 8885 break; |
8927 | 8886 |
8928 f = mac_window_to_frame (window_ptr); | 8887 f = mac_window_to_frame (window_ptr); |
8888 GetRootControl (window_ptr, &root_control); | |
8929 | 8889 |
8930 if ((er.modifiers & activeFlag) != 0) | 8890 if ((er.modifiers & activeFlag) != 0) |
8931 { | 8891 { |
8932 /* A window has been activated */ | 8892 /* A window has been activated */ |
8933 Point mouse_loc = er.where; | 8893 Point mouse_loc = er.where; |
8934 | 8894 |
8935 x_new_focus_frame (dpyinfo, f); | 8895 x_new_focus_frame (dpyinfo, f); |
8936 activate_scroll_bars (f); | 8896 ActivateControl (root_control); |
8937 | 8897 |
8938 SetPortWindowPort (window_ptr); | 8898 SetPortWindowPort (window_ptr); |
8939 GlobalToLocal (&mouse_loc); | 8899 GlobalToLocal (&mouse_loc); |
8940 /* Window-activated event counts as mouse movement, | 8900 /* Window-activated event counts as mouse movement, |
8941 so update things that depend on mouse position. */ | 8901 so update things that depend on mouse position. */ |
8948 dpyinfo->grabbed = 0; | 8908 dpyinfo->grabbed = 0; |
8949 | 8909 |
8950 if (f == dpyinfo->x_focus_frame) | 8910 if (f == dpyinfo->x_focus_frame) |
8951 { | 8911 { |
8952 x_new_focus_frame (dpyinfo, 0); | 8912 x_new_focus_frame (dpyinfo, 0); |
8953 deactivate_scroll_bars (f); | 8913 DeactivateControl (root_control); |
8954 } | 8914 } |
8955 | 8915 |
8956 | 8916 |
8957 if (f == dpyinfo->mouse_face_mouse_frame) | 8917 if (f == dpyinfo->mouse_face_mouse_frame) |
8958 { | 8918 { |
9286 f->output_data.mac->cursor_pixel = 0; | 9246 f->output_data.mac->cursor_pixel = 0; |
9287 f->output_data.mac->border_pixel = 0x00ff00; | 9247 f->output_data.mac->border_pixel = 0x00ff00; |
9288 f->output_data.mac->mouse_pixel = 0xff00ff; | 9248 f->output_data.mac->mouse_pixel = 0xff00ff; |
9289 f->output_data.mac->cursor_foreground_pixel = 0x0000ff; | 9249 f->output_data.mac->cursor_foreground_pixel = 0x0000ff; |
9290 | 9250 |
9291 #if TARGET_API_MAC_CARBON | |
9292 f->output_data.mac->text_cursor = kThemeIBeamCursor; | 9251 f->output_data.mac->text_cursor = kThemeIBeamCursor; |
9293 f->output_data.mac->nontext_cursor = kThemeArrowCursor; | 9252 f->output_data.mac->nontext_cursor = kThemeArrowCursor; |
9294 f->output_data.mac->modeline_cursor = kThemeArrowCursor; | 9253 f->output_data.mac->modeline_cursor = kThemeArrowCursor; |
9295 f->output_data.mac->hand_cursor = kThemePointingHandCursor; | 9254 f->output_data.mac->hand_cursor = kThemePointingHandCursor; |
9296 f->output_data.mac->hourglass_cursor = kThemeWatchCursor; | 9255 f->output_data.mac->hourglass_cursor = kThemeWatchCursor; |
9297 f->output_data.mac->horizontal_drag_cursor = kThemeResizeLeftRightCursor; | 9256 f->output_data.mac->horizontal_drag_cursor = kThemeResizeLeftRightCursor; |
9298 #else | |
9299 f->output_data.mac->text_cursor = GetCursor (iBeamCursor); | |
9300 f->output_data.mac->nontext_cursor = &arrow_cursor; | |
9301 f->output_data.mac->modeline_cursor = &arrow_cursor; | |
9302 f->output_data.mac->hand_cursor = &arrow_cursor; | |
9303 f->output_data.mac->hourglass_cursor = GetCursor (watchCursor); | |
9304 f->output_data.mac->horizontal_drag_cursor = &arrow_cursor; | |
9305 #endif | |
9306 | 9257 |
9307 FRAME_FONTSET (f) = -1; | 9258 FRAME_FONTSET (f) = -1; |
9308 f->output_data.mac->explicit_parent = 0; | 9259 f->output_data.mac->explicit_parent = 0; |
9309 f->left_pos = 8; | 9260 f->left_pos = 8; |
9310 f->top_pos = 32; | 9261 f->top_pos = 32; |