@@ -2877,10 +2877,7 @@ static BOOL CALLBACK _enum_proc_find_window_from_process_id_callback(HWND hWnd,
2877
2877
GetWindowThreadProcessId (hWnd, &process_id);
2878
2878
if (ed.process_id == process_id) {
2879
2879
if (GetParent (hWnd) != ed.parent_hWnd ) {
2880
- const DWORD style = GetWindowLongPtr (hWnd, GWL_STYLE);
2881
- if ((style & WS_VISIBLE) != WS_VISIBLE) {
2882
- return TRUE ;
2883
- }
2880
+ return TRUE ;
2884
2881
}
2885
2882
2886
2883
// Found it.
@@ -2936,24 +2933,9 @@ Error DisplayServerWindows::embed_process(WindowID p_window, OS::ProcessID p_pid
2936
2933
ep->is_visible = (style & WS_VISIBLE) == WS_VISIBLE;
2937
2934
2938
2935
embedded_processes.insert (p_pid, ep);
2939
-
2940
- HWND old_parent = GetParent (ep->window_handle );
2941
- if (old_parent != wd.hWnd ) {
2942
- // It's important that the window does not have the WS_CHILD flag
2943
- // to prevent the current process from interfering with the embedded process.
2944
- // I observed lags and issues with mouse capture when WS_CHILD is set.
2945
- // Additionally, WS_POPUP must be set to ensure that the coordinates of the embedded
2946
- // window remain screen coordinates and not local coordinates of the parent window.
2947
- if ((style & WS_CHILD) == WS_CHILD || (style & WS_POPUP) != WS_POPUP) {
2948
- const DWORD new_style = (style & ~WS_CHILD) | WS_POPUP;
2949
- SetWindowLong (ep->window_handle , GWL_STYLE, new_style);
2950
- }
2951
- // Set the parent to current window.
2952
- SetParent (ep->window_handle , wd.hWnd );
2953
- }
2954
2936
}
2955
2937
2956
- if (p_rect.size .x < 100 || p_rect.size .y < 100 ) {
2938
+ if (p_rect.size .x <= 100 || p_rect.size .y <= 100 ) {
2957
2939
p_visible = false ;
2958
2940
}
2959
2941
@@ -2962,7 +2944,7 @@ Error DisplayServerWindows::embed_process(WindowID p_window, OS::ProcessID p_pid
2962
2944
// (e.g., a screen to the left of the main screen).
2963
2945
const Rect2i adjusted_rect = Rect2i (p_rect.position + _get_screens_origin (), p_rect.size );
2964
2946
2965
- SetWindowPos (ep->window_handle , HWND_BOTTOM , adjusted_rect.position .x , adjusted_rect.position .y , adjusted_rect.size .x , adjusted_rect.size .y , SWP_NOZORDER | SWP_NOACTIVATE);
2947
+ SetWindowPos (ep->window_handle , nullptr , adjusted_rect.position .x , adjusted_rect.position .y , adjusted_rect.size .x , adjusted_rect.size .y , SWP_NOZORDER | SWP_NOACTIVATE | SWP_ASYNCWINDOWPOS );
2966
2948
2967
2949
if (ep->is_visible != p_visible) {
2968
2950
if (p_visible) {
0 commit comments