Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Adding support for passing the raw character(s) to the BrowserServer …

…in a key event.
  • Loading branch information...
commit 6a28ee97a1e786a468bfeaf6d8998f570d24b04b 1 parent d0beeea
Randall E. Barker authored
Showing with 18 additions and 14 deletions.
  1. +2 −2 BrowserAdapter.cpp
  2. +14 −10 BrowserClientBase.cpp
  3. +2 −2 BrowserClientBase.h
View
4 BrowserAdapter.cpp
@@ -1428,14 +1428,14 @@ bool BrowserAdapter::handlePenDoubleClick(NpPalmPenEvent *event)
bool BrowserAdapter::handleKeyDown(NpPalmKeyEvent *event)
{
EVENT_TRACEF("KeyDown %d/0x%08x\n", event->rawkeyCode, event->rawModifier);
- asyncCmdKeyDown(event->rawkeyCode, event->rawModifier);
+ asyncCmdKeyDown(event->rawkeyCode, event->rawModifier, event->chr);
return event->rawkeyCode != ESC_KEY && bEditorFocused;
}
bool BrowserAdapter::handleKeyUp(NpPalmKeyEvent *event)
{
EVENT_TRACEF("KeyUp %d/0x%08x\n", event->rawkeyCode, event->rawModifier);
- asyncCmdKeyUp(event->rawkeyCode, event->rawModifier);
+ asyncCmdKeyUp(event->rawkeyCode, event->rawModifier, event->chr);
return event->rawkeyCode != ESC_KEY && bEditorFocused;
}
View
24 BrowserClientBase.cpp
@@ -79,21 +79,23 @@ void BrowserClientBase::asyncCmdClickAt(int32_t contentX, int32_t contentY, int3
sendAsyncCommand();
}
-void BrowserClientBase::asyncCmdKeyDown(int32_t key, int32_t modifiers)
+void BrowserClientBase::asyncCmdKeyDown(int32_t key, int32_t modifiers, int32_t chr)
{
YapPacket* _cmd = packetCommand();
(*_cmd) << (int16_t) 0x1008; // KeyDown
(*_cmd) << key;
(*_cmd) << modifiers;
+ (*_cmd) << chr;
sendAsyncCommand();
}
-void BrowserClientBase::asyncCmdKeyUp(int32_t key, int32_t modifiers)
+void BrowserClientBase::asyncCmdKeyUp(int32_t key, int32_t modifiers, int32_t chr)
{
YapPacket* _cmd = packetCommand();
(*_cmd) << (int16_t) 0x1009; // KeyUp
(*_cmd) << key;
(*_cmd) << modifiers;
+ (*_cmd) << chr;
sendAsyncCommand();
}
@@ -715,23 +717,25 @@ bool BrowserClientBase::sendRawCmd(const char* rawCmd)
}
if (!matched && (strcmp(strSplit[0], "KeyDown") == 0)) {
- if ((argCount - 1) < 2) return false;
+ if ((argCount - 1) < 3) return false;
matched = true;
- uint16_t key = strtoul(strSplit[1], NULL, 0);
- uint16_t modifiers = strtoul(strSplit[2], NULL, 0);
+ int32_t key = strtoul(strSplit[1], NULL, 0);
+ int32_t modifiers = strtoul(strSplit[2], NULL, 0);
+ int32_t chr = strtoul(strSplit[3], NULL, 0);
- asyncCmdKeyDown(key, modifiers);
+ asyncCmdKeyDown(key, modifiers, chr);
}
if (!matched && (strcmp(strSplit[0], "KeyUp") == 0)) {
- if ((argCount - 1) < 2) return false;
+ if ((argCount - 1) < 3) return false;
matched = true;
- uint16_t key = strtoul(strSplit[1], NULL, 0);
- uint16_t modifiers = strtoul(strSplit[2], NULL, 0);
+ int32_t key = strtoul(strSplit[1], NULL, 0);
+ int32_t modifiers = strtoul(strSplit[2], NULL, 0);
+ int32_t chr = strtoul(strSplit[3], NULL, 0);
- asyncCmdKeyUp(key, modifiers);
+ asyncCmdKeyUp(key, modifiers, chr);
}
if (!matched && (strcmp(strSplit[0], "Forward") == 0)) {
View
4 BrowserClientBase.h
@@ -22,8 +22,8 @@ class BrowserClientBase : public YapClient
void asyncCmdOpenUrl(const char* url);
void asyncCmdSetHtml(const char* url, const char* body);
void asyncCmdClickAt(int32_t contentX, int32_t contentY, int32_t numClicks, int32_t counter);
- void asyncCmdKeyDown(int32_t key, int32_t modifiers);
- void asyncCmdKeyUp(int32_t key, int32_t modifiers);
+ void asyncCmdKeyDown(int32_t key, int32_t modifiers, int32_t chr);
+ void asyncCmdKeyUp(int32_t key, int32_t modifiers, int32_t chr);
void asyncCmdForward();
void asyncCmdBack();
void asyncCmdReload();
Please sign in to comment.
Something went wrong with that request. Please try again.