mirror of
https://github.com/servo/servo.git
synced 2025-06-25 01:24:37 +01:00
Auto merge of #26043 - paulrouget:IMMenu, r=jdm
Context menu API This adds an API for Servo internals to request a context menu to the embedder, along an implement for the UWP port.
This commit is contained in:
commit
c3ecf2ecef
10 changed files with 132 additions and 10 deletions
|
@ -43,7 +43,7 @@ void on_ime_state_changed(bool aShow) {
|
|||
sServo->Delegate().OnServoIMEStateChanged(aShow);
|
||||
}
|
||||
|
||||
void set_clipboard_contents(const char *content) {
|
||||
void set_clipboard_contents(const char *) {
|
||||
// FIXME
|
||||
}
|
||||
|
||||
|
@ -67,6 +67,14 @@ void prompt_alert(const char *message, bool trusted) {
|
|||
sServo->Delegate().OnServoPromptAlert(char2hstring(message), trusted);
|
||||
}
|
||||
|
||||
void show_context_menu(const char *const *items_list, uint32_t items_size) {
|
||||
std::vector<winrt::hstring> items;
|
||||
for (uint32_t i = 0; i < items_size; i++) {
|
||||
items.push_back(char2hstring(items_list[i]));
|
||||
}
|
||||
sServo->Delegate().OnServoShowContextMenu(items);
|
||||
}
|
||||
|
||||
void on_devtools_started(Servo::DevtoolsServerState result,
|
||||
const unsigned int port) {
|
||||
sServo->Delegate().OnServoDevtoolsStarted(
|
||||
|
@ -150,6 +158,7 @@ Servo::Servo(hstring url, hstring args, GLsizei width, GLsizei height,
|
|||
c.prompt_yes_no = &prompt_yes_no;
|
||||
c.prompt_input = &prompt_input;
|
||||
c.on_devtools_started = &on_devtools_started;
|
||||
c.show_context_menu = &show_context_menu;
|
||||
|
||||
capi::register_panic_handler(&on_panic);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue