changeset 81656:fb6a1213c5e8

[USE_MAC_TSM] (mac_handle_text_input_event): Check WINDOWP before using XWINDOW. Consolidate return statements.
author YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
date Thu, 28 Jun 2007 10:08:41 +0000
parents 170a5ecefd82
children 28b986302f81
files src/macterm.c
diffstat 1 files changed, 25 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/src/macterm.c	Thu Jun 28 09:11:43 2007 +0000
+++ b/src/macterm.c	Thu Jun 28 10:08:41 2007 +0000
@@ -11164,7 +11164,7 @@
      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 @@
       SetEventParameter (event, EVENT_PARAM_TEXT_INPUT_SEQUENCE_NUMBER,
 			 typeUInt32, sizeof (UInt32), &seqno_uaia);
       seqno_uaia++;
+      result = noErr;
       break;
 
     case kEventTextInputUnicodeForKeyEvent:
@@ -11242,7 +11243,7 @@
 	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 @@
 			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 @@
 	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 @@
 	       + 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 @@
     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