diff options
| author | Karoly Lorentey | 2007-01-13 22:59:28 +0000 |
|---|---|---|
| committer | Karoly Lorentey | 2007-01-13 22:59:28 +0000 |
| commit | 38db5c8d522cc1faa8190e77dbc932a5560e6aad (patch) | |
| tree | efe4c81d7210843bb208282461ebce12c5bd3daf /src/macterm.c | |
| parent | 191ae1cf7cd2571277635b3b8e488e773ca5c9b9 (diff) | |
| parent | b4ec8cb4e66f94547e8215a1c1eb6cda3b83ca63 (diff) | |
| download | emacs-38db5c8d522cc1faa8190e77dbc932a5560e6aad.tar.gz emacs-38db5c8d522cc1faa8190e77dbc932a5560e6aad.zip | |
Merged from emacs@sv.gnu.org
Patches applied:
* emacs@sv.gnu.org/emacs--devo--0--patch-592
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-593
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-594
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-595
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-596
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-597
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-598
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-186
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-187
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-188
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-189
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-190
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-191
Update from CVS
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-593
Diffstat (limited to 'src/macterm.c')
| -rw-r--r-- | src/macterm.c | 117 |
1 files changed, 61 insertions, 56 deletions
diff --git a/src/macterm.c b/src/macterm.c index 7c3f036f1ba..1706da48cc3 100644 --- a/src/macterm.c +++ b/src/macterm.c | |||
| @@ -505,8 +505,10 @@ mac_draw_line (f, gc, x1, y1, x2, y2) | |||
| 505 | #endif | 505 | #endif |
| 506 | } | 506 | } |
| 507 | 507 | ||
| 508 | /* Mac version of XDrawLine (to Pixmap). */ | ||
| 509 | |||
| 508 | void | 510 | void |
| 509 | mac_draw_line_to_pixmap (display, p, gc, x1, y1, x2, y2) | 511 | XDrawLine (display, p, gc, x1, y1, x2, y2) |
| 510 | Display *display; | 512 | Display *display; |
| 511 | Pixmap p; | 513 | Pixmap p; |
| 512 | GC gc; | 514 | GC gc; |
| @@ -1628,9 +1630,9 @@ XChangeGC (display, gc, mask, xgcv) | |||
| 1628 | /* Mac replacement for XCreateGC. */ | 1630 | /* Mac replacement for XCreateGC. */ |
| 1629 | 1631 | ||
| 1630 | GC | 1632 | GC |
| 1631 | XCreateGC (display, window, mask, xgcv) | 1633 | XCreateGC (display, d, mask, xgcv) |
| 1632 | Display *display; | 1634 | Display *display; |
| 1633 | Window window; | 1635 | void *d; |
| 1634 | unsigned long mask; | 1636 | unsigned long mask; |
| 1635 | XGCValues *xgcv; | 1637 | XGCValues *xgcv; |
| 1636 | { | 1638 | { |
| @@ -1663,8 +1665,13 @@ XFreeGC (display, gc) | |||
| 1663 | if (gc->clip_region) | 1665 | if (gc->clip_region) |
| 1664 | DisposeRgn (gc->clip_region); | 1666 | DisposeRgn (gc->clip_region); |
| 1665 | #if USE_CG_DRAWING && MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 | 1667 | #if USE_CG_DRAWING && MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 |
| 1666 | CGColorRelease (gc->cg_fore_color); | 1668 | #if MAC_OS_X_VERSION_MIN_REQUIRED == 1020 |
| 1667 | CGColorRelease (gc->cg_back_color); | 1669 | if (CGColorGetTypeID != NULL) |
| 1670 | #endif | ||
| 1671 | { | ||
| 1672 | CGColorRelease (gc->cg_fore_color); | ||
| 1673 | CGColorRelease (gc->cg_back_color); | ||
| 1674 | } | ||
| 1668 | #endif | 1675 | #endif |
| 1669 | xfree (gc); | 1676 | xfree (gc); |
| 1670 | } | 1677 | } |
| @@ -8967,7 +8974,7 @@ static const unsigned char fn_keycode_to_keycode_table[] = { | |||
| 8967 | }; | 8974 | }; |
| 8968 | #endif /* MAC_OSX */ | 8975 | #endif /* MAC_OSX */ |
| 8969 | 8976 | ||
| 8970 | static unsigned int | 8977 | static int |
| 8971 | #if USE_CARBON_EVENTS | 8978 | #if USE_CARBON_EVENTS |
| 8972 | mac_to_emacs_modifiers (UInt32 mods) | 8979 | mac_to_emacs_modifiers (UInt32 mods) |
| 8973 | #else | 8980 | #else |
| @@ -9014,6 +9021,23 @@ mac_to_emacs_modifiers (EventModifiers mods) | |||
| 9014 | return result; | 9021 | return result; |
| 9015 | } | 9022 | } |
| 9016 | 9023 | ||
| 9024 | static UInt32 | ||
| 9025 | mac_mapped_modifiers (modifiers) | ||
| 9026 | UInt32 modifiers; | ||
| 9027 | { | ||
| 9028 | UInt32 mapped_modifiers_all = | ||
| 9029 | (NILP (Vmac_control_modifier) ? 0 : controlKey) | ||
| 9030 | | (NILP (Vmac_option_modifier) ? 0 : optionKey) | ||
| 9031 | | (NILP (Vmac_command_modifier) ? 0 : cmdKey); | ||
| 9032 | |||
| 9033 | #ifdef MAC_OSX | ||
| 9034 | mapped_modifiers_all |= | ||
| 9035 | (NILP (Vmac_function_modifier) ? 0 : kEventKeyModifierFnMask); | ||
| 9036 | #endif | ||
| 9037 | |||
| 9038 | return mapped_modifiers_all & modifiers; | ||
| 9039 | } | ||
| 9040 | |||
| 9017 | static int | 9041 | static int |
| 9018 | mac_get_emulated_btn ( UInt32 modifiers ) | 9042 | mac_get_emulated_btn ( UInt32 modifiers ) |
| 9019 | { | 9043 | { |
| @@ -9031,7 +9055,7 @@ mac_get_emulated_btn ( UInt32 modifiers ) | |||
| 9031 | #if USE_CARBON_EVENTS | 9055 | #if USE_CARBON_EVENTS |
| 9032 | /* Obtains the event modifiers from the event ref and then calls | 9056 | /* Obtains the event modifiers from the event ref and then calls |
| 9033 | mac_to_emacs_modifiers. */ | 9057 | mac_to_emacs_modifiers. */ |
| 9034 | static UInt32 | 9058 | static int |
| 9035 | mac_event_to_emacs_modifiers (EventRef eventRef) | 9059 | mac_event_to_emacs_modifiers (EventRef eventRef) |
| 9036 | { | 9060 | { |
| 9037 | UInt32 mods = 0; | 9061 | UInt32 mods = 0; |
| @@ -9256,6 +9280,9 @@ do_window_update (WindowPtr win) | |||
| 9256 | GetPortVisibleRegion (GetWindowPort (win), region); | 9280 | GetPortVisibleRegion (GetWindowPort (win), region); |
| 9257 | GetRegionBounds (region, &r); | 9281 | GetRegionBounds (region, &r); |
| 9258 | expose_frame (f, r.left, r.top, r.right - r.left, r.bottom - r.top); | 9282 | expose_frame (f, r.left, r.top, r.right - r.left, r.bottom - r.top); |
| 9283 | #if USE_CG_DRAWING | ||
| 9284 | mac_prepare_for_quickdraw (f); | ||
| 9285 | #endif | ||
| 9259 | UpdateControls (win, region); | 9286 | UpdateControls (win, region); |
| 9260 | DisposeRgn (region); | 9287 | DisposeRgn (region); |
| 9261 | #else | 9288 | #else |
| @@ -10067,21 +10094,10 @@ mac_handle_text_input_event (next_handler, event, data) | |||
| 10067 | err = GetEventParameter (kbd_event, kEventParamKeyModifiers, | 10094 | err = GetEventParameter (kbd_event, kEventParamKeyModifiers, |
| 10068 | typeUInt32, NULL, | 10095 | typeUInt32, NULL, |
| 10069 | sizeof (UInt32), NULL, &modifiers); | 10096 | sizeof (UInt32), NULL, &modifiers); |
| 10070 | if (err == noErr) | 10097 | if (err == noErr && mac_mapped_modifiers (modifiers)) |
| 10071 | { | 10098 | /* There're mapped modifier keys. Process it in |
| 10072 | mapped_modifiers = | 10099 | XTread_socket. */ |
| 10073 | (NILP (Vmac_control_modifier) ? 0 : controlKey) | 10100 | return eventNotHandledErr; |
| 10074 | | (NILP (Vmac_option_modifier) ? 0 : optionKey) | ||
| 10075 | | (NILP (Vmac_command_modifier) ? 0 : cmdKey); | ||
| 10076 | #ifdef MAC_OSX | ||
| 10077 | mapped_modifiers |= | ||
| 10078 | (NILP (Vmac_function_modifier) ? 0 : kEventKeyModifierFnMask); | ||
| 10079 | #endif | ||
| 10080 | if (modifiers & mapped_modifiers) | ||
| 10081 | /* There're mapped modifier keys. Process it in | ||
| 10082 | XTread_socket. */ | ||
| 10083 | return eventNotHandledErr; | ||
| 10084 | } | ||
| 10085 | if (err == noErr) | 10101 | if (err == noErr) |
| 10086 | err = GetEventParameter (kbd_event, kEventParamKeyUnicodes, | 10102 | err = GetEventParameter (kbd_event, kEventParamKeyUnicodes, |
| 10087 | typeUnicodeText, NULL, 0, &actual_size, | 10103 | typeUnicodeText, NULL, 0, &actual_size, |
| @@ -11032,20 +11048,12 @@ XTread_socket (sd, expected, hold_quit) | |||
| 11032 | SInt16 current_key_script; | 11048 | SInt16 current_key_script; |
| 11033 | UInt32 modifiers = er.modifiers, mapped_modifiers; | 11049 | UInt32 modifiers = er.modifiers, mapped_modifiers; |
| 11034 | 11050 | ||
| 11035 | mapped_modifiers = | ||
| 11036 | (NILP (Vmac_control_modifier) ? 0 : controlKey) | ||
| 11037 | | (NILP (Vmac_option_modifier) ? 0 : optionKey) | ||
| 11038 | | (NILP (Vmac_command_modifier) ? 0 : cmdKey); | ||
| 11039 | |||
| 11040 | #if USE_CARBON_EVENTS && defined (MAC_OSX) | 11051 | #if USE_CARBON_EVENTS && defined (MAC_OSX) |
| 11041 | mapped_modifiers |= | ||
| 11042 | (NILP (Vmac_function_modifier) ? 0 : kEventKeyModifierFnMask); | ||
| 11043 | |||
| 11044 | GetEventParameter (eventRef, kEventParamKeyModifiers, | 11052 | GetEventParameter (eventRef, kEventParamKeyModifiers, |
| 11045 | typeUInt32, NULL, | 11053 | typeUInt32, NULL, |
| 11046 | sizeof (UInt32), NULL, &modifiers); | 11054 | sizeof (UInt32), NULL, &modifiers); |
| 11047 | #endif | 11055 | #endif |
| 11048 | mapped_modifiers &= modifiers; | 11056 | mapped_modifiers = mac_mapped_modifiers (modifiers); |
| 11049 | 11057 | ||
| 11050 | #if USE_CARBON_EVENTS && (defined (MAC_OSX) || USE_MAC_TSM) | 11058 | #if USE_CARBON_EVENTS && (defined (MAC_OSX) || USE_MAC_TSM) |
| 11051 | /* When using Carbon Events, we need to pass raw keyboard | 11059 | /* When using Carbon Events, we need to pass raw keyboard |
| @@ -11639,34 +11647,33 @@ MakeMeTheFrontProcess () | |||
| 11639 | } | 11647 | } |
| 11640 | 11648 | ||
| 11641 | /***** Code to handle C-g testing *****/ | 11649 | /***** Code to handle C-g testing *****/ |
| 11642 | |||
| 11643 | /* Contains the Mac modifier formed from quit_char */ | ||
| 11644 | int mac_quit_char_modifiers = 0; | ||
| 11645 | int mac_quit_char_keycode; | ||
| 11646 | extern int quit_char; | 11650 | extern int quit_char; |
| 11651 | extern int make_ctrl_char P_ ((int)); | ||
| 11647 | 11652 | ||
| 11648 | static void | 11653 | int |
| 11649 | mac_determine_quit_char_modifiers() | 11654 | mac_quit_char_key_p (modifiers, key_code) |
| 11650 | { | 11655 | UInt32 modifiers, key_code; |
| 11651 | /* Todo: Determine modifiers from quit_char. */ | 11656 | { |
| 11652 | UInt32 qc_modifiers = ctrl_modifier; | 11657 | UInt32 char_code; |
| 11658 | unsigned long some_state = 0; | ||
| 11659 | Ptr kchr_ptr = (Ptr) GetScriptManagerVariable (smKCHRCache); | ||
| 11660 | int c, emacs_modifiers; | ||
| 11661 | |||
| 11662 | /* Mask off modifier keys that are mapped to some Emacs modifiers. */ | ||
| 11663 | key_code |= (modifiers & ~(mac_mapped_modifiers (modifiers))); | ||
| 11664 | char_code = KeyTranslate (kchr_ptr, key_code, &some_state); | ||
| 11665 | if (char_code & ~0xff) | ||
| 11666 | return 0; | ||
| 11653 | 11667 | ||
| 11654 | /* Map modifiers */ | 11668 | emacs_modifiers = mac_to_emacs_modifiers (modifiers); |
| 11655 | mac_quit_char_modifiers = 0; | 11669 | if (emacs_modifiers & ctrl_modifier) |
| 11656 | if (qc_modifiers & ctrl_modifier) mac_quit_char_modifiers |= controlKey; | 11670 | c = make_ctrl_char (char_code); |
| 11657 | if (qc_modifiers & shift_modifier) mac_quit_char_modifiers |= shiftKey; | ||
| 11658 | if (qc_modifiers & alt_modifier) mac_quit_char_modifiers |= optionKey; | ||
| 11659 | } | ||
| 11660 | 11671 | ||
| 11661 | static void | 11672 | c |= (emacs_modifiers |
| 11662 | init_quit_char_handler () | 11673 | & (meta_modifier | alt_modifier |
| 11663 | { | 11674 | | hyper_modifier | super_modifier)); |
| 11664 | /* TODO: Let this support keys other the 'g' */ | ||
| 11665 | mac_quit_char_keycode = 5; | ||
| 11666 | /* Look at <architecture/adb_kb_map.h> for details */ | ||
| 11667 | /* http://gemma.apple.com/techpubs/mac/Toolbox/Toolbox-40.html#MARKER-9-184*/ | ||
| 11668 | 11675 | ||
| 11669 | mac_determine_quit_char_modifiers(); | 11676 | return c == quit_char; |
| 11670 | } | 11677 | } |
| 11671 | #endif /* MAC_OSX */ | 11678 | #endif /* MAC_OSX */ |
| 11672 | 11679 | ||
| @@ -11804,8 +11811,6 @@ mac_initialize () | |||
| 11804 | #if USE_CARBON_EVENTS | 11811 | #if USE_CARBON_EVENTS |
| 11805 | #ifdef MAC_OSX | 11812 | #ifdef MAC_OSX |
| 11806 | init_service_handler (); | 11813 | init_service_handler (); |
| 11807 | |||
| 11808 | init_quit_char_handler (); | ||
| 11809 | #endif /* MAC_OSX */ | 11814 | #endif /* MAC_OSX */ |
| 11810 | 11815 | ||
| 11811 | init_command_handler (); | 11816 | init_command_handler (); |