Mercurial > emacs
diff src/macterm.c @ 83556:07774e5c3ff5
Merged from emacs@sv.gnu.org
Patches applied:
* emacs@sv.gnu.org/emacs--devo--0--patch-619
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-620
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-621
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-622
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-623
Remove RCS keywords
* emacs@sv.gnu.org/emacs--devo--0--patch-624
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-625
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-626
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-627
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-628
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-629
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-630
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-631
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-632
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-633
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-634
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-635
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-636
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-637
Remove RCS keywords
* emacs@sv.gnu.org/emacs--devo--0--patch-638
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-639
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-640
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-641
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-642
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-643
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-644
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-645
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-646
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-647
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-648
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-649
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-197
Merge from emacs--devo--0
* emacs@sv.gnu.org/gnus--rel--5.10--patch-198
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-199
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-200
Merge from emacs--devo--0
* emacs@sv.gnu.org/gnus--rel--5.10--patch-201
Update from CVS: lisp/nnweb.el (nnweb-google-parse-1): Update parser.
* emacs@sv.gnu.org/gnus--rel--5.10--patch-202
Update from CVS
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-596
author | Karoly Lorentey <karoly@lorentey.hu> |
---|---|
date | Sat, 24 Feb 2007 19:26:54 +0000 |
parents | b8d9a391daf3 d14fbfc5dd8e |
children | 738ce3540ffb |
line wrap: on
line diff
--- a/src/macterm.c Sat Feb 24 19:12:27 2007 +0000 +++ b/src/macterm.c Sat Feb 24 19:26:54 2007 +0000 @@ -1916,18 +1916,16 @@ #define XFlush(DISPLAY) (void) 0 - -/* Return the struct mac_display_info corresponding to DPY. There's - only one. */ - -struct mac_display_info * -mac_display_info_for_display (dpy) - Display *dpy; -{ - return &one_mac_display_info; -} - - +#if USE_CG_DRAWING +static void +mac_flush_display_optional (f) + struct frame *f; +{ + BLOCK_INPUT; + mac_prepare_for_quickdraw (f); + UNBLOCK_INPUT; +} +#endif /*********************************************************************** Starting and ending an update @@ -4649,7 +4647,7 @@ static OSStatus get_control_part_bounds P_ ((ControlHandle, ControlPartCode, Rect *)); static void x_scroll_bar_handle_press P_ ((struct scroll_bar *, - ControlPartCode, + ControlPartCode, Point, struct input_event *)); static void x_scroll_bar_handle_release P_ ((struct scroll_bar *, struct input_event *)); @@ -4762,9 +4760,10 @@ } static void -x_scroll_bar_handle_press (bar, part_code, bufp) +x_scroll_bar_handle_press (bar, part_code, mouse_pos, bufp) struct scroll_bar *bar; ControlPartCode part_code; + Point mouse_pos; struct input_event *bufp; { int part = control_part_code_to_scroll_bar_part (part_code); @@ -4777,10 +4776,18 @@ construct_scroll_bar_click (bar, part, bufp); HiliteControl (SCROLL_BAR_CONTROL_HANDLE (bar), part_code); set_scroll_bar_timer (SCROLL_BAR_FIRST_DELAY); + bar->dragging = Qnil; + } + else + { + Rect r; + + get_control_part_bounds (SCROLL_BAR_CONTROL_HANDLE (bar), + kControlIndicatorPart, &r); + XSETINT (bar->dragging, - (mouse_pos.v - r.top) - 1); } last_scroll_bar_part = part; - bar->dragging = Qnil; tracked_scroll_bar = bar; } @@ -4790,7 +4797,7 @@ struct input_event *bufp; { if (last_scroll_bar_part != scroll_bar_handle - || !GC_NILP (bar->dragging)) + || (INTEGERP (bar->dragging) && XINT (bar->dragging) >= 0)) construct_scroll_bar_click (bar, scroll_bar_end_scroll, bufp); HiliteControl (SCROLL_BAR_CONTROL_HANDLE (bar), 0); @@ -4818,13 +4825,11 @@ get_control_part_bounds (SCROLL_BAR_CONTROL_HANDLE (bar), kControlIndicatorPart, &r); - if (GC_NILP (bar->dragging)) - XSETINT (bar->dragging, mouse_pos.v - r.top); + if (INTEGERP (bar->dragging) && XINT (bar->dragging) < 0) + XSETINT (bar->dragging, - (XINT (bar->dragging) + 1)); top = mouse_pos.v - XINT (bar->dragging) - XINT (bar->track_top); - top_range = (XINT (bar->track_height) - (r.bottom - r.top)) * - (1.0 + (float) GetControlViewSize (ch) / GetControl32BitMaximum (ch)) - + .5; + top_range = XINT (bar->track_height) - XINT (bar->min_handle); if (top < 0) top = 0; @@ -4891,13 +4896,16 @@ if (XINT (bar->track_height) == 0) return; - if (whole == 0) + if (whole <= portion) value = 0, viewsize = 1, maximum = 0; else { - value = position; - viewsize = portion; - maximum = max (0, whole - portion); + float scale; + + maximum = XINT (bar->track_height) - XINT (bar->min_handle); + scale = (float) maximum / (whole - portion); + value = position * scale + 0.5f; + viewsize = (int) (portion * scale + 0.5f) + XINT (bar->min_handle); } BLOCK_INPUT; @@ -4978,6 +4986,7 @@ #ifdef USE_TOOLKIT_SCROLL_BARS bar->track_top = Qnil; bar->track_height = Qnil; + bar->min_handle = Qnil; #endif /* Add bar to its frame's list of scroll bars. */ @@ -5198,6 +5207,7 @@ #ifdef USE_TOOLKIT_SCROLL_BARS bar->track_top = Qnil; bar->track_height = Qnil; + bar->min_handle = Qnil; #endif } @@ -5211,6 +5221,7 @@ { XSETINT (bar->track_top, 0); XSETINT (bar->track_height, 0); + XSETINT (bar->min_handle, 0); } else { @@ -5220,7 +5231,7 @@ BLOCK_INPUT; SetControl32BitMinimum (ch, 0); - SetControl32BitMaximum (ch, 1); + SetControl32BitMaximum (ch, 1 << 30); SetControlViewSize (ch, 1); /* Move the scroll bar thumb to the top. */ @@ -5228,12 +5239,13 @@ get_control_part_bounds (ch, kControlIndicatorPart, &r0); /* Move the scroll bar thumb to the bottom. */ - SetControl32BitValue (ch, 1); + SetControl32BitValue (ch, 1 << 30); get_control_part_bounds (ch, kControlIndicatorPart, &r1); UnionRect (&r0, &r1, &r0); XSETINT (bar->track_top, r0.top); XSETINT (bar->track_height, r0.bottom - r0.top); + XSETINT (bar->min_handle, r1.bottom - r1.top); /* Don't show the scroll bar if its height is not enough to display the scroll bar thumb. */ @@ -8791,9 +8803,6 @@ #define M_APPLE 234 #define I_ABOUT 1 -#define WINDOW_RESOURCE 128 -#define TERM_WINDOW_RESOURCE 129 - #define DEFAULT_NUM_COLS 80 #define MIN_DOC_SIZE 64 @@ -10120,7 +10129,7 @@ case kEventTextInputUnicodeForKeyEvent: { EventRef kbd_event; - UInt32 actual_size, modifiers, mapped_modifiers; + UInt32 actual_size, modifiers; err = GetEventParameter (event, kEventParamTextInputSendKeyboardEvent, typeEventRef, NULL, sizeof (EventRef), NULL, @@ -10757,12 +10766,12 @@ #ifdef USE_TOOLKIT_SCROLL_BARS /* Make the "Ctrl-Mouse-2 splits window" work for toolkit scroll bars. */ - if (er.modifiers & controlKey) + if (inev.modifiers & ctrl_modifier) x_scroll_bar_handle_click (bar, control_part_code, &er, &inev); else if (er.what == mouseDown) x_scroll_bar_handle_press (bar, control_part_code, - &inev); + mouse_loc, &inev); else x_scroll_bar_handle_release (bar, &inev); #else /* not USE_TOOLKIT_SCROLL_BARS */ @@ -10825,7 +10834,9 @@ f->mouse_moved = 0; #ifdef USE_TOOLKIT_SCROLL_BARS - if (inev.kind == MOUSE_CLICK_EVENT) + if (inev.kind == MOUSE_CLICK_EVENT + || (inev.kind == SCROLL_BAR_CLICK_EVENT + && (inev.modifiers & ctrl_modifier))) #endif switch (er.what) { @@ -11165,6 +11176,16 @@ /* translate the keycode back to determine the original key */ #ifdef MAC_OSX + UCKeyboardLayout *uchr_ptr = NULL; +#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1020 + OSStatus err; + KeyboardLayoutRef layout; + + err = KLGetCurrentKeyboardLayout (&layout); + if (err == noErr) + KLGetKeyboardLayoutProperty (layout, kKLuchrData, + (const void **) &uchr_ptr); +#else static SInt16 last_key_layout_id = 0; static Handle uchr_handle = (Handle)-1; SInt16 current_key_layout_id = @@ -11176,8 +11197,11 @@ uchr_handle = GetResource ('uchr', current_key_layout_id); last_key_layout_id = current_key_layout_id; } - if (uchr_handle) + uchr_ptr = (UCKeyboardLayout *)*uchr_handle; +#endif + + if (uchr_ptr) { OSStatus status; UInt16 key_action = er.what - keyDown; @@ -11188,7 +11212,7 @@ UniChar code; UniCharCount actual_length; - status = UCKeyTranslate ((UCKeyboardLayout *)*uchr_handle, + status = UCKeyTranslate (uchr_ptr, keycode, key_action, modifier_key_state, keyboard_type, @@ -11640,19 +11664,6 @@ } -#ifdef MAC_OSX -void -MakeMeTheFrontProcess () -{ - ProcessSerialNumber psn; - OSErr err; - - err = GetCurrentProcess (&psn); - if (err == noErr) - (void) SetFrontProcess (&psn); -} -#endif /* MAC_OSX */ - static void init_menu_bar () { @@ -11717,7 +11728,11 @@ x_update_window_end, x_cursor_to, x_flush, +#if USE_CG_DRAWING + mac_flush_display_optional, +#else 0, /* flush_display_optional */ +#endif x_clear_window_mouse_face, x_get_glyph_overhangs, x_fix_overlapping_area, @@ -11804,7 +11819,11 @@ init_apple_event_handler (); if (!inhibit_window_system) - MakeMeTheFrontProcess (); + { + static const ProcessSerialNumber psn = {0, kCurrentProcess}; + + SetFrontProcess (&psn); + } #endif #endif