Migrate to new keycode constants in keycodes.h.
Change-Id: I775efb0f73b418db5bf65c218949b164f8e65647
diff --git a/simulator/app/DeviceManager.cpp b/simulator/app/DeviceManager.cpp
index a859c63..c387d3a 100644
--- a/simulator/app/DeviceManager.cpp
+++ b/simulator/app/DeviceManager.cpp
@@ -278,7 +278,7 @@
*
* The events are defined in display_device.h.
*/
-void DeviceManager::SendKeyEvent(KeyCode keyCode, bool down)
+void DeviceManager::SendKeyEvent(int32_t keyCode, bool down)
{
android::MessageStream* pStream = GetStream();
if (pStream == NULL)
diff --git a/simulator/app/DeviceManager.h b/simulator/app/DeviceManager.h
index bd4371e..e3d8af3 100644
--- a/simulator/app/DeviceManager.h
+++ b/simulator/app/DeviceManager.h
@@ -107,7 +107,7 @@
#endif
// send a key-up or key-down event to the runtime
- void SendKeyEvent(KeyCode keyCode, bool down);
+ void SendKeyEvent(int32_t keyCode, bool down);
// send touch-screen events
void SendTouchEvent(android::Simulator::TouchMode mode, int x, int y);
diff --git a/simulator/app/PhoneButton.cpp b/simulator/app/PhoneButton.cpp
index eca7ddc..15c5109 100644
--- a/simulator/app/PhoneButton.cpp
+++ b/simulator/app/PhoneButton.cpp
@@ -27,7 +27,7 @@
assert(!mHasImage); // quick check for re-use
mKeyCode = LookupKeyCode(label);
- if (mKeyCode == kKeyCodeUnknown) {
+ if (mKeyCode == AKEYCODE_UNKNOWN) {
fprintf(stderr, "WARNING: key code '%s' not recognized\n", label);
// keep going
}
@@ -129,9 +129,9 @@
/*
* Look up a key code based on a string.
*
- * Returns kKeyCodeUnknown if the label doesn't match anything.
+ * Returns AKEYCODE_UNKNOWN if the label doesn't match anything.
*/
-KeyCode PhoneButton::LookupKeyCode(const char* label) const
+int32_t PhoneButton::LookupKeyCode(const char* label) const
{
static const struct {
const char* label;
@@ -172,9 +172,9 @@
for (int i = 0; i < numCodes; i++) {
if (strcmp(label, codeList[i].label) == 0)
- return (KeyCode) codeList[i].keyCode;
+ return codeList[i].keyCode;
}
- return kKeyCodeUnknown;
+ return AKEYCODE_UNKNOWN;
};
diff --git a/simulator/app/PhoneButton.h b/simulator/app/PhoneButton.h
index 4bbaf56..86c32dd 100644
--- a/simulator/app/PhoneButton.h
+++ b/simulator/app/PhoneButton.h
@@ -21,11 +21,11 @@
class PhoneButton {
public:
PhoneButton(void)
- : mHasImage(false), mKeyCode(kKeyCodeUnknown)
+ : mHasImage(false), mKeyCode(AKEYCODE_UNKNOWN)
{}
virtual ~PhoneButton(void) {}
PhoneButton(const PhoneButton& src)
- : mHasImage(false), mKeyCode(kKeyCodeUnknown)
+ : mHasImage(false), mKeyCode(AKEYCODE_UNKNOWN)
{
CopyMembers(src);
}
@@ -60,7 +60,7 @@
}
bool CheckCollision(int x, int y) const;
- KeyCode GetKeyCode(void) const { return mKeyCode; }
+ int32_t GetKeyCode(void) const { return mKeyCode; }
// load or unload the image bitmap, if any
bool LoadResources(void);
@@ -68,13 +68,13 @@
private:
void CreateHighlightedBitmap(void);
- KeyCode LookupKeyCode(const char* label) const;
+ int32_t LookupKeyCode(const char* label) const;
LoadableImage mSelectedImage;
wxBitmap mHighlightedBitmap;
bool mHasImage; // both exist or neither exist
- KeyCode mKeyCode;
+ int32_t mKeyCode;
};
#endif // _SIM_PHONE_BUTTON_H
diff --git a/simulator/app/PhoneData.cpp b/simulator/app/PhoneData.cpp
index f15df2b..f6756f5 100644
--- a/simulator/app/PhoneData.cpp
+++ b/simulator/app/PhoneData.cpp
@@ -413,7 +413,7 @@
/*
* Find the first button with a matching key code.
*/
-PhoneButton* PhoneView::FindButtonByKey(KeyCode keyCode)
+PhoneButton* PhoneView::FindButtonByKey(int32_t keyCode)
{
typedef List<PhoneButton>::iterator Iter;
diff --git a/simulator/app/PhoneData.h b/simulator/app/PhoneData.h
index 2d7003a..5a95796 100644
--- a/simulator/app/PhoneData.h
+++ b/simulator/app/PhoneData.h
@@ -178,7 +178,7 @@
PhoneButton* FindButtonHit(int x, int y);
// find the first button with a matching key code
- PhoneButton* FindButtonByKey(KeyCode keyCode);
+ PhoneButton* FindButtonByKey(int32_t keyCode);
bool ProcessAndValidate(TiXmlNode* pNode, const char* directory);
bool ProcessImage(TiXmlNode* pNode, const char* directory);
diff --git a/simulator/app/PhoneWindow.cpp b/simulator/app/PhoneWindow.cpp
index 60a9809..0a87762 100644
--- a/simulator/app/PhoneWindow.cpp
+++ b/simulator/app/PhoneWindow.cpp
@@ -54,7 +54,7 @@
wxDEFAULT_DIALOG_STYLE),
mpMOHViewIndex(-1),
mpMOHButton(NULL),
- mMouseKeySent(kKeyCodeUnknown),
+ mMouseKeySent(AKEYCODE_UNKNOWN),
mpViewInfo(NULL),
mNumViewInfo(0),
mpDeviceWindow(NULL),
@@ -113,7 +113,7 @@
if (!event.GetActive()) {
ListIter iter;
for (iter = mPressedKeys.begin(); iter != mPressedKeys.end(); ) {
- KeyCode keyCode = (*iter).GetKeyCode();
+ int32_t keyCode = (*iter).GetKeyCode();
GetDeviceManager()->SendKeyEvent(keyCode, false);
iter = mPressedKeys.erase(iter);
}
@@ -474,27 +474,27 @@
case WXK_NUMPAD_NEXT:
case WXK_NUMPAD9:
case '9': return KEY_9;
- case WXK_NUMPAD_MULTIPLY: return KEY_SWITCHVIDEOMODE; //kKeyCodeStar;
+ case WXK_NUMPAD_MULTIPLY: return KEY_SWITCHVIDEOMODE; //AKEYCODE_STAR;
case WXK_LEFT: return KEY_LEFT;
case WXK_RIGHT: return KEY_RIGHT;
case WXK_UP: return KEY_UP;
case WXK_DOWN: return KEY_DOWN;
- case WXK_NUMPAD_ENTER: return KEY_REPLY; //kKeyCodeDpadCenter;
+ case WXK_NUMPAD_ENTER: return KEY_REPLY; //AKEYCODE_DPAD_CENTER;
case WXK_HOME: return KEY_HOME;
case WXK_PRIOR:
- case WXK_PAGEUP: return KEY_MENU; //kKeyCodeSoftLeft;
+ case WXK_PAGEUP: return KEY_MENU; //AKEYCODE_SOFT_LEFT;
case WXK_NEXT:
- case WXK_PAGEDOWN: return KEY_KBDILLUMUP; //kKeyCodeSoftRight;
+ case WXK_PAGEDOWN: return KEY_KBDILLUMUP; //AKEYCODE_SOFT_RIGHT;
case WXK_DELETE:
- case WXK_BACK: return KEY_BACKSPACE; //kKeyCodeDel;
+ case WXK_BACK: return KEY_BACKSPACE; //AKEYCODE_DEL;
case WXK_ESCAPE:
- case WXK_END: return KEY_BACK; //kKeyCodeBack;
+ case WXK_END: return KEY_BACK; //AKEYCODE_BACK;
case WXK_NUMPAD_DELETE:
- case WXK_NUMPAD_DECIMAL: return KEY_KBDILLUMTOGGLE; //kKeyCodePound;
- case WXK_SPACE: return KEY_SPACE; //kKeyCodeSpace;
- case WXK_RETURN: return KEY_ENTER; //kKeyCodeNewline;
- case WXK_F3: return KEY_F3; //kKeyCodeCall;
- case WXK_F4: return KEY_F4; //kKeyCodeEndCall;
+ case WXK_NUMPAD_DECIMAL: return KEY_KBDILLUMTOGGLE; //AKEYCODE_POUND;
+ case WXK_SPACE: return KEY_SPACE; //AKEYCODE_SPACE;
+ case WXK_RETURN: return KEY_ENTER; //AKEYCODE_ENTER;
+ case WXK_F3: return KEY_F3; //AKEYCODE_CALL;
+ case WXK_F4: return KEY_F4; //AKEYCODE_END_CALL;
case WXK_NUMPAD_ADD:
case WXK_F5: return KEY_VOLUMEUP;
case WXK_NUMPAD_SUBTRACT:
@@ -552,7 +552,7 @@
break;
}
- return kKeyCodeUnknown;
+ return AKEYCODE_UNKNOWN;
}
@@ -566,10 +566,10 @@
*/
void PhoneWindow::OnKeyDown(wxKeyEvent& event)
{
- KeyCode keyCode;
+ int32_t keyCode;
- keyCode = (KeyCode) ConvertKeyCode(event.GetKeyCode());
- if (keyCode != kKeyCodeUnknown) {
+ keyCode = ConvertKeyCode(event.GetKeyCode());
+ if (keyCode != AKEYCODE_UNKNOWN) {
if (!IsKeyPressed(keyCode)) {
//printf("PW: down: key %d\n", keyCode);
GetDeviceManager()->SendKeyEvent(keyCode, true);
@@ -586,10 +586,10 @@
*/
void PhoneWindow::OnKeyUp(wxKeyEvent& event)
{
- KeyCode keyCode;
+ int32_t keyCode;
- keyCode = (KeyCode) ConvertKeyCode(event.GetKeyCode());
- if (keyCode != kKeyCodeUnknown) {
+ keyCode = ConvertKeyCode(event.GetKeyCode());
+ if (keyCode != AKEYCODE_UNKNOWN) {
// Send the key event if we already have this key pressed.
if (IsKeyPressed(keyCode)) {
//printf("PW: up: key %d\n", keyCode);
@@ -617,7 +617,7 @@
{
if (mpMOHButton != NULL) {
//printf("PW: left down\n");
- KeyCode keyCode = mpMOHButton->GetKeyCode();
+ int32_t keyCode = mpMOHButton->GetKeyCode();
GetDeviceManager()->SendKeyEvent(keyCode, true);
mMouseKeySent = keyCode;
AddPressedKey(keyCode);
@@ -644,7 +644,7 @@
*/
void PhoneWindow::OnMouseLeftUp(wxMouseEvent& WXUNUSED(event))
{
- if (mMouseKeySent != kKeyCodeUnknown) {
+ if (mMouseKeySent != AKEYCODE_UNKNOWN) {
//printf("PW: left up\n");
GetDeviceManager()->SendKeyEvent(mMouseKeySent, false);
RemovePressedKey(mMouseKeySent);
@@ -658,7 +658,7 @@
//printf("(ignoring left-up)\n");
}
}
- mMouseKeySent = kKeyCodeUnknown;
+ mMouseKeySent = AKEYCODE_UNKNOWN;
}
void PhoneWindow::OnMouseRightDown(wxMouseEvent& event)
@@ -909,7 +909,7 @@
ListIter iter;
for (iter = mPressedKeys.begin(); iter != mPressedKeys.end(); ++iter) {
- KeyCode keyCode;
+ int32_t keyCode;
PhoneButton* pButton;
keyCode = (*iter).GetKeyCode();
@@ -933,7 +933,7 @@
*
* Schedules a screen refresh if the set of held-down keys changes.
*/
-void PhoneWindow::AddPressedKey(KeyCode keyCode)
+void PhoneWindow::AddPressedKey(int32_t keyCode)
{
/*
* See if the key is already down. This usually means that the key
@@ -943,8 +943,8 @@
* a second time. This way, if we did lose a key-up somehow, they
* can "clear" the stuck key by hitting it again.
*/
- if (keyCode == kKeyCodeUnknown) {
- //printf("--- not adding kKeyCodeUnknown!\n");
+ if (keyCode == AKEYCODE_UNKNOWN) {
+ //printf("--- not adding AKEYCODE_UNKNOWN!\n");
return;
}
@@ -969,7 +969,7 @@
*
* Schedules a screen refresh if the set of held-down keys changes.
*/
-void PhoneWindow::RemovePressedKey(KeyCode keyCode)
+void PhoneWindow::RemovePressedKey(int32_t keyCode)
{
/*
* Release the key. If it's not in the list, we either missed a
@@ -1000,7 +1000,7 @@
if (!mPressedKeys.empty()) {
ListIter iter = mPressedKeys.begin();
while (iter != mPressedKeys.end()) {
- KeyCode keyCode = (*iter).GetKeyCode();
+ int32_t keyCode = (*iter).GetKeyCode();
GetDeviceManager()->SendKeyEvent(keyCode, false);
iter = mPressedKeys.erase(iter);
}
@@ -1011,7 +1011,7 @@
/*
* Returns "true" if the specified key is currently pressed.
*/
-bool PhoneWindow::IsKeyPressed(KeyCode keyCode)
+bool PhoneWindow::IsKeyPressed(int32_t keyCode)
{
ListIter iter;
for (iter = mPressedKeys.begin(); iter != mPressedKeys.end(); ++iter) {
diff --git a/simulator/app/PhoneWindow.h b/simulator/app/PhoneWindow.h
index 5eb1800..a346e9c 100644
--- a/simulator/app/PhoneWindow.h
+++ b/simulator/app/PhoneWindow.h
@@ -89,7 +89,7 @@
*/
class KeyInfo {
public:
- KeyInfo(void) : mKeyCode(kKeyCodeUnknown) {}
+ KeyInfo(void) : mKeyCode(AKEYCODE_UNKNOWN) {}
KeyInfo(const KeyInfo& src) {
mKeyCode = src.mKeyCode;
}
@@ -102,14 +102,14 @@
return *this;
}
- KeyCode GetKeyCode(void) const { return mKeyCode; }
- void SetKeyCode(KeyCode keyCode) { mKeyCode = keyCode; }
+ int32_t GetKeyCode(void) const { return mKeyCode; }
+ void SetKeyCode(int32_t keyCode) { mKeyCode = keyCode; }
//PhoneButton* GetPhoneButton(void) const { return mpButton; }
//void SetPhoneButton(PhoneButton* pButton) { mpButton = pButton; }
private:
- KeyCode mKeyCode;
+ int32_t mKeyCode;
//PhoneButton* mpButton;
};
@@ -135,13 +135,13 @@
int ConvertKeyCode(int wxKeyCode) const;
/* press a key on the device */
- void AddPressedKey(KeyCode keyCode);
+ void AddPressedKey(int32_t keyCode);
/* release a key on the device */
- void RemovePressedKey(KeyCode keyCode);
+ void RemovePressedKey(int32_t keyCode);
/* "raise" all keys */
void ClearPressedKeys(void);
/* determine whether a key is down */
- bool IsKeyPressed(KeyCode keyCode);
+ bool IsKeyPressed(int32_t keyCode);
/* manage the device runtime */
DeviceManager mDeviceManager;
@@ -149,7 +149,7 @@
/* button mouse-over highlight handling */
int mpMOHViewIndex; // mouse is in this view
PhoneButton* mpMOHButton; // over this button
- KeyCode mMouseKeySent; // to handle "key up" for mouse button
+ int32_t mMouseKeySent; // to handle "key up" for mouse button
/* handle multiple simultaneous key presses */
android::List<KeyInfo> mPressedKeys;