diff options
| author | Karoly Lorentey | 2005-06-15 12:57:51 +0000 |
|---|---|---|
| committer | Karoly Lorentey | 2005-06-15 12:57:51 +0000 |
| commit | ef85512e51f043d73788f00a2aed13cccde0682c (patch) | |
| tree | fc1fa1378533250f260ef8eaa9a84ae882d9df84 /src/macterm.c | |
| parent | 8736257554f49445f7b4402ac7a9436b38ce6452 (diff) | |
| parent | ef88a9999004e6c26148c8d280d6a41f623d7249 (diff) | |
| download | emacs-ef85512e51f043d73788f00a2aed13cccde0682c.tar.gz emacs-ef85512e51f043d73788f00a2aed13cccde0682c.zip | |
Merged from miles@gnu.org--gnu-2005 (patch 80-82, 350-422)
Patches applied:
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-350
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-351
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-352
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-353
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-354
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-355
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-356
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-357
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-358
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-359
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-360
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-361
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-362
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-363
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-364
Remove "-face" suffix from widget faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Remove "-face" suffix from custom faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-366
Remove "-face" suffix from change-log faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-367
Remove "-face" suffix from compilation faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-368
Remove "-face" suffix from diff-mode faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-369
lisp/longlines.el (longlines-visible-face): Face removed
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-370
Remove "-face" suffix from woman faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-371
Remove "-face" suffix from whitespace-highlight face
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-372
Remove "-face" suffix from ruler-mode faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-373
Remove "-face" suffix from show-paren faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-374
Remove "-face" suffix from log-view faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-375
Remove "-face" suffix from smerge faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-376
Remove "-face" suffix from show-tabs faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-377
Remove "-face" suffix from highlight-changes faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-378
Remove "-face" suffix from and downcase info faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-379
Remove "-face" suffix from pcvs faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-380
Update uses of renamed pcvs faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-381
Tweak ChangeLog
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-382
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-383
Remove "-face" suffix from strokes-char face
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-384
Remove "-face" suffix from compare-windows face
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-385
Remove "-face" suffix from calendar faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-386
Remove "-face" suffix from diary-button face
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-387
Remove "-face" suffix from testcover faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-388
Remove "-face" suffix from viper faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-389
Remove "-face" suffix from org faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-390
Remove "-face" suffix from sgml-namespace face
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-391
Remove "-face" suffix from table-cell face
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-392
Remove "-face" suffix from tex-mode faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-393
Remove "-face" suffix from texinfo-heading face
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-394
Remove "-face" suffix from flyspell faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-395
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-396
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-397
Remove "-face" suffix from gomoku faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-398
Remove "-face" suffix from mpuz faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-399
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-400
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-401
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-402
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-403
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-404
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-405
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-406
Merge from gnus--rel--5.10
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-407
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-408
Remove "-face" suffix from Buffer-menu-buffer face
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-409
Remove "-face" suffix from antlr-mode faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-410
Remove "-face" suffix from ebrowse faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-411
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-412
Remove "-face" suffix from flymake faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-413
Remove "-face" suffix from idlwave faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-414
Remove "-face" suffix from sh-script faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-415
Remove "-face" suffix from vhdl-mode faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-416
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-417
Remove "-face" suffix from which-func face
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-418
Remove "-face" suffix from cperl-mode faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-419
Remove "-face" suffix from ld-script faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-420
Fix cperl-mode font-lock problem
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-421
Tweak which-func face
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-422
Update from CVS
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-80
Merge from emacs--cvs-trunk--0
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-81
Update from CVS
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-82
Update from CVS
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-350
Diffstat (limited to 'src/macterm.c')
| -rw-r--r-- | src/macterm.c | 318 |
1 files changed, 192 insertions, 126 deletions
diff --git a/src/macterm.c b/src/macterm.c index 890c1a1b9ba..f5c71ab2c24 100644 --- a/src/macterm.c +++ b/src/macterm.c | |||
| @@ -1996,33 +1996,37 @@ static void | |||
| 1996 | mac_compute_glyph_string_overhangs (s) | 1996 | mac_compute_glyph_string_overhangs (s) |
| 1997 | struct glyph_string *s; | 1997 | struct glyph_string *s; |
| 1998 | { | 1998 | { |
| 1999 | Rect r; | 1999 | if (s->cmp == NULL |
| 2000 | MacFontStruct *font = s->font; | 2000 | && s->first_glyph->type == CHAR_GLYPH) |
| 2001 | |||
| 2002 | TextFont (font->mac_fontnum); | ||
| 2003 | TextSize (font->mac_fontsize); | ||
| 2004 | TextFace (font->mac_fontface); | ||
| 2005 | |||
| 2006 | if (s->two_byte_p) | ||
| 2007 | QDTextBounds (s->nchars * 2, (char *)s->char2b, &r); | ||
| 2008 | else | ||
| 2009 | { | 2001 | { |
| 2010 | int i; | 2002 | Rect r; |
| 2011 | char *buf = xmalloc (s->nchars); | 2003 | MacFontStruct *font = s->font; |
| 2012 | 2004 | ||
| 2013 | if (buf == NULL) | 2005 | TextFont (font->mac_fontnum); |
| 2014 | SetRect (&r, 0, 0, 0, 0); | 2006 | TextSize (font->mac_fontsize); |
| 2007 | TextFace (font->mac_fontface); | ||
| 2008 | |||
| 2009 | if (s->two_byte_p) | ||
| 2010 | QDTextBounds (s->nchars * 2, (char *)s->char2b, &r); | ||
| 2015 | else | 2011 | else |
| 2016 | { | 2012 | { |
| 2017 | for (i = 0; i < s->nchars; ++i) | 2013 | int i; |
| 2018 | buf[i] = s->char2b[i].byte2; | 2014 | char *buf = xmalloc (s->nchars); |
| 2019 | QDTextBounds (s->nchars, buf, &r); | 2015 | |
| 2020 | xfree (buf); | 2016 | if (buf == NULL) |
| 2017 | SetRect (&r, 0, 0, 0, 0); | ||
| 2018 | else | ||
| 2019 | { | ||
| 2020 | for (i = 0; i < s->nchars; ++i) | ||
| 2021 | buf[i] = s->char2b[i].byte2; | ||
| 2022 | QDTextBounds (s->nchars, buf, &r); | ||
| 2023 | xfree (buf); | ||
| 2024 | } | ||
| 2021 | } | 2025 | } |
| 2022 | } | ||
| 2023 | 2026 | ||
| 2024 | s->right_overhang = r.right > s->width ? r.right - s->width : 0; | 2027 | s->right_overhang = r.right > s->width ? r.right - s->width : 0; |
| 2025 | s->left_overhang = r.left < 0 ? -r.left : 0; | 2028 | s->left_overhang = r.left < 0 ? -r.left : 0; |
| 2029 | } | ||
| 2026 | } | 2030 | } |
| 2027 | 2031 | ||
| 2028 | 2032 | ||
| @@ -7469,6 +7473,11 @@ Lisp_Object Vmac_pass_command_to_system; | |||
| 7469 | /* If Non-nil, the Mac "Control" key is passed on to the Mac Toolbox | 7473 | /* If Non-nil, the Mac "Control" key is passed on to the Mac Toolbox |
| 7470 | for processing before Emacs sees it. */ | 7474 | for processing before Emacs sees it. */ |
| 7471 | Lisp_Object Vmac_pass_control_to_system; | 7475 | Lisp_Object Vmac_pass_control_to_system; |
| 7476 | |||
| 7477 | /* Points to the variable `inev' in the function XTread_socket. It is | ||
| 7478 | used for passing an input event to the function back from a Carbon | ||
| 7479 | event handler. */ | ||
| 7480 | static struct input_event *read_socket_inev = NULL; | ||
| 7472 | #endif | 7481 | #endif |
| 7473 | 7482 | ||
| 7474 | /* Set in term/mac-win.el to indicate that event loop can now generate | 7483 | /* Set in term/mac-win.el to indicate that event loop can now generate |
| @@ -7601,45 +7610,79 @@ mac_get_mouse_btn (EventRef ref) | |||
| 7601 | 7610 | ||
| 7602 | /* Normally, ConvertEventRefToEventRecord will correctly handle all | 7611 | /* Normally, ConvertEventRefToEventRecord will correctly handle all |
| 7603 | events. However the click of the mouse wheel is not converted to a | 7612 | events. However the click of the mouse wheel is not converted to a |
| 7604 | mouseDown or mouseUp event. This calls ConvertEventRef, but then | 7613 | mouseDown or mouseUp event. Likewise for dead key down events. |
| 7605 | checks to see if it is a mouse up or down carbon event that has not | 7614 | This calls ConvertEventRef, but then checks to see if it is a mouse |
| 7606 | been converted, and if so, converts it by hand (to be picked up in | 7615 | up/down, or a dead key down carbon event that has not been |
| 7607 | the XTread_socket loop). */ | 7616 | converted, and if so, converts it by hand (to be picked up in the |
| 7617 | XTread_socket loop). */ | ||
| 7608 | static Boolean mac_convert_event_ref (EventRef eventRef, EventRecord *eventRec) | 7618 | static Boolean mac_convert_event_ref (EventRef eventRef, EventRecord *eventRec) |
| 7609 | { | 7619 | { |
| 7610 | Boolean result = ConvertEventRefToEventRecord (eventRef, eventRec); | 7620 | Boolean result = ConvertEventRefToEventRecord (eventRef, eventRec); |
| 7611 | /* Do special case for mouse wheel button. */ | 7621 | |
| 7612 | if (!result && GetEventClass (eventRef) == kEventClassMouse) | 7622 | if (result) |
| 7623 | return result; | ||
| 7624 | |||
| 7625 | switch (GetEventClass (eventRef)) | ||
| 7613 | { | 7626 | { |
| 7614 | UInt32 kind = GetEventKind (eventRef); | 7627 | case kEventClassMouse: |
| 7615 | if (kind == kEventMouseDown && !(eventRec->what == mouseDown)) | 7628 | switch (GetEventKind (eventRef)) |
| 7616 | { | 7629 | { |
| 7630 | case kEventMouseDown: | ||
| 7617 | eventRec->what = mouseDown; | 7631 | eventRec->what = mouseDown; |
| 7618 | result=1; | 7632 | result = 1; |
| 7619 | } | 7633 | break; |
| 7620 | if (kind == kEventMouseUp && !(eventRec->what == mouseUp)) | 7634 | |
| 7621 | { | 7635 | case kEventMouseUp: |
| 7622 | eventRec->what = mouseUp; | 7636 | eventRec->what = mouseUp; |
| 7623 | result=1; | 7637 | result = 1; |
| 7638 | break; | ||
| 7639 | |||
| 7640 | default: | ||
| 7641 | break; | ||
| 7624 | } | 7642 | } |
| 7625 | if (result) | 7643 | |
| 7644 | case kEventClassKeyboard: | ||
| 7645 | switch (GetEventKind (eventRef)) | ||
| 7626 | { | 7646 | { |
| 7627 | /* Need where and when. */ | 7647 | case kEventRawKeyDown: |
| 7628 | UInt32 mods; | 7648 | { |
| 7629 | GetEventParameter (eventRef, kEventParamMouseLocation, | 7649 | unsigned char char_codes; |
| 7630 | typeQDPoint, NULL, sizeof (Point), | 7650 | UInt32 key_code; |
| 7631 | NULL, &eventRec->where); | 7651 | |
| 7632 | /* Use two step process because new event modifiers are | 7652 | eventRec->what = keyDown; |
| 7633 | 32-bit and old are 16-bit. Currently, only loss is | 7653 | GetEventParameter (eventRef, kEventParamKeyMacCharCodes, typeChar, |
| 7634 | NumLock & Fn. */ | 7654 | NULL, sizeof (char), NULL, &char_codes); |
| 7635 | GetEventParameter (eventRef, kEventParamKeyModifiers, | 7655 | GetEventParameter (eventRef, kEventParamKeyCode, typeUInt32, |
| 7636 | typeUInt32, NULL, sizeof (UInt32), | 7656 | NULL, sizeof (UInt32), NULL, &key_code); |
| 7637 | NULL, &mods); | 7657 | eventRec->message = char_codes | ((key_code & 0xff) << 8); |
| 7638 | eventRec->modifiers = mods; | 7658 | result = 1; |
| 7639 | 7659 | } | |
| 7640 | eventRec->when = EventTimeToTicks (GetEventTime (eventRef)); | 7660 | break; |
| 7661 | |||
| 7662 | default: | ||
| 7663 | break; | ||
| 7641 | } | 7664 | } |
| 7665 | |||
| 7666 | default: | ||
| 7667 | break; | ||
| 7642 | } | 7668 | } |
| 7669 | |||
| 7670 | if (result) | ||
| 7671 | { | ||
| 7672 | /* Need where and when. */ | ||
| 7673 | UInt32 mods; | ||
| 7674 | |||
| 7675 | GetEventParameter (eventRef, kEventParamMouseLocation, typeQDPoint, | ||
| 7676 | NULL, sizeof (Point), NULL, &eventRec->where); | ||
| 7677 | /* Use two step process because new event modifiers are 32-bit | ||
| 7678 | and old are 16-bit. Currently, only loss is NumLock & Fn. */ | ||
| 7679 | GetEventParameter (eventRef, kEventParamKeyModifiers, typeUInt32, | ||
| 7680 | NULL, sizeof (UInt32), NULL, &mods); | ||
| 7681 | eventRec->modifiers = mods; | ||
| 7682 | |||
| 7683 | eventRec->when = EventTimeToTicks (GetEventTime (eventRef)); | ||
| 7684 | } | ||
| 7685 | |||
| 7643 | return result; | 7686 | return result; |
| 7644 | } | 7687 | } |
| 7645 | 7688 | ||
| @@ -8209,8 +8252,7 @@ mac_handle_command_event (next_handler, event, data) | |||
| 8209 | } | 8252 | } |
| 8210 | 8253 | ||
| 8211 | static OSErr | 8254 | static OSErr |
| 8212 | init_command_handler (window) | 8255 | init_command_handler () |
| 8213 | WindowPtr window; | ||
| 8214 | { | 8256 | { |
| 8215 | OSErr err = noErr; | 8257 | OSErr err = noErr; |
| 8216 | EventTypeSpec specs[] = {{kEventClassCommand, kEventCommandProcess}}; | 8258 | EventTypeSpec specs[] = {{kEventClassCommand, kEventCommandProcess}}; |
| @@ -8295,6 +8337,68 @@ mac_handle_window_event (next_handler, event, data) | |||
| 8295 | 8337 | ||
| 8296 | return eventNotHandledErr; | 8338 | return eventNotHandledErr; |
| 8297 | } | 8339 | } |
| 8340 | |||
| 8341 | static pascal OSStatus | ||
| 8342 | mac_handle_mouse_event (next_handler, event, data) | ||
| 8343 | EventHandlerCallRef next_handler; | ||
| 8344 | EventRef event; | ||
| 8345 | void *data; | ||
| 8346 | { | ||
| 8347 | OSStatus result; | ||
| 8348 | |||
| 8349 | switch (GetEventKind (event)) | ||
| 8350 | { | ||
| 8351 | case kEventMouseWheelMoved: | ||
| 8352 | { | ||
| 8353 | WindowPtr wp; | ||
| 8354 | struct frame *f; | ||
| 8355 | EventMouseWheelAxis axis; | ||
| 8356 | SInt32 delta; | ||
| 8357 | Point point; | ||
| 8358 | |||
| 8359 | result = CallNextEventHandler (next_handler, event); | ||
| 8360 | if (result != eventNotHandledErr || read_socket_inev == NULL) | ||
| 8361 | return result; | ||
| 8362 | |||
| 8363 | GetEventParameter (event, kEventParamWindowRef, typeWindowRef, | ||
| 8364 | NULL, sizeof (WindowRef), NULL, &wp); | ||
| 8365 | f = mac_window_to_frame (wp); | ||
| 8366 | if (f != mac_focus_frame (&one_mac_display_info)) | ||
| 8367 | break; | ||
| 8368 | |||
| 8369 | GetEventParameter (event, kEventParamMouseWheelAxis, | ||
| 8370 | typeMouseWheelAxis, NULL, | ||
| 8371 | sizeof (EventMouseWheelAxis), NULL, &axis); | ||
| 8372 | if (axis != kEventMouseWheelAxisY) | ||
| 8373 | break; | ||
| 8374 | |||
| 8375 | GetEventParameter (event, kEventParamMouseWheelDelta, typeSInt32, | ||
| 8376 | NULL, sizeof (SInt32), NULL, &delta); | ||
| 8377 | GetEventParameter (event, kEventParamMouseLocation, typeQDPoint, | ||
| 8378 | NULL, sizeof (Point), NULL, &point); | ||
| 8379 | read_socket_inev->kind = WHEEL_EVENT; | ||
| 8380 | read_socket_inev->code = 0; | ||
| 8381 | read_socket_inev->modifiers = | ||
| 8382 | (mac_event_to_emacs_modifiers (event) | ||
| 8383 | | ((delta < 0) ? down_modifier : up_modifier)); | ||
| 8384 | SetPortWindowPort (wp); | ||
| 8385 | GlobalToLocal (&point); | ||
| 8386 | XSETINT (read_socket_inev->x, point.h); | ||
| 8387 | XSETINT (read_socket_inev->y, point.v); | ||
| 8388 | XSETFRAME (read_socket_inev->frame_or_window, f); | ||
| 8389 | read_socket_inev->timestamp = | ||
| 8390 | EventTimeToTicks (GetEventTime (event)) * (1000/60); | ||
| 8391 | |||
| 8392 | return noErr; | ||
| 8393 | } | ||
| 8394 | break; | ||
| 8395 | |||
| 8396 | default: | ||
| 8397 | break; | ||
| 8398 | } | ||
| 8399 | |||
| 8400 | return eventNotHandledErr; | ||
| 8401 | } | ||
| 8298 | #endif /* USE_CARBON_EVENTS */ | 8402 | #endif /* USE_CARBON_EVENTS */ |
| 8299 | 8403 | ||
| 8300 | 8404 | ||
| @@ -8304,16 +8408,24 @@ install_window_handler (window) | |||
| 8304 | { | 8408 | { |
| 8305 | OSErr err = noErr; | 8409 | OSErr err = noErr; |
| 8306 | #if USE_CARBON_EVENTS | 8410 | #if USE_CARBON_EVENTS |
| 8307 | EventTypeSpec specs[] = {{kEventClassWindow, kEventWindowUpdate}, | 8411 | EventTypeSpec specs_window[] = |
| 8308 | {kEventClassWindow, kEventWindowBoundsChanging}}; | 8412 | {{kEventClassWindow, kEventWindowUpdate}, |
| 8309 | static EventHandlerUPP handle_window_event_UPP = NULL; | 8413 | {kEventClassWindow, kEventWindowBoundsChanging}}; |
| 8310 | 8414 | EventTypeSpec specs_mouse[] = {{kEventClassMouse, kEventMouseWheelMoved}}; | |
| 8311 | if (handle_window_event_UPP == NULL) | 8415 | static EventHandlerUPP handle_window_eventUPP = NULL; |
| 8312 | handle_window_event_UPP = NewEventHandlerUPP (mac_handle_window_event); | 8416 | static EventHandlerUPP handle_mouse_eventUPP = NULL; |
| 8313 | 8417 | ||
| 8314 | err = InstallWindowEventHandler (window, handle_window_event_UPP, | 8418 | if (handle_window_eventUPP == NULL) |
| 8315 | GetEventTypeCount (specs), specs, | 8419 | handle_window_eventUPP = NewEventHandlerUPP (mac_handle_window_event); |
| 8316 | NULL, NULL); | 8420 | if (handle_mouse_eventUPP == NULL) |
| 8421 | handle_mouse_eventUPP = NewEventHandlerUPP (mac_handle_mouse_event); | ||
| 8422 | err = InstallWindowEventHandler (window, handle_window_eventUPP, | ||
| 8423 | GetEventTypeCount (specs_window), | ||
| 8424 | specs_window, NULL, NULL); | ||
| 8425 | if (err == noErr) | ||
| 8426 | err = InstallWindowEventHandler (window, handle_mouse_eventUPP, | ||
| 8427 | GetEventTypeCount (specs_mouse), | ||
| 8428 | specs_mouse, NULL, NULL); | ||
| 8317 | #endif | 8429 | #endif |
| 8318 | #if TARGET_API_MAC_CARBON | 8430 | #if TARGET_API_MAC_CARBON |
| 8319 | if (mac_do_track_dragUPP == NULL) | 8431 | if (mac_do_track_dragUPP == NULL) |
| @@ -8865,68 +8977,19 @@ XTread_socket (sd, expected, hold_quit) | |||
| 8865 | #if USE_CARBON_EVENTS | 8977 | #if USE_CARBON_EVENTS |
| 8866 | /* Handle new events */ | 8978 | /* Handle new events */ |
| 8867 | if (!mac_convert_event_ref (eventRef, &er)) | 8979 | if (!mac_convert_event_ref (eventRef, &er)) |
| 8868 | switch (GetEventClass (eventRef)) | 8980 | { |
| 8869 | { | 8981 | /* There used to be a handler for the kEventMouseWheelMoved |
| 8870 | case kEventClassWindow: | 8982 | event here. But as of Mac OS X 10.4, this kind of event |
| 8871 | if (GetEventKind (eventRef) == kEventWindowBoundsChanged) | 8983 | is not directly posted to the main event queue by |
| 8872 | { | 8984 | two-finger scrolling on the trackpad. Instead, some |
| 8873 | WindowPtr window_ptr; | 8985 | private event is posted and it is converted to a wheel |
| 8874 | GetEventParameter(eventRef, kEventParamDirectObject, | 8986 | event by the default handler for the application target. |
| 8875 | typeWindowRef, NULL, sizeof(WindowPtr), | 8987 | The converted one can be received by a Carbon event |
| 8876 | NULL, &window_ptr); | 8988 | handler installed on a window target. */ |
| 8877 | f = mac_window_to_frame (window_ptr); | 8989 | read_socket_inev = &inev; |
| 8878 | if (f && !f->async_iconified) | 8990 | SendEventToEventTarget (eventRef, toolbox_dispatcher); |
| 8879 | x_real_positions (f, &f->left_pos, &f->top_pos); | 8991 | read_socket_inev = NULL; |
| 8880 | SendEventToEventTarget (eventRef, toolbox_dispatcher); | 8992 | } |
| 8881 | } | ||
| 8882 | break; | ||
| 8883 | case kEventClassMouse: | ||
| 8884 | if (GetEventKind (eventRef) == kEventMouseWheelMoved) | ||
| 8885 | { | ||
| 8886 | SInt32 delta; | ||
| 8887 | Point point; | ||
| 8888 | struct frame *f = mac_focus_frame (dpyinfo); | ||
| 8889 | WindowPtr window_ptr; | ||
| 8890 | |||
| 8891 | #if 0 | ||
| 8892 | if (dpyinfo->x_focus_frame == NULL) | ||
| 8893 | { | ||
| 8894 | /* Beep if wheel move occurs when all the frames | ||
| 8895 | are invisible. */ | ||
| 8896 | SysBeep(1); | ||
| 8897 | break; | ||
| 8898 | } | ||
| 8899 | #endif | ||
| 8900 | |||
| 8901 | GetEventParameter(eventRef, kEventParamMouseWheelDelta, | ||
| 8902 | typeSInt32, NULL, sizeof (SInt32), | ||
| 8903 | NULL, &delta); | ||
| 8904 | GetEventParameter(eventRef, kEventParamMouseLocation, | ||
| 8905 | typeQDPoint, NULL, sizeof (Point), | ||
| 8906 | NULL, &point); | ||
| 8907 | inev.kind = WHEEL_EVENT; | ||
| 8908 | inev.code = 0; | ||
| 8909 | inev.modifiers = (mac_event_to_emacs_modifiers (eventRef) | ||
| 8910 | | ((delta < 0) ? down_modifier | ||
| 8911 | : up_modifier)); | ||
| 8912 | window_ptr = FRAME_MAC_WINDOW (f); | ||
| 8913 | SetPortWindowPort (window_ptr); | ||
| 8914 | GlobalToLocal (&point); | ||
| 8915 | XSETINT (inev.x, point.h); | ||
| 8916 | XSETINT (inev.y, point.v); | ||
| 8917 | XSETFRAME (inev.frame_or_window, | ||
| 8918 | mac_window_to_frame (window_ptr)); | ||
| 8919 | inev.timestamp = EventTimeToTicks (GetEventTime (eventRef))*(1000/60); | ||
| 8920 | } | ||
| 8921 | else | ||
| 8922 | SendEventToEventTarget (eventRef, toolbox_dispatcher); | ||
| 8923 | |||
| 8924 | break; | ||
| 8925 | |||
| 8926 | default: | ||
| 8927 | /* Send the event to the appropriate receiver. */ | ||
| 8928 | SendEventToEventTarget (eventRef, toolbox_dispatcher); | ||
| 8929 | } | ||
| 8930 | else | 8993 | else |
| 8931 | #endif /* USE_CARBON_EVENTS */ | 8994 | #endif /* USE_CARBON_EVENTS */ |
| 8932 | switch (er.what) | 8995 | switch (er.what) |
| @@ -9362,7 +9425,10 @@ XTread_socket (sd, expected, hold_quit) | |||
| 9362 | if ((!NILP (Vmac_pass_command_to_system) | 9425 | if ((!NILP (Vmac_pass_command_to_system) |
| 9363 | || !(er.modifiers & cmdKey)) | 9426 | || !(er.modifiers & cmdKey)) |
| 9364 | && (!NILP (Vmac_pass_control_to_system) | 9427 | && (!NILP (Vmac_pass_control_to_system) |
| 9365 | || !(er.modifiers & controlKey))) | 9428 | || !(er.modifiers & controlKey)) |
| 9429 | && (!NILP (Vmac_command_key_is_meta) | ||
| 9430 | && NILP (Vmac_option_modifier) | ||
| 9431 | || !(er.modifiers & optionKey))) | ||
| 9366 | if (SendEventToEventTarget (eventRef, toolbox_dispatcher) | 9432 | if (SendEventToEventTarget (eventRef, toolbox_dispatcher) |
| 9367 | != eventNotHandledErr) | 9433 | != eventNotHandledErr) |
| 9368 | break; | 9434 | break; |
| @@ -9890,8 +9956,8 @@ MakeMeTheFrontProcess () | |||
| 9890 | /***** Code to handle C-g testing *****/ | 9956 | /***** Code to handle C-g testing *****/ |
| 9891 | 9957 | ||
| 9892 | /* Contains the Mac modifier formed from quit_char */ | 9958 | /* Contains the Mac modifier formed from quit_char */ |
| 9893 | static mac_quit_char_modifiers = 0; | 9959 | int mac_quit_char_modifiers = 0; |
| 9894 | static mac_quit_char_keycode; | 9960 | int mac_quit_char_keycode; |
| 9895 | extern int quit_char; | 9961 | extern int quit_char; |
| 9896 | 9962 | ||
| 9897 | static void | 9963 | static void |