Skip to content

Commit

Permalink
Initial pass at event mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
madhurajayaraman committed Jan 9, 2025
1 parent 05ec3d2 commit a061442
Showing 1 changed file with 136 additions and 0 deletions.
136 changes: 136 additions & 0 deletions ui/ozone/platform/starboard/platform_event_source_starboard.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ namespace starboard {
constexpr auto kSbKeyToDomCodeMap = base::MakeFixedFlatMap<SbKey, ui::DomCode>({
// Convenience keys for keyboard support.
{kSbKeySpace, ui::DomCode::MEDIA_PLAY_PAUSE},
// {kSbKeySpace, ui::DomCode::SPACE}, Should this be space or play/pause

// Keys which are used by the Cast SDK.
{kSbKeyReturn, ui::DomCode::ENTER},
Expand Down Expand Up @@ -60,6 +61,141 @@ constexpr auto kSbKeyToDomCodeMap = base::MakeFixedFlatMap<SbKey, ui::DomCode>({
{kSbKeyChannelDown, ui::DomCode::CHANNEL_DOWN},
{kSbKeyClosedCaption, ui::DomCode::CLOSED_CAPTION_TOGGLE},
{kSbKeyRecord, ui::DomCode::MEDIA_RECORD},

// 0-9, a-z
{kSbKey0, ui::DomCode::DIGIT0},
{kSbKey1, ui::DomCode::DIGIT1},
{kSbKey2, ui::DomCode::DIGIT2},
{kSbKey3, ui::DomCode::DIGIT3},
{kSbKey4, ui::DomCode::DIGIT4},
{kSbKey5, ui::DomCode::DIGIT5},
{kSbKey6, ui::DomCode::DIGIT6},
{kSbKey7, ui::DomCode::DIGIT7},
{kSbKey8, ui::DomCode::DIGIT8},
{kSbKey9, ui::DomCode::DIGIT9},
{kSbKeyA, ui::DomCode::US_A},
{kSbKeyB, ui::DomCode::US_B},
{kSbKeyC, ui::DomCode::US_C},
{kSbKeyD, ui::DomCode::US_D},
{kSbKeyE, ui::DomCode::US_E},
{kSbKeyF, ui::DomCode::US_F},
{kSbKeyG, ui::DomCode::US_G},
{kSbKeyH, ui::DomCode::US_H},
{kSbKeyI, ui::DomCode::US_I},
{kSbKeyJ, ui::DomCode::US_J},
{kSbKeyK, ui::DomCode::US_K},
{kSbKeyL, ui::DomCode::US_L},
{kSbKeyM, ui::DomCode::US_M},
{kSbKeyN, ui::DomCode::US_N},
{kSbKeyO, ui::DomCode::US_O},
{kSbKeyP, ui::DomCode::US_P},
{kSbKeyQ, ui::DomCode::US_Q},
{kSbKeyR, ui::DomCode::US_R},
{kSbKeyS, ui::DomCode::US_S},
{kSbKeyT, ui::DomCode::US_T},
{kSbKeyU, ui::DomCode::US_U},
{kSbKeyV, ui::DomCode::US_V},
{kSbKeyW, ui::DomCode::US_W},
{kSbKeyX, ui::DomCode::US_X},
{kSbKeyY, ui::DomCode::US_Y},
{kSbKeyZ, ui::DomCode::US_Z},

// Numpad keys
{kSbKeyNumpad0, ui::DomCode::NUMPAD0},
{kSbKeyNumpad1, ui::DomCode::NUMPAD1},
{kSbKeyNumpad2, ui::DomCode::NUMPAD2},
{kSbKeyNumpad3, ui::DomCode::NUMPAD3},
{kSbKeyNumpad4, ui::DomCode::NUMPAD4},
{kSbKeyNumpad5, ui::DomCode::NUMPAD5},
{kSbKeyNumpad6, ui::DomCode::NUMPAD6},
{kSbKeyNumpad7, ui::DomCode::NUMPAD7},
{kSbKeyNumpad8, ui::DomCode::NUMPAD8},
{kSbKeyNumpad9, ui::DomCode::NUMPAD9},
{kSbKeyMultiply, ui::DomCode::NUMPAD_MULTIPLY},
{kSbKeyAdd, ui::DomCode::NUMPAD_ADD},
{kSbKeySubtract, ui::DomCode::NUMPAD_SUBTRACT},
{kSbKeyDecimal, ui::DomCode::NUMPAD_DECIMAL},
{kSbKeyDivide, ui::DomCode::NUMPAD_DIVIDE},
{kSbKeyNumlock, ui::DomCode::NUM_LOCK},

// function keys
{kSbKeyF1, ui::DomCode::F1},
{kSbKeyF2, ui::DomCode::F2},
{kSbKeyF3, ui::DomCode::F3},
{kSbKeyF4, ui::DomCode::F4},
{kSbKeyF5, ui::DomCode::F5},
{kSbKeyF6, ui::DomCode::F6},
{kSbKeyF7, ui::DomCode::F7},
{kSbKeyF8, ui::DomCode::F8},
{kSbKeyF9, ui::DomCode::F9},
{kSbKeyF10, ui::DomCode::F10},
{kSbKeyF11, ui::DomCode::F11},
{kSbKeyF12, ui::DomCode::F12},
{kSbKeyF13, ui::DomCode::F13},
{kSbKeyF14, ui::DomCode::F14},
{kSbKeyF15, ui::DomCode::F15},
{kSbKeyF16, ui::DomCode::F16},
{kSbKeyF17, ui::DomCode::F17},
{kSbKeyF18, ui::DomCode::F18},
{kSbKeyF19, ui::DomCode::F19},
{kSbKeyF20, ui::DomCode::F20},
{kSbKeyF21, ui::DomCode::F21},
{kSbKeyF22, ui::DomCode::F22},
{kSbKeyF23, ui::DomCode::F23},
{kSbKeyF24, ui::DomCode::F24},

// Browser keys
{kSbKeyBrowserBack, ui::DomCode::BROWSER_BACK},
{kSbKeyBrowserForward, ui::DomCode::BROWSER_FORWARD},
{kSbKeyBrowserRefresh, ui::DomCode::BROWSER_REFRESH},
{kSbKeyBrowserStop, ui::DomCode::BROWSER_STOP},
{kSbKeyBrowserSearch, ui::DomCode::BROWSER_SEARCH},
{kSbKeyBrowserFavorites, ui::DomCode::BROWSER_FAVORITES},
{kSbKeyBrowserHome, ui::DomCode::BROWSER_HOME},

// Left/Right specific keys
{kSbKeyLwin, ui::DomCode::META_LEFT},
{kSbKeyRwin, ui::DomCode::META_RIGHT},
{kSbKeyLshift, ui::DomCode::SHIFT_LEFT},
{kSbKeyRshift, ui::DomCode::SHIFT_RIGHT},
{kSbKeyLcontrol, ui::DomCode::CONTROL_LEFT},
{kSbKeyRcontrol, ui::DomCode::CONTROL_RIGHT},

// Oem keys
{kSbKeyOemPlus, ui::DomCode::EQUAL},
{kSbKeyOemComma, ui::DomCode::COMMA},
{kSbKeyOem1, ui::DomCode::SEMICOLON},
{kSbKeyOem2, ui::DomCode::SLASH},
{kSbKeyOem4, ui::DomCode::BRACKET_LEFT},
{kSbKeyOem5, ui::DomCode::BACKSLASH},
{kSbKeyOem6, ui::DomCode::BRACKET_RIGHT},

// Volume keys
{kSbKeyVolumeMute, ui::DomCode::VOLUME_MUTE},
{kSbKeyVolumeDown, ui::DomCode::VOLUME_DOWN},
{kSbKeyVolumeUp, ui::DomCode::VOLUME_UP},

// Brightness keys
{kSbKeyBrightnessDown, ui::DomCode::BRIGHTNESS_DOWN},
{kSbKeyBrightnessUp, ui::DomCode::BRIGHTNESS_UP},
{kSbKeyKbdBrightnessDown, ui::DomCode::BRIGHTNESS_DOWN},
{kSbKeyKbdBrightnessUp, ui::DomCode::BRIGHTNESS_UP},

{kSbKeyPrior, ui::DomCode::PAGE_UP},
{kSbKeyNext, ui::DomCode::PAGE_DOWN},
{kSbKeyEnd, ui::DomCode::END},
{kSbKeyHome, ui::DomCode::HOME},
{kSbKeyPrint, ui::DomCode::PRINT},
{kSbKeyExecute, ui::DomCode::OPEN},
{kSbKeyInsert, ui::DomCode::INSERT},
{kSbKeyDelete, ui::DomCode::DEL},
{kSbKeyCapital, ui::DomCode::CAPS_LOCK},

{kSbKeySleep, ui::DomCode::SLEEP},
{kSbKeyPower, ui::DomCode::POWER},
{kSbKeyCancel, ui::DomCode::ABORT},
{kSbKeyTab, ui::DomCode::TAB},
{kSbKeyEscape, ui::DomCode::ESCAPE},
});
// Hack: replace this when implementing event handling
static scoped_refptr<base::TaskRunner> g_reply_runner_;
Expand Down

0 comments on commit a061442

Please sign in to comment.