printf("%s\n", str);
PRINTF("%s\n", str);
nsEventStatus PR_CALLBACK HandleEvent(nsGUIEvent *aEvent){    nsEventStatus result = nsEventStatus_eIgnore;   switch(aEvent->message) {        case NS_PAINT:                          // paint the background            if (aEvent->widget == gWindow) {                nsIRenderingContext *drawCtx = ((nsPaintEvent*)aEvent)->renderingContext;                drawCtx->SetColor(aEvent->widget->GetBackgroundColor());                drawCtx->FillRect(*(((nsPaintEvent*)aEvent)->rect));                drawtest(drawCtx);                return nsEventStatus_eIgnore;            }            break;        case NS_KEY_UP: {            nsKeyEvent * ke = (nsKeyEvent*)aEvent;            char str[256];            sprintf(str, "Key Event Key Code[%d] Key [%c] Shift [%s] Control [%s] Alt [%s]",              ke->keyCode, ke->keyCode,               (ke->isShift?"Pressed":"Released"),              (ke->isControl?"Pressed":"Released"),              (ke->isAlt?"Pressed":"Released"));            printf("%s\n", str);            switch(ke->keyCode) {               case 'U':                 gOffsetY -= 9;                 gWindow->Invalidate(PR_FALSE);               break;               case 'D':                 gOffsetY += 10;                 gWindow->Invalidate(PR_FALSE);                break;               case 'R':                 gOffsetX += 9;                 gWindow->Invalidate(PR_FALSE);               break;               case 'L':                 gOffsetX -= 10;                 gWindow->Invalidate(PR_FALSE);               break;            }            }            break;                case NS_DESTROY:			      exit(0); // for now            break;        default:            result = nsEventStatus_eIgnore;    }    return result;}