comparison src/macterm.c @ 76091:746a3424769c

(mac_display_info_for_display): Remove function. (mac_flush_display_optional) [USE_CG_DRAWING]: New function. (x_redisplay_interface) [USE_CG_DRAWING]: Set it as handler for flush_display_optional. [USE_TOOLKIT_SCROLL_BARS] (x_scroll_bar_handle_press): New argument MOUSE_POS. All uses changed. Set bar->dragging to negative integer if scroll bar handle is pressed. [USE_TOOLKIT_SCROLL_BARS] (x_scroll_bar_handle_release): Negative bar->dragging means scroll bar handle is not dragged. [USE_TOOLKIT_SCROLL_BARS] (x_scroll_bar_handle_drag): Get initial offset of scroll bar handle from negative bar->dragging. (XTread_socket) [USE_TOOLKIT_SCROLL_BARS]: Modifiers for scroll bar click is compared against mapped one. Set down/up_modifier for scroll bar click event with control key.
author YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
date Fri, 23 Feb 2007 08:26:06 +0000
parents 82a0ad25cc0d
children d14fbfc5dd8e
comparison
equal deleted inserted replaced
76090:9e1d5ee9152e 76091:746a3424769c
1914 XTread_socket calls XPending. Removing XFlush improves 1914 XTread_socket calls XPending. Removing XFlush improves
1915 performance. */ 1915 performance. */
1916 1916
1917 #define XFlush(DISPLAY) (void) 0 1917 #define XFlush(DISPLAY) (void) 0
1918 1918
1919 1919 #if USE_CG_DRAWING
1920 /* Return the struct mac_display_info corresponding to DPY. There's 1920 static void
1921 only one. */ 1921 mac_flush_display_optional (f)
1922 1922 struct frame *f;
1923 struct mac_display_info * 1923 {
1924 mac_display_info_for_display (dpy) 1924 BLOCK_INPUT;
1925 Display *dpy; 1925 mac_prepare_for_quickdraw (f);
1926 { 1926 UNBLOCK_INPUT;
1927 return &one_mac_display_info; 1927 }
1928 } 1928 #endif
1929
1930
1931 1929
1932 /*********************************************************************** 1930 /***********************************************************************
1933 Starting and ending an update 1931 Starting and ending an update
1934 ***********************************************************************/ 1932 ***********************************************************************/
1935 1933
4647 static void construct_scroll_bar_click P_ ((struct scroll_bar *, int, 4645 static void construct_scroll_bar_click P_ ((struct scroll_bar *, int,
4648 struct input_event *)); 4646 struct input_event *));
4649 static OSStatus get_control_part_bounds P_ ((ControlHandle, ControlPartCode, 4647 static OSStatus get_control_part_bounds P_ ((ControlHandle, ControlPartCode,
4650 Rect *)); 4648 Rect *));
4651 static void x_scroll_bar_handle_press P_ ((struct scroll_bar *, 4649 static void x_scroll_bar_handle_press P_ ((struct scroll_bar *,
4652 ControlPartCode, 4650 ControlPartCode, Point,
4653 struct input_event *)); 4651 struct input_event *));
4654 static void x_scroll_bar_handle_release P_ ((struct scroll_bar *, 4652 static void x_scroll_bar_handle_release P_ ((struct scroll_bar *,
4655 struct input_event *)); 4653 struct input_event *));
4656 static void x_scroll_bar_handle_drag P_ ((WindowPtr, struct scroll_bar *, 4654 static void x_scroll_bar_handle_drag P_ ((WindowPtr, struct scroll_bar *,
4657 Point, struct input_event *)); 4655 Point, struct input_event *));
4760 4758
4761 return err; 4759 return err;
4762 } 4760 }
4763 4761
4764 static void 4762 static void
4765 x_scroll_bar_handle_press (bar, part_code, bufp) 4763 x_scroll_bar_handle_press (bar, part_code, mouse_pos, bufp)
4766 struct scroll_bar *bar; 4764 struct scroll_bar *bar;
4767 ControlPartCode part_code; 4765 ControlPartCode part_code;
4766 Point mouse_pos;
4768 struct input_event *bufp; 4767 struct input_event *bufp;
4769 { 4768 {
4770 int part = control_part_code_to_scroll_bar_part (part_code); 4769 int part = control_part_code_to_scroll_bar_part (part_code);
4771 4770
4772 if (part < 0) 4771 if (part < 0)
4775 if (part != scroll_bar_handle) 4774 if (part != scroll_bar_handle)
4776 { 4775 {
4777 construct_scroll_bar_click (bar, part, bufp); 4776 construct_scroll_bar_click (bar, part, bufp);
4778 HiliteControl (SCROLL_BAR_CONTROL_HANDLE (bar), part_code); 4777 HiliteControl (SCROLL_BAR_CONTROL_HANDLE (bar), part_code);
4779 set_scroll_bar_timer (SCROLL_BAR_FIRST_DELAY); 4778 set_scroll_bar_timer (SCROLL_BAR_FIRST_DELAY);
4779 bar->dragging = Qnil;
4780 }
4781 else
4782 {
4783 Rect r;
4784
4785 get_control_part_bounds (SCROLL_BAR_CONTROL_HANDLE (bar),
4786 kControlIndicatorPart, &r);
4787 XSETINT (bar->dragging, - (mouse_pos.v - r.top) - 1);
4780 } 4788 }
4781 4789
4782 last_scroll_bar_part = part; 4790 last_scroll_bar_part = part;
4783 bar->dragging = Qnil;
4784 tracked_scroll_bar = bar; 4791 tracked_scroll_bar = bar;
4785 } 4792 }
4786 4793
4787 static void 4794 static void
4788 x_scroll_bar_handle_release (bar, bufp) 4795 x_scroll_bar_handle_release (bar, bufp)
4789 struct scroll_bar *bar; 4796 struct scroll_bar *bar;
4790 struct input_event *bufp; 4797 struct input_event *bufp;
4791 { 4798 {
4792 if (last_scroll_bar_part != scroll_bar_handle 4799 if (last_scroll_bar_part != scroll_bar_handle
4793 || !GC_NILP (bar->dragging)) 4800 || (INTEGERP (bar->dragging) && XINT (bar->dragging) >= 0))
4794 construct_scroll_bar_click (bar, scroll_bar_end_scroll, bufp); 4801 construct_scroll_bar_click (bar, scroll_bar_end_scroll, bufp);
4795 4802
4796 HiliteControl (SCROLL_BAR_CONTROL_HANDLE (bar), 0); 4803 HiliteControl (SCROLL_BAR_CONTROL_HANDLE (bar), 0);
4797 set_scroll_bar_timer (kEventDurationForever); 4804 set_scroll_bar_timer (kEventDurationForever);
4798 4805
4816 Rect r; 4823 Rect r;
4817 4824
4818 get_control_part_bounds (SCROLL_BAR_CONTROL_HANDLE (bar), 4825 get_control_part_bounds (SCROLL_BAR_CONTROL_HANDLE (bar),
4819 kControlIndicatorPart, &r); 4826 kControlIndicatorPart, &r);
4820 4827
4821 if (GC_NILP (bar->dragging)) 4828 if (INTEGERP (bar->dragging) && XINT (bar->dragging) < 0)
4822 XSETINT (bar->dragging, mouse_pos.v - r.top); 4829 XSETINT (bar->dragging, - (XINT (bar->dragging) + 1));
4823 4830
4824 top = mouse_pos.v - XINT (bar->dragging) - XINT (bar->track_top); 4831 top = mouse_pos.v - XINT (bar->dragging) - XINT (bar->track_top);
4825 top_range = (XINT (bar->track_height) - (r.bottom - r.top)) * 4832 top_range = (XINT (bar->track_height) - (r.bottom - r.top)) *
4826 (1.0 + (float) GetControlViewSize (ch) / GetControl32BitMaximum (ch)) 4833 (1.0 + (float) GetControlViewSize (ch) / GetControl32BitMaximum (ch))
4827 + .5; 4834 + .5;
10752 else 10759 else
10753 bar = (struct scroll_bar *) GetControlReference (ch); 10760 bar = (struct scroll_bar *) GetControlReference (ch);
10754 #ifdef USE_TOOLKIT_SCROLL_BARS 10761 #ifdef USE_TOOLKIT_SCROLL_BARS
10755 /* Make the "Ctrl-Mouse-2 splits window" work 10762 /* Make the "Ctrl-Mouse-2 splits window" work
10756 for toolkit scroll bars. */ 10763 for toolkit scroll bars. */
10757 if (er.modifiers & controlKey) 10764 if (inev.modifiers & ctrl_modifier)
10758 x_scroll_bar_handle_click (bar, control_part_code, 10765 x_scroll_bar_handle_click (bar, control_part_code,
10759 &er, &inev); 10766 &er, &inev);
10760 else if (er.what == mouseDown) 10767 else if (er.what == mouseDown)
10761 x_scroll_bar_handle_press (bar, control_part_code, 10768 x_scroll_bar_handle_press (bar, control_part_code,
10762 &inev); 10769 mouse_loc, &inev);
10763 else 10770 else
10764 x_scroll_bar_handle_release (bar, &inev); 10771 x_scroll_bar_handle_release (bar, &inev);
10765 #else /* not USE_TOOLKIT_SCROLL_BARS */ 10772 #else /* not USE_TOOLKIT_SCROLL_BARS */
10766 x_scroll_bar_handle_click (bar, control_part_code, 10773 x_scroll_bar_handle_click (bar, control_part_code,
10767 &er, &inev); 10774 &er, &inev);
10820 ButtonPress. */ 10827 ButtonPress. */
10821 if (f != 0) 10828 if (f != 0)
10822 f->mouse_moved = 0; 10829 f->mouse_moved = 0;
10823 10830
10824 #ifdef USE_TOOLKIT_SCROLL_BARS 10831 #ifdef USE_TOOLKIT_SCROLL_BARS
10825 if (inev.kind == MOUSE_CLICK_EVENT) 10832 if (inev.kind == MOUSE_CLICK_EVENT
10833 || (inev.kind == SCROLL_BAR_CLICK_EVENT
10834 && (inev.modifiers & ctrl_modifier)))
10826 #endif 10835 #endif
10827 switch (er.what) 10836 switch (er.what)
10828 { 10837 {
10829 case mouseDown: 10838 case mouseDown:
10830 inev.modifiers |= down_modifier; 10839 inev.modifiers |= down_modifier;
11712 x_after_update_window_line, 11721 x_after_update_window_line,
11713 x_update_window_begin, 11722 x_update_window_begin,
11714 x_update_window_end, 11723 x_update_window_end,
11715 x_cursor_to, 11724 x_cursor_to,
11716 x_flush, 11725 x_flush,
11726 #if USE_CG_DRAWING
11727 mac_flush_display_optional,
11728 #else
11717 0, /* flush_display_optional */ 11729 0, /* flush_display_optional */
11730 #endif
11718 x_clear_window_mouse_face, 11731 x_clear_window_mouse_face,
11719 x_get_glyph_overhangs, 11732 x_get_glyph_overhangs,
11720 x_fix_overlapping_area, 11733 x_fix_overlapping_area,
11721 x_draw_fringe_bitmap, 11734 x_draw_fringe_bitmap,
11722 #if USE_CG_DRAWING 11735 #if USE_CG_DRAWING