Mercurial > emacs
comparison src/macterm.c @ 83304:6fef25c75847
Merged from miles@gnu.org--gnu-2005 (patch 296-306)
Patches applied:
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-296
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-297
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-298
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-299
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-300
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-301
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-302
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-303
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-304
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-305
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-306
Update from CVS
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-344
author | Karoly Lorentey <lorentey@elte.hu> |
---|---|
date | Fri, 13 May 2005 22:59:23 +0000 |
parents | 5ae8a8b0a308 9df01a686e3c |
children | 6aee1e9b0bd7 |
comparison
equal
deleted
inserted
replaced
83303:108e45fdcdbd | 83304:6fef25c75847 |
---|---|
3269 /* We don't set the output cursor here because there will always | 3269 /* We don't set the output cursor here because there will always |
3270 follow an explicit cursor_to. */ | 3270 follow an explicit cursor_to. */ |
3271 BLOCK_INPUT; | 3271 BLOCK_INPUT; |
3272 XClearWindow (FRAME_MAC_DISPLAY (f), FRAME_MAC_WINDOW (f)); | 3272 XClearWindow (FRAME_MAC_DISPLAY (f), FRAME_MAC_WINDOW (f)); |
3273 | 3273 |
3274 #if 0 /* Clearing frame on Mac OS clears scroll bars. */ | |
3275 /* We have to clear the scroll bars, too. If we have changed | 3274 /* We have to clear the scroll bars, too. If we have changed |
3276 colors or something like that, then they should be notified. */ | 3275 colors or something like that, then they should be notified. */ |
3277 x_scroll_bar_clear (f); | 3276 x_scroll_bar_clear (f); |
3278 #endif | |
3279 | 3277 |
3280 XFlush (FRAME_MAC_DISPLAY (f)); | 3278 XFlush (FRAME_MAC_DISPLAY (f)); |
3281 UNBLOCK_INPUT; | 3279 UNBLOCK_INPUT; |
3282 } | 3280 } |
3283 | 3281 |
4133 #ifdef USE_TOOLKIT_SCROLL_BARS | 4131 #ifdef USE_TOOLKIT_SCROLL_BARS |
4134 | 4132 |
4135 static pascal void scroll_bar_timer_callback P_ ((EventLoopTimerRef, void *)); | 4133 static pascal void scroll_bar_timer_callback P_ ((EventLoopTimerRef, void *)); |
4136 static OSStatus install_scroll_bar_timer P_ ((void)); | 4134 static OSStatus install_scroll_bar_timer P_ ((void)); |
4137 static OSStatus set_scroll_bar_timer P_ ((EventTimerInterval)); | 4135 static OSStatus set_scroll_bar_timer P_ ((EventTimerInterval)); |
4138 static int control_part_code_to_scroll_bar_part P_((ControlPartCode)); | 4136 static int control_part_code_to_scroll_bar_part P_ ((ControlPartCode)); |
4139 static void construct_scroll_bar_click P_ ((struct scroll_bar *, int, | 4137 static void construct_scroll_bar_click P_ ((struct scroll_bar *, int, |
4140 unsigned long, | 4138 unsigned long, |
4141 struct input_event *)); | 4139 struct input_event *)); |
4142 static OSErr get_control_part_bound P_((ControlHandle, ControlPartCode, | 4140 static OSErr get_control_part_bounds P_ ((ControlHandle, ControlPartCode, |
4143 Rect *)); | 4141 Rect *)); |
4144 static void x_scroll_bar_handle_press P_ ((struct scroll_bar *, | 4142 static void x_scroll_bar_handle_press P_ ((struct scroll_bar *, |
4145 ControlPartCode, | 4143 ControlPartCode, |
4146 unsigned long, | 4144 unsigned long, |
4147 struct input_event *)); | 4145 struct input_event *)); |
4148 static void x_scroll_bar_handle_release P_ ((struct scroll_bar *, | 4146 static void x_scroll_bar_handle_release P_ ((struct scroll_bar *, |
4265 XSETINT (bufp->y, 0); | 4263 XSETINT (bufp->y, 0); |
4266 bufp->modifiers = 0; | 4264 bufp->modifiers = 0; |
4267 } | 4265 } |
4268 | 4266 |
4269 static OSErr | 4267 static OSErr |
4270 get_control_part_bound (ch, part_code, rect) | 4268 get_control_part_bounds (ch, part_code, rect) |
4271 ControlHandle ch; | 4269 ControlHandle ch; |
4272 ControlPartCode part_code; | 4270 ControlPartCode part_code; |
4273 Rect *rect; | 4271 Rect *rect; |
4274 { | 4272 { |
4275 RgnHandle region = NewRgn (); | 4273 RgnHandle region = NewRgn (); |
4338 if (last_scroll_bar_part == scroll_bar_handle) | 4336 if (last_scroll_bar_part == scroll_bar_handle) |
4339 { | 4337 { |
4340 int top, top_range; | 4338 int top, top_range; |
4341 Rect r; | 4339 Rect r; |
4342 | 4340 |
4343 get_control_part_bound (SCROLL_BAR_CONTROL_HANDLE (bar), | 4341 get_control_part_bounds (SCROLL_BAR_CONTROL_HANDLE (bar), |
4344 kControlIndicatorPart, &r); | 4342 kControlIndicatorPart, &r); |
4345 | 4343 |
4346 if (GC_NILP (bar->dragging)) | 4344 if (GC_NILP (bar->dragging)) |
4347 XSETINT (bar->dragging, mouse_pos.v - r.top); | 4345 XSETINT (bar->dragging, mouse_pos.v - r.top); |
4348 | 4346 |
4349 top = mouse_pos.v - XINT (bar->dragging) - XINT (bar->track_top); | 4347 top = mouse_pos.v - XINT (bar->dragging) - XINT (bar->track_top); |
4667 ch = SCROLL_BAR_CONTROL_HANDLE (bar); | 4665 ch = SCROLL_BAR_CONTROL_HANDLE (bar); |
4668 | 4666 |
4669 BLOCK_INPUT; | 4667 BLOCK_INPUT; |
4670 | 4668 |
4671 /* If already correctly positioned, do nothing. */ | 4669 /* If already correctly positioned, do nothing. */ |
4672 if (XINT (bar->left) == sb_left | 4670 if (!(XINT (bar->left) == sb_left |
4673 && XINT (bar->top) == top | 4671 && XINT (bar->top) == top |
4674 && XINT (bar->width) == sb_width | 4672 && XINT (bar->width) == sb_width |
4675 && XINT (bar->height) == height) | 4673 && XINT (bar->height) == height)) |
4676 Draw1Control (ch); | 4674 { |
4677 else | |
4678 { | |
4679 /* Clear areas not covered by the scroll bar because it's not as | 4675 /* Clear areas not covered by the scroll bar because it's not as |
4680 wide as the area reserved for it . This makes sure a | 4676 wide as the area reserved for it . This makes sure a |
4681 previous mode line display is cleared after C-x 2 C-x 1, for | 4677 previous mode line display is cleared after C-x 2 C-x 1, for |
4682 example. */ | 4678 example. */ |
4683 int area_width = WINDOW_SCROLL_BAR_AREA_WIDTH (w); | 4679 int area_width = WINDOW_SCROLL_BAR_AREA_WIDTH (w); |
4722 SetControl32BitMaximum (ch, 1); | 4718 SetControl32BitMaximum (ch, 1); |
4723 SetControlViewSize (ch, 1); | 4719 SetControlViewSize (ch, 1); |
4724 | 4720 |
4725 /* Move the scroll bar thumb to the top. */ | 4721 /* Move the scroll bar thumb to the top. */ |
4726 SetControl32BitValue (ch, 0); | 4722 SetControl32BitValue (ch, 0); |
4727 get_control_part_bound (ch, kControlIndicatorPart, &r0); | 4723 get_control_part_bounds (ch, kControlIndicatorPart, &r0); |
4728 | 4724 |
4729 /* Move the scroll bar thumb to the bottom. */ | 4725 /* Move the scroll bar thumb to the bottom. */ |
4730 SetControl32BitValue (ch, 1); | 4726 SetControl32BitValue (ch, 1); |
4731 get_control_part_bound (ch, kControlIndicatorPart, &r1); | 4727 get_control_part_bounds (ch, kControlIndicatorPart, &r1); |
4732 | 4728 |
4733 UnionRect (&r0, &r1, &r0); | 4729 UnionRect (&r0, &r1, &r0); |
4734 XSETINT (bar->track_top, r0.top); | 4730 XSETINT (bar->track_top, r0.top); |
4735 XSETINT (bar->track_height, r0.bottom - r0.top); | 4731 XSETINT (bar->track_height, r0.bottom - r0.top); |
4736 | 4732 |
4874 mark bits. */ | 4870 mark bits. */ |
4875 | 4871 |
4876 static void | 4872 static void |
4877 x_scroll_bar_handle_click (bar, part_code, er, bufp) | 4873 x_scroll_bar_handle_click (bar, part_code, er, bufp) |
4878 struct scroll_bar *bar; | 4874 struct scroll_bar *bar; |
4879 int part_code; | 4875 ControlPartCode part_code; |
4880 EventRecord *er; | 4876 EventRecord *er; |
4881 struct input_event *bufp; | 4877 struct input_event *bufp; |
4882 { | 4878 { |
4883 int win_y, top_range; | 4879 int win_y, top_range; |
4884 | 4880 |
5032 f->mouse_moved = 0; | 5028 f->mouse_moved = 0; |
5033 last_mouse_scroll_bar = Qnil; | 5029 last_mouse_scroll_bar = Qnil; |
5034 | 5030 |
5035 *time = last_mouse_movement_time; | 5031 *time = last_mouse_movement_time; |
5036 } | 5032 } |
5033 | |
5034 | |
5035 /* The screen has been cleared so we may have changed foreground or | |
5036 background colors, and the scroll bars may need to be redrawn. | |
5037 Clear out the scroll bars, and ask for expose events, so we can | |
5038 redraw them. */ | |
5039 | |
5040 void | |
5041 x_scroll_bar_clear (f) | |
5042 FRAME_PTR f; | |
5043 { | |
5044 XTcondemn_scroll_bars (f); | |
5045 XTjudge_scroll_bars (f); | |
5046 } | |
5047 | |
5037 | 5048 |
5038 /*********************************************************************** | 5049 /*********************************************************************** |
5039 Text Cursor | 5050 Text Cursor |
5040 ***********************************************************************/ | 5051 ***********************************************************************/ |
5041 | 5052 |
7496 #endif | 7507 #endif |
7497 OSErr install_window_handler (WindowPtr); | 7508 OSErr install_window_handler (WindowPtr); |
7498 | 7509 |
7499 extern void init_emacs_passwd_dir (); | 7510 extern void init_emacs_passwd_dir (); |
7500 extern int emacs_main (int, char **, char **); | 7511 extern int emacs_main (int, char **, char **); |
7501 extern void check_alarm (); | |
7502 | 7512 |
7503 extern void initialize_applescript(); | 7513 extern void initialize_applescript(); |
7504 extern void terminate_applescript(); | 7514 extern void terminate_applescript(); |
7505 | 7515 |
7506 static unsigned int | 7516 static unsigned int |
8648 ProfilerTerm (); | 8658 ProfilerTerm (); |
8649 } | 8659 } |
8650 #endif | 8660 #endif |
8651 | 8661 |
8652 /* These few functions implement Emacs as a normal Mac application | 8662 /* These few functions implement Emacs as a normal Mac application |
8653 (almost): set up the heap and the Toolbox, handle necessary | 8663 (almost): set up the heap and the Toolbox, handle necessary system |
8654 system events plus a few simple menu events. They also set up | 8664 events plus a few simple menu events. They also set up Emacs's |
8655 Emacs's access to functions defined in the rest of this file. | 8665 access to functions defined in the rest of this file. Emacs uses |
8656 Emacs uses function hooks to perform all its terminal I/O. A | 8666 function hooks to perform all its terminal I/O. A complete list of |
8657 complete list of these functions appear in termhooks.h. For what | 8667 these functions appear in termhooks.h. For what they do, read the |
8658 they do, read the comments there and see also w32term.c and | 8668 comments there and see also w32term.c and xterm.c. What's |
8659 xterm.c. What's noticeably missing here is the event loop, which | 8669 noticeably missing here is the event loop, which is normally |
8660 is normally present in most Mac application. After performing the | 8670 present in most Mac application. After performing the necessary |
8661 necessary Mac initializations, main passes off control to | 8671 Mac initializations, main passes off control to emacs_main |
8662 emacs_main (corresponding to main in emacs.c). Emacs_main calls | 8672 (corresponding to main in emacs.c). Emacs_main calls XTread_socket |
8663 mac_read_socket (defined further below) to read input. This is | 8673 (defined further below) to read input. This is where |
8664 where WaitNextEvent is called to process Mac events. This is also | 8674 WaitNextEvent/ReceiveNextEvent is called to process Mac events. */ |
8665 where check_alarm in sysdep.c is called to simulate alarm signals. | |
8666 This makes the cursor jump back to its correct position after | |
8667 briefly jumping to that of the matching parenthesis, print useful | |
8668 hints and prompts in the minibuffer after the user stops typing for | |
8669 a wait, etc. */ | |
8670 | 8675 |
8671 #ifdef MAC_OS8 | 8676 #ifdef MAC_OS8 |
8672 #undef main | 8677 #undef main |
8673 int | 8678 int |
8674 main (void) | 8679 main (void) |
8927 { | 8932 { |
8928 case mouseDown: | 8933 case mouseDown: |
8929 case mouseUp: | 8934 case mouseUp: |
8930 { | 8935 { |
8931 WindowPtr window_ptr; | 8936 WindowPtr window_ptr; |
8932 SInt16 part_code; | 8937 ControlPartCode part_code; |
8933 int tool_bar_p = 0; | 8938 int tool_bar_p = 0; |
8934 | 8939 |
8935 #if USE_CARBON_EVENTS | 8940 #if USE_CARBON_EVENTS |
8936 /* This is needed to send mouse events like aqua window | 8941 /* This is needed to send mouse events like aqua window |
8937 buttons to the correct handler. */ | 8942 buttons to the correct handler. */ |
8971 case inContent: | 8976 case inContent: |
8972 if (window_ptr != FRAME_MAC_WINDOW (mac_focus_frame (dpyinfo))) | 8977 if (window_ptr != FRAME_MAC_WINDOW (mac_focus_frame (dpyinfo))) |
8973 SelectWindow (window_ptr); | 8978 SelectWindow (window_ptr); |
8974 else | 8979 else |
8975 { | 8980 { |
8976 SInt16 control_part_code; | 8981 ControlPartCode control_part_code; |
8977 ControlHandle ch; | 8982 ControlHandle ch; |
8978 Point mouse_loc = er.where; | 8983 Point mouse_loc = er.where; |
8979 #ifdef MAC_OSX | 8984 #ifdef MAC_OSX |
8980 ControlKind control_kind; | 8985 ControlKind control_kind; |
8981 #endif | 8986 #endif |
9546 { | 9551 { |
9547 x_raise_frame (pending_autoraise_frame); | 9552 x_raise_frame (pending_autoraise_frame); |
9548 pending_autoraise_frame = 0; | 9553 pending_autoraise_frame = 0; |
9549 } | 9554 } |
9550 | 9555 |
9551 #if !TARGET_API_MAC_CARBON | |
9552 check_alarm (); /* simulate the handling of a SIGALRM */ | |
9553 #endif | |
9554 | |
9555 UNBLOCK_INPUT; | 9556 UNBLOCK_INPUT; |
9556 return count; | 9557 return count; |
9557 } | 9558 } |
9558 | 9559 |
9559 | 9560 |