void CTestEngine::RunL() { OstTraceFunctionEntry1( CTESTENGINE_RUNL_ENTRY, this ); TInt completionCode(iStatus.Int()); if(completionCode == KErrNone) { // Possibility of displaying a range of key commands // then gtest.Console()->Getch() TKeyCode keyCode(gtest.Console()->KeyCode()); if(keyCode == EKeySpace) { iTestCaseController->Cancel(); gtest.Printf(_L("Test module terminating\n")); OstTrace0(TRACE_NORMAL, CTESTENGINE_RUNL, "Test module terminating\n"); OstTrace0(TRACE_NORMAL, CTESTENGINE_RUNL_DUP01, "CActiveScheduler::Stop CTestEngine::RunL"); CActiveScheduler::Stop(); } else { gtest.Printf(_L("%d key pressed"),keyCode); OstTrace1(TRACE_NORMAL, CTESTENGINE_RUNL_DUP02, "%d key pressed",keyCode); } } else { gtest.Printf(_L("Manual key error %d\n"),completionCode); OstTrace1(TRACE_NORMAL, CTESTENGINE_RUNL_DUP03, "Manual key error %d\n",completionCode); SetActive(); } OstTraceFunctionExit1( CTESTENGINE_RUNL_EXIT, this ); }
void isr_uart_for_keyboard(unsigned int intNum){ unsigned int baseaddr = modulelist[intNum].baseAddr; if(UARTIntPendingStatusGet(baseaddr) == UART_N0_INT_PENDING) return; unsigned int intval = UARTIntIdentityGet(baseaddr); if (intval == UART_INTID_RX_THRES_REACH) { for (int i=0;i<8;i++) { volatile unsigned char tempval = HWREGB(baseaddr+UART_RHR); ((unsigned char *)&keyTouchpadMsg)[i] = tempval; //UARTPutc(tempval); } if (isKeyTouchEvent(&keyTouchpadMsg)) { if(keyTouchpadMsg.type & MSG_TYPE_KEY){ g_keycode = keyCode(keyTouchpadMsg.keycode); atomicSet(&g_keyPushed); if(keyhandler!=NULL) keyhandler(g_keycode); } if (keyTouchpadMsg.type & MSG_TYPE_TOUCH) { g_ts.x = g_tsRaw.x = keyTouchpadMsg.tscval & 0xffff; g_ts.y = g_tsRaw.y = keyTouchpadMsg.tscval >>16; ts_linear(&tsCalibration, (int *)&g_ts.x, (int *)&g_ts.y); atomicSet(&g_touched); } if (keyTouchpadMsg.type & MSG_TYPE_KEYRESET) { atomicSet(&g_keyRest); } } }
int KeyboardEvent::which() const { // Netscape's "which" returns a virtual key code for keydown and keyup, and a character code for keypress. // That's exactly what IE's "keyCode" returns. So they are the same for keyboard events. if (m_which) return m_which.value(); return keyCode(); }
void HbInputVkbWidgetPrivate::handleStandardButtonRelease(int buttonid) { int keycode = buttonid; if (buttonid >= 0) { keycode = keyCode(buttonid); } QKeyEvent event(QEvent::KeyRelease, keycode, Qt::NoModifier); if (mOwner) { mOwner->filterEvent(&event); } }
void HbInputVkbWidgetPrivate::updateKeyCodes() { Q_Q(HbInputVkbWidget); HbInputButtonGroup *buttonGroup = static_cast<HbInputButtonGroup *>(q->contentItem()); if (buttonGroup) { int key = 0; QList<HbInputButton *> buttons = buttonGroup->buttons(); for (int i = 0; i < buttons.count(); ++i) { if (keyCode(i) == HbInputButton::ButtonKeyCodeCharacter) { HbInputButton *item = buttons.at(i); const HbKeyboardMap *keyboardMap = mKeymap->keyboard(q->keyboardType()); if (keyboardMap && key < keyboardMap->keys.count()) { item->setKeyCode(keyboardMap->keys.at(key)->keycode.unicode()); } else { item->setKeyCode(-1); } ++key; } } } }
void HbInputVkbWidgetPrivate::updateButtons() { Q_Q(HbInputVkbWidget); HbInputButtonGroup *buttonGroup = static_cast<HbInputButtonGroup *>(q->contentItem()); if (buttonGroup) { int key = 0; QList<HbInputButton *> buttons = buttonGroup->buttons(); for (int i = 0; i < buttons.count(); ++i) { if (keyCode(i) == HbInputButton::ButtonKeyCodeCharacter) { HbInputButton *item = buttons.at(i); const HbKeyboardMap *keyboardMap = mKeymap->keyboard(q->keyboardType()); if (keyboardMap && key < keyboardMap->keys.count() && keyboardMap->keys.at(key)->characters(mModifiers) != QString("")) { QString keydata = keyboardMap->keys.at(key)->characters(mModifiers); item->setText(keydata.at(0), HbInputButton::ButtonTextIndexPrimary); QString mappedCharacters; keydata.append(keyboardMap->keys.at(key)->characters(mModifiers | HbModifierFnPressed)); for (int i = 0; i < keydata.length(); ++i) { if (mOwner->focusObject() && mOwner->focusObject()->characterAllowedInEditor(keydata.at(i))) { mappedCharacters.append(keydata.at(i)); } } item->setMappedCharacters(mappedCharacters); } else { item->setText("", HbInputButton::ButtonTextIndexPrimary); item->setMappedCharacters(""); } ++key; } } buttonGroup->setButtons(buttons); } }
// Was the key first released this frame? ie. It is not depressed now, but was last frame int input_keyReleased( input* in, enum key k ) { int key_code = keyCode( k ); return !keyHeldInternal( in, key_code) && keyWasHeldInternal( in, key_code ); }
// Was the key first pressed this frame? ie. It is depressed now, but was not last frame int input_keyPressed( input* in, enum key k ) { int key_code = keyCode( k ); return keyHeldInternal( in, key_code ) && !keyWasHeldInternal( in, key_code ); }
// Was the key held down last frame? Regardless of previous state int input_keyWasHeld( input* in, enum key k ) { return keyWasHeldInternal( in, keyCode( k )); }
void PreferencesDialog::keyPressEvent( QKeyEvent* evt ) { if( grabAccelKeyFor != NULL ) { switch (evt->key()) { case Qt::Key_Shift: case Qt::Key_Control: case Qt::Key_Meta: case Qt::Key_Alt: case Qt::Key_CapsLock: case Qt::Key_NumLock: case Qt::Key_ScrollLock: case Qt::Key_F22: evt->ignore(); break; default: KeyActionListViewItem *ka = (KeyActionListViewItem*)grabAccelKeyFor; QKeySequence keyCode( evt->key() ); if( (evt->modifiers() & Qt::ShiftModifier) != 0 ) keyCode = keyCode | Qt::SHIFT; if( (evt->modifiers() & Qt::AltModifier) != 0 ) keyCode = keyCode | Qt::ALT; if( (evt->modifiers() & Qt::ControlModifier ) != 0 ) keyCode = keyCode | Qt::CTRL; releaseKeyboard(); // Check for duplicate key codes bool cancelBinding = false; for( int i = 0; i < keyboardAccelListView->topLevelItemCount(); i++ ) { KeyActionListViewItem* item = (KeyActionListViewItem*)keyboardAccelListView->topLevelItem( i ); if( item == ka ) continue; if( item->getKey() == keyCode ) { int sel = QMessageBox::warning( this, tr( "Duplicate key binding" ), tr( "Key '" ) + keyCode.toString() + tr( "'\nis currently assigned to\n'" ) + item->getAction()->text() + tr( "'.\nOverwrite the current assignment?" ), QMessageBox::No, QMessageBox::Yes ); if( sel == QMessageBox::Yes ) item->setKey( 0 ); else { cancelBinding = true; break; } } } if( cancelBinding ) ka->updateText(); else { ka->setKey( keyCode ); keyboardAccelModified = true; ka->updateText(); } grabAccelKeyFor = NULL; evt->accept(); break; } } else if( evt->key() == Qt::Key_Return ) { setAccelKey(); } }
//------------------------------------------------------------------------------ // Printing functions //------------------------------------------------------------------------------ void Navaid::printRecord(std::ostream& sout) const { char icas[32]; icaoCode(icas); char ikey[32]; key(ikey); char id[12]; ident(id); char ccode[4]; countryCode(ccode); char rc[8]; radioClass(rc); sout << icas << ", "; sout << "\""; sout << ikey; sout << "\", "; sout << id; sout << "-"; sout << static_cast<char>(navaidType()); sout << "-"; sout << ccode; sout << "-"; sout << keyCode(); sout << ":"; std::streamoff old = sout.precision(); sout.precision(12); sout << " "; sout << latitude(); sout << ", "; sout << longitude(); sout.precision(old); sout << ", "; sout << elevation(); sout << " "; sout << frequency(); sout << "-"; sout << channel(); sout << " ( "; sout << magVariance(); sout << ", "; sout << slaveVariance(); sout << " )"; sout << " ("; sout << power(); sout << "-"; sout << rc; sout << "-"; sout << range(); sout << ")"; }
int USBMouseKeyboard::_putc(int c) { return keyCode(c, keymap[c].modifier); }
void bbSystemEmitOSEvent( HWND hwnd,UINT msg,WPARAM wp,LPARAM lp,BBObject *source ){ RECT rect; POINT point; int inRect,id,data=0,x=0,y=0; switch( msg ){ case WM_KEYDOWN:case WM_SYSKEYDOWN: if( wp<1 || wp>255 ) return; id=( lp & 0x40000000 ) ? BBEVENT_KEYREPEAT : BBEVENT_KEYDOWN; data=keyCode( wp,lp ); break; case WM_KEYUP:case WM_SYSKEYUP: if( wp<1 || wp>255 ) return; id=BBEVENT_KEYUP; data=keyCode( wp,lp ); break; case WM_CHAR:case WM_SYSCHAR: id=BBEVENT_KEYCHAR; data=wp; break; case WM_LBUTTONDOWN:case WM_RBUTTONDOWN:case WM_MBUTTONDOWN: SetCapture( hwnd ); id=BBEVENT_MOUSEDOWN; data=(msg==WM_LBUTTONDOWN) ? 1 : (msg==WM_RBUTTONDOWN ? 2 : 3); x=(short)LOWORD(lp); y=(short)HIWORD(lp); break; case WM_LBUTTONUP:case WM_RBUTTONUP:case WM_MBUTTONUP: ReleaseCapture(); id=BBEVENT_MOUSEUP; data=(msg==WM_LBUTTONUP) ? 1 : (msg==WM_RBUTTONUP ? 2 : 3); x=(short)LOWORD(lp); y=(short)HIWORD(lp); break; case WM_MOUSEMOVE: x=(short)LOWORD(lp); y=(short)HIWORD(lp); if (wp&MK_LBUTTON) data=1; if (wp&MK_MBUTTON) data=4; if (wp&MK_RBUTTON) data=2; GetClientRect( hwnd,&rect ); inRect=(x>=0 && y>=0 && x<rect.right && y<rect.bottom); setMouseHwnd( inRect ? hwnd : 0,x,y,source ); id=BBEVENT_MOUSEMOVE; break; case WM_MOUSELEAVE: if( hwnd==mouseHwnd ) setMouseHwnd( 0,(short)LOWORD(lp),(short)HIWORD(lp),&bbNullObject ); return; case WM_MOUSEWHEEL: id=BBEVENT_MOUSEWHEEL; data=(short)HIWORD(wp)/120; point.x=(short)LOWORD(lp); point.y=(short)HIWORD(lp); ScreenToClient( hwnd,&point ); x=point.x; y=point.y; break; case WM_CLOSE: id=BBEVENT_APPTERMINATE; break; case WM_ACTIVATE: if( LOWORD(wp)==WA_INACTIVE || !IsIconic(hwnd) ){ DWORD proc; GetWindowThreadProcessId( lp,&proc ); if( proc!=GetCurrentProcessId() ){ id = (LOWORD(wp) == WA_INACTIVE) ? BBEVENT_APPSUSPEND : BBEVENT_APPRESUME; break; } } return; /* case WM_ACTIVATEAPP: // // WM_ACTIVATEAPP appears to be broken. // // Clicking on taskbar button to minimize an app appears to confuse poor old windows. // // So, we'll use the WM_ACTIVATE code above courtesy of Seb... // id=wp ? BBEVENT_APPRESUME : BBEVENT_APPSUSPEND; break; */ default: return; } bbSystemEmitEvent( id,source,data,mods,x,y,&bbNullObject ); }
void Hb12KeyTouchKeyboardPrivate::applyEditorConstraints() { Q_Q(Hb12KeyTouchKeyboard); HbInputFocusObject *focusedObject = mOwner->focusObject(); if (!focusedObject) { return; } HbInputButtonGroup *buttonGroup = static_cast<HbInputButtonGroup*>(q->contentItem()); if (buttonGroup) { QList<HbInputButton*> buttons = buttonGroup->buttons(); for (int i = 0; i < buttons.count(); ++i) { HbInputButton *item = buttons.at(i); HbInputButton::HbInputButtonState state = item->state(); if (keyCode(i) == HbInputButton::ButtonKeyCodeCharacter) { if (mMode == EModeNumeric) { QString data = item->text(HbInputButton::ButtonTextIndexPrimary); if (data.isEmpty() || !focusedObject->characterAllowedInEditor(data.at(0))) { state = HbInputButton::ButtonStateDisabled; } else if (item->state() == HbInputButton::ButtonStateDisabled) { state = HbInputButton::ButtonStateReleased; } } else if (mMode == EModeAbc) { if (item->text(HbInputButton::ButtonTextIndexSecondaryFirstRow).isEmpty() && item->icon(HbInputButton::ButtonIconIndexSecondaryFirstRow).isNull()) { state = HbInputButton::ButtonStateDisabled; } else if (item->state() == HbInputButton::ButtonStateDisabled) { state = HbInputButton::ButtonStateReleased; } } } else if (keyCode(i) == HbInputButton::ButtonKeyCodeSymbol) { if (mMode == EModeNumeric && focusedObject->editorInterface().isNumericEditor()) { state = HbInputButton::ButtonStateDisabled; } else if (item->state() == HbInputButton::ButtonStateDisabled) { state = HbInputButton::ButtonStateReleased; } } else if (keyCode(i) == HbInputButton::ButtonKeyCodeAsterisk || keyCode(i) == HbInputButton::ButtonKeyCodeShift) { QString sctCharacters; const HbKeyboardMap *keyboardMap = mKeymap->keyboard(HbKeyboardSctPortrait); if (keyboardMap) { foreach (const HbMappedKey* mappedKey, keyboardMap->keys) { focusedObject->filterStringWithEditorFilter(mappedKey->characters(HbModifierNone), sctCharacters); if (sctCharacters.count()) { break; } } } if (!sctCharacters.count() && mMode == EModeNumeric && focusedObject->editorInterface().isNumericEditor()) { state = HbInputButton::ButtonStateDisabled; } else if (item->state() == HbInputButton::ButtonStateDisabled) { state = HbInputButton::ButtonStateReleased; } } item->setState(state); } buttonGroup->setButtons(buttons); }