@@ -10,9 +10,9 @@ use cef::{self, ImplBrowserHost, ImplDragData, do_message_loop_work};
1010use godot:: classes:: notify:: ControlNotification ;
1111use godot:: classes:: texture_rect:: ExpandMode ;
1212use godot:: classes:: {
13- ITextureRect , ImageTexture , InputEvent , InputEventKey , InputEventMagnifyGesture ,
14- InputEventMouseButton , InputEventMouseMotion , InputEventPanGesture , InputEventScreenDrag ,
15- InputEventScreenTouch , LineEdit , TextureRect ,
13+ CanvasItemMaterial , ITextureRect , ImageTexture , InputEvent , InputEventKey ,
14+ InputEventMagnifyGesture , InputEventMouseButton , InputEventMouseMotion , InputEventPanGesture ,
15+ InputEventScreenDrag , InputEventScreenTouch , LineEdit , TextureRect ,
1616} ;
1717use godot:: prelude:: * ;
1818
@@ -181,6 +181,12 @@ impl CefTexture {
181181 position - self . base ( ) . get_global_position ( )
182182 }
183183
184+ fn make_browser_material ( ) -> Gd < godot:: classes:: Material > {
185+ let mut material = CanvasItemMaterial :: new_gd ( ) ;
186+ material. set_blend_mode ( godot:: classes:: canvas_item_material:: BlendMode :: PREMULT_ALPHA ) ;
187+ material. upcast ( )
188+ }
189+
184190 #[ signal]
185191 fn ipc_message ( message : GString ) ;
186192
@@ -270,6 +276,7 @@ impl CefTexture {
270276 self . with_app_mut ( |app| app. mark_cef_retained ( ) ) ;
271277
272278 self . base_mut ( ) . set_expand_mode ( ExpandMode :: IGNORE_SIZE ) ;
279+ self . base_mut ( ) . set_material ( & Self :: make_browser_material ( ) ) ;
273280 // Must explicitly enable processing when using on_notification instead of fn process()
274281 self . base_mut ( ) . set_process ( true ) ;
275282 // Enable focus so we receive FOCUS_ENTER/EXIT notifications and can forward to CEF.
0 commit comments