aboutsummaryrefslogtreecommitdiffstats
path: root/src/macterm.c
diff options
context:
space:
mode:
authorYAMAMOTO Mitsuharu2005-05-13 08:42:38 +0000
committerYAMAMOTO Mitsuharu2005-05-13 08:42:38 +0000
commite6bdfa32e4c6ad5b36ce0397dade0fde7837565b (patch)
tree34572524beebaf49f639981f2dc1e29a1dcb6624 /src/macterm.c
parent40ef069579b4c2d2e09c3a5115e91284b5dbafe3 (diff)
downloademacs-e6bdfa32e4c6ad5b36ce0397dade0fde7837565b.tar.gz
emacs-e6bdfa32e4c6ad5b36ce0397dade0fde7837565b.zip
[USE_TOOLKIT_SCROLL_BARS] (get_control_part_bounds):
Rename from get_control_part_bound. All callers changed. (x_scroll_bar_clear): New function. (x_clear_frame): Use it. (XTset_vertical_scroll_bar): Don't call Draw1Control. (x_scroll_bar_handle_click): Change type of second argument from int to ControlPartCode. (check_alarm): Remove declaration. (XTread_Socket) [!TARGET_API_MAC_CARBON]: Don't call it. (XTread_Socket): Use ControlPartCode instead of SInt16.
Diffstat (limited to 'src/macterm.c')
-rw-r--r--src/macterm.c85
1 files changed, 43 insertions, 42 deletions
diff --git a/src/macterm.c b/src/macterm.c
index b83419ef6da..b94c3a1bbba 100644
--- a/src/macterm.c
+++ b/src/macterm.c
@@ -3271,11 +3271,9 @@ x_clear_frame ()
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;
@@ -4135,12 +4133,12 @@ XTmouse_position (fp, insist, bar_window, part, x, y, time)
4135static pascal void scroll_bar_timer_callback P_ ((EventLoopTimerRef, void *)); 4133static pascal void scroll_bar_timer_callback P_ ((EventLoopTimerRef, void *));
4136static OSStatus install_scroll_bar_timer P_ ((void)); 4134static OSStatus install_scroll_bar_timer P_ ((void));
4137static OSStatus set_scroll_bar_timer P_ ((EventTimerInterval)); 4135static OSStatus set_scroll_bar_timer P_ ((EventTimerInterval));
4138static int control_part_code_to_scroll_bar_part P_((ControlPartCode)); 4136static int control_part_code_to_scroll_bar_part P_ ((ControlPartCode));
4139static void construct_scroll_bar_click P_ ((struct scroll_bar *, int, 4137static void construct_scroll_bar_click P_ ((struct scroll_bar *, int,
4140 unsigned long, 4138 unsigned long,
4141 struct input_event *)); 4139 struct input_event *));
4142static OSErr get_control_part_bound P_((ControlHandle, ControlPartCode, 4140static OSErr get_control_part_bounds P_ ((ControlHandle, ControlPartCode,
4143 Rect *)); 4141 Rect *));
4144static void x_scroll_bar_handle_press P_ ((struct scroll_bar *, 4142static void x_scroll_bar_handle_press P_ ((struct scroll_bar *,
4145 ControlPartCode, 4143 ControlPartCode,
4146 unsigned long, 4144 unsigned long,
@@ -4267,7 +4265,7 @@ construct_scroll_bar_click (bar, part, timestamp, bufp)
4267} 4265}
4268 4266
4269static OSErr 4267static OSErr
4270get_control_part_bound (ch, part_code, rect) 4268get_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;
@@ -4340,8 +4338,8 @@ x_scroll_bar_handle_drag (win, bar, mouse_pos, timestamp, bufp)
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);
@@ -4669,13 +4667,11 @@ XTset_vertical_scroll_bar (w, portion, whole, position)
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
@@ -4724,11 +4720,11 @@ XTset_vertical_scroll_bar (w, portion, whole, position)
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);
@@ -4876,7 +4872,7 @@ XTjudge_scroll_bars (f)
4876static void 4872static void
4877x_scroll_bar_handle_click (bar, part_code, er, bufp) 4873x_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{
@@ -5034,6 +5030,21 @@ x_scroll_bar_report_motion (fp, bar_window, part, x, y, time)
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
5040void
5041x_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
@@ -7498,7 +7509,6 @@ OSErr install_window_handler (WindowPtr);
7498 7509
7499extern void init_emacs_passwd_dir (); 7510extern void init_emacs_passwd_dir ();
7500extern int emacs_main (int, char **, char **); 7511extern int emacs_main (int, char **, char **);
7501extern void check_alarm ();
7502 7512
7503extern void initialize_applescript(); 7513extern void initialize_applescript();
7504extern void terminate_applescript(); 7514extern void terminate_applescript();
@@ -8650,23 +8660,18 @@ profiler_exit_proc ()
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
@@ -8929,7 +8934,7 @@ XTread_socket (sd, expected, hold_quit)
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
@@ -8973,7 +8978,7 @@ XTread_socket (sd, expected, hold_quit)
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
@@ -9548,10 +9553,6 @@ XTread_socket (sd, expected, hold_quit)
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}