~vcs-imports/libsdl/trunk

« back to all changes in this revision

Viewing changes to src/events/SDL_keyboard.c

  • Committer: slouken
  • Date: 2010-01-21 06:21:52 UTC
  • Revision ID: svn-v4:c70aab31-4412-0410-b14c-859654838e24:trunk/SDL:5525
Switched from SDL_WindowID and SDL_TextureID to SDL_Window* and SDL_Texture* for code simplicity and improved performance.

Show diffs side-by-side

added added

removed removed

Lines of Context:
646
646
}
647
647
 
648
648
void
649
 
SDL_SetKeyboardFocus(int index, SDL_WindowID windowID)
 
649
SDL_SetKeyboardFocus(int index, SDL_Window * window)
650
650
{
651
651
    SDL_Keyboard *keyboard = SDL_GetKeyboard(index);
652
652
    int i;
657
657
    }
658
658
 
659
659
    /* See if the current window has lost focus */
660
 
    if (keyboard->focus && keyboard->focus != windowID) {
 
660
    if (keyboard->focus && keyboard->focus != window) {
661
661
        focus = SDL_FALSE;
662
662
        for (i = 0; i < SDL_num_keyboards; ++i) {
663
663
            if (i != index) {
674
674
        }
675
675
    }
676
676
 
677
 
    keyboard->focus = windowID;
 
677
    keyboard->focus = window;
678
678
 
679
679
    if (keyboard->focus) {
680
680
        SDL_SendWindowEvent(keyboard->focus, SDL_WINDOWEVENT_FOCUS_GAINED,
809
809
        event.key.keysym.sym = keyboard->keymap[scancode];
810
810
        event.key.keysym.mod = modstate;
811
811
        event.key.keysym.unicode = 0;
812
 
        event.key.windowID = keyboard->focus;
 
812
        event.key.windowID = keyboard->focus->id;
813
813
        posted = (SDL_PushEvent(&event) > 0);
814
814
    }
815
815
    return (posted);
832
832
        event.text.type = SDL_TEXTINPUT;
833
833
        event.text.which = (Uint8) index;
834
834
        SDL_strlcpy(event.text.text, text, SDL_arraysize(event.text.text));
835
 
        event.text.windowID = keyboard->focus;
 
835
        event.text.windowID = keyboard->focus->id;
836
836
        posted = (SDL_PushEvent(&event) > 0);
837
837
    }
838
838
    return (posted);