Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions crates/gdcef/src/cef_texture/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ use cef::{self, ImplBrowserHost, ImplDragData, do_message_loop_work};
use godot::classes::notify::ControlNotification;
use godot::classes::texture_rect::ExpandMode;
use godot::classes::{
ITextureRect, ImageTexture, InputEvent, InputEventKey, InputEventMagnifyGesture,
InputEventMouseButton, InputEventMouseMotion, InputEventPanGesture, InputEventScreenDrag,
InputEventScreenTouch, LineEdit, TextureRect,
CanvasItemMaterial, ITextureRect, ImageTexture, InputEvent, InputEventKey,
InputEventMagnifyGesture, InputEventMouseButton, InputEventMouseMotion, InputEventPanGesture,
InputEventScreenDrag, InputEventScreenTouch, LineEdit, TextureRect,
};
use godot::prelude::*;

Expand Down Expand Up @@ -181,6 +181,12 @@ impl CefTexture {
position - self.base().get_global_position()
}

fn make_browser_material() -> Gd<godot::classes::Material> {
let mut material = CanvasItemMaterial::new_gd();
material.set_blend_mode(godot::classes::canvas_item_material::BlendMode::PREMULT_ALPHA);
material.upcast()
}

#[signal]
fn ipc_message(message: GString);

Expand Down Expand Up @@ -270,6 +276,7 @@ impl CefTexture {
self.with_app_mut(|app| app.mark_cef_retained());

self.base_mut().set_expand_mode(ExpandMode::IGNORE_SIZE);
self.base_mut().set_material(&Self::make_browser_material());
// Must explicitly enable processing when using on_notification instead of fn process()
self.base_mut().set_process(true);
// Enable focus so we receive FOCUS_ENTER/EXIT notifications and can forward to CEF.
Expand Down
1 change: 1 addition & 0 deletions crates/gdcef/src/cef_texture/rendering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ impl CefTexture {
if self.popup_overlay.is_none() {
let mut overlay = TextureRect::new_alloc();
overlay.set_expand_mode(ExpandMode::IGNORE_SIZE);
overlay.set_material(&Self::make_browser_material());
Comment on lines 155 to +157
overlay.set_mouse_filter(MouseFilter::IGNORE);
let overlay_node: Gd<godot::classes::Node> = overlay.clone().upcast();
self.base_mut().add_child(&overlay_node);
Expand Down
Loading