Mercurial > emacs
diff src/macterm.c @ 83037:03a73693678e
Merged in changes from CVS HEAD
Patches applied:
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-71
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-72
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-73
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-74
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-75
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-76
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-77
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-78
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-79
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-80
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-81
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-82
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-83
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-84
Add lisp/emacs-lisp/macroexp.el
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-85
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-86
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-87
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-88
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-89
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-90
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-91
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-92
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-93
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-94
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-95
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-96
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-97
Update from CVS
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-77
author | Karoly Lorentey <lorentey@elte.hu> |
---|---|
date | Tue, 17 Feb 2004 01:52:25 +0000 |
parents | 1d2f73785d9d 922b1cbf208b |
children | 887bb2eb4a89 |
line wrap: on
line diff
--- a/src/macterm.c Tue Feb 10 13:52:03 2004 +0000 +++ b/src/macterm.c Tue Feb 17 01:52:25 2004 +0000 @@ -467,15 +467,21 @@ /* Mac replacement for XCopyArea. */ static void -mac_draw_bitmap (display, w, gc, x, y, bitmap) +mac_draw_bitmap (display, w, gc, x, y, width, height, bits, overlay_p) Display *display; WindowPtr w; GC gc; - int x, y; - BitMap *bitmap; -{ + int x, y, width, height; + unsigned short *bits; + int overlay_p; +{ + BitMap bitmap; Rect r; + bitmap.rowBytes = sizeof(unsigned short); + bitmap.baseAddr = bits; + SetRect (&(bitmap.bounds), 0, 0, width, height); + #if TARGET_API_MAC_CARBON SetPort (GetWindowPort (w)); #else @@ -483,7 +489,7 @@ #endif mac_set_colors (gc); - SetRect (&r, x, y, x + bitmap->bounds.right, y + bitmap->bounds.bottom); + SetRect (&r, x, y, x + bitmap.bounds.right, y + bitmap.bounds.bottom); #if TARGET_API_MAC_CARBON { @@ -491,11 +497,13 @@ LockPortBits (GetWindowPort (w)); pmh = GetPortPixMap (GetWindowPort (w)); - CopyBits (bitmap, (BitMap *) *pmh, &(bitmap->bounds), &r, srcCopy, 0); + CopyBits (&bitmap, (BitMap *) *pmh, &(bitmap.bounds), &r, + overlay_p ? srcOr : srcCopy, 0); UnlockPortBits (GetWindowPort (w)); } #else /* not TARGET_API_MAC_CARBON */ - CopyBits (bitmap, &(w->portBits), &(bitmap->bounds), &r, srcCopy, 0); + CopyBits (&bitmap, &(w->portBits), &(bitmap.bounds), &r, + overlay_p ? srcOr : srcCopy, 0); #endif /* not TARGET_API_MAC_CARBON */ } @@ -1313,7 +1321,7 @@ else x_clip_to_row (w, row, gc); - if (p->bx >= 0) + if (p->bx >= 0 && !p->overlay_p) { XGCValues gcv; gcv.foreground = face->background; @@ -1339,18 +1347,18 @@ #endif } - if (p->which != NO_FRINGE_BITMAP) - { - unsigned char *bits = fringe_bitmaps[p->which].bits + p->dh; - BitMap bitmap; - - mac_create_bitmap_from_bitmap_data (&bitmap, bits, p->wd, p->h); - gcv.foreground = face->foreground; + if (p->which) + { + unsigned short *bits = p->bits + p->dh; + + gcv.foreground = (p->cursor_p + ? (p->overlay_p ? face->background + : f->output_data.mac->cursor_pixel) + : face->foreground); gcv.background = face->background; - mac_draw_bitmap (display, window, &gcv, p->x, p->y, &bitmap); - - mac_free_bitmap (&bitmap); + mac_draw_bitmap (display, window, &gcv, p->x, p->y, + p->wd, p->h, bits, p->overlay_p); } mac_reset_clipping (display, window); @@ -6455,12 +6463,19 @@ Boolean terminate_flag = false; +/* Contains the string "reverse", which is a constant for mouse button emu.*/ +Lisp_Object Qreverse; + /* True if using command key as meta key. */ Lisp_Object Vmac_command_key_is_meta; /* True if the ctrl and meta keys should be reversed. */ Lisp_Object Vmac_reverse_ctrl_meta; +/* True if the option and command modifiers should be used to emulate + a three button mouse */ +Lisp_Object Vmac_emulate_three_button_mouse; + #if USE_CARBON_EVENTS /* True if the mouse wheel button (i.e. button 4) should map to mouse-2, instead of mouse-3. */ @@ -6533,6 +6548,20 @@ return result; } +static int +mac_get_emulated_btn ( UInt32 modifiers ) +{ + int result = 0; + if (Vmac_emulate_three_button_mouse != Qnil) { + int cmdIs3 = (Vmac_emulate_three_button_mouse != Qreverse); + if (modifiers & controlKey) + result = cmdIs3 ? 2 : 1; + else if (modifiers & optionKey) + result = cmdIs3 ? 1 : 2; + } + return result; +} + #if USE_CARBON_EVENTS /* Obtains the event modifiers from the event ref and then calls mac_to_emacs_modifiers. */ @@ -6542,6 +6571,11 @@ UInt32 mods = 0; GetEventParameter (eventRef, kEventParamKeyModifiers, typeUInt32, NULL, sizeof (UInt32), NULL, &mods); + if (Vmac_emulate_three_button_mouse != Qnil && + GetEventClass(eventRef) == kEventClassMouse) + { + mods &= ~(optionKey & cmdKey); + } return mac_to_emacs_modifiers (mods); } @@ -6556,7 +6590,14 @@ switch (result) { case kEventMouseButtonPrimary: - return 0; + if (Vmac_emulate_three_button_mouse == Qnil) + return 0; + else { + UInt32 mods = 0; + GetEventParameter (ref, kEventParamKeyModifiers, typeUInt32, NULL, + sizeof (UInt32), NULL, &mods); + return mac_get_emulated_btn(mods); + } case kEventMouseButtonSecondary: return NILP (Vmac_wheel_button_is_mouse_2) ? 1 : 2; case kEventMouseButtonTertiary: @@ -7692,7 +7733,7 @@ #if USE_CARBON_EVENTS bufp->code = mac_get_mouse_btn (eventRef); #else - bufp->code = 0; /* only one mouse button */ + bufp_.code = mac_get_emulate_btn (er.modifiers); #endif bufp->kind = SCROLL_BAR_CLICK_EVENT; bufp->frame_or_window = tracked_scroll_bar->window; @@ -7760,7 +7801,7 @@ #if USE_CARBON_EVENTS bufp->code = mac_get_mouse_btn (eventRef); #else - bufp->code = 0; /* only one mouse button */ + bufp_.code = mac_get_emulate_btn (er.modifiers); #endif XSETINT (bufp->x, mouse_loc.h); XSETINT (bufp->y, mouse_loc.v); @@ -8517,6 +8558,8 @@ x_get_glyph_overhangs, x_fix_overlapping_area, x_draw_fringe_bitmap, + 0, /* define_fringe_bitmap */ + 0, /* destroy_fringe_bitmap */ mac_per_char_metric, mac_encode_char, NULL, /* mac_compute_glyph_string_overhangs */ @@ -8636,6 +8679,9 @@ Fprovide (intern ("mac-carbon"), Qnil); + staticpro (&Qreverse); + Qreverse = intern ("reverse"); + staticpro (&x_display_name_list); x_display_name_list = Qnil; @@ -8680,6 +8726,17 @@ useful for non-standard keyboard layouts. */); Vmac_reverse_ctrl_meta = Qnil; + DEFVAR_LISP ("mac-emulate-three-button-mouse", + &Vmac_emulate_three_button_mouse, + doc: /* t means that when the option-key is held down while pressing the + mouse button, the click will register as mouse-2 and while the + command-key is held down, the click will register as mouse-3. + 'reverse means that the the option-key will register for mouse-3 + and the command-key will register for mouse-2. nil means that + not emulation should be done and the modifiers should be placed + on the mouse-1 event. */); + Vmac_emulate_three_button_mouse = Qnil; + #if USE_CARBON_EVENTS DEFVAR_LISP ("mac-wheel-button-is-mouse-2", &Vmac_wheel_button_is_mouse_2, doc: /* Non-nil means that the wheel button will be treated as mouse-2 and