Skip to content

Commit 53faed5

Browse files
committed
Merge pull request #103339 from Hilderin/adjustment-error-message-embedded-game
Replace error to info messages for embedded game
2 parents dd43d40 + 0c384e7 commit 53faed5

File tree

2 files changed

+72
-18
lines changed

2 files changed

+72
-18
lines changed

platform/linuxbsd/x11/display_server_x11.cpp

+36-9
Original file line numberDiff line numberDiff line change
@@ -2171,7 +2171,10 @@ void DisplayServerX11::window_set_current_screen(int p_screen, WindowID p_window
21712171
return;
21722172
}
21732173

2174-
ERR_FAIL_COND_MSG(wd.embed_parent, "Embedded window can't be moved to another screen.");
2174+
if (wd.embed_parent) {
2175+
print_line("Embedded window can't be moved to another screen.");
2176+
return;
2177+
}
21752178

21762179
if (window_get_mode(p_window) == WINDOW_MODE_FULLSCREEN || window_get_mode(p_window) == WINDOW_MODE_MAXIMIZED) {
21772180
Point2i position = screen_get_position(p_screen);
@@ -2330,7 +2333,10 @@ void DisplayServerX11::window_set_position(const Point2i &p_position, WindowID p
23302333
ERR_FAIL_COND(!windows.has(p_window));
23312334
WindowData &wd = windows[p_window];
23322335

2333-
ERR_FAIL_COND_MSG(wd.embed_parent, "Embedded window can't be moved.");
2336+
if (wd.embed_parent) {
2337+
print_line("Embedded window can't be moved.");
2338+
return;
2339+
}
23342340

23352341
int x = 0;
23362342
int y = 0;
@@ -2364,7 +2370,10 @@ void DisplayServerX11::window_set_max_size(const Size2i p_size, WindowID p_windo
23642370
ERR_FAIL_COND(!windows.has(p_window));
23652371
WindowData &wd = windows[p_window];
23662372

2367-
ERR_FAIL_COND_MSG(wd.embed_parent, "Embedded windows can't have a maximum size.");
2373+
if (wd.embed_parent) {
2374+
print_line("Embedded windows can't have a maximum size.");
2375+
return;
2376+
}
23682377

23692378
if ((p_size != Size2i()) && ((p_size.x < wd.min_size.x) || (p_size.y < wd.min_size.y))) {
23702379
ERR_PRINT("Maximum window size can't be smaller than minimum window size!");
@@ -2391,7 +2400,10 @@ void DisplayServerX11::window_set_min_size(const Size2i p_size, WindowID p_windo
23912400
ERR_FAIL_COND(!windows.has(p_window));
23922401
WindowData &wd = windows[p_window];
23932402

2394-
ERR_FAIL_COND_MSG(wd.embed_parent, "Embedded windows can't have a minimum size.");
2403+
if (wd.embed_parent) {
2404+
print_line("Embedded windows can't have a minimum size.");
2405+
return;
2406+
}
23952407

23962408
if ((p_size != Size2i()) && (wd.max_size != Size2i()) && ((p_size.x > wd.max_size.x) || (p_size.y > wd.max_size.y))) {
23972409
ERR_PRINT("Minimum window size can't be larger than maximum window size!");
@@ -2422,7 +2434,10 @@ void DisplayServerX11::window_set_size(const Size2i p_size, WindowID p_window) {
24222434

24232435
WindowData &wd = windows[p_window];
24242436

2425-
ERR_FAIL_COND_MSG(wd.embed_parent, "Embedded window can't be resized.");
2437+
if (wd.embed_parent) {
2438+
print_line("Embedded window can't be resized.");
2439+
return;
2440+
}
24262441

24272442
if (wd.size.width == size.width && wd.size.height == size.height) {
24282443
return;
@@ -2842,7 +2857,10 @@ void DisplayServerX11::window_set_mode(WindowMode p_mode, WindowID p_window) {
28422857
return; // do nothing
28432858
}
28442859

2845-
ERR_FAIL_COND_MSG(p_mode != WINDOW_MODE_WINDOWED && wd.embed_parent, "Embedded window only supports Windowed mode.");
2860+
if (p_mode != WINDOW_MODE_WINDOWED && wd.embed_parent) {
2861+
print_line("Embedded window only supports Windowed mode.");
2862+
return;
2863+
}
28462864

28472865
// Remove all "extra" modes.
28482866
switch (old_mode) {
@@ -2944,7 +2962,10 @@ void DisplayServerX11::window_set_flag(WindowFlags p_flag, bool p_enabled, Windo
29442962

29452963
switch (p_flag) {
29462964
case WINDOW_FLAG_RESIZE_DISABLED: {
2947-
ERR_FAIL_COND_MSG(p_enabled && wd.embed_parent, "Embedded window resize can't be disabled.");
2965+
if (p_enabled && wd.embed_parent) {
2966+
print_line("Embedded window resize can't be disabled.");
2967+
return;
2968+
}
29482969

29492970
wd.resize_disabled = p_enabled;
29502971
_update_size_hints(p_window);
@@ -2971,7 +2992,10 @@ void DisplayServerX11::window_set_flag(WindowFlags p_flag, bool p_enabled, Windo
29712992
} break;
29722993
case WINDOW_FLAG_ALWAYS_ON_TOP: {
29732994
ERR_FAIL_COND_MSG(wd.transient_parent != INVALID_WINDOW_ID, "Can't make a window transient if the 'on top' flag is active.");
2974-
ERR_FAIL_COND_MSG(p_enabled && wd.embed_parent, "Embedded window can't become on top.");
2995+
if (p_enabled && wd.embed_parent) {
2996+
print_line("Embedded window can't become on top.");
2997+
return;
2998+
}
29752999
if (p_enabled && wd.fullscreen) {
29763000
_set_wm_maximized(p_window, true);
29773001
}
@@ -3013,7 +3037,10 @@ void DisplayServerX11::window_set_flag(WindowFlags p_flag, bool p_enabled, Windo
30133037

30143038
ERR_FAIL_COND_MSG(p_window == MAIN_WINDOW_ID, "Main window can't be popup.");
30153039
ERR_FAIL_COND_MSG((xwa.map_state == IsViewable) && (wd.is_popup != p_enabled), "Popup flag can't changed while window is opened.");
3016-
ERR_FAIL_COND_MSG(p_enabled && wd.embed_parent, "Embedded window can't be popup.");
3040+
if (p_enabled && wd.embed_parent) {
3041+
print_line("Embedded window can't be popup.");
3042+
return;
3043+
}
30173044
wd.is_popup = p_enabled;
30183045
} break;
30193046
default: {

platform/windows/display_server_windows.cpp

+36-9
Original file line numberDiff line numberDiff line change
@@ -1969,7 +1969,10 @@ void DisplayServerWindows::window_set_current_screen(int p_screen, WindowID p_wi
19691969
return;
19701970
}
19711971
const WindowData &wd = windows[p_window];
1972-
ERR_FAIL_COND_MSG(wd.parent_hwnd, "Embedded window can't be moved to another screen.");
1972+
if (wd.parent_hwnd) {
1973+
print_line("Embedded window can't be moved to another screen.");
1974+
return;
1975+
}
19731976
if (wd.fullscreen) {
19741977
Point2 pos = screen_get_position(p_screen) + _get_screens_origin();
19751978
Size2 size = screen_get_size(p_screen);
@@ -2050,7 +2053,10 @@ void DisplayServerWindows::window_set_position(const Point2i &p_position, Window
20502053
ERR_FAIL_COND(!windows.has(p_window));
20512054
WindowData &wd = windows[p_window];
20522055

2053-
ERR_FAIL_COND_MSG(wd.parent_hwnd, "Embedded window can't be moved.");
2056+
if (wd.parent_hwnd) {
2057+
print_line("Embedded window can't be moved.");
2058+
return;
2059+
}
20542060

20552061
if (wd.fullscreen || wd.maximized) {
20562062
return;
@@ -2136,7 +2142,10 @@ void DisplayServerWindows::window_set_max_size(const Size2i p_size, WindowID p_w
21362142
ERR_FAIL_COND(!windows.has(p_window));
21372143
WindowData &wd = windows[p_window];
21382144

2139-
ERR_FAIL_COND_MSG(wd.parent_hwnd, "Embedded windows can't have a maximum size.");
2145+
if (wd.parent_hwnd) {
2146+
print_line("Embedded windows can't have a maximum size.");
2147+
return;
2148+
}
21402149

21412150
if ((p_size != Size2()) && ((p_size.x < wd.min_size.x) || (p_size.y < wd.min_size.y))) {
21422151
ERR_PRINT("Maximum window size can't be smaller than minimum window size!");
@@ -2159,7 +2168,10 @@ void DisplayServerWindows::window_set_min_size(const Size2i p_size, WindowID p_w
21592168
ERR_FAIL_COND(!windows.has(p_window));
21602169
WindowData &wd = windows[p_window];
21612170

2162-
ERR_FAIL_COND_MSG(wd.parent_hwnd, "Embedded windows can't have a minimum size.");
2171+
if (wd.parent_hwnd) {
2172+
print_line("Embedded windows can't have a minimum size.");
2173+
return;
2174+
}
21632175

21642176
if ((p_size != Size2()) && (wd.max_size != Size2()) && ((p_size.x > wd.max_size.x) || (p_size.y > wd.max_size.y))) {
21652177
ERR_PRINT("Minimum window size can't be larger than maximum window size!");
@@ -2182,7 +2194,10 @@ void DisplayServerWindows::window_set_size(const Size2i p_size, WindowID p_windo
21822194
ERR_FAIL_COND(!windows.has(p_window));
21832195
WindowData &wd = windows[p_window];
21842196

2185-
ERR_FAIL_COND_MSG(wd.parent_hwnd, "Embedded window can't be resized.");
2197+
if (wd.parent_hwnd) {
2198+
print_line("Embedded window can't be resized.");
2199+
return;
2200+
}
21862201

21872202
if (wd.fullscreen || wd.maximized) {
21882203
return;
@@ -2340,7 +2355,10 @@ void DisplayServerWindows::window_set_mode(WindowMode p_mode, WindowID p_window)
23402355
ERR_FAIL_COND(!windows.has(p_window));
23412356
WindowData &wd = windows[p_window];
23422357

2343-
ERR_FAIL_COND_MSG(p_mode != WINDOW_MODE_WINDOWED && wd.parent_hwnd, "Embedded window only supports Windowed mode.");
2358+
if (p_mode != WINDOW_MODE_WINDOWED && wd.parent_hwnd) {
2359+
print_line("Embedded window only supports Windowed mode.");
2360+
return;
2361+
}
23442362

23452363
bool was_fullscreen = wd.fullscreen;
23462364
wd.was_fullscreen_pre_min = false;
@@ -2475,7 +2493,10 @@ void DisplayServerWindows::window_set_flag(WindowFlags p_flag, bool p_enabled, W
24752493
WindowData &wd = windows[p_window];
24762494
switch (p_flag) {
24772495
case WINDOW_FLAG_RESIZE_DISABLED: {
2478-
ERR_FAIL_COND_MSG(p_enabled && wd.parent_hwnd, "Embedded window resize can't be disabled.");
2496+
if (p_enabled && wd.parent_hwnd) {
2497+
print_line("Embedded window resize can't be disabled.");
2498+
return;
2499+
}
24792500
wd.resizable = !p_enabled;
24802501
_update_window_style(p_window);
24812502
} break;
@@ -2487,7 +2508,10 @@ void DisplayServerWindows::window_set_flag(WindowFlags p_flag, bool p_enabled, W
24872508
} break;
24882509
case WINDOW_FLAG_ALWAYS_ON_TOP: {
24892510
ERR_FAIL_COND_MSG(wd.transient_parent != INVALID_WINDOW_ID && p_enabled, "Transient windows can't become on top.");
2490-
ERR_FAIL_COND_MSG(p_enabled && wd.parent_hwnd, "Embedded window can't become on top.");
2511+
if (p_enabled && wd.parent_hwnd) {
2512+
print_line("Embedded window can't become on top.");
2513+
return;
2514+
}
24912515
wd.always_on_top = p_enabled;
24922516
_update_window_style(p_window);
24932517
} break;
@@ -2547,7 +2571,10 @@ void DisplayServerWindows::window_set_flag(WindowFlags p_flag, bool p_enabled, W
25472571
case WINDOW_FLAG_POPUP: {
25482572
ERR_FAIL_COND_MSG(p_window == MAIN_WINDOW_ID, "Main window can't be popup.");
25492573
ERR_FAIL_COND_MSG(IsWindowVisible(wd.hWnd) && (wd.is_popup != p_enabled), "Popup flag can't changed while window is opened.");
2550-
ERR_FAIL_COND_MSG(p_enabled && wd.parent_hwnd, "Embedded window can't be popup.");
2574+
if (p_enabled && wd.parent_hwnd) {
2575+
print_line("Embedded window can't be popup.");
2576+
return;
2577+
}
25512578
wd.is_popup = p_enabled;
25522579
} break;
25532580
default:

0 commit comments

Comments
 (0)