diff --git a/.gitignore b/.gitignore
index 72de5f5..519b7e3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,7 +2,10 @@ target
Cargo.lock
.DS_Store
.vscode/
-resources/
.flatpak-builder/
libmozjs*
cargo-sources.json
+
+resources/
+!resources/panel.html
+!resources/context-menu.html
\ No newline at end of file
diff --git a/Cargo.lock b/Cargo.lock
index 804e99b..0ff3c0a 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -6682,6 +6682,8 @@ dependencies = [
"raw-window-handle",
"script",
"script_traits",
+ "serde",
+ "serde_json",
"servo-media",
"servo-media-dummy",
"servo_config",
diff --git a/Cargo.toml b/Cargo.toml
index 6719a66..3350426 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -107,6 +107,10 @@ url = { workspace = true }
headers = "0.3"
versoview_messages = { path = "./versoview_messages" }
+[target.'cfg(all(unix, not(apple), not(android)))'.dependencies]
+serde_json = "1.0.132"
+serde = { workspace = true }
+
[target.'cfg(any(target_os = "macos", target_os = "windows"))'.dependencies]
muda = "0.15"
diff --git a/resources/context_menu.html b/resources/context_menu.html
new file mode 100644
index 0000000..765b5f9
--- /dev/null
+++ b/resources/context_menu.html
@@ -0,0 +1,81 @@
+
+
+
+
+
+
+
+
+
diff --git a/src/compositor.rs b/src/compositor.rs
index 2f08194..f5273b8 100644
--- a/src/compositor.rs
+++ b/src/compositor.rs
@@ -1106,6 +1106,10 @@ impl IOCompositor {
if close_window {
window_id = Some(window.id());
+ } else {
+ // if the window is not closed, we need to update the display list
+ // to remove the webview from viewport
+ self.send_root_pipeline_display_list(window);
}
self.frame_tree_id.next();
@@ -1329,7 +1333,8 @@ impl IOCompositor {
}
}
- fn hit_test_at_point(&self, point: DevicePoint) -> Option {
+ /// TODO: doc
+ pub fn hit_test_at_point(&self, point: DevicePoint) -> Option {
return self
.hit_test_at_point_with_flags_and_pipeline(point, HitTestFlags::empty(), None)
.first()
@@ -2158,6 +2163,24 @@ impl IOCompositor {
self.webrender_api
.send_transaction(self.webrender_document, transaction);
}
+
+ /// Get webview id on the position
+ pub fn webview_id_on_position(
+ &self,
+ position: DevicePoint,
+ ) -> Option {
+ let hit_result: Option = self.hit_test_at_point(position);
+ if let Some(result) = hit_result {
+ let pipeline_id = result.pipeline_id;
+ for (w_id, p_id) in &self.webviews {
+ if *p_id == pipeline_id {
+ return Some(*w_id);
+ }
+ }
+ }
+
+ None
+ }
}
#[derive(Debug, PartialEq)]
diff --git a/src/context_menu.rs b/src/context_menu.rs
index 968aa93..b1feb91 100644
--- a/src/context_menu.rs
+++ b/src/context_menu.rs
@@ -1,25 +1,69 @@
+/* macOS, Windows Native Implementation */
#[cfg(any(target_os = "macos", target_os = "windows"))]
-use muda::{ContextMenu as MudaContextMenu, Menu};
+use muda::{ContextMenu as MudaContextMenu, Menu as MudaMenu};
#[cfg(any(target_os = "macos", target_os = "windows"))]
use raw_window_handle::{HasWindowHandle, RawWindowHandle};
-/// Context Menu
-#[cfg(any(target_os = "macos", target_os = "windows"))]
-pub struct ContextMenu {
- menu: Menu,
-}
-
-/// Context Menu
+/* Wayland Implementation */
+#[cfg(linux)]
+use crate::{verso::send_to_constellation, webview::WebView, window::Window};
+#[cfg(linux)]
+use base::id::WebViewId;
+#[cfg(linux)]
+use compositing_traits::ConstellationMsg;
#[cfg(linux)]
-pub struct ContextMenu {}
+use crossbeam_channel::Sender;
+#[cfg(linux)]
+use euclid::{Point2D, Size2D};
+#[cfg(linux)]
+use serde::{Deserialize, Serialize};
+#[cfg(linux)]
+use servo_url::ServoUrl;
+#[cfg(linux)]
+use webrender_api::units::DeviceIntRect;
+#[cfg(linux)]
+use winit::dpi::PhysicalPosition;
+/// Context Menu inner menu
#[cfg(any(target_os = "macos", target_os = "windows"))]
+pub struct Menu(pub MudaMenu);
+/// Context Menu inner menu
+#[cfg(linux)]
+#[derive(Debug, Clone)]
+pub struct Menu(pub Vec