} else anEvent.isShift = PR_FALSE;
}
void InitKeyPressEvent(GdkEventKey *aGEK,                       gpointer p,                       nsKeyEvent &anEvent){  //  // init the basic event fields  //  anEvent.eventStructType = NS_KEY_EVENT;  anEvent.message = NS_KEY_PRESS;  anEvent.widget = (nsWidget*)p;  if (aGEK!=nsnull) {    anEvent.isShift = (aGEK->state & GDK_SHIFT_MASK) ? PR_TRUE : PR_FALSE;    anEvent.isControl = (aGEK->state & GDK_CONTROL_MASK) ? PR_TRUE : PR_FALSE;    anEvent.isAlt = (aGEK->state & GDK_MOD1_MASK) ? PR_TRUE : PR_FALSE;    anEvent.isMeta = (aGEK->state & GDK_MOD4_MASK) ? PR_TRUE : PR_FALSE;    anEvent.charCode = nsConvertCharCodeToUnicode(aGEK);    if (anEvent.charCode) {      anEvent.keyCode = 0;            // if the control, meta, or alt key is down, then we should leave      // the isShift flag alone (probably not a printable character)      // if none of the other modifier keys are pressed then we need to      // clear isShift so the character can be inserted in the editor      if ( anEvent.isControl || anEvent.isAlt || anEvent.isMeta ) {         // make Ctrl+uppercase functional as same as Ctrl+lowercase         // when Ctrl+uppercase(eg.Ctrl+C) is pressed,convert the charCode         // from uppercase to lowercase(eg.Ctrl+c),so do Alt and Meta Key         // It is hack code for bug 61355, there is same code snip for         // Windows platform in widget/src/windows/nsWindow.cpp: See bug 16486         // Note: if Shift is pressed at the same time, do not to_lower()         // Because Ctrl+Shift has different function with Ctrl         if ( !anEvent.isShift &&              anEvent.charCode >= GDK_A &&              anEvent.charCode <= GDK_Z )           anEvent.charCode = gdk_keyval_to_lower(anEvent.charCode);      } else        anEvent.isShift = PR_FALSE;    } else {      anEvent.keyCode = nsPlatformToDOMKeyCode(aGEK);    }#if defined(DEBUG_akkana_not) || defined (DEBUG_ftang)    if (!aGEK->length) printf("!length, ");    printf("Key Press event: gtk string = '%s', keyval = '%c' = %d,\n",           aGEK->string, aGEK->keyval, aGEK->keyval);    printf("    --> keyCode = 0x%x, char code = '%c'",           anEvent.keyCode, anEvent.charCode);    if (anEvent.isShift)      printf(" [shift]");    if (anEvent.isControl)      printf(" [ctrl]");    if (anEvent.isAlt)      printf(" [alt]");    if (anEvent.isMeta)      printf(" [meta]");    printf("\n");#endif    anEvent.time = aGEK->time;    anEvent.point.x = 0;    anEvent.point.y = 0;  }}