Correct app-command name of APPCOMMAND_MEDIA_PLAY_PAUSE (#12408)
* correct app-command name * add compatibility with old app-command name * add temporary compatibility with old app-command name * add a comment saying that media-play_pause is deprecated * fix lint
This commit is contained in:
parent
b842a4b133
commit
7c2303c758
2 changed files with 19 additions and 1 deletions
|
@ -44,7 +44,7 @@ const char* AppCommandToString(int command_id) {
|
||||||
case APPCOMMAND_MEDIA_STOP:
|
case APPCOMMAND_MEDIA_STOP:
|
||||||
return "media-stop";
|
return "media-stop";
|
||||||
case APPCOMMAND_MEDIA_PLAY_PAUSE:
|
case APPCOMMAND_MEDIA_PLAY_PAUSE:
|
||||||
return "media-play_pause";
|
return "media-play-pause";
|
||||||
case APPCOMMAND_LAUNCH_MAIL:
|
case APPCOMMAND_LAUNCH_MAIL:
|
||||||
return "launch-mail";
|
return "launch-mail";
|
||||||
case APPCOMMAND_LAUNCH_MEDIA_SELECT:
|
case APPCOMMAND_LAUNCH_MEDIA_SELECT:
|
||||||
|
@ -142,6 +142,11 @@ HHOOK NativeWindowViews::mouse_hook_ = NULL;
|
||||||
bool NativeWindowViews::ExecuteWindowsCommand(int command_id) {
|
bool NativeWindowViews::ExecuteWindowsCommand(int command_id) {
|
||||||
std::string command = AppCommandToString(command_id);
|
std::string command = AppCommandToString(command_id);
|
||||||
NotifyWindowExecuteWindowsCommand(command);
|
NotifyWindowExecuteWindowsCommand(command);
|
||||||
|
|
||||||
|
if (command_id == APPCOMMAND_MEDIA_PLAY_PAUSE)
|
||||||
|
// FIXME(htk3): Remove media-play_pause in 3.0
|
||||||
|
NotifyWindowExecuteWindowsCommand("media-play_pause");
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,19 @@ let windowA = new BrowserWindow(optionsA)
|
||||||
// Replace with
|
// Replace with
|
||||||
let optionsB = {webPreferences: {enableBlinkFeatures: ''}}
|
let optionsB = {webPreferences: {enableBlinkFeatures: ''}}
|
||||||
let windowB = new BrowserWindow(optionsB)
|
let windowB = new BrowserWindow(optionsB)
|
||||||
|
|
||||||
|
// Deprecated
|
||||||
|
window.on('app-command', (e, cmd) => {
|
||||||
|
if (cmd === 'media-play_pause') {
|
||||||
|
// do something
|
||||||
|
}
|
||||||
|
})
|
||||||
|
// Replace with
|
||||||
|
window.on('app-command', (e, cmd) => {
|
||||||
|
if (cmd === 'media-play-pause') {
|
||||||
|
// do something
|
||||||
|
}
|
||||||
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
## `clipboard`
|
## `clipboard`
|
||||||
|
|
Loading…
Reference in a new issue