/* SDL - Simple DirectMedia Layer Copyright (C) 1997-2006 Sam Lantinga This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Sam Lantinga slouken@libsdl.org */ #include "SDL_config.h" #include #include #include #include "SDL_error.h" #include "SDL_events.h" #include "SDL_QWin.h" #include "SDL_lowvideo.h" #include "SDL_timer.h" extern "C" { #include "../../events/SDL_sysevents.h" #include "../../events/SDL_events_c.h" #include "SDL_sysevents_c.h" // static SDLKey keymap[128]; /* This is special because we know it will be run in a loop in a separate thread. Normally this function should loop as long as there are input states changing, i.e. new events arriving. */ void QT_PumpEvents(_THIS) { if(!qApp) { return; } // printf("processing events: %p\n", qApp); //qApp->processOneEvent(); // wait for a event qApp->processEvents(); // and process all outstanding ones #if 0 BView *view; BRect bounds; BPoint point; uint32 buttons; const uint32 button_masks[3] = { B_PRIMARY_MOUSE_BUTTON, B_TERTIARY_MOUSE_BUTTON, B_SECONDARY_MOUSE_BUTTON, }; unsigned int i, j; /* Check out the mouse buttons and position (slight race condition) */ if ( SDL_Win->Lock() ) { /* Don't do anything if we have no view */ view = SDL_Win->View(); if ( ! view ) { SDL_Win->Unlock(); return; } bounds = view->Bounds(); /* Get new input state, if still active */ if ( SDL_Win->IsActive() ) { key_flip = !key_flip; get_key_info(&keyinfo[key_flip]); view->GetMouse(&point, &buttons, true); } else { key_flip = key_flip; point = last_point; buttons = last_buttons; } SDL_Win->Unlock(); } else { return; } /* If our view is active, we'll find key changes here */ if ( SDL_memcmp(keyinfo[0].key_states, keyinfo[1].key_states, 16) != 0 ) { for ( i=0; i<16; ++i ) { Uint8 new_state, transition; new_state = keyinfo[key_flip].key_states[i]; transition = keyinfo[!key_flip].key_states[i] ^ keyinfo[ key_flip].key_states[i]; for ( j=0; j<8; ++j ) { if ( transition&0x80 ) QueueKey(i*8+j, new_state&0x80); transition <<= 1; new_state <<= 1; } } } /* We check keyboard, but not mouse if mouse isn't in window */ if ( ! bounds.Contains(point) ) { /* Mouse moved outside our view? */ if ( SDL_GetAppState() & SDL_APPMOUSEFOCUS ) { SDL_PrivateAppActive(0, SDL_APPMOUSEFOCUS); be_app->SetCursor(B_HAND_CURSOR); } return; } /* Has the mouse moved back into our view? */ if ( ! (SDL_GetAppState() & SDL_APPMOUSEFOCUS) ) { /* Reset the B_HAND_CURSOR to our own */ SDL_PrivateAppActive(1, SDL_APPMOUSEFOCUS); SDL_SetCursor(NULL); } /* Check for mouse motion */ if ( point != last_point ) { int x, y; SDL_Win->GetXYOffset(x, y); x = (int)point.x - x; y = (int)point.y - y; SDL_PrivateMouseMotion(0, 0, x, y); } last_point = point; /* Add any mouse button events */ for ( i=0; i