static int WmKeyDown(JNIEnv *env, jobject window, UINT wkey, UINT repCnt, UINT flags, BOOL system) { UINT modifiers = 0, jkey = 0, character = -1; if (wkey == VK_PROCESSKEY) { return 1; } modifiers = GetModifiers(); jkey = WindowsKeyToJavaKey(wkey, modifiers); /* character = WindowsKeyToJavaChar(wkey, modifiers, SAVE); */ (*env)->CallVoidMethod(env, window, sendKeyEventID, (jint) EVENT_KEY_PRESSED, modifiers, (jint) jkey, (jchar) character); /* windows does not create a WM_CHAR for the Del key for some reason, so we need to create the KEY_TYPED event on the WM_KEYDOWN. */ if (jkey == J_VK_DELETE) { (*env)->CallVoidMethod(env, window, sendKeyEventID, (jint) EVENT_KEY_TYPED, GetModifiers(), (jint) -1, (jchar) '\177'); } return 0; }
void CBaseInput::PostHoldEvents() { FUNCTION_PROFILER( GetISystem(),PROFILE_INPUT ); SInputEvent event; // DARIO_NOTE: In this loop, m_holdSymbols size and content is changed so previous // code was resulting in occasional index out of bounds. // The desired behaviour as I understand it is as follows: // (PRESSED) symbols should be added to the to the end of m_holdSymbols but not // processed this frame (thus the keep the loop comparison as is). // On the other hand, (RELEASED) symbols need to be removed from the m_holdSymbols this frame // so the size of m_holdSymbols may decrease. The search for a RELEASED symbol is done backwards // i.e. from m_holdSymbols.end() - 1 to 0 thus it will never go before the sending index (i.e. i) // In order to allow for this behaviour, the (i < kCurrentCount) check is added. const size_t kInitialCount = m_holdSymbols.size(); for (size_t i=0; i < kInitialCount; ++i) { const size_t kCurrentCount = m_holdSymbols.size(); if (i < kCurrentCount) { m_holdSymbols[i]->AssignTo(event, GetModifiers()); event.deviceIndex = m_holdSymbols[i]->deviceIndex; if (g_pInputCVars->i_debug) { gEnv->pLog->Log("InputDebug: 0x%p PostHoldEvent Symbol %d %s", this, m_holdSymbols[i]->keyId, m_holdSymbols[i]->name.c_str() ); } PostInputEvent(event); } } }
void MakeNullEvent( REventRecord *event) { // give him current stuff event->type = 0; CurMouse(&(event->where)); event->modifiers = GetModifiers(); }
PRBool nsMenuBarListener::IsAccessKeyPressed(nsIDOMKeyEvent* aKeyEvent) { InitAccessKey(); // No other modifiers are allowed to be down except for Shift. PRUint32 modifiers = GetModifiers(aKeyEvent); return (mAccessKeyMask != MODIFIER_SHIFT && (modifiers & mAccessKeyMask) && (modifiers & ~(mAccessKeyMask | MODIFIER_SHIFT)) == 0); }
void QmitkRenderWindow::keyPressEvent(QKeyEvent *ke) { mitk::InteractionEvent::ModifierKeys modifiers = GetModifiers(ke); std::string key = GetKeyLetter(ke); mitk::InteractionKeyEvent::Pointer keyEvent = mitk::InteractionKeyEvent::New(m_Renderer, key, modifiers); if (!this->HandleEvent(keyEvent.GetPointer())) { QVTKWidget::keyPressEvent(ke); } if (m_ResendQtEvents) ke->ignore(); }
void QmitkRenderWindow::wheelEvent(QWheelEvent *we) { mitk::Point2D displayPos = GetMousePosition(we); mitk::MouseWheelEvent::Pointer mWheelEvent = mitk::MouseWheelEvent::New(m_Renderer, displayPos, GetButtonState(we), GetModifiers(we), GetDelta(we)); if (!this->HandleEvent(mWheelEvent.GetPointer())) { QVTKWidget::wheelEvent(we); } if (m_ResendQtEvents) we->ignore(); }
void QmitkRenderWindow::mouseMoveEvent(QMouseEvent *me) { mitk::Point2D displayPos = GetMousePosition(me); this->AdjustRenderWindowMenuVisibility(me->pos()); mitk::MouseMoveEvent::Pointer mMoveEvent = mitk::MouseMoveEvent::New(m_Renderer, displayPos, GetButtonState(me), GetModifiers(me)); if (!this->HandleEvent(mMoveEvent.GetPointer())) { QVTKWidget::mouseMoveEvent(me); } }
void QmitkRenderWindow::mouseReleaseEvent(QMouseEvent *me) { mitk::Point2D displayPos = GetMousePosition(me); mitk::MouseReleaseEvent::Pointer mReleaseEvent = mitk::MouseReleaseEvent::New(m_Renderer, displayPos, GetButtonState(me), GetModifiers(me), GetEventButton(me)); if (!this->HandleEvent(mReleaseEvent.GetPointer())) { QVTKWidget::mouseReleaseEvent(me); } if (m_ResendQtEvents) me->ignore(); }
bool csKeyEventHelper::GetEventData (const iEvent* event, csKeyEventData& data) { // if (!CS_IS_KEYBOARD_EVENT (*event)) return false; // Need an iObjectRegistry* to do this... data.autoRepeat = GetAutoRepeat (event); data.charType = GetCharacterType (event); data.codeCooked = GetCookedCode (event); data.codeRaw = GetRawCode (event); data.eventType = GetEventType (event); GetModifiers (event, data.modifiers); return true; }
static void menuitem_activate_handler(GtkMenuItem *menu_item) { printf("menuitem_activate_handler\n"); if (in_handler_flag == 0) { in_handler_flag = 1; if (GTK_IS_CHECK_MENU_ITEM(menu_item)) gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu_item), !(GTK_CHECK_MENU_ITEM(menu_item)->active)); GdkEvent* event = gtk_get_current_event(); if (!event || event->key.type != GDK_KEY_RELEASE) // We only look for key presses, otherwise every shortcut fires twice SendMessage2ToClean (CcWmCOMMAND, GTK_WIDGET(menu_item), GetModifiers ()); in_handler_flag = 0; } }
float CSkillsButeMgr::GetModifier(eSkill skl, eSkillLevel lvl, uint8 nMod) { uint8 nMax = GetNumModifiers(skl); if (nMod > nMax) { ASSERT(!"Invalid modifier specified."); return 1.0f; } const SkillModifiers* pMods = GetModifiers(skl, lvl); return pMods->fModifier[nMod]; }
void QmitkRenderWindow::mouseMoveEvent(QMouseEvent *me) { mitk::Point2D displayPos = GetMousePosition(me); mitk::Point3D worldPos = m_Renderer->Map2DRendererPositionTo3DWorldPosition(GetMousePosition(me)); this->AdjustRenderWindowMenuVisibility(me->pos()); mitk::MouseMoveEvent::Pointer mMoveEvent = mitk::MouseMoveEvent::New(m_Renderer, displayPos, worldPos, GetButtonState(me), GetModifiers(me)); if (!this->HandleEvent(mMoveEvent.GetPointer())) { // TODO: INTERACTION_LEGACY mitk::MouseEvent myevent(QmitkEventAdapter::AdaptMouseEvent(m_Renderer, me)); this->mouseMoveMitkEvent(&myevent); QVTKWidget::mouseMoveEvent(me); } }
void QmitkRenderWindow::mouseReleaseEvent(QMouseEvent *me) { mitk::Point2D displayPos = GetMousePosition(me); mitk::Point3D worldPos = m_Renderer->Map2DRendererPositionTo3DWorldPosition(GetMousePosition(me)); mitk::MouseReleaseEvent::Pointer mReleaseEvent = mitk::MouseReleaseEvent::New(m_Renderer, displayPos,worldPos, GetButtonState(me), GetModifiers(me), GetEventButton(me)); if (!this->HandleEvent(mReleaseEvent.GetPointer())) { // TODO: INTERACTION_LEGACY mitk::MouseEvent myevent(QmitkEventAdapter::AdaptMouseEvent(m_Renderer, me)); this->mouseReleaseMitkEvent(&myevent); QVTKWidget::mouseReleaseEvent(me); } if (m_ResendQtEvents) me->ignore(); }
void QmitkRenderWindow::wheelEvent(QWheelEvent *we) { mitk::Point2D displayPos = GetMousePosition(we); mitk::Point3D worldPos = m_Renderer->Map2DRendererPositionTo3DWorldPosition(GetMousePosition(we)); mitk::MouseWheelEvent::Pointer mWheelEvent = mitk::MouseWheelEvent::New(m_Renderer, displayPos,worldPos, GetButtonState(we), GetModifiers(we), GetDelta(we)); if (!this->HandleEvent(mWheelEvent.GetPointer())) { // TODO: INTERACTION_LEGACY mitk::WheelEvent myevent(QmitkEventAdapter::AdaptWheelEvent(m_Renderer, we)); this->wheelMitkEvent(&myevent); QVTKWidget::wheelEvent(we); } if (m_ResendQtEvents) we->ignore(); }
void QmitkRenderWindow::keyPressEvent(QKeyEvent *ke) { mitk::InteractionEvent::ModifierKeys modifiers = GetModifiers(ke); std::string key = GetKeyLetter(ke); mitk::InteractionKeyEvent::Pointer keyEvent = mitk::InteractionKeyEvent::New(m_Renderer, key, modifiers); if (!this->HandleEvent(keyEvent.GetPointer())) { // TODO: INTERACTION_LEGACY QPoint cp = mapFromGlobal(QCursor::pos()); mitk::KeyEvent mke(QmitkEventAdapter::AdaptKeyEvent(m_Renderer, ke, cp)); this->keyPressMitkEvent(&mke); ke->accept(); QVTKWidget::keyPressEvent(ke); } if (m_ResendQtEvents) ke->ignore(); }
void QmitkRenderWindow::mousePressEvent(QMouseEvent *me) { //Get mouse position in vtk display coordinate system. me contains qt display infos... mitk::Point2D displayPos = GetMousePosition(me); mitk::MousePressEvent::Pointer mPressEvent = mitk::MousePressEvent::New(m_Renderer, displayPos, GetButtonState(me), GetModifiers(me), GetEventButton(me)); if (!this->HandleEvent(mPressEvent.GetPointer())) { QVTKWidget::mousePressEvent(me); } if (m_ResendQtEvents) me->ignore(); }
nsresult nsMenuBarListener::KeyDown(nsIDOMEvent* aKeyEvent) { InitAccessKey(); //handlers shouldn't be triggered by non-trusted events. nsCOMPtr<nsIDOMNSEvent> domNSEvent = do_QueryInterface(aKeyEvent); PRBool trustedEvent = PR_FALSE; if (domNSEvent) { domNSEvent->GetIsTrusted(&trustedEvent); } if (!trustedEvent) return NS_OK; if (mAccessKey && mAccessKeyFocuses) { nsCOMPtr<nsIDOMKeyEvent> keyEvent = do_QueryInterface(aKeyEvent); PRUint32 theChar; keyEvent->GetKeyCode(&theChar); if (theChar == (PRUint32)mAccessKey && (GetModifiers(keyEvent) & ~mAccessKeyMask) == 0) { // No other modifiers can be down. // Especially CTRL. CTRL+ALT == AltGR, and // we'll f**k up on non-US enhanced 102-key // keyboards if we don't check this. mAccessKeyDown = PR_TRUE; } else { // Some key other than the access key just went down, // so we won't activate the menu bar when the access // key is released. mAccessKeyDown = PR_FALSE; } } return NS_OK; // means I am NOT consuming event }
static int WmKeyUp(JNIEnv *env, jobject window, UINT wkey, UINT repCnt, UINT flags, BOOL system) { UINT modifiers = 0, jkey = 0, character = -1; if (wkey == VK_PROCESSKEY) { return 1; } modifiers = GetModifiers(); jkey = WindowsKeyToJavaKey(wkey, modifiers); /* character = WindowsKeyToJavaChar(wkey, modifiers, SAVE); */ (*env)->CallVoidMethod(env, window, sendKeyEventID, (jint) EVENT_KEY_RELEASED, modifiers, (jint) jkey, (jchar) character); return 0; }
Boolean ImeAdapter::TranslateAndSendNativeEvents( /* [in] */ IKeyEvent* event) { if (mNativeImeAdapterAndroid == 0) return FALSE; Int32 action; event->GetAction(&action); if (action != IKeyEvent::ACTION_DOWN && action != IKeyEvent::ACTION_UP) { // action == KeyEvent.ACTION_MULTIPLE // TODO(bulach): confirm the actual behavior. Apparently: // If event.getKeyCode() == KEYCODE_UNKNOWN, we can send a // composition key down (229) followed by a commit text with the // string from event.getUnicodeChars(). // Otherwise, we'd need to send an event with a // WebInputEvent::IsAutoRepeat modifier. We also need to verify when // we receive ACTION_MULTIPLE: we may receive it after an ACTION_DOWN, // and if that's the case, we'll need to review when to send the Char // event. return FALSE; } mViewEmbedder->OnImeEvent(FALSE); Int32 metaState; event->GetMetaState(&metaState); Int32 action; event->GetAction(&action); Int64 eventTime; event->GetEventTime(&eventTime); Int32 keyCode; event->GetKeyCode(&keyCode); Int32 unicodeChar; event->GetUnicodeChar(&unicodeChar); return NativeSendKeyEvent(mNativeImeAdapterAndroid, event, metaState, GetModifiers(metaState), eventTime, keyCode, /*isSystemKey=*/FALSE, unicodeChar); }
static int WmChar(JNIEnv *env, jobject window, UINT character, UINT repCnt, UINT flags, BOOL system) { // The Alt modifier is reported in the 29th bit of the lParam, // i.e., it is the 13th bit of `flags' (which is HIWORD(lParam)). BOOL alt_is_down = (flags & (1<<13)) != 0; if (system && alt_is_down) { if (character == VK_SPACE) { return 1; } } if (character == VK_RETURN) { character = J_VK_ENTER; } (*env)->CallVoidMethod(env, window, sendKeyEventID, (jint) EVENT_KEY_TYPED, GetModifiers(), (jint) -1, (jchar) character); return 1; }
/* This is used by other methods that accept key events. We set the event's keycode to the supplied value and then invoke the widget's handleEvent. */ static int handOffKeyEvent(JNIEnv *env, jobject widget, int keyCode, const char *keyEventType) { jobject keyEvent; long modifiers; jclass eventClass; eventClass = getClass(env, "java/awt/event/InputEvent", "Unable to get java.awt.event.InputEvent class"); modifiers = GetModifiers(env, eventClass, 0); keyEvent = newKeyEvent(env, widget, keyEventType, /* when */ 0, modifiers, keyCode); if (keyEvent == NULL) { return JNI_FALSE; } return handOff(env, widget, keyEvent); }
void CBaseInput::RetriggerKeyState() { if (g_pInputCVars->i_debug) { gEnv->pLog->Log("InputDebug: RetriggerKeyState"); } m_retriggering = true; SInputEvent event; // DARIO_NOTE: In this loop, m_holdSymbols size and content is changed so previous // code was resulting in occasional index out of bounds. // Note that PostInputEvent() can either push or pop elements from m_holdSymbols. // The original intent of the code has been lost in time... so.... // the fix includes checking for (i < m_holdSymbols.size()) inside the loop and // caching m_holdSymbols[i] const size_t count = m_holdSymbols.size(); for (size_t i=0; i < count; ++i) { if (i < m_holdSymbols.size()) { SInputSymbol* pSymbol = m_holdSymbols[i]; EInputState oldState = pSymbol->state; pSymbol->state = eIS_Pressed; pSymbol->AssignTo(event, GetModifiers()); event.deviceIndex = pSymbol->deviceIndex; PostInputEvent(event); pSymbol->state = oldState; } } m_retriggering = false; if (g_pInputCVars->i_debug) { gEnv->pLog->Log("InputDebug: ~RetriggerKeyState"); } }
void CCLUDrawBase::Mouse(int iButton, int iState, int iX, int iY) { GetModifiers(); if (iButton == CLU_LEFT_BUTTON()) { if (iState == CLU_DOWN()) { m_bMouseLDown = true; m_sMousePos.iX = iX; m_sMousePos.iY = iY; if (!(m_bCtrlDown ? 0 : m_iRTMode)) ResetMouseRotHist(); } else if (iState == CLU_UP()) { m_bMouseLDown = false; m_mTransform[m_iRTMode].iFlags = 0; } } else if (iButton == CLU_RIGHT_BUTTON()) { if (iState == CLU_DOWN()) { m_bMouseRDown = true; m_sMousePos.iX = iX; m_sMousePos.iY = iY; } else if (iState == CLU_UP()) { m_bMouseRDown = false; m_mTransform[m_iRTMode].iFlags = 0; } } }
void QmlMitkRenderWindowItem::wheelEvent(QWheelEvent *we) { mitk::Point2D mousePosition = GetMousePosition(we); mitk::MouseWheelEvent::Pointer mWheelEvent = mitk::MouseWheelEvent::New(mitk::RenderWindowBase::GetRenderer(), mousePosition, GetButtonState(we), GetModifiers(we), we->delta()); mitk::RenderWindowBase::HandleEvent(mWheelEvent.GetPointer()); QVTKQuickItem::wheelEvent(we); }
uint32 csKeyEventHelper::GetModifiersBits (const iEvent* event) { csKeyModifiers m; GetModifiers (event, m); return GetModifiersBits (m); }
LRESULT CALLBACK WndProc(HWND hWnd, UINT Message, WPARAM wParam, LPARAM lParam) { int wmId, wmEvent; HWND hDlg; switch(Message) { case WM_KEYDOWN: if(wParam != VK_PAUSE) break; // case WM_SYSKEYDOWN: case WM_CUSTKEYDOWN: { int modifiers = GetModifiers(wParam); if(!HandleKeyMessage(wParam,lParam, modifiers)) return 0; break; } case WM_KEYUP: if(wParam != VK_PAUSE) break; case WM_SYSKEYUP: case WM_CUSTKEYUP: { int modifiers = GetModifiers(wParam); HandleKeyUp(wParam, lParam, modifiers); } break; case WM_SIZE: switch(wParam) { case SIZE_MINIMIZED: break; case SIZE_MAXIMIZED: pcejin.maximized = true; break; case SIZE_RESTORED: pcejin.maximized = false; break; default: break; } return 0; case WM_MOVE: RECT rect; GetWindowRect(hWnd,&rect); WndX = rect.left; WndY = rect.top; return 0; case WM_DROPFILES: { char filename[MAX_PATH] = ""; DragQueryFile((HDROP)wParam,0,filename,MAX_PATH); DragFinish((HDROP)wParam); std::string fileDropped = filename; //------------------------------------------------------- //Check if mcm file, if so auto-convert and play //------------------------------------------------------- if (!(fileDropped.find(".mcm") == std::string::npos) && (fileDropped.find(".mcm") == fileDropped.length()-4)) { if (!pcejin.romLoaded) //If no ROM is loaded, prompt for one { soundDriver->pause(); LoadGame(); pcejin.tempUnPause(); } if (pcejin.romLoaded && !(fileDropped.find(".mcm") == std::string::npos)) LoadMCM(fileDropped.c_str(), true); } //------------------------------------------------------- //Check if Movie file //------------------------------------------------------- else if (!(fileDropped.find(".mc2") == std::string::npos) && (fileDropped.find(".mc2") == fileDropped.length()-4)) { if (!pcejin.romLoaded) //If no ROM is loaded, prompt for one { soundDriver->pause(); LoadGame(); pcejin.tempUnPause(); } if (pcejin.romLoaded && !(fileDropped.find(".mc2") == std::string::npos)) { LoadMovie(fileDropped.c_str(), 1, false, false); RecentMovies.UpdateRecentItems(fileDropped); } } //------------------------------------------------------- //Check if Savestate file //------------------------------------------------------- else if (!(fileDropped.find(".nc") == std::string::npos)) { if (fileDropped.find(".nc") == fileDropped.length()-4) { if ((fileDropped[fileDropped.length()-1] >= '0' && fileDropped[fileDropped.length()-1] <= '9')) { MDFNSS_Load(filename, NULL); UpdateToolWindows(); } } } //------------------------------------------------------- //Check if Lua script file //------------------------------------------------------- else if (!(fileDropped.find(".lua") == std::string::npos) && (fileDropped.find(".lua") == fileDropped.length()-4)) //ROM is already loaded and .dsm in filename { if(LuaScriptHWnds.size() < 16) { char temp [1024]; strcpy(temp, fileDropped.c_str()); HWND IsScriptFileOpen(const char* Path); RecentLua.UpdateRecentItems(fileDropped); if(!IsScriptFileOpen(temp)) { HWND hDlg = CreateDialog(g_hInstance, MAKEINTRESOURCE(IDD_LUA), hWnd, (DLGPROC) LuaScriptProc); SendDlgItemMessage(hDlg,IDC_EDIT_LUAPATH,WM_SETTEXT,0,(LPARAM)temp); } } } //------------------------------------------------------- //Check if watchlist file //------------------------------------------------------- else if (!(fileDropped.find(".wch") == std::string::npos) && (fileDropped.find(".wch") == fileDropped.length()-4)) //ROM is already loaded and .dsm in filename { if(!RamWatchHWnd) { RamWatchHWnd = CreateDialog(g_hInstance, MAKEINTRESOURCE(IDD_RAMWATCH), hWnd, (DLGPROC) RamWatchProc); } else SetForegroundWindow(RamWatchHWnd); Load_Watches(true, fileDropped.c_str()); } //------------------------------------------------------- //Else load it as a ROM //------------------------------------------------------- else { ALoad(fileDropped.c_str()); } } return 0; case WM_ENTERMENULOOP: soundDriver->pause(); EnableMenuItem(GetMenu(hWnd), IDM_RECORD_MOVIE, MF_BYCOMMAND | (movieMode == MOVIEMODE_INACTIVE && pcejin.romLoaded) ? MF_ENABLED : MF_GRAYED); EnableMenuItem(GetMenu(hWnd), IDM_PLAY_MOVIE, MF_BYCOMMAND | (movieMode == MOVIEMODE_INACTIVE && pcejin.romLoaded) ? MF_ENABLED : MF_GRAYED); EnableMenuItem(GetMenu(hWnd), IDM_STOPMOVIE, MF_BYCOMMAND | (movieMode != MOVIEMODE_INACTIVE) ? MF_ENABLED : MF_GRAYED); EnableMenuItem(GetMenu(hWnd), IDM_RESTARTMOVIE, MF_BYCOMMAND | (movieMode != MOVIEMODE_INACTIVE) ? MF_ENABLED : MF_GRAYED); EnableMenuItem(GetMenu(hWnd), IDM_FILE_STOPAVI, MF_BYCOMMAND | (DRV_AviIsRecording()) ? MF_ENABLED : MF_GRAYED); EnableMenuItem(GetMenu(hWnd), IDM_FILE_RECORDAVI, MF_BYCOMMAND | (!DRV_AviIsRecording()) ? MF_ENABLED : MF_GRAYED); //Window Size checkMenu(IDC_WINDOW1X, ((pcejin.windowSize==1))); checkMenu(IDC_WINDOW2X, ((pcejin.windowSize==2))); checkMenu(IDC_WINDOW3X, ((pcejin.windowSize==3))); checkMenu(IDC_WINDOW4X, ((pcejin.windowSize==4))); checkMenu(IDC_ASPECT, ((pcejin.aspectRatio))); checkMenu(ID_VIEW_FRAMECOUNTER,Hud.FrameCounterDisplay); checkMenu(ID_VIEW_DISPLAYINPUT,Hud.ShowInputDisplay); checkMenu(ID_VIEW_DISPLAYSTATESLOTS,Hud.DisplayStateSlots); checkMenu(ID_VIEW_DISPLAYLAG,Hud.ShowLagFrameCounter); checkMenu(IDM_MUTE,soundDriver->userMute); break; case WM_EXITMENULOOP: pcejin.tempUnPause(); break; case WM_CLOSE: { SaveIniSettings(); PostQuitMessage(0); } case WM_DESTROY: { PostQuitMessage(0); } // HANDLE_MSG(hWnd, WM_DESTROY, OnDestroy); // HANDLE_MSG(hWnd, WM_PAINT, OnPaint); // HANDLE_MSG(hwnd, WM_COMMAND, OnCommand); case WM_COMMAND: //Recent ROMs if(wParam >= RECENTROM_START && wParam <= RECENTROM_START + RecentROMs.MAX_RECENT_ITEMS - 1) { ALoad(RecentROMs.GetRecentItem(wParam - RECENTROM_START).c_str()); break; } else if (wParam == RecentROMs.GetClearID()) { RecentROMs.ClearRecentItems(); break; } else if (wParam == RecentROMs.GetAutoloadID()) { RecentROMs.FlipAutoLoad(); break; } //Recent Movies if(wParam >= RECENTMOVIE_START && wParam <= RECENTMOVIE_START + RecentMovies.MAX_RECENT_ITEMS - 1) { strcpy(Tmp_Str, RecentMovies.GetRecentItem(wParam - RECENTMOVIE_START).c_str()); RecentMovies.UpdateRecentItems(Tmp_Str); //WIN32_StartMovieReplay(Str_Tmp); break; } else if (wParam == RecentMovies.GetClearID()) { RecentMovies.ClearRecentItems(); break; } else if (wParam == RecentMovies.GetAutoloadID()) { RecentMovies.FlipAutoLoad(); break; } //Recent Lua if(wParam >= RECENTLUA_START && wParam <= RECENTLUA_START + RecentLua.MAX_RECENT_ITEMS - 1) { if(LuaScriptHWnds.size() < 16) { char temp [1024]; strcpy(temp, RecentLua.GetRecentItem(wParam - RECENTLUA_START).c_str()); HWND IsScriptFileOpen(const char* Path); RecentLua.UpdateRecentItems(temp); if(!IsScriptFileOpen(temp)) { HWND hDlg = CreateDialog(g_hInstance, MAKEINTRESOURCE(IDD_LUA), hWnd, (DLGPROC) LuaScriptProc); SendDlgItemMessage(hDlg,IDC_EDIT_LUAPATH,WM_SETTEXT,0,(LPARAM)temp); } } break; } else if (wParam == RecentLua.GetClearID()) { RecentLua.ClearRecentItems(); break; } else if (wParam == RecentLua.GetAutoloadID()) { RecentLua.FlipAutoLoad(); break; } wmId = LOWORD(wParam); wmEvent = HIWORD(wParam); // Parse the menu selections: switch (wmId) { case IDC_WINDOW1X: pcejin.windowSize=1; ScaleScreen(pcejin.windowSize); break; case IDC_WINDOW2X: pcejin.windowSize=2; ScaleScreen(pcejin.windowSize); break; case IDC_WINDOW3X: pcejin.windowSize=3; ScaleScreen(pcejin.windowSize); break; case IDC_WINDOW4X: pcejin.windowSize=4; ScaleScreen(pcejin.windowSize); break; case IDC_ASPECT: pcejin.aspectRatio ^= 1; ScaleScreen(pcejin.windowSize); break; case IDM_EXIT: SaveIniSettings(); PostQuitMessage(0); break; case IDM_RESET: PCE_Power(); break; case IDM_OPEN_ROM: soundDriver->pause(); LoadGame(); pcejin.tempUnPause(); break; case IDM_RECORD_MOVIE: soundDriver->pause(); MovieRecordTo(); pcejin.tempUnPause(); return 0; case IDM_PLAY_MOVIE: soundDriver->pause(); Replay_LoadMovie(); pcejin.tempUnPause(); return 0; case IDM_INPUT_CONFIG: soundDriver->pause(); DialogBox(g_hInstance, MAKEINTRESOURCE(IDD_INPUTCONFIG), hWnd, DlgInputConfig); pcejin.tempUnPause(); // RunInputConfig(); break; case IDM_HOTKEY_CONFIG: { soundDriver->pause(); DialogBox(g_hInstance, MAKEINTRESOURCE(IDD_KEYCUSTOM), hWnd, DlgHotkeyConfig); pcejin.tempUnPause(); } break; case IDM_BIOS_CONFIG: soundDriver->pause(); DialogBox(g_hInstance, MAKEINTRESOURCE(IDD_BIOS), hWnd, (DLGPROC) BiosSettingsDlgProc); // DialogBox(g_hInstance, MAKEINTRESOURCE(IDD_KEYCUSTOM), hWnd, BiosSettingsDlgProc); pcejin.tempUnPause(); break; case ID_VIEW_FRAMECOUNTER: Hud.FrameCounterDisplay ^= true; WritePrivateProfileBool("Display", "FrameCounter", Hud.FrameCounterDisplay, IniName); return 0; case ID_VIEW_DISPLAYINPUT: Hud.ShowInputDisplay ^= true; WritePrivateProfileBool("Display", "Display Input", Hud.ShowInputDisplay, IniName); osd->clear(); return 0; case ID_VIEW_DISPLAYSTATESLOTS: Hud.DisplayStateSlots ^= true; WritePrivateProfileBool("Display", "Display State Slots", Hud.DisplayStateSlots, IniName); osd->clear(); return 0; case ID_VIEW_DISPLAYLAG: Hud.ShowLagFrameCounter ^= true; WritePrivateProfileBool("Display", "Display Lag Counter", Hud.ShowLagFrameCounter, IniName); osd->clear(); return 0; case IDC_NEW_LUA_SCRIPT: if(LuaScriptHWnds.size() < 16) { CreateDialog(g_hInstance, MAKEINTRESOURCE(IDD_LUA), g_hWnd, (DLGPROC) LuaScriptProc); } break; case IDM_CONVERT_MCM: ConvertMCM(hWnd); break; case IDM_MUTE: soundDriver->doUserMute(); break; case IDM_STOPMOVIE: StopMovie(); return 0; break; case IDM_RESTARTMOVIE: PCE_Power(); ResetFrameCount(); movieMode = MOVIEMODE_PLAY; movie_readonly = true; return 0; break; case ID_RAM_SEARCH: if(!RamSearchHWnd) { InitRamSearch(); RamSearchHWnd = CreateDialog(winClass.hInstance, MAKEINTRESOURCE(IDD_RAMSEARCH), hWnd, (DLGPROC) RamSearchProc); } else SetForegroundWindow(RamSearchHWnd); break; case ID_RAM_WATCH: if(!RamWatchHWnd) { RamWatchHWnd = CreateDialog(winClass.hInstance, MAKEINTRESOURCE(IDD_RAMWATCH), hWnd, (DLGPROC) RamWatchProc); } else SetForegroundWindow(RamWatchHWnd); return 0; case IDM_MEMORY: if (!RegWndClass("MemView_ViewBox", MemView_ViewBoxProc, 0, sizeof(CMemView*))) return 0; OpenToolWindow(new CMemView()); return 0; case IDM_ABOUT: soundDriver->pause(); DialogBox(winClass.hInstance, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About); pcejin.tempUnPause(); break; case IDM_FILE_RECORDAVI: soundDriver->pause(); RecordAvi(); pcejin.tempUnPause(); break; case IDM_FILE_STOPAVI: StopAvi(); break; } break; } return DefWindowProc(hWnd, Message, wParam, lParam); }
nsresult nsMenuBarListener::KeyPress(nsIDOMEvent* aKeyEvent) { mMenuBarFrame->ClearRecentlyRolledUp(); // if event has already been handled, bail nsCOMPtr<nsIDOMNSUIEvent> uiEvent ( do_QueryInterface(aKeyEvent) ); if ( uiEvent ) { PRBool eventHandled = PR_FALSE; uiEvent->GetPreventDefault ( &eventHandled ); if ( eventHandled ) return NS_OK; // don't consume event } //handlers shouldn't be triggered by non-trusted events. nsCOMPtr<nsIDOMNSEvent> domNSEvent = do_QueryInterface(aKeyEvent); PRBool trustedEvent = PR_FALSE; if (domNSEvent) { domNSEvent->GetIsTrusted(&trustedEvent); } if (!trustedEvent) return NS_OK; nsresult retVal = NS_OK; // default is to not consume event InitAccessKey(); if (mAccessKey) { nsCOMPtr<nsIDOMNSUIEvent> nsUIEvent = do_QueryInterface(aKeyEvent); PRBool preventDefault; nsUIEvent->GetPreventDefault(&preventDefault); if (!preventDefault) { nsCOMPtr<nsIDOMKeyEvent> keyEvent = do_QueryInterface(aKeyEvent); PRUint32 keyCode, charCode; keyEvent->GetKeyCode(&keyCode); keyEvent->GetCharCode(&charCode); // Clear the access key flag unless we are pressing the access key. if (keyCode != (PRUint32)mAccessKey) mAccessKeyDown = PR_FALSE; // If charCode == 0, then it is not a printable character. // Don't attempt to handle accesskey for non-printable characters. if (IsAccessKeyPressed(keyEvent) && charCode) { // Do shortcut navigation. // A letter was pressed. We want to see if a shortcut gets matched. If // so, we'll know the menu got activated. PRBool active = PR_FALSE; mMenuBarFrame->ShortcutNavigation(keyEvent, active); if (active) { aKeyEvent->StopPropagation(); aKeyEvent->PreventDefault(); retVal = NS_ERROR_BASE; // I am consuming event } } #if !defined(XP_MAC) && !defined(XP_MACOSX) // Also need to handle F10 specially on Non-Mac platform. else if (keyCode == NS_VK_F10) { if ((GetModifiers(keyEvent) & ~MODIFIER_CONTROL) == 0) { // The F10 key just went down by itself or with ctrl pressed. // In Windows, both of these activate the menu bar. mMenuBarFrame->ToggleMenuActiveState(); aKeyEvent->StopPropagation(); aKeyEvent->PreventDefault(); return NS_ERROR_BASE; // consume the event } } #endif // !XP_MAC && !XP_MACOSX } } return retVal; }
LRESULT CALLBACK glwtWin32WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { GLWTWindow *win = (GLWTWindow*)GetWindowLongPtr(hwnd, 0); if(win) { switch(uMsg) { case WM_PAINT: if(win->win_callback) { GLWTWindowEvent event; event.window = win; event.type = GLWT_WINDOW_EXPOSE; event.dummy.dummy = 0; win->win_callback(win, &event, win->userdata); } ValidateRect(hwnd, NULL); return 0; case WM_KEYUP: case WM_KEYDOWN: case WM_SYSKEYUP: case WM_SYSKEYDOWN: if(win->win_callback) { GLWTWindowEvent event; event.window = win; event.type = (uMsg == WM_KEYDOWN || uMsg == WM_SYSKEYDOWN) ? GLWT_WINDOW_KEY_DOWN : GLWT_WINDOW_KEY_UP; event.key.keysym = translate_key(wParam, lParam); event.key.scancode = (lParam >> 16) & 0xff; event.key.mod = GetModifiers(); win->win_callback(win, &event, win->userdata); } if(uMsg == WM_SYSKEYUP || uMsg == WM_SYSKEYDOWN) break; return 0; case WM_LBUTTONUP: case WM_LBUTTONDOWN: case WM_MBUTTONUP: case WM_MBUTTONDOWN: case WM_RBUTTONUP: case WM_RBUTTONDOWN: case WM_XBUTTONUP: case WM_XBUTTONDOWN: case WM_MOUSEWHEEL: case WM_MOUSEHWHEEL: if(win->win_callback) { GLWTWindowEvent event; event.window = win; event.type = ( uMsg == WM_LBUTTONUP || uMsg == WM_MBUTTONUP || uMsg == WM_RBUTTONUP || uMsg == WM_XBUTTONUP || uMsg == WM_MOUSEWHEEL || uMsg == WM_MOUSEHWHEEL ) ? GLWT_WINDOW_BUTTON_DOWN : GLWT_WINDOW_BUTTON_UP; event.button.x = LOWORD(lParam); event.button.y = HIWORD(lParam); event.button.button = (uMsg == WM_LBUTTONUP || uMsg == WM_LBUTTONDOWN) ? 0 : (uMsg == WM_MBUTTONUP || uMsg == WM_MBUTTONDOWN) ? 1 : (uMsg == WM_RBUTTONUP || uMsg == WM_RBUTTONDOWN) ? 2 : (uMsg == WM_XBUTTONUP || uMsg == WM_XBUTTONDOWN) ? (HIWORD(wParam) == XBUTTON1 ? 5 : 6) : (uMsg == WM_MOUSEWHEEL) ? (GET_WHEEL_DELTA_WPARAM(wParam) < 0 ? 3 : 4) : (uMsg == WM_MOUSEHWHEEL) ? (GET_WHEEL_DELTA_WPARAM(wParam) < 0 ? 7 : 8) : 0; event.button.mod = GetModifiers(); win->win_callback(win, &event, win->userdata); } return 0; case WM_MOUSEMOVE: if(win->win_callback) { GLWTWindowEvent event; event.window = win; event.type = GLWT_WINDOW_MOUSE_MOTION; event.motion.x = GET_X_LPARAM(lParam); event.motion.y = GET_Y_LPARAM(lParam); event.motion.buttons = (wParam & MK_LBUTTON ? (1 << 0) : 0) | (wParam & MK_RBUTTON ? (1 << 1) : 0) | (wParam & MK_MBUTTON ? (1 << 2) : 0) | (wParam & MK_XBUTTON1 ? (1 << 5) : 0) | (wParam & MK_XBUTTON2 ? (1 << 6) : 0); win->win_callback(win, &event, win->userdata); } { TRACKMOUSEEVENT tme; tme.cbSize = sizeof(tme); tme.dwFlags = TME_QUERY; tme.hwndTrack = hwnd; TrackMouseEvent(&tme); if(tme.dwFlags != TME_LEAVE) { tme.cbSize = sizeof(tme); tme.dwFlags = TME_HOVER|TME_LEAVE; tme.hwndTrack = hwnd; tme.dwHoverTime = 1; TrackMouseEvent(&tme); } } return 0; case WM_SETFOCUS: case WM_KILLFOCUS: if(win->win_callback) { GLWTWindowEvent event; event.window = win; event.type = uMsg == WM_SETFOCUS ? GLWT_WINDOW_FOCUS_IN : GLWT_WINDOW_FOCUS_OUT; event.dummy.dummy = 0; win->win_callback(win, &event, win->userdata); } return 0; case WM_MOUSEHOVER: case WM_MOUSELEAVE: if(win->win_callback) { GLWTWindowEvent event; event.window = win; event.type = (uMsg == WM_MOUSEHOVER ? GLWT_WINDOW_MOUSE_ENTER : GLWT_WINDOW_MOUSE_LEAVE); event.dummy.dummy = 0; win->win_callback(win, &event, win->userdata); } { TRACKMOUSEEVENT tme; tme.cbSize = sizeof(tme); tme.dwFlags = uMsg == WM_MOUSEHOVER ? TME_LEAVE : TME_HOVER; tme.hwndTrack = hwnd; tme.dwHoverTime = 1; TrackMouseEvent(&tme); } return 0; case WM_SHOWWINDOW: if(win->win_callback) { GLWTWindowEvent event; event.window = win; event.type = (wParam == TRUE ? GLWT_WINDOW_SHOW : GLWT_WINDOW_HIDE); event.dummy.dummy = 0; win->win_callback(win, &event, win->userdata); } return 0; case WM_SIZE: if(win->win_callback) { GLWTWindowEvent event; event.window = win; event.type = GLWT_WINDOW_RESIZE; event.resize.width = LOWORD(lParam); event.resize.height = HIWORD(lParam); win->win_callback(win, &event, win->userdata); } return 0; case WM_CLOSE: win->closed = 1; if(win->win_callback) { GLWTWindowEvent event; event.window = win; event.type = GLWT_WINDOW_CLOSE; event.dummy.dummy = 0; win->win_callback(win, &event, win->userdata); } return 0; case WM_SYSCHAR: case WM_CHAR: if(win->win_callback) { GLWTWindowEvent event; event.window = win; event.type = GLWT_WINDOW_CHARACTER_INPUT; event.character.unicode = utf16_decode((unsigned int)wParam); win->win_callback(win, &event, win->userdata); } return 0; default: break; } }
void CInputManager::HandleKeyBindings() { short modifiers = 0; short modifierTest = 0; DWORD dwOldKB = m_ActiveKeyBindPage; // no handler, so don't do anything if (!m_pInputModule) { return; } // cycle through key bindings for (KEYBINDINGMAP::iterator keyItor = m_KeyMap[m_ActiveKeyBindPage].begin(); keyItor != m_KeyMap[m_ActiveKeyBindPage].end(); ++keyItor) { char bindType = ((*keyItor).second).bindType; // get modifiers (if any) modifiers = GetModifiers((*keyItor).first); // see if key is pressed if ( m_pInputModule->KBIsKeyPressed(LOBYTE(LOWORD((*keyItor).first)))) { if( bindType & 1 ) { // check them if (m_pInputModule->KBIsKeyPressed(EEK_LSHIFT)) { modifierTest = modifierTest | 0x0001; } if (m_pInputModule->KBIsKeyPressed(EEK_RSHIFT)) { modifierTest = modifierTest | 0x0002; } if (m_pInputModule->KBIsKeyPressed(EEK_RCTRL)) { modifierTest = modifierTest | 0x0004; } if (m_pInputModule->KBIsKeyPressed(EEK_LCTRL)) { modifierTest = modifierTest | 0x0008; } if (m_pInputModule->KBIsKeyPressed(EEK_RALT)) { modifierTest = modifierTest | 0x0010; } if (m_pInputModule->KBIsKeyPressed(EEK_LALT)) { modifierTest = modifierTest | 0x0020; } // if the modifiers pressed match expected if (modifierTest == modifiers) { KEYEVENTPARAMS keyParams; keyParams.m_cBindType = KEYBIND_PRESSED; // send message // Vision::Message.Print(1, 0, 60, "%s PRESSED!", (*keyItor).second.c_str()); DWORD tMsgID = ((*keyItor).second).msg; DWORD retVal = m_ToolBox->SendMessage(tMsgID, sizeof(KEYEVENTPARAMS), &keyParams); // check to see if keybindings were swapped if(dwOldKB != m_ActiveKeyBindPage) { return; } } // reset modifierTest modifierTest = 0; } } else if( m_pInputModule->KBIsKeyReleased(LOBYTE(LOWORD((*keyItor).first))) ) { if( bindType & 2 ) { KEYEVENTPARAMS keyParams; keyParams.m_cBindType = KEYBIND_RELEASED; DWORD tMsgID = ((*keyItor).second).msg; DWORD retVal = m_ToolBox->SendMessage(tMsgID, sizeof(KEYEVENTPARAMS), &keyParams); } } } }
void QmlMitkRenderWindowItem::mouseMoveEvent(QMouseEvent* me) { mitk::Point2D mousePosition = GetMousePosition(me); //mousePosition[1] = this->GetRenderer()->GetSizeY() - mousePosition[1]; mitk::MouseMoveEvent::Pointer mMoveEvent = mitk::MouseMoveEvent::New(mitk::RenderWindowBase::GetRenderer(), mousePosition, GetButtonState(me), GetModifiers(me)); mitk::RenderWindowBase::HandleEvent(mMoveEvent.GetPointer()); QVTKQuickItem::mouseMoveEvent(me); }