Fix gray bar of embed game window in Windows

This commit is contained in:
arkology
2026-01-11 11:14:07 +03:00
parent 85c75da4ad
commit 993d28c2cf
4 changed files with 15 additions and 12 deletions

View File

@@ -52,6 +52,7 @@
#include "scene/gui/flow_container.h"
#include "scene/gui/label.h"
#include "scene/gui/menu_button.h"
#include "scene/gui/panel.h"
#include "scene/gui/separator.h"
void GameViewDebugger::_session_started(Ref<EditorDebuggerSession> p_session) {
@@ -1423,13 +1424,10 @@ GameView::GameView(Ref<GameViewDebugger> p_debugger, EmbeddedProcessBase *p_embe
game_size_label->set_h_size_flags(SIZE_EXPAND_FILL);
game_size_label->set_horizontal_alignment(HorizontalAlignment::HORIZONTAL_ALIGNMENT_RIGHT);
panel = memnew(PanelContainer);
panel = memnew(Panel);
add_child(panel);
panel->set_theme_type_variation("GamePanel");
panel->set_v_size_flags(SIZE_EXPAND_FILL);
#ifdef MACOS_ENABLED
panel->set_mouse_filter(Control::MOUSE_FILTER_IGNORE);
#endif
panel->add_child(embedded_process);
embedded_process->set_anchors_and_offsets_preset(PRESET_FULL_RECT);
@@ -1439,8 +1437,17 @@ GameView::GameView(Ref<GameViewDebugger> p_debugger, EmbeddedProcessBase *p_embe
embedded_process->connect("embedded_process_focused", callable_mp(this, &GameView::_embedded_process_focused));
embedded_process->set_custom_minimum_size(Size2i(100, 100));
MarginContainer *state_container = memnew(MarginContainer);
state_container->add_theme_constant_override("margin_left", 8 * EDSCALE);
state_container->add_theme_constant_override("margin_right", 8 * EDSCALE);
state_container->set_anchors_and_offsets_preset(PRESET_FULL_RECT);
#ifdef MACOS_ENABLED
state_container->set_mouse_filter(Control::MOUSE_FILTER_IGNORE);
#endif
panel->add_child(state_container);
state_label = memnew(Label());
panel->add_child(state_label);
state_container->add_child(state_label);
state_label->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER);
state_label->set_vertical_alignment(VERTICAL_ALIGNMENT_CENTER);
state_label->set_autowrap_mode(TextServer::AUTOWRAP_WORD);

View File

@@ -181,7 +181,7 @@ class GameView : public VBoxContainer {
HBoxContainer *embedding_hb = nullptr;
MenuButton *embed_options_menu = nullptr;
Label *game_size_label = nullptr;
PanelContainer *panel = nullptr;
Panel *panel = nullptr;
EmbeddedProcessBase *embedded_process = nullptr;
Label *state_label = nullptr;

View File

@@ -1645,11 +1645,9 @@ void ThemeClassic::populate_editor_styles(const Ref<EditorTheme> &p_theme, Edito
p_theme->set_stylebox("ScriptEditor", EditorStringName(EditorStyles), EditorThemeManager::make_empty_stylebox(0, 0, 0, 0));
// Game view.
p_theme->set_type_variation("GamePanel", "PanelContainer");
p_theme->set_type_variation("GamePanel", "Panel");
Ref<StyleBoxFlat> game_panel = p_theme->get_stylebox(SceneStringName(panel), SNAME("Panel"))->duplicate();
game_panel->set_corner_radius_all(0);
game_panel->set_content_margin_all(0);
game_panel->set_draw_center(true);
p_theme->set_stylebox(SceneStringName(panel), "GamePanel", game_panel);
// Main menu.

View File

@@ -1672,11 +1672,9 @@ void ThemeModern::populate_editor_styles(const Ref<EditorTheme> &p_theme, Editor
p_theme->set_stylebox("ScriptEditor", EditorStringName(EditorStyles), EditorThemeManager::make_empty_stylebox(0, 0, 0, 0));
// Game view.
p_theme->set_type_variation("GamePanel", "PanelContainer");
p_theme->set_type_variation("GamePanel", "Panel");
Ref<StyleBoxFlat> game_panel = p_theme->get_stylebox(SceneStringName(panel), SNAME("Panel"))->duplicate();
game_panel->set_corner_radius_all(0);
game_panel->set_content_margin_all(0);
game_panel->set_draw_center(true);
p_theme->set_stylebox(SceneStringName(panel), "GamePanel", game_panel);
// Main menu.