diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/macterm.c | 199 |
1 files changed, 89 insertions, 110 deletions
diff --git a/src/macterm.c b/src/macterm.c index 32abee0bc10..a4030a18ecb 100644 --- a/src/macterm.c +++ b/src/macterm.c | |||
| @@ -35,12 +35,7 @@ Boston, MA 02110-1301, USA. */ | |||
| 35 | #include <alloca.h> | 35 | #include <alloca.h> |
| 36 | #endif | 36 | #endif |
| 37 | 37 | ||
| 38 | #if TARGET_API_MAC_CARBON | 38 | #if !TARGET_API_MAC_CARBON |
| 39 | /* USE_CARBON_EVENTS determines if the Carbon Event Manager is used to | ||
| 40 | obtain events from the event queue. If set to 0, WaitNextEvent is | ||
| 41 | used instead. */ | ||
| 42 | #define USE_CARBON_EVENTS 1 | ||
| 43 | #else /* not TARGET_API_MAC_CARBON */ | ||
| 44 | #include <Quickdraw.h> | 39 | #include <Quickdraw.h> |
| 45 | #include <ToolUtils.h> | 40 | #include <ToolUtils.h> |
| 46 | #include <Sound.h> | 41 | #include <Sound.h> |
| @@ -263,7 +258,7 @@ static void x_scroll_bar_report_motion P_ ((struct frame **, Lisp_Object *, | |||
| 263 | Lisp_Object *, Lisp_Object *, | 258 | Lisp_Object *, Lisp_Object *, |
| 264 | unsigned long *)); | 259 | unsigned long *)); |
| 265 | 260 | ||
| 266 | static int is_emacs_window P_ ((WindowPtr)); | 261 | static int is_emacs_window P_ ((WindowRef)); |
| 267 | static XCharStruct *mac_per_char_metric P_ ((XFontStruct *, XChar2b *, int)); | 262 | static XCharStruct *mac_per_char_metric P_ ((XFontStruct *, XChar2b *, int)); |
| 268 | static void XSetFont P_ ((Display *, GC, XFontStruct *)); | 263 | static void XSetFont P_ ((Display *, GC, XFontStruct *)); |
| 269 | 264 | ||
| @@ -753,7 +748,7 @@ mac_free_bitmap (bitmap) | |||
| 753 | Pixmap | 748 | Pixmap |
| 754 | XCreatePixmap (display, w, width, height, depth) | 749 | XCreatePixmap (display, w, width, height, depth) |
| 755 | Display *display; /* not used */ | 750 | Display *display; /* not used */ |
| 756 | WindowPtr w; | 751 | WindowRef w; |
| 757 | unsigned int width, height; | 752 | unsigned int width, height; |
| 758 | unsigned int depth; | 753 | unsigned int depth; |
| 759 | { | 754 | { |
| @@ -782,7 +777,7 @@ XCreatePixmap (display, w, width, height, depth) | |||
| 782 | Pixmap | 777 | Pixmap |
| 783 | XCreatePixmapFromBitmapData (display, w, data, width, height, fg, bg, depth) | 778 | XCreatePixmapFromBitmapData (display, w, data, width, height, fg, bg, depth) |
| 784 | Display *display; /* not used */ | 779 | Display *display; /* not used */ |
| 785 | WindowPtr w; | 780 | WindowRef w; |
| 786 | char *data; | 781 | char *data; |
| 787 | unsigned int width, height; | 782 | unsigned int width, height; |
| 788 | unsigned long fg, bg; | 783 | unsigned long fg, bg; |
| @@ -1590,7 +1585,7 @@ mac_scroll_area (f, gc, src_x, src_y, width, height, dest_x, dest_y) | |||
| 1590 | DisposeRgn (dummy); | 1585 | DisposeRgn (dummy); |
| 1591 | #else /* not TARGET_API_MAC_CARBON */ | 1586 | #else /* not TARGET_API_MAC_CARBON */ |
| 1592 | Rect src_r, dest_r; | 1587 | Rect src_r, dest_r; |
| 1593 | WindowPtr w = FRAME_MAC_WINDOW (f); | 1588 | WindowRef w = FRAME_MAC_WINDOW (f); |
| 1594 | 1589 | ||
| 1595 | SetPort (w); | 1590 | SetPort (w); |
| 1596 | 1591 | ||
| @@ -1850,7 +1845,7 @@ mac_reset_clip_rectangles (display, gc) | |||
| 1850 | void | 1845 | void |
| 1851 | XSetWindowBackground (display, w, color) | 1846 | XSetWindowBackground (display, w, color) |
| 1852 | Display *display; | 1847 | Display *display; |
| 1853 | WindowPtr w; | 1848 | WindowRef w; |
| 1854 | unsigned long color; | 1849 | unsigned long color; |
| 1855 | { | 1850 | { |
| 1856 | #if !TARGET_API_MAC_CARBON | 1851 | #if !TARGET_API_MAC_CARBON |
| @@ -4373,7 +4368,7 @@ x_detect_focus_change (dpyinfo, event, bufp) | |||
| 4373 | { | 4368 | { |
| 4374 | struct frame *frame; | 4369 | struct frame *frame; |
| 4375 | 4370 | ||
| 4376 | frame = mac_window_to_frame ((WindowPtr) event->message); | 4371 | frame = mac_window_to_frame ((WindowRef) event->message); |
| 4377 | if (! frame) | 4372 | if (! frame) |
| 4378 | return; | 4373 | return; |
| 4379 | 4374 | ||
| @@ -4644,14 +4639,14 @@ static OSStatus set_scroll_bar_timer P_ ((EventTimerInterval)); | |||
| 4644 | static int control_part_code_to_scroll_bar_part P_ ((ControlPartCode)); | 4639 | static int control_part_code_to_scroll_bar_part P_ ((ControlPartCode)); |
| 4645 | static void construct_scroll_bar_click P_ ((struct scroll_bar *, int, | 4640 | static void construct_scroll_bar_click P_ ((struct scroll_bar *, int, |
| 4646 | struct input_event *)); | 4641 | struct input_event *)); |
| 4647 | static OSStatus get_control_part_bounds P_ ((ControlHandle, ControlPartCode, | 4642 | static OSStatus get_control_part_bounds P_ ((ControlRef, ControlPartCode, |
| 4648 | Rect *)); | 4643 | Rect *)); |
| 4649 | static void x_scroll_bar_handle_press P_ ((struct scroll_bar *, | 4644 | static void x_scroll_bar_handle_press P_ ((struct scroll_bar *, |
| 4650 | ControlPartCode, Point, | 4645 | ControlPartCode, Point, |
| 4651 | struct input_event *)); | 4646 | struct input_event *)); |
| 4652 | static void x_scroll_bar_handle_release P_ ((struct scroll_bar *, | 4647 | static void x_scroll_bar_handle_release P_ ((struct scroll_bar *, |
| 4653 | struct input_event *)); | 4648 | struct input_event *)); |
| 4654 | static void x_scroll_bar_handle_drag P_ ((WindowPtr, struct scroll_bar *, | 4649 | static void x_scroll_bar_handle_drag P_ ((WindowRef, struct scroll_bar *, |
| 4655 | Point, struct input_event *)); | 4650 | Point, struct input_event *)); |
| 4656 | static void x_set_toolkit_scroll_bar_thumb P_ ((struct scroll_bar *, | 4651 | static void x_set_toolkit_scroll_bar_thumb P_ ((struct scroll_bar *, |
| 4657 | int, int, int)); | 4652 | int, int, int)); |
| @@ -4744,7 +4739,7 @@ construct_scroll_bar_click (bar, part, bufp) | |||
| 4744 | 4739 | ||
| 4745 | static OSStatus | 4740 | static OSStatus |
| 4746 | get_control_part_bounds (ch, part_code, rect) | 4741 | get_control_part_bounds (ch, part_code, rect) |
| 4747 | ControlHandle ch; | 4742 | ControlRef ch; |
| 4748 | ControlPartCode part_code; | 4743 | ControlPartCode part_code; |
| 4749 | Rect *rect; | 4744 | Rect *rect; |
| 4750 | { | 4745 | { |
| @@ -4774,7 +4769,7 @@ x_scroll_bar_handle_press (bar, part_code, mouse_pos, bufp) | |||
| 4774 | if (part != scroll_bar_handle) | 4769 | if (part != scroll_bar_handle) |
| 4775 | { | 4770 | { |
| 4776 | construct_scroll_bar_click (bar, part, bufp); | 4771 | construct_scroll_bar_click (bar, part, bufp); |
| 4777 | HiliteControl (SCROLL_BAR_CONTROL_HANDLE (bar), part_code); | 4772 | HiliteControl (SCROLL_BAR_CONTROL_REF (bar), part_code); |
| 4778 | set_scroll_bar_timer (SCROLL_BAR_FIRST_DELAY); | 4773 | set_scroll_bar_timer (SCROLL_BAR_FIRST_DELAY); |
| 4779 | bar->dragging = Qnil; | 4774 | bar->dragging = Qnil; |
| 4780 | } | 4775 | } |
| @@ -4782,7 +4777,7 @@ x_scroll_bar_handle_press (bar, part_code, mouse_pos, bufp) | |||
| 4782 | { | 4777 | { |
| 4783 | Rect r; | 4778 | Rect r; |
| 4784 | 4779 | ||
| 4785 | get_control_part_bounds (SCROLL_BAR_CONTROL_HANDLE (bar), | 4780 | get_control_part_bounds (SCROLL_BAR_CONTROL_REF (bar), |
| 4786 | kControlIndicatorPart, &r); | 4781 | kControlIndicatorPart, &r); |
| 4787 | XSETINT (bar->dragging, - (mouse_pos.v - r.top) - 1); | 4782 | XSETINT (bar->dragging, - (mouse_pos.v - r.top) - 1); |
| 4788 | } | 4783 | } |
| @@ -4800,7 +4795,7 @@ x_scroll_bar_handle_release (bar, bufp) | |||
| 4800 | || (INTEGERP (bar->dragging) && XINT (bar->dragging) >= 0)) | 4795 | || (INTEGERP (bar->dragging) && XINT (bar->dragging) >= 0)) |
| 4801 | construct_scroll_bar_click (bar, scroll_bar_end_scroll, bufp); | 4796 | construct_scroll_bar_click (bar, scroll_bar_end_scroll, bufp); |
| 4802 | 4797 | ||
| 4803 | HiliteControl (SCROLL_BAR_CONTROL_HANDLE (bar), 0); | 4798 | HiliteControl (SCROLL_BAR_CONTROL_REF (bar), 0); |
| 4804 | set_scroll_bar_timer (kEventDurationForever); | 4799 | set_scroll_bar_timer (kEventDurationForever); |
| 4805 | 4800 | ||
| 4806 | last_scroll_bar_part = -1; | 4801 | last_scroll_bar_part = -1; |
| @@ -4810,19 +4805,19 @@ x_scroll_bar_handle_release (bar, bufp) | |||
| 4810 | 4805 | ||
| 4811 | static void | 4806 | static void |
| 4812 | x_scroll_bar_handle_drag (win, bar, mouse_pos, bufp) | 4807 | x_scroll_bar_handle_drag (win, bar, mouse_pos, bufp) |
| 4813 | WindowPtr win; | 4808 | WindowRef win; |
| 4814 | struct scroll_bar *bar; | 4809 | struct scroll_bar *bar; |
| 4815 | Point mouse_pos; | 4810 | Point mouse_pos; |
| 4816 | struct input_event *bufp; | 4811 | struct input_event *bufp; |
| 4817 | { | 4812 | { |
| 4818 | ControlHandle ch = SCROLL_BAR_CONTROL_HANDLE (bar); | 4813 | ControlRef ch = SCROLL_BAR_CONTROL_REF (bar); |
| 4819 | 4814 | ||
| 4820 | if (last_scroll_bar_part == scroll_bar_handle) | 4815 | if (last_scroll_bar_part == scroll_bar_handle) |
| 4821 | { | 4816 | { |
| 4822 | int top, top_range; | 4817 | int top, top_range; |
| 4823 | Rect r; | 4818 | Rect r; |
| 4824 | 4819 | ||
| 4825 | get_control_part_bounds (SCROLL_BAR_CONTROL_HANDLE (bar), | 4820 | get_control_part_bounds (SCROLL_BAR_CONTROL_REF (bar), |
| 4826 | kControlIndicatorPart, &r); | 4821 | kControlIndicatorPart, &r); |
| 4827 | 4822 | ||
| 4828 | if (INTEGERP (bar->dragging) && XINT (bar->dragging) < 0) | 4823 | if (INTEGERP (bar->dragging) && XINT (bar->dragging) < 0) |
| @@ -4870,13 +4865,13 @@ x_scroll_bar_handle_drag (win, bar, mouse_pos, bufp) | |||
| 4870 | } | 4865 | } |
| 4871 | 4866 | ||
| 4872 | if (unhilite_p) | 4867 | if (unhilite_p) |
| 4873 | HiliteControl (SCROLL_BAR_CONTROL_HANDLE (bar), 0); | 4868 | HiliteControl (SCROLL_BAR_CONTROL_REF (bar), 0); |
| 4874 | else if (part != last_scroll_bar_part | 4869 | else if (part != last_scroll_bar_part |
| 4875 | || scroll_bar_timer_event_posted_p) | 4870 | || scroll_bar_timer_event_posted_p) |
| 4876 | { | 4871 | { |
| 4877 | construct_scroll_bar_click (bar, part, bufp); | 4872 | construct_scroll_bar_click (bar, part, bufp); |
| 4878 | last_scroll_bar_part = part; | 4873 | last_scroll_bar_part = part; |
| 4879 | HiliteControl (SCROLL_BAR_CONTROL_HANDLE (bar), part_code); | 4874 | HiliteControl (SCROLL_BAR_CONTROL_REF (bar), part_code); |
| 4880 | set_scroll_bar_timer (SCROLL_BAR_CONTINUOUS_DELAY); | 4875 | set_scroll_bar_timer (SCROLL_BAR_CONTINUOUS_DELAY); |
| 4881 | } | 4876 | } |
| 4882 | } | 4877 | } |
| @@ -4890,7 +4885,7 @@ x_set_toolkit_scroll_bar_thumb (bar, portion, position, whole) | |||
| 4890 | struct scroll_bar *bar; | 4885 | struct scroll_bar *bar; |
| 4891 | int portion, position, whole; | 4886 | int portion, position, whole; |
| 4892 | { | 4887 | { |
| 4893 | ControlHandle ch = SCROLL_BAR_CONTROL_HANDLE (bar); | 4888 | ControlRef ch = SCROLL_BAR_CONTROL_REF (bar); |
| 4894 | int value, viewsize, maximum; | 4889 | int value, viewsize, maximum; |
| 4895 | 4890 | ||
| 4896 | if (XINT (bar->track_height) == 0) | 4891 | if (XINT (bar->track_height) == 0) |
| @@ -4949,7 +4944,7 @@ x_scroll_bar_create (w, top, left, width, height, disp_top, disp_height) | |||
| 4949 | struct scroll_bar *bar | 4944 | struct scroll_bar *bar |
| 4950 | = XSCROLL_BAR (Fmake_vector (make_number (SCROLL_BAR_VEC_SIZE), Qnil)); | 4945 | = XSCROLL_BAR (Fmake_vector (make_number (SCROLL_BAR_VEC_SIZE), Qnil)); |
| 4951 | Rect r; | 4946 | Rect r; |
| 4952 | ControlHandle ch; | 4947 | ControlRef ch; |
| 4953 | 4948 | ||
| 4954 | BLOCK_INPUT; | 4949 | BLOCK_INPUT; |
| 4955 | 4950 | ||
| @@ -4973,7 +4968,7 @@ x_scroll_bar_create (w, top, left, width, height, disp_top, disp_height) | |||
| 4973 | ch = NewControl (FRAME_MAC_WINDOW (f), &r, "\p", width < disp_height, | 4968 | ch = NewControl (FRAME_MAC_WINDOW (f), &r, "\p", width < disp_height, |
| 4974 | 0, 0, 0, scrollBarProc, (long) bar); | 4969 | 0, 0, 0, scrollBarProc, (long) bar); |
| 4975 | #endif | 4970 | #endif |
| 4976 | SET_SCROLL_BAR_CONTROL_HANDLE (bar, ch); | 4971 | SET_SCROLL_BAR_CONTROL_REF (bar, ch); |
| 4977 | 4972 | ||
| 4978 | XSETWINDOW (bar->window, w); | 4973 | XSETWINDOW (bar->window, w); |
| 4979 | XSETINT (bar->top, top); | 4974 | XSETINT (bar->top, top); |
| @@ -5023,7 +5018,7 @@ x_scroll_bar_set_handle (bar, start, end, rebuild) | |||
| 5023 | int rebuild; | 5018 | int rebuild; |
| 5024 | { | 5019 | { |
| 5025 | int dragging = ! NILP (bar->dragging); | 5020 | int dragging = ! NILP (bar->dragging); |
| 5026 | ControlHandle ch = SCROLL_BAR_CONTROL_HANDLE (bar); | 5021 | ControlRef ch = SCROLL_BAR_CONTROL_REF (bar); |
| 5027 | FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window))); | 5022 | FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window))); |
| 5028 | int top_range = VERTICAL_SCROLL_BAR_TOP_RANGE (f, XINT (bar->height)); | 5023 | int top_range = VERTICAL_SCROLL_BAR_TOP_RANGE (f, XINT (bar->height)); |
| 5029 | int length = end - start; | 5024 | int length = end - start; |
| @@ -5092,7 +5087,7 @@ x_scroll_bar_remove (bar) | |||
| 5092 | mac_prepare_for_quickdraw (f); | 5087 | mac_prepare_for_quickdraw (f); |
| 5093 | #endif | 5088 | #endif |
| 5094 | /* Destroy the Mac scroll bar control */ | 5089 | /* Destroy the Mac scroll bar control */ |
| 5095 | DisposeControl (SCROLL_BAR_CONTROL_HANDLE (bar)); | 5090 | DisposeControl (SCROLL_BAR_CONTROL_REF (bar)); |
| 5096 | 5091 | ||
| 5097 | /* Disassociate this scroll bar from its window. */ | 5092 | /* Disassociate this scroll bar from its window. */ |
| 5098 | XWINDOW (bar->window)->vertical_scroll_bar = Qnil; | 5093 | XWINDOW (bar->window)->vertical_scroll_bar = Qnil; |
| @@ -5170,10 +5165,10 @@ XTset_vertical_scroll_bar (w, portion, whole, position) | |||
| 5170 | else | 5165 | else |
| 5171 | { | 5166 | { |
| 5172 | /* It may just need to be moved and resized. */ | 5167 | /* It may just need to be moved and resized. */ |
| 5173 | ControlHandle ch; | 5168 | ControlRef ch; |
| 5174 | 5169 | ||
| 5175 | bar = XSCROLL_BAR (w->vertical_scroll_bar); | 5170 | bar = XSCROLL_BAR (w->vertical_scroll_bar); |
| 5176 | ch = SCROLL_BAR_CONTROL_HANDLE (bar); | 5171 | ch = SCROLL_BAR_CONTROL_REF (bar); |
| 5177 | 5172 | ||
| 5178 | BLOCK_INPUT; | 5173 | BLOCK_INPUT; |
| 5179 | 5174 | ||
| @@ -5229,7 +5224,7 @@ XTset_vertical_scroll_bar (w, portion, whole, position) | |||
| 5229 | } | 5224 | } |
| 5230 | else | 5225 | else |
| 5231 | { | 5226 | { |
| 5232 | ControlHandle ch = SCROLL_BAR_CONTROL_HANDLE (bar); | 5227 | ControlRef ch = SCROLL_BAR_CONTROL_REF (bar); |
| 5233 | Rect r0, r1; | 5228 | Rect r0, r1; |
| 5234 | 5229 | ||
| 5235 | BLOCK_INPUT; | 5230 | BLOCK_INPUT; |
| @@ -5506,11 +5501,11 @@ x_scroll_bar_report_motion (fp, bar_window, part, x, y, time) | |||
| 5506 | unsigned long *time; | 5501 | unsigned long *time; |
| 5507 | { | 5502 | { |
| 5508 | struct scroll_bar *bar = XSCROLL_BAR (last_mouse_scroll_bar); | 5503 | struct scroll_bar *bar = XSCROLL_BAR (last_mouse_scroll_bar); |
| 5509 | ControlHandle ch = SCROLL_BAR_CONTROL_HANDLE (bar); | 5504 | ControlRef ch = SCROLL_BAR_CONTROL_REF (bar); |
| 5510 | #if TARGET_API_MAC_CARBON | 5505 | #if TARGET_API_MAC_CARBON |
| 5511 | WindowPtr wp = GetControlOwner (ch); | 5506 | WindowRef wp = GetControlOwner (ch); |
| 5512 | #else | 5507 | #else |
| 5513 | WindowPtr wp = (*ch)->contrlOwner; | 5508 | WindowRef wp = (*ch)->contrlOwner; |
| 5514 | #endif | 5509 | #endif |
| 5515 | Point mouse_pos; | 5510 | Point mouse_pos; |
| 5516 | struct frame *f = mac_window_to_frame (wp); | 5511 | struct frame *f = mac_window_to_frame (wp); |
| @@ -6146,9 +6141,7 @@ x_set_offset (f, xoff, yoff, change_gravity) | |||
| 6146 | ConstrainWindowToScreen (FRAME_MAC_WINDOW (f), kWindowTitleBarRgn, | 6141 | ConstrainWindowToScreen (FRAME_MAC_WINDOW (f), kWindowTitleBarRgn, |
| 6147 | kWindowConstrainMoveRegardlessOfFit | 6142 | kWindowConstrainMoveRegardlessOfFit |
| 6148 | | kWindowConstrainAllowPartial, NULL, NULL); | 6143 | | kWindowConstrainAllowPartial, NULL, NULL); |
| 6149 | #if USE_CARBON_EVENTS | ||
| 6150 | if (!NILP (tip_frame) && XFRAME (tip_frame) == f) | 6144 | if (!NILP (tip_frame) && XFRAME (tip_frame) == f) |
| 6151 | #endif | ||
| 6152 | mac_handle_origin_change (f); | 6145 | mac_handle_origin_change (f); |
| 6153 | #else | 6146 | #else |
| 6154 | { | 6147 | { |
| @@ -6224,7 +6217,7 @@ x_set_window_size (f, change_gravity, cols, rows) | |||
| 6224 | 6217 | ||
| 6225 | SizeWindow (FRAME_MAC_WINDOW (f), pixelwidth, pixelheight, 0); | 6218 | SizeWindow (FRAME_MAC_WINDOW (f), pixelwidth, pixelheight, 0); |
| 6226 | 6219 | ||
| 6227 | #if USE_CARBON_EVENTS | 6220 | #if TARGET_API_MAC_CARBON |
| 6228 | if (!NILP (tip_frame) && f == XFRAME (tip_frame)) | 6221 | if (!NILP (tip_frame) && f == XFRAME (tip_frame)) |
| 6229 | #endif | 6222 | #endif |
| 6230 | mac_handle_size_change (f, pixelwidth, pixelheight); | 6223 | mac_handle_size_change (f, pixelwidth, pixelheight); |
| @@ -6363,7 +6356,7 @@ static void | |||
| 6363 | mac_handle_visibility_change (f) | 6356 | mac_handle_visibility_change (f) |
| 6364 | struct frame *f; | 6357 | struct frame *f; |
| 6365 | { | 6358 | { |
| 6366 | WindowPtr wp = FRAME_MAC_WINDOW (f); | 6359 | WindowRef wp = FRAME_MAC_WINDOW (f); |
| 6367 | int visible = 0, iconified = 0; | 6360 | int visible = 0, iconified = 0; |
| 6368 | struct input_event buf; | 6361 | struct input_event buf; |
| 6369 | 6362 | ||
| @@ -6448,9 +6441,7 @@ x_make_frame_visible (f) | |||
| 6448 | kWindowCascadeOnParentWindowScreen | 6441 | kWindowCascadeOnParentWindowScreen |
| 6449 | #endif | 6442 | #endif |
| 6450 | ); | 6443 | ); |
| 6451 | #if USE_CARBON_EVENTS | ||
| 6452 | if (!NILP (tip_frame) && f == XFRAME (tip_frame)) | 6444 | if (!NILP (tip_frame) && f == XFRAME (tip_frame)) |
| 6453 | #endif | ||
| 6454 | mac_handle_origin_change (f); | 6445 | mac_handle_origin_change (f); |
| 6455 | } | 6446 | } |
| 6456 | else | 6447 | else |
| @@ -6541,7 +6532,7 @@ x_make_frame_invisible (f) | |||
| 6541 | 6532 | ||
| 6542 | UNBLOCK_INPUT; | 6533 | UNBLOCK_INPUT; |
| 6543 | 6534 | ||
| 6544 | #if !USE_CARBON_EVENTS | 6535 | #if !TARGET_API_MAC_CARBON |
| 6545 | mac_handle_visibility_change (f); | 6536 | mac_handle_visibility_change (f); |
| 6546 | #endif | 6537 | #endif |
| 6547 | } | 6538 | } |
| @@ -6580,7 +6571,7 @@ x_iconify_frame (f) | |||
| 6580 | if (err != noErr) | 6571 | if (err != noErr) |
| 6581 | error ("Can't notify window manager of iconification"); | 6572 | error ("Can't notify window manager of iconification"); |
| 6582 | 6573 | ||
| 6583 | #if !USE_CARBON_EVENTS | 6574 | #if !TARGET_API_MAC_CARBON |
| 6584 | mac_handle_visibility_change (f); | 6575 | mac_handle_visibility_change (f); |
| 6585 | #endif | 6576 | #endif |
| 6586 | } | 6577 | } |
| @@ -6593,7 +6584,7 @@ x_free_frame_resources (f) | |||
| 6593 | struct frame *f; | 6584 | struct frame *f; |
| 6594 | { | 6585 | { |
| 6595 | struct mac_display_info *dpyinfo = FRAME_MAC_DISPLAY_INFO (f); | 6586 | struct mac_display_info *dpyinfo = FRAME_MAC_DISPLAY_INFO (f); |
| 6596 | WindowPtr wp = FRAME_MAC_WINDOW (f); | 6587 | WindowRef wp = FRAME_MAC_WINDOW (f); |
| 6597 | 6588 | ||
| 6598 | BLOCK_INPUT; | 6589 | BLOCK_INPUT; |
| 6599 | 6590 | ||
| @@ -8853,7 +8844,7 @@ Lisp_Object Vmac_function_modifier; | |||
| 8853 | a three button mouse */ | 8844 | a three button mouse */ |
| 8854 | Lisp_Object Vmac_emulate_three_button_mouse; | 8845 | Lisp_Object Vmac_emulate_three_button_mouse; |
| 8855 | 8846 | ||
| 8856 | #if USE_CARBON_EVENTS | 8847 | #if TARGET_API_MAC_CARBON |
| 8857 | /* Non-zero if the mouse wheel button (i.e. button 4) should map to | 8848 | /* Non-zero if the mouse wheel button (i.e. button 4) should map to |
| 8858 | mouse-2, instead of mouse-3. */ | 8849 | mouse-2, instead of mouse-3. */ |
| 8859 | int mac_wheel_button_is_mouse_2; | 8850 | int mac_wheel_button_is_mouse_2; |
| @@ -8878,7 +8869,7 @@ static int mac_screen_config_changed = 0; | |||
| 8878 | Point saved_menu_event_location; | 8869 | Point saved_menu_event_location; |
| 8879 | 8870 | ||
| 8880 | /* Apple Events */ | 8871 | /* Apple Events */ |
| 8881 | #if USE_CARBON_EVENTS | 8872 | #if TARGET_API_MAC_CARBON |
| 8882 | static Lisp_Object Qhi_command; | 8873 | static Lisp_Object Qhi_command; |
| 8883 | #ifdef MAC_OSX | 8874 | #ifdef MAC_OSX |
| 8884 | extern Lisp_Object Qwindow; | 8875 | extern Lisp_Object Qwindow; |
| @@ -8913,9 +8904,9 @@ extern OSErr install_drag_handler P_ ((WindowRef)); | |||
| 8913 | extern void remove_drag_handler P_ ((WindowRef)); | 8904 | extern void remove_drag_handler P_ ((WindowRef)); |
| 8914 | 8905 | ||
| 8915 | /* Showing help echo string during menu tracking */ | 8906 | /* Showing help echo string during menu tracking */ |
| 8916 | extern OSStatus install_menu_target_item_handler P_ ((WindowPtr)); | 8907 | extern OSStatus install_menu_target_item_handler P_ ((WindowRef)); |
| 8917 | 8908 | ||
| 8918 | #if USE_CARBON_EVENTS | 8909 | #if TARGET_API_MAC_CARBON |
| 8919 | #ifdef MAC_OSX | 8910 | #ifdef MAC_OSX |
| 8920 | extern void init_service_handler (); | 8911 | extern void init_service_handler (); |
| 8921 | static Lisp_Object Qservice, Qpaste, Qperform; | 8912 | static Lisp_Object Qservice, Qpaste, Qperform; |
| @@ -8925,7 +8916,7 @@ static Lisp_Object Qservice, Qpaste, Qperform; | |||
| 8925 | static pascal OSStatus mac_handle_window_event (EventHandlerCallRef, | 8916 | static pascal OSStatus mac_handle_window_event (EventHandlerCallRef, |
| 8926 | EventRef, void *); | 8917 | EventRef, void *); |
| 8927 | #endif | 8918 | #endif |
| 8928 | OSStatus install_window_handler (WindowPtr); | 8919 | OSStatus install_window_handler (WindowRef); |
| 8929 | 8920 | ||
| 8930 | extern void init_emacs_passwd_dir (); | 8921 | extern void init_emacs_passwd_dir (); |
| 8931 | extern int emacs_main (int, char **, char **); | 8922 | extern int emacs_main (int, char **, char **); |
| @@ -9009,7 +9000,7 @@ static const unsigned char fn_keycode_to_keycode_table[] = { | |||
| 9009 | #endif /* MAC_OSX */ | 9000 | #endif /* MAC_OSX */ |
| 9010 | 9001 | ||
| 9011 | static int | 9002 | static int |
| 9012 | #if USE_CARBON_EVENTS | 9003 | #if TARGET_API_MAC_CARBON |
| 9013 | mac_to_emacs_modifiers (UInt32 mods) | 9004 | mac_to_emacs_modifiers (UInt32 mods) |
| 9014 | #else | 9005 | #else |
| 9015 | mac_to_emacs_modifiers (EventModifiers mods) | 9006 | mac_to_emacs_modifiers (EventModifiers mods) |
| @@ -9118,7 +9109,7 @@ mac_quit_char_key_p (modifiers, key_code) | |||
| 9118 | } | 9109 | } |
| 9119 | #endif | 9110 | #endif |
| 9120 | 9111 | ||
| 9121 | #if USE_CARBON_EVENTS | 9112 | #if TARGET_API_MAC_CARBON |
| 9122 | /* Obtains the event modifiers from the event ref and then calls | 9113 | /* Obtains the event modifiers from the event ref and then calls |
| 9123 | mac_to_emacs_modifiers. */ | 9114 | mac_to_emacs_modifiers. */ |
| 9124 | static int | 9115 | static int |
| @@ -9267,7 +9258,7 @@ static void | |||
| 9267 | do_get_menus (void) | 9258 | do_get_menus (void) |
| 9268 | { | 9259 | { |
| 9269 | Handle menubar_handle; | 9260 | Handle menubar_handle; |
| 9270 | MenuHandle menu_handle; | 9261 | MenuRef menu; |
| 9271 | 9262 | ||
| 9272 | menubar_handle = GetNewMBar (128); | 9263 | menubar_handle = GetNewMBar (128); |
| 9273 | if(menubar_handle == NULL) | 9264 | if(menubar_handle == NULL) |
| @@ -9276,9 +9267,9 @@ do_get_menus (void) | |||
| 9276 | DrawMenuBar (); | 9267 | DrawMenuBar (); |
| 9277 | 9268 | ||
| 9278 | #if !TARGET_API_MAC_CARBON | 9269 | #if !TARGET_API_MAC_CARBON |
| 9279 | menu_handle = GetMenuHandle (M_APPLE); | 9270 | menu = GetMenuRef (M_APPLE); |
| 9280 | if(menu_handle != NULL) | 9271 | if (menu != NULL) |
| 9281 | AppendResMenu (menu_handle,'DRVR'); | 9272 | AppendResMenu (menu, 'DRVR'); |
| 9282 | else | 9273 | else |
| 9283 | abort (); | 9274 | abort (); |
| 9284 | #endif | 9275 | #endif |
| @@ -9327,7 +9318,7 @@ do_check_ram_size (void) | |||
| 9327 | #endif /* MAC_OS8 */ | 9318 | #endif /* MAC_OS8 */ |
| 9328 | 9319 | ||
| 9329 | static void | 9320 | static void |
| 9330 | do_window_update (WindowPtr win) | 9321 | do_window_update (WindowRef win) |
| 9331 | { | 9322 | { |
| 9332 | struct frame *f = mac_window_to_frame (win); | 9323 | struct frame *f = mac_window_to_frame (win); |
| 9333 | 9324 | ||
| @@ -9372,7 +9363,7 @@ do_window_update (WindowPtr win) | |||
| 9372 | } | 9363 | } |
| 9373 | 9364 | ||
| 9374 | static int | 9365 | static int |
| 9375 | is_emacs_window (WindowPtr win) | 9366 | is_emacs_window (WindowRef win) |
| 9376 | { | 9367 | { |
| 9377 | Lisp_Object tail, frame; | 9368 | Lisp_Object tail, frame; |
| 9378 | 9369 | ||
| @@ -9485,7 +9476,7 @@ do_apple_menu (SInt16 menu_item) | |||
| 9485 | NoteAlert (ABOUT_ALERT_ID, NULL); | 9476 | NoteAlert (ABOUT_ALERT_ID, NULL); |
| 9486 | else | 9477 | else |
| 9487 | { | 9478 | { |
| 9488 | GetMenuItemText (GetMenuHandle (M_APPLE), menu_item, item_name); | 9479 | GetMenuItemText (GetMenuRef (M_APPLE), menu_item, item_name); |
| 9489 | da_driver_refnum = OpenDeskAcc (item_name); | 9480 | da_driver_refnum = OpenDeskAcc (item_name); |
| 9490 | } | 9481 | } |
| 9491 | } | 9482 | } |
| @@ -9496,7 +9487,7 @@ do_apple_menu (SInt16 menu_item) | |||
| 9496 | 9487 | ||
| 9497 | static void | 9488 | static void |
| 9498 | do_grow_window (w, e) | 9489 | do_grow_window (w, e) |
| 9499 | WindowPtr w; | 9490 | WindowRef w; |
| 9500 | const EventRecord *e; | 9491 | const EventRecord *e; |
| 9501 | { | 9492 | { |
| 9502 | Rect limit_rect; | 9493 | Rect limit_rect; |
| @@ -9548,7 +9539,7 @@ mac_get_ideal_size (f) | |||
| 9548 | struct frame *f; | 9539 | struct frame *f; |
| 9549 | { | 9540 | { |
| 9550 | struct mac_display_info *dpyinfo = FRAME_MAC_DISPLAY_INFO (f); | 9541 | struct mac_display_info *dpyinfo = FRAME_MAC_DISPLAY_INFO (f); |
| 9551 | WindowPtr w = FRAME_MAC_WINDOW (f); | 9542 | WindowRef w = FRAME_MAC_WINDOW (f); |
| 9552 | Point ideal_size; | 9543 | Point ideal_size; |
| 9553 | Rect standard_rect; | 9544 | Rect standard_rect; |
| 9554 | int height, width, columns, rows; | 9545 | int height, width, columns, rows; |
| @@ -9574,7 +9565,7 @@ mac_get_ideal_size (f) | |||
| 9574 | wide (DEFAULT_NUM_COLS) and as tall as will fit on the screen. */ | 9565 | wide (DEFAULT_NUM_COLS) and as tall as will fit on the screen. */ |
| 9575 | 9566 | ||
| 9576 | static void | 9567 | static void |
| 9577 | do_zoom_window (WindowPtr w, int zoom_in_or_out) | 9568 | do_zoom_window (WindowRef w, int zoom_in_or_out) |
| 9578 | { | 9569 | { |
| 9579 | Rect zoom_rect, port_rect; | 9570 | Rect zoom_rect, port_rect; |
| 9580 | int width, height; | 9571 | int width, height; |
| @@ -9637,13 +9628,9 @@ do_zoom_window (WindowPtr w, int zoom_in_or_out) | |||
| 9637 | SetPort (save_port); | 9628 | SetPort (save_port); |
| 9638 | #endif /* not TARGET_API_MAC_CARBON */ | 9629 | #endif /* not TARGET_API_MAC_CARBON */ |
| 9639 | 9630 | ||
| 9640 | #if !USE_CARBON_EVENTS | 9631 | #if !TARGET_API_MAC_CARBON |
| 9641 | /* retrieve window size and update application values */ | 9632 | /* retrieve window size and update application values */ |
| 9642 | #if TARGET_API_MAC_CARBON | ||
| 9643 | GetWindowPortBounds (w, &port_rect); | ||
| 9644 | #else | ||
| 9645 | port_rect = w->portRect; | 9633 | port_rect = w->portRect; |
| 9646 | #endif | ||
| 9647 | height = port_rect.bottom - port_rect.top; | 9634 | height = port_rect.bottom - port_rect.top; |
| 9648 | width = port_rect.right - port_rect.left; | 9635 | width = port_rect.right - port_rect.left; |
| 9649 | 9636 | ||
| @@ -9730,9 +9717,7 @@ mac_store_drag_event (window, mouse_pos, modifiers, desc) | |||
| 9730 | buf.arg = mac_aedesc_to_lisp (desc); | 9717 | buf.arg = mac_aedesc_to_lisp (desc); |
| 9731 | kbd_buffer_store_event (&buf); | 9718 | kbd_buffer_store_event (&buf); |
| 9732 | } | 9719 | } |
| 9733 | #endif | ||
| 9734 | 9720 | ||
| 9735 | #if USE_CARBON_EVENTS | ||
| 9736 | static pascal OSStatus | 9721 | static pascal OSStatus |
| 9737 | mac_handle_command_event (next_handler, event, data) | 9722 | mac_handle_command_event (next_handler, event, data) |
| 9738 | EventHandlerCallRef next_handler; | 9723 | EventHandlerCallRef next_handler; |
| @@ -9785,14 +9770,14 @@ mac_handle_window_event (next_handler, event, data) | |||
| 9785 | EventRef event; | 9770 | EventRef event; |
| 9786 | void *data; | 9771 | void *data; |
| 9787 | { | 9772 | { |
| 9788 | WindowPtr wp; | 9773 | WindowRef wp; |
| 9789 | OSStatus result, err; | 9774 | OSStatus result, err; |
| 9790 | struct frame *f; | 9775 | struct frame *f; |
| 9791 | UInt32 attributes; | 9776 | UInt32 attributes; |
| 9792 | XSizeHints *size_hints; | 9777 | XSizeHints *size_hints; |
| 9793 | 9778 | ||
| 9794 | err = GetEventParameter (event, kEventParamDirectObject, typeWindowRef, | 9779 | err = GetEventParameter (event, kEventParamDirectObject, typeWindowRef, |
| 9795 | NULL, sizeof (WindowPtr), NULL, &wp); | 9780 | NULL, sizeof (WindowRef), NULL, &wp); |
| 9796 | if (err != noErr) | 9781 | if (err != noErr) |
| 9797 | return eventNotHandledErr; | 9782 | return eventNotHandledErr; |
| 9798 | 9783 | ||
| @@ -9981,7 +9966,7 @@ mac_handle_mouse_event (next_handler, event, data) | |||
| 9981 | { | 9966 | { |
| 9982 | case kEventMouseWheelMoved: | 9967 | case kEventMouseWheelMoved: |
| 9983 | { | 9968 | { |
| 9984 | WindowPtr wp; | 9969 | WindowRef wp; |
| 9985 | struct frame *f; | 9970 | struct frame *f; |
| 9986 | EventMouseWheelAxis axis; | 9971 | EventMouseWheelAxis axis; |
| 9987 | SInt32 delta; | 9972 | SInt32 delta; |
| @@ -10321,15 +10306,15 @@ mac_store_service_event (event) | |||
| 10321 | return err; | 10306 | return err; |
| 10322 | } | 10307 | } |
| 10323 | #endif /* MAC_OSX */ | 10308 | #endif /* MAC_OSX */ |
| 10324 | #endif /* USE_CARBON_EVENTS */ | 10309 | #endif /* TARGET_API_MAC_CARBON */ |
| 10325 | 10310 | ||
| 10326 | 10311 | ||
| 10327 | OSStatus | 10312 | OSStatus |
| 10328 | install_window_handler (window) | 10313 | install_window_handler (window) |
| 10329 | WindowPtr window; | 10314 | WindowRef window; |
| 10330 | { | 10315 | { |
| 10331 | OSStatus err = noErr; | 10316 | OSStatus err = noErr; |
| 10332 | #if USE_CARBON_EVENTS | 10317 | #if TARGET_API_MAC_CARBON |
| 10333 | static const EventTypeSpec specs_window[] = | 10318 | static const EventTypeSpec specs_window[] = |
| 10334 | {{kEventClassWindow, kEventWindowUpdate}, | 10319 | {{kEventClassWindow, kEventWindowUpdate}, |
| 10335 | {kEventClassWindow, kEventWindowGetIdealSize}, | 10320 | {kEventClassWindow, kEventWindowGetIdealSize}, |
| @@ -10409,7 +10394,7 @@ install_window_handler (window) | |||
| 10409 | 10394 | ||
| 10410 | void | 10395 | void |
| 10411 | remove_window_handler (window) | 10396 | remove_window_handler (window) |
| 10412 | WindowPtr window; | 10397 | WindowRef window; |
| 10413 | { | 10398 | { |
| 10414 | remove_drag_handler (window); | 10399 | remove_drag_handler (window); |
| 10415 | } | 10400 | } |
| @@ -10580,7 +10565,7 @@ main (void) | |||
| 10580 | } | 10565 | } |
| 10581 | #endif | 10566 | #endif |
| 10582 | 10567 | ||
| 10583 | #if !USE_CARBON_EVENTS | 10568 | #if !TARGET_API_MAC_CARBON |
| 10584 | static RgnHandle mouse_region = NULL; | 10569 | static RgnHandle mouse_region = NULL; |
| 10585 | 10570 | ||
| 10586 | Boolean | 10571 | Boolean |
| @@ -10617,7 +10602,7 @@ mac_wait_next_event (er, sleep_time, dequeue) | |||
| 10617 | er_buf.what = nullEvent; | 10602 | er_buf.what = nullEvent; |
| 10618 | return true; | 10603 | return true; |
| 10619 | } | 10604 | } |
| 10620 | #endif /* not USE_CARBON_EVENTS */ | 10605 | #endif /* not TARGET_API_MAC_CARBON */ |
| 10621 | 10606 | ||
| 10622 | #if TARGET_API_MAC_CARBON | 10607 | #if TARGET_API_MAC_CARBON |
| 10623 | OSStatus | 10608 | OSStatus |
| @@ -10700,7 +10685,7 @@ XTread_socket (sd, expected, hold_quit) | |||
| 10700 | { | 10685 | { |
| 10701 | struct input_event inev; | 10686 | struct input_event inev; |
| 10702 | int count = 0; | 10687 | int count = 0; |
| 10703 | #if USE_CARBON_EVENTS | 10688 | #if TARGET_API_MAC_CARBON |
| 10704 | EventRef eventRef; | 10689 | EventRef eventRef; |
| 10705 | EventTargetRef toolbox_dispatcher; | 10690 | EventTargetRef toolbox_dispatcher; |
| 10706 | #endif | 10691 | #endif |
| @@ -10721,7 +10706,7 @@ XTread_socket (sd, expected, hold_quit) | |||
| 10721 | 10706 | ||
| 10722 | ++handling_signal; | 10707 | ++handling_signal; |
| 10723 | 10708 | ||
| 10724 | #if USE_CARBON_EVENTS | 10709 | #if TARGET_API_MAC_CARBON |
| 10725 | toolbox_dispatcher = GetEventDispatcherTarget (); | 10710 | toolbox_dispatcher = GetEventDispatcherTarget (); |
| 10726 | 10711 | ||
| 10727 | while ( | 10712 | while ( |
| @@ -10730,9 +10715,9 @@ XTread_socket (sd, expected, hold_quit) | |||
| 10730 | #endif | 10715 | #endif |
| 10731 | !ReceiveNextEvent (0, NULL, kEventDurationNoWait, | 10716 | !ReceiveNextEvent (0, NULL, kEventDurationNoWait, |
| 10732 | kEventRemoveFromQueue, &eventRef)) | 10717 | kEventRemoveFromQueue, &eventRef)) |
| 10733 | #else /* !USE_CARBON_EVENTS */ | 10718 | #else /* !TARGET_API_MAC_CARBON */ |
| 10734 | while (mac_wait_next_event (&er, 0, true)) | 10719 | while (mac_wait_next_event (&er, 0, true)) |
| 10735 | #endif /* !USE_CARBON_EVENTS */ | 10720 | #endif /* !TARGET_API_MAC_CARBON */ |
| 10736 | { | 10721 | { |
| 10737 | int do_help = 0; | 10722 | int do_help = 0; |
| 10738 | struct frame *f; | 10723 | struct frame *f; |
| @@ -10742,13 +10727,13 @@ XTread_socket (sd, expected, hold_quit) | |||
| 10742 | inev.kind = NO_EVENT; | 10727 | inev.kind = NO_EVENT; |
| 10743 | inev.arg = Qnil; | 10728 | inev.arg = Qnil; |
| 10744 | 10729 | ||
| 10745 | #if USE_CARBON_EVENTS | 10730 | #if TARGET_API_MAC_CARBON |
| 10746 | timestamp = GetEventTime (eventRef) / kEventDurationMillisecond; | 10731 | timestamp = GetEventTime (eventRef) / kEventDurationMillisecond; |
| 10747 | #else | 10732 | #else |
| 10748 | timestamp = er.when * (1000 / 60); /* ticks to milliseconds */ | 10733 | timestamp = er.when * (1000 / 60); /* ticks to milliseconds */ |
| 10749 | #endif | 10734 | #endif |
| 10750 | 10735 | ||
| 10751 | #if USE_CARBON_EVENTS | 10736 | #if TARGET_API_MAC_CARBON |
| 10752 | /* Handle new events */ | 10737 | /* Handle new events */ |
| 10753 | if (!mac_convert_event_ref (eventRef, &er)) | 10738 | if (!mac_convert_event_ref (eventRef, &er)) |
| 10754 | { | 10739 | { |
| @@ -10765,17 +10750,17 @@ XTread_socket (sd, expected, hold_quit) | |||
| 10765 | read_socket_inev = NULL; | 10750 | read_socket_inev = NULL; |
| 10766 | } | 10751 | } |
| 10767 | else | 10752 | else |
| 10768 | #endif /* USE_CARBON_EVENTS */ | 10753 | #endif /* TARGET_API_MAC_CARBON */ |
| 10769 | switch (er.what) | 10754 | switch (er.what) |
| 10770 | { | 10755 | { |
| 10771 | case mouseDown: | 10756 | case mouseDown: |
| 10772 | case mouseUp: | 10757 | case mouseUp: |
| 10773 | { | 10758 | { |
| 10774 | WindowPtr window_ptr; | 10759 | WindowRef window_ptr; |
| 10775 | ControlPartCode part_code; | 10760 | ControlPartCode part_code; |
| 10776 | int tool_bar_p = 0; | 10761 | int tool_bar_p = 0; |
| 10777 | 10762 | ||
| 10778 | #if USE_CARBON_EVENTS | 10763 | #if TARGET_API_MAC_CARBON |
| 10779 | /* This is needed to send mouse events like aqua window | 10764 | /* This is needed to send mouse events like aqua window |
| 10780 | buttons to the correct handler. */ | 10765 | buttons to the correct handler. */ |
| 10781 | if (SendEventToEventTarget (eventRef, toolbox_dispatcher) | 10766 | if (SendEventToEventTarget (eventRef, toolbox_dispatcher) |
| @@ -10827,7 +10812,7 @@ XTread_socket (sd, expected, hold_quit) | |||
| 10827 | else | 10812 | else |
| 10828 | { | 10813 | { |
| 10829 | ControlPartCode control_part_code; | 10814 | ControlPartCode control_part_code; |
| 10830 | ControlHandle ch; | 10815 | ControlRef ch; |
| 10831 | Point mouse_loc = er.where; | 10816 | Point mouse_loc = er.where; |
| 10832 | #ifdef MAC_OSX | 10817 | #ifdef MAC_OSX |
| 10833 | ControlKind control_kind; | 10818 | ControlKind control_kind; |
| @@ -10850,7 +10835,7 @@ XTread_socket (sd, expected, hold_quit) | |||
| 10850 | &ch); | 10835 | &ch); |
| 10851 | #endif | 10836 | #endif |
| 10852 | 10837 | ||
| 10853 | #if USE_CARBON_EVENTS | 10838 | #if TARGET_API_MAC_CARBON |
| 10854 | inev.code = mac_get_mouse_btn (eventRef); | 10839 | inev.code = mac_get_mouse_btn (eventRef); |
| 10855 | inev.modifiers = mac_event_to_emacs_modifiers (eventRef); | 10840 | inev.modifiers = mac_event_to_emacs_modifiers (eventRef); |
| 10856 | #else | 10841 | #else |
| @@ -10986,16 +10971,14 @@ XTread_socket (sd, expected, hold_quit) | |||
| 10986 | DragWindow (window_ptr, er.where, NULL); | 10971 | DragWindow (window_ptr, er.where, NULL); |
| 10987 | #else /* not TARGET_API_MAC_CARBON */ | 10972 | #else /* not TARGET_API_MAC_CARBON */ |
| 10988 | DragWindow (window_ptr, er.where, &qd.screenBits.bounds); | 10973 | DragWindow (window_ptr, er.where, &qd.screenBits.bounds); |
| 10989 | #endif /* not TARGET_API_MAC_CARBON */ | ||
| 10990 | /* Update the frame parameters. */ | 10974 | /* Update the frame parameters. */ |
| 10991 | #if !USE_CARBON_EVENTS | ||
| 10992 | { | 10975 | { |
| 10993 | struct frame *f = mac_window_to_frame (window_ptr); | 10976 | struct frame *f = mac_window_to_frame (window_ptr); |
| 10994 | 10977 | ||
| 10995 | if (f && !f->async_iconified) | 10978 | if (f && !f->async_iconified) |
| 10996 | mac_handle_origin_change (f); | 10979 | mac_handle_origin_change (f); |
| 10997 | } | 10980 | } |
| 10998 | #endif | 10981 | #endif /* not TARGET_API_MAC_CARBON */ |
| 10999 | break; | 10982 | break; |
| 11000 | 10983 | ||
| 11001 | case inGoAway: | 10984 | case inGoAway: |
| @@ -11026,17 +11009,17 @@ XTread_socket (sd, expected, hold_quit) | |||
| 11026 | break; | 11009 | break; |
| 11027 | 11010 | ||
| 11028 | case updateEvt: | 11011 | case updateEvt: |
| 11029 | #if USE_CARBON_EVENTS | 11012 | #if TARGET_API_MAC_CARBON |
| 11030 | if (SendEventToEventTarget (eventRef, toolbox_dispatcher) | 11013 | if (SendEventToEventTarget (eventRef, toolbox_dispatcher) |
| 11031 | != eventNotHandledErr) | 11014 | != eventNotHandledErr) |
| 11032 | break; | 11015 | break; |
| 11033 | #else | 11016 | #else |
| 11034 | do_window_update ((WindowPtr) er.message); | 11017 | do_window_update ((WindowRef) er.message); |
| 11035 | #endif | 11018 | #endif |
| 11036 | break; | 11019 | break; |
| 11037 | 11020 | ||
| 11038 | case osEvt: | 11021 | case osEvt: |
| 11039 | #if USE_CARBON_EVENTS | 11022 | #if TARGET_API_MAC_CARBON |
| 11040 | if (SendEventToEventTarget (eventRef, toolbox_dispatcher) | 11023 | if (SendEventToEventTarget (eventRef, toolbox_dispatcher) |
| 11041 | != eventNotHandledErr) | 11024 | != eventNotHandledErr) |
| 11042 | break; | 11025 | break; |
| @@ -11053,7 +11036,7 @@ XTread_socket (sd, expected, hold_quit) | |||
| 11053 | break; | 11036 | break; |
| 11054 | 11037 | ||
| 11055 | case mouseMovedMessage: | 11038 | case mouseMovedMessage: |
| 11056 | #if !USE_CARBON_EVENTS | 11039 | #if !TARGET_API_MAC_CARBON |
| 11057 | SetRectRgn (mouse_region, er.where.h, er.where.v, | 11040 | SetRectRgn (mouse_region, er.where.h, er.where.v, |
| 11058 | er.where.h + 1, er.where.v + 1); | 11041 | er.where.h + 1, er.where.v + 1); |
| 11059 | #endif | 11042 | #endif |
| @@ -11074,7 +11057,7 @@ XTread_socket (sd, expected, hold_quit) | |||
| 11074 | 11057 | ||
| 11075 | if (f) | 11058 | if (f) |
| 11076 | { | 11059 | { |
| 11077 | WindowPtr wp = FRAME_MAC_WINDOW (f); | 11060 | WindowRef wp = FRAME_MAC_WINDOW (f); |
| 11078 | Point mouse_pos = er.where; | 11061 | Point mouse_pos = er.where; |
| 11079 | 11062 | ||
| 11080 | SetPortWindowPort (wp); | 11063 | SetPortWindowPort (wp); |
| @@ -11133,9 +11116,9 @@ XTread_socket (sd, expected, hold_quit) | |||
| 11133 | 11116 | ||
| 11134 | case activateEvt: | 11117 | case activateEvt: |
| 11135 | { | 11118 | { |
| 11136 | WindowPtr window_ptr = (WindowPtr) er.message; | 11119 | WindowRef window_ptr = (WindowRef) er.message; |
| 11137 | 11120 | ||
| 11138 | #if USE_CARBON_EVENTS | 11121 | #if TARGET_API_MAC_CARBON |
| 11139 | if (SendEventToEventTarget (eventRef, toolbox_dispatcher) | 11122 | if (SendEventToEventTarget (eventRef, toolbox_dispatcher) |
| 11140 | != eventNotHandledErr) | 11123 | != eventNotHandledErr) |
| 11141 | break; | 11124 | break; |
| @@ -11215,14 +11198,14 @@ XTread_socket (sd, expected, hold_quit) | |||
| 11215 | SInt16 current_key_script; | 11198 | SInt16 current_key_script; |
| 11216 | UInt32 modifiers = er.modifiers, mapped_modifiers; | 11199 | UInt32 modifiers = er.modifiers, mapped_modifiers; |
| 11217 | 11200 | ||
| 11218 | #if USE_CARBON_EVENTS && defined (MAC_OSX) | 11201 | #ifdef MAC_OSX |
| 11219 | GetEventParameter (eventRef, kEventParamKeyModifiers, | 11202 | GetEventParameter (eventRef, kEventParamKeyModifiers, |
| 11220 | typeUInt32, NULL, | 11203 | typeUInt32, NULL, |
| 11221 | sizeof (UInt32), NULL, &modifiers); | 11204 | sizeof (UInt32), NULL, &modifiers); |
| 11222 | #endif | 11205 | #endif |
| 11223 | mapped_modifiers = mac_mapped_modifiers (modifiers); | 11206 | mapped_modifiers = mac_mapped_modifiers (modifiers); |
| 11224 | 11207 | ||
| 11225 | #if USE_CARBON_EVENTS && (defined (MAC_OSX) || USE_MAC_TSM) | 11208 | #if defined (MAC_OSX) || USE_MAC_TSM |
| 11226 | /* When using Carbon Events, we need to pass raw keyboard | 11209 | /* When using Carbon Events, we need to pass raw keyboard |
| 11227 | events to the TSM ourselves. If TSM handles it, it | 11210 | events to the TSM ourselves. If TSM handles it, it |
| 11228 | will pass back noErr, otherwise it will pass back | 11211 | will pass back noErr, otherwise it will pass back |
| @@ -11430,7 +11413,7 @@ XTread_socket (sd, expected, hold_quit) | |||
| 11430 | default: | 11413 | default: |
| 11431 | break; | 11414 | break; |
| 11432 | } | 11415 | } |
| 11433 | #if USE_CARBON_EVENTS | 11416 | #if TARGET_API_MAC_CARBON |
| 11434 | ReleaseEvent (eventRef); | 11417 | ReleaseEvent (eventRef); |
| 11435 | #endif | 11418 | #endif |
| 11436 | 11419 | ||
| @@ -11482,7 +11465,7 @@ XTread_socket (sd, expected, hold_quit) | |||
| 11482 | mac_screen_config_changed = 0; | 11465 | mac_screen_config_changed = 0; |
| 11483 | } | 11466 | } |
| 11484 | 11467 | ||
| 11485 | #if !USE_CARBON_EVENTS | 11468 | #if !TARGET_API_MAC_CARBON |
| 11486 | /* Check which frames are still visible. We do this here because | 11469 | /* Check which frames are still visible. We do this here because |
| 11487 | there doesn't seem to be any direct notification from the Window | 11470 | there doesn't seem to be any direct notification from the Window |
| 11488 | Manager that the visibility of a window has changed (at least, | 11471 | Manager that the visibility of a window has changed (at least, |
| @@ -11587,7 +11570,7 @@ make_mac_terminal_frame (struct frame *f) | |||
| 11587 | 11570 | ||
| 11588 | if (!(FRAME_MAC_WINDOW (f) = | 11571 | if (!(FRAME_MAC_WINDOW (f) = |
| 11589 | NewCWindow (NULL, &r, "\p", true, dBoxProc, | 11572 | NewCWindow (NULL, &r, "\p", true, dBoxProc, |
| 11590 | (WindowPtr) -1, 1, (long) f->output_data.mac))) | 11573 | (WindowRef) -1, 1, (long) f->output_data.mac))) |
| 11591 | abort (); | 11574 | abort (); |
| 11592 | /* so that update events can find this mac_output struct */ | 11575 | /* so that update events can find this mac_output struct */ |
| 11593 | f->output_data.mac->mFP = f; /* point back to emacs frame */ | 11576 | f->output_data.mac->mFP = f; /* point back to emacs frame */ |
| @@ -11777,7 +11760,6 @@ init_menu_bar () | |||
| 11777 | &menu, &menu_index); | 11760 | &menu, &menu_index); |
| 11778 | if (err == noErr) | 11761 | if (err == noErr) |
| 11779 | SetMenuItemCommandKey (menu, menu_index, false, 0); | 11762 | SetMenuItemCommandKey (menu, menu_index, false, 0); |
| 11780 | #if USE_CARBON_EVENTS | ||
| 11781 | EnableMenuCommand (NULL, kHICommandPreferences); | 11763 | EnableMenuCommand (NULL, kHICommandPreferences); |
| 11782 | err = GetIndMenuItemWithCommandID (NULL, kHICommandPreferences, 1, | 11764 | err = GetIndMenuItemWithCommandID (NULL, kHICommandPreferences, 1, |
| 11783 | &menu, &menu_index); | 11765 | &menu, &menu_index); |
| @@ -11789,10 +11771,9 @@ init_menu_bar () | |||
| 11789 | InsertMenuItemTextWithCFString (menu, CFSTR ("About Emacs"), | 11771 | InsertMenuItemTextWithCFString (menu, CFSTR ("About Emacs"), |
| 11790 | 0, 0, kHICommandAbout); | 11772 | 0, 0, kHICommandAbout); |
| 11791 | } | 11773 | } |
| 11792 | #endif /* USE_CARBON_EVENTS */ | ||
| 11793 | #else /* !MAC_OSX */ | 11774 | #else /* !MAC_OSX */ |
| 11794 | #if USE_CARBON_EVENTS | 11775 | #if TARGET_API_MAC_CARBON |
| 11795 | SetMenuItemCommandID (GetMenuHandle (M_APPLE), I_ABOUT, kHICommandAbout); | 11776 | SetMenuItemCommandID (GetMenuRef (M_APPLE), I_ABOUT, kHICommandAbout); |
| 11796 | #endif | 11777 | #endif |
| 11797 | #endif | 11778 | #endif |
| 11798 | } | 11779 | } |
| @@ -11899,7 +11880,6 @@ mac_initialize () | |||
| 11899 | 11880 | ||
| 11900 | #if TARGET_API_MAC_CARBON | 11881 | #if TARGET_API_MAC_CARBON |
| 11901 | 11882 | ||
| 11902 | #if USE_CARBON_EVENTS | ||
| 11903 | #ifdef MAC_OSX | 11883 | #ifdef MAC_OSX |
| 11904 | init_service_handler (); | 11884 | init_service_handler (); |
| 11905 | #endif /* MAC_OSX */ | 11885 | #endif /* MAC_OSX */ |
| @@ -11911,7 +11891,6 @@ mac_initialize () | |||
| 11911 | #if USE_MAC_TSM | 11891 | #if USE_MAC_TSM |
| 11912 | init_tsm (); | 11892 | init_tsm (); |
| 11913 | #endif | 11893 | #endif |
| 11914 | #endif /* USE_CARBON_EVENTS */ | ||
| 11915 | 11894 | ||
| 11916 | #ifdef MAC_OSX | 11895 | #ifdef MAC_OSX |
| 11917 | init_coercion_handler (); | 11896 | init_coercion_handler (); |
| @@ -11961,7 +11940,7 @@ syms_of_macterm () | |||
| 11961 | Fput (Qhyper, Qmodifier_value, make_number (hyper_modifier)); | 11940 | Fput (Qhyper, Qmodifier_value, make_number (hyper_modifier)); |
| 11962 | Fput (Qsuper, Qmodifier_value, make_number (super_modifier)); | 11941 | Fput (Qsuper, Qmodifier_value, make_number (super_modifier)); |
| 11963 | 11942 | ||
| 11964 | #if USE_CARBON_EVENTS | 11943 | #if TARGET_API_MAC_CARBON |
| 11965 | Qhi_command = intern ("hi-command"); staticpro (&Qhi_command); | 11944 | Qhi_command = intern ("hi-command"); staticpro (&Qhi_command); |
| 11966 | #ifdef MAC_OSX | 11945 | #ifdef MAC_OSX |
| 11967 | Qtoolbar_switch_mode = intern ("toolbar-switch-mode"); | 11946 | Qtoolbar_switch_mode = intern ("toolbar-switch-mode"); |
| @@ -12086,7 +12065,7 @@ The symbol `reverse' means that the option-key will register for | |||
| 12086 | mouse-3 and the command-key will register for mouse-2. */); | 12065 | mouse-3 and the command-key will register for mouse-2. */); |
| 12087 | Vmac_emulate_three_button_mouse = Qnil; | 12066 | Vmac_emulate_three_button_mouse = Qnil; |
| 12088 | 12067 | ||
| 12089 | #if USE_CARBON_EVENTS | 12068 | #if TARGET_API_MAC_CARBON |
| 12090 | DEFVAR_BOOL ("mac-wheel-button-is-mouse-2", &mac_wheel_button_is_mouse_2, | 12069 | DEFVAR_BOOL ("mac-wheel-button-is-mouse-2", &mac_wheel_button_is_mouse_2, |
| 12091 | doc: /* *Non-nil if the wheel button is mouse-2 and the right click mouse-3. | 12070 | doc: /* *Non-nil if the wheel button is mouse-2 and the right click mouse-3. |
| 12092 | Otherwise, the right click will be treated as mouse-2 and the wheel | 12071 | Otherwise, the right click will be treated as mouse-2 and the wheel |