Context Menu: UWP

This commit is contained in:
Paul Rouget 2020-03-27 09:27:52 +01:00
parent ed46f5985c
commit ed601bcbad
4 changed files with 46 additions and 7 deletions

View file

@ -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(
@ -154,6 +162,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);