Skip to content

Commit 0c384e7

Browse files
committed
Replace error to info messages for embedded game
1 parent 3ef055f commit 0c384e7

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
@@ -1974,7 +1974,10 @@ void DisplayServerWindows::window_set_current_screen(int p_screen, WindowID p_wi
19741974
return;
19751975
}
19761976
const WindowData &wd = windows[p_window];
1977-
ERR_FAIL_COND_MSG(wd.parent_hwnd, "Embedded window can't be moved to another screen.");
1977+
if (wd.parent_hwnd) {
1978+
print_line("Embedded window can't be moved to another screen.");
1979+
return;
1980+
}
19781981
if (wd.fullscreen) {
19791982
Point2 pos = screen_get_position(p_screen) + _get_screens_origin();
19801983
Size2 size = screen_get_size(p_screen);
@@ -2055,7 +2058,10 @@ void DisplayServerWindows::window_set_position(const Point2i &p_position, Window
20552058
ERR_FAIL_COND(!windows.has(p_window));
20562059
WindowData &wd = windows[p_window];
20572060

2058-
ERR_FAIL_COND_MSG(wd.parent_hwnd, "Embedded window can't be moved.");
2061+
if (wd.parent_hwnd) {
2062+
print_line("Embedded window can't be moved.");
2063+
return;
2064+
}
20592065

20602066
if (wd.fullscreen || wd.maximized) {
20612067
return;
@@ -2141,7 +2147,10 @@ void DisplayServerWindows::window_set_max_size(const Size2i p_size, WindowID p_w
21412147
ERR_FAIL_COND(!windows.has(p_window));
21422148
WindowData &wd = windows[p_window];
21432149

2144-
ERR_FAIL_COND_MSG(wd.parent_hwnd, "Embedded windows can't have a maximum size.");
2150+
if (wd.parent_hwnd) {
2151+
print_line("Embedded windows can't have a maximum size.");
2152+
return;
2153+
}
21452154

21462155
if ((p_size != Size2()) && ((p_size.x < wd.min_size.x) || (p_size.y < wd.min_size.y))) {
21472156
ERR_PRINT("Maximum window size can't be smaller than minimum window size!");
@@ -2164,7 +2173,10 @@ void DisplayServerWindows::window_set_min_size(const Size2i p_size, WindowID p_w
21642173
ERR_FAIL_COND(!windows.has(p_window));
21652174
WindowData &wd = windows[p_window];
21662175

2167-
ERR_FAIL_COND_MSG(wd.parent_hwnd, "Embedded windows can't have a minimum size.");
2176+
if (wd.parent_hwnd) {
2177+
print_line("Embedded windows can't have a minimum size.");
2178+
return;
2179+
}
21682180

21692181
if ((p_size != Size2()) && (wd.max_size != Size2()) && ((p_size.x > wd.max_size.x) || (p_size.y > wd.max_size.y))) {
21702182
ERR_PRINT("Minimum window size can't be larger than maximum window size!");
@@ -2187,7 +2199,10 @@ void DisplayServerWindows::window_set_size(const Size2i p_size, WindowID p_windo
21872199
ERR_FAIL_COND(!windows.has(p_window));
21882200
WindowData &wd = windows[p_window];
21892201

2190-
ERR_FAIL_COND_MSG(wd.parent_hwnd, "Embedded window can't be resized.");
2202+
if (wd.parent_hwnd) {
2203+
print_line("Embedded window can't be resized.");
2204+
return;
2205+
}
21912206

21922207
if (wd.fullscreen || wd.maximized) {
21932208
return;
@@ -2345,7 +2360,10 @@ void DisplayServerWindows::window_set_mode(WindowMode p_mode, WindowID p_window)
23452360
ERR_FAIL_COND(!windows.has(p_window));
23462361
WindowData &wd = windows[p_window];
23472362

2348-
ERR_FAIL_COND_MSG(p_mode != WINDOW_MODE_WINDOWED && wd.parent_hwnd, "Embedded window only supports Windowed mode.");
2363+
if (p_mode != WINDOW_MODE_WINDOWED && wd.parent_hwnd) {
2364+
print_line("Embedded window only supports Windowed mode.");
2365+
return;
2366+
}
23492367

23502368
bool was_fullscreen = wd.fullscreen;
23512369
wd.was_fullscreen_pre_min = false;
@@ -2480,7 +2498,10 @@ void DisplayServerWindows::window_set_flag(WindowFlags p_flag, bool p_enabled, W
24802498
WindowData &wd = windows[p_window];
24812499
switch (p_flag) {
24822500
case WINDOW_FLAG_RESIZE_DISABLED: {
2483-
ERR_FAIL_COND_MSG(p_enabled && wd.parent_hwnd, "Embedded window resize can't be disabled.");
2501+
if (p_enabled && wd.parent_hwnd) {
2502+
print_line("Embedded window resize can't be disabled.");
2503+
return;
2504+
}
24842505
wd.resizable = !p_enabled;
24852506
_update_window_style(p_window);
24862507
} break;
@@ -2492,7 +2513,10 @@ void DisplayServerWindows::window_set_flag(WindowFlags p_flag, bool p_enabled, W
24922513
} break;
24932514
case WINDOW_FLAG_ALWAYS_ON_TOP: {
24942515
ERR_FAIL_COND_MSG(wd.transient_parent != INVALID_WINDOW_ID && p_enabled, "Transient windows can't become on top.");
2495-
ERR_FAIL_COND_MSG(p_enabled && wd.parent_hwnd, "Embedded window can't become on top.");
2516+
if (p_enabled && wd.parent_hwnd) {
2517+
print_line("Embedded window can't become on top.");
2518+
return;
2519+
}
24962520
wd.always_on_top = p_enabled;
24972521
_update_window_style(p_window);
24982522
} break;
@@ -2552,7 +2576,10 @@ void DisplayServerWindows::window_set_flag(WindowFlags p_flag, bool p_enabled, W
25522576
case WINDOW_FLAG_POPUP: {
25532577
ERR_FAIL_COND_MSG(p_window == MAIN_WINDOW_ID, "Main window can't be popup.");
25542578
ERR_FAIL_COND_MSG(IsWindowVisible(wd.hWnd) && (wd.is_popup != p_enabled), "Popup flag can't changed while window is opened.");
2555-
ERR_FAIL_COND_MSG(p_enabled && wd.parent_hwnd, "Embedded window can't be popup.");
2579+
if (p_enabled && wd.parent_hwnd) {
2580+
print_line("Embedded window can't be popup.");
2581+
return;
2582+
}
25562583
wd.is_popup = p_enabled;
25572584
} break;
25582585
default:

0 commit comments

Comments
 (0)