Skip to content

Commit

Permalink
Revert Pepper Key event "USB code" CL.
Browse files Browse the repository at this point in the history
Revert "Expose scancodes to PP_InputEvent_Key events that are independent of the input language/layout in effect, i.e. that represent the physical key pressed, independent of its meaning in the current context."

This reverts commit 35b9f7f.

BUG=
TEST=


Review URL: http://codereview.chromium.org/6902020

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@83034 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
wez@chromium.org committed Apr 26, 2011
1 parent a5dc53d commit bb2bd5e
Show file tree
Hide file tree
Showing 7 changed files with 4 additions and 194 deletions.
19 changes: 3 additions & 16 deletions ppapi/c/pp_input_event.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,26 +114,13 @@ struct PP_InputEvent_Key {
uint32_t modifier;

/**
* |key_code| reflects the deprecated DOM KeyboardEvent |keyCode| field.
* |key_code| reflects the DOM KeyboardEvent |keyCode| field.
* Chrome populates this with the Windows-style Virtual Key code of the key.
*/
uint32_t key_code;

/**
* |native_key_code| reflects the hardware and/or platform specific code for
* the key.
*/
uint32_t native_key_code;

/**
* |usb_key_code| contains the equivalent USB HID Page and Usage codes for
* the key, in the high- and low-order 16-bit words respectively. See
* http://www.usb.org/developers/hidpage/ for tables of HID Usage codes.
* If the no USB HID Usage equivalent is known for the key, the code is zero.
*/
uint32_t usb_key_code;
uint32_t key_code;
};
PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_InputEvent_Key, 16);
PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_InputEvent_Key, 8);
/**
* @}
*/
Expand Down
20 changes: 1 addition & 19 deletions ppapi/example/example.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,13 @@
#include <time.h>

#include <algorithm>
#include <sstream>

#include "ppapi/c/dev/ppb_console_dev.h"
#include "ppapi/c/dev/ppb_cursor_control_dev.h"
#include "ppapi/c/dev/ppp_printing_dev.h"
#include "ppapi/c/pp_errors.h"
#include "ppapi/c/pp_input_event.h"
#include "ppapi/c/pp_rect.h"
#include "ppapi/c/ppb_var.h"
#include "ppapi/cpp/completion_callback.h"
#include "ppapi/cpp/dev/scriptable_object_deprecated.h"
#include "ppapi/cpp/graphics_2d.h"
Expand All @@ -29,6 +27,7 @@
#include "ppapi/cpp/rect.h"
#include "ppapi/cpp/url_loader.h"
#include "ppapi/cpp/url_request_info.h"
#include "ppapi/cpp/var.h"

static const int kStepsPerCircle = 800;

Expand Down Expand Up @@ -195,22 +194,6 @@ class MyInstance : public pp::InstancePrivate, public MyFetcherClient {
return true;
}

void HandleKeyEvent(const PP_InputEvent_Key& key_event) {
Log(PP_LOGLEVEL_LOG, "HandleKeyDownEvent");

// Stringify the Windows-style and Native key codes
std::ostringstream last_key_down_text;
last_key_down_text << "vkey=" << key_event.key_code
<< " native=" << key_event.native_key_code
<< " usb=" << std::hex << key_event.usb_key_code;

// Locate the field to update in the page DOM
pp::VarPrivate window = GetWindowObject();
pp::VarPrivate doc = window.GetProperty("document");
pp::VarPrivate last_key_down = doc.Call("getElementById", "lastKeyDown");
last_key_down.SetProperty("innerHTML", last_key_down_text.str());
}

virtual bool HandleInputEvent(const PP_InputEvent& event) {
switch (event.type) {
case PP_INPUTEVENT_TYPE_MOUSEDOWN:
Expand All @@ -220,7 +203,6 @@ class MyInstance : public pp::InstancePrivate, public MyFetcherClient {
case PP_INPUTEVENT_TYPE_MOUSEMOVE:
return true;
case PP_INPUTEVENT_TYPE_KEYDOWN:
HandleKeyEvent(event.u.key);
return true;
default:
return false;
Expand Down
1 change: 0 additions & 1 deletion ppapi/example/example.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
<button onclick='Test()'>Test</button>
<button onclick='ToggleSize()'>Toggle Size</button>
<div id="fps" style="background-color:white; font-weight:bold; padding:4px; width:200px;">FPS GOES HERE</div>
<div id="lastKeyDown" style="background-color:white; font-weight:bold; padding:4px; width:200px;">LAST KEY DOWN GOES HERE</div>
<div id="size" style="background-color:white; font-weight:bold; padding:4px; width:200px;"></div>
<object id="plugin" type="application/x-ppapi-example" width="400" height="400" border="2px"></object>
<hr>
Expand Down
2 changes: 0 additions & 2 deletions webkit/glue/webkit_glue.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,6 @@
'../plugins/ppapi/resource_tracker.h',
'../plugins/ppapi/string.cc',
'../plugins/ppapi/string.h',
'../plugins/ppapi/usb_code_for_event.cc',
'../plugins/ppapi/usb_code_for_event.h',
'../plugins/ppapi/var.cc',
'../plugins/ppapi/var.h',
'../plugins/sad_plugin.cc',
Expand Down
3 changes: 0 additions & 3 deletions webkit/plugins/ppapi/event_conversion.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include "ppapi/c/pp_input_event.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
#include "webkit/plugins/ppapi/common.h"
#include "webkit/plugins/ppapi/usb_code_for_event.h"

using WebKit::WebInputEvent;
using WebKit::WebKeyboardEvent;
Expand Down Expand Up @@ -77,8 +76,6 @@ void AppendKeyEvent(const WebInputEvent& event,
PP_InputEvent result = GetPPEventWithCommonFieldsAndType(event);
result.u.key.modifier = key_event.modifiers;
result.u.key.key_code = key_event.windowsKeyCode;
result.u.key.native_key_code = key_event.nativeKeyCode;
result.u.key.usb_key_code = UsbCodeForKeyboardEvent(key_event);
pp_events->push_back(result);
}

Expand Down
126 changes: 0 additions & 126 deletions webkit/plugins/ppapi/usb_code_for_event.cc

This file was deleted.

27 changes: 0 additions & 27 deletions webkit/plugins/ppapi/usb_code_for_event.h

This file was deleted.

0 comments on commit bb2bd5e

Please sign in to comment.