Ticket #141: InputServer.cpp.2.patch

File InputServer.cpp.2.patch, 2.3 KB (added by bxi07354@…, 18 years ago)

InputServer.cpp

  • haiku/src/servers/input/InputServer.cpp

    old new  
    14761476                PRINT(("SanitizeEvents: %lx, %lx\n", fKeyInfo.modifiers,
    14771477                    fKeyInfo.key_states[KEY_Spacebar >> 3]));
    14781478
     1479                int8 byte;
    14791480                if ((fKeyInfo.modifiers & B_COMMAND_KEY) != 0
    1480                     && (fKeyInfo.key_states[KEY_Spacebar >> 3]
    1481                         & (1 << (7 - (KEY_Spacebar % 8))))) {
     1481                    && event->FindInt8("byte", &byte) == B_OK && byte == ' ') {
    14821482                    SetNextMethod(!fKeyInfo.modifiers & B_SHIFT_KEY);
    14831483
    14841484                    // this event isn't sent to the user
     
    15261526
    15271527    if (!fInputMethodAware) {
    15281528        // special handling for non-input-method-aware views
    1529         for (int32 i = count; i < newCount; i++) {
     1529        for (int32 i = 0; i < newCount; i++) {
    15301530            BMessage* event = events.ItemAt(i);
    15311531
    15321532            if (event->what != B_INPUT_METHOD_EVENT)
     
    15361536
    15371537            int32 opcode;
    15381538            if (event->FindInt32("be:opcode", &opcode) == B_OK) {
    1539                 if (fInputMethodWindow && opcode == B_INPUT_METHOD_STOPPED) {
    1540                     fInputMethodWindow->PostMessage(B_QUIT_REQUESTED);
    1541                     fInputMethodWindow = NULL;
    1542                     continue;
    1543                 }
    15441539                if (fInputMethodWindow == NULL
    15451540                    && opcode == B_INPUT_METHOD_STARTED)
    15461541                    fInputMethodWindow = new (nothrow) BottomlineWindow();
    1547             }
    15481542
    1549             if (fInputMethodWindow != NULL) {
    1550                 EventList newEvents;
    1551                 fInputMethodWindow->HandleInputMethodEvent(event, newEvents);
    1552 
    1553                 if (!newEvents.IsEmpty()) {
    1554                     fInputMethodWindow->PostMessage(B_QUIT_REQUESTED);
    1555                     fInputMethodWindow = NULL;
     1543                if (fInputMethodWindow != NULL) {
     1544                    EventList newEvents;
     1545                    fInputMethodWindow->HandleInputMethodEvent(event, newEvents);
    15561546
    15571547                    // replace event with new events (but don't scan them again
    15581548                    // for input method messages)
    1559                     events.RemoveItemAt(i);
     1549                    events.RemoveItemAt(i--);
    15601550                    delete event;
     1551                    newCount--;
    15611552
    1562                     events.AddList(&newEvents, i);
    1563                     i += newEvents.CountItems() - 1;
    1564                     newCount = events.CountItems();
     1553                    if (!newEvents.IsEmpty()) {
     1554                        events.AddList(&newEvents);
     1555                        opcode = B_INPUT_METHOD_STOPPED;
     1556                    }
     1557
     1558                    if (opcode == B_INPUT_METHOD_STOPPED) {
     1559                        fInputMethodWindow->PostMessage(B_QUIT_REQUESTED);
     1560                        fInputMethodWindow = NULL;
     1561                    }
    15651562                }
    15661563            }
    15671564        }