From a56dd283e47fddebd754f94137e379ae85622cbe Mon Sep 17 00:00:00 2001 From: YAMAMOTO Mitsuharu Date: Thu, 28 Jun 2007 10:09:00 +0000 Subject: [PATCH] [USE_MAC_TSM] (mac_handle_text_input_event): Check WINDOWP before using XWINDOW. Consolidate return statements. --- src/ChangeLog | 5 +++++ src/macterm.c | 44 +++++++++++++++++++++++++------------------- 2 files changed, 30 insertions(+), 19 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 0659b8499b0..c66a1ea6dd9 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2007-06-28 YAMAMOTO Mitsuharu + + * macterm.c [USE_MAC_TSM] (mac_handle_text_input_event): + Check WINDOWP before using XWINDOW. Consolidate return statements. + 2007-06-27 Richard Stallman * fileio.c (syms_of_fileio) : Doc fix. diff --git a/src/macterm.c b/src/macterm.c index 52709c757f2..906f946388c 100644 --- a/src/macterm.c +++ b/src/macterm.c @@ -11164,7 +11164,7 @@ mac_handle_text_input_event (next_handler, event, data) EventRef event; void *data; { - OSStatus result, err = noErr; + OSStatus err, result; Lisp_Object id_key = Qnil; int num_params; const EventParamName *names; @@ -11225,6 +11225,7 @@ mac_handle_text_input_event (next_handler, event, data) SetEventParameter (event, EVENT_PARAM_TEXT_INPUT_SEQUENCE_NUMBER, typeUInt32, sizeof (UInt32), &seqno_uaia); seqno_uaia++; + result = noErr; break; case kEventTextInputUnicodeForKeyEvent: @@ -11242,7 +11243,7 @@ mac_handle_text_input_event (next_handler, event, data) if (err == noErr && mac_mapped_modifiers (modifiers)) /* There're mapped modifier keys. Process it in do_keystroke. */ - return eventNotHandledErr; + break; if (err == noErr) err = GetEventParameter (kbd_event, kEventParamKeyUnicodes, typeUnicodeText, NULL, 0, &actual_size, @@ -11281,16 +11282,20 @@ mac_handle_text_input_event (next_handler, event, data) XSETFRAME (read_socket_inev->frame_or_window, f); } } - return eventNotHandledErr; + break; } } + if (err == noErr) + { + /* Non-ASCII keystrokes without mapped modifiers are + processed at the Lisp level. */ + id_key = Qunicode_for_key_event; + num_params = sizeof (names_ufke) / sizeof (names_ufke[0]); + names = names_ufke; + types = types_ufke; + result = noErr; + } } - /* Non-ASCII keystrokes without mapped modifiers are processed - at the Lisp level. */ - id_key = Qunicode_for_key_event; - num_params = sizeof (names_ufke) / sizeof (names_ufke[0]); - names = names_ufke; - types = types_ufke; break; case kEventTextInputOffsetToPos: @@ -11300,22 +11305,24 @@ mac_handle_text_input_event (next_handler, event, data) Point p; if (!OVERLAYP (Vmac_ts_active_input_overlay)) - return eventNotHandledErr; + break; /* Strictly speaking, this is not always correct because previous events may change some states about display. */ - if (NILP (Foverlay_get (Vmac_ts_active_input_overlay, Qbefore_string))) + if (!NILP (Foverlay_get (Vmac_ts_active_input_overlay, Qbefore_string))) + { + /* Active input area is displayed around the current point. */ + f = SELECTED_FRAME (); + w = XWINDOW (f->selected_window); + } + else if (WINDOWP (echo_area_window)) { /* Active input area is displayed in the echo area. */ w = XWINDOW (echo_area_window); f = WINDOW_XFRAME (w); } else - { - /* Active input area is displayed around the current point. */ - f = SELECTED_FRAME (); - w = XWINDOW (f->selected_window); - } + break; p.h = (WINDOW_TO_FRAME_PIXEL_X (w, w->cursor.x) + WINDOW_LEFT_FRINGE_WIDTH (w) @@ -11325,6 +11332,8 @@ mac_handle_text_input_event (next_handler, event, data) + f->top_pos + FRAME_OUTER_TO_INNER_DIFF_Y (f)); err = SetEventParameter (event, kEventParamTextInputReplyPoint, typeQDPoint, sizeof (typeQDPoint), &p); + if (err == noErr) + result = noErr; } break; @@ -11336,9 +11345,6 @@ mac_handle_text_input_event (next_handler, event, data) err = mac_store_event_ref_as_apple_event (0, 0, Qtext_input, id_key, event, num_params, names, types); - if (err == noErr) - result = noErr; - return result; } #endif -- 2.39.2