mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-04 06:29:31 +00:00
gl: win32: set the parent window when creating internal window
When _set_window_handle() was called in READY state, it wasn't set to the internal window created later. https://bugzilla.gnome.org/show_bug.cgi?id=749601
This commit is contained in:
parent
e24bc348bd
commit
0acc18c60f
1 changed files with 44 additions and 28 deletions
|
@ -166,6 +166,46 @@ gst_gl_window_win32_close (GstGLWindow * window)
|
||||||
window_win32->msg_source = NULL;
|
window_win32->msg_source = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
set_parent_win_id (GstGLWindowWin32 * window_win32)
|
||||||
|
{
|
||||||
|
WNDPROC window_parent_proc;
|
||||||
|
RECT rect;
|
||||||
|
|
||||||
|
if (!window_win32->parent_win_id) {
|
||||||
|
/* no parent so the internal window needs borders and system menu */
|
||||||
|
SetWindowLongPtr (window_win32->internal_win_id, GWL_STYLE,
|
||||||
|
WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_OVERLAPPEDWINDOW);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
window_parent_proc =
|
||||||
|
(WNDPROC) GetWindowLongPtr (window_win32->parent_win_id, GWLP_WNDPROC);
|
||||||
|
|
||||||
|
GST_DEBUG ("set parent %" G_GUINTPTR_FORMAT,
|
||||||
|
(guintptr) window_win32->parent_win_id);
|
||||||
|
|
||||||
|
SetProp (window_win32->parent_win_id, "gl_window_id",
|
||||||
|
window_win32->internal_win_id);
|
||||||
|
SetProp (window_win32->parent_win_id, "gl_window_parent_proc",
|
||||||
|
(WNDPROC) window_parent_proc);
|
||||||
|
SetWindowLongPtr (window_win32->parent_win_id, GWLP_WNDPROC,
|
||||||
|
(LONG_PTR) sub_class_proc);
|
||||||
|
|
||||||
|
SetWindowLongPtr (window_win32->internal_win_id, GWL_STYLE,
|
||||||
|
WS_CHILD | WS_MAXIMIZE);
|
||||||
|
SetParent (window_win32->internal_win_id, window_win32->parent_win_id);
|
||||||
|
|
||||||
|
/* take changes into account: SWP_FRAMECHANGED */
|
||||||
|
GetClientRect (window_win32->parent_win_id, &rect);
|
||||||
|
SetWindowPos (window_win32->internal_win_id, HWND_TOP, rect.left, rect.top,
|
||||||
|
rect.right, rect.bottom,
|
||||||
|
SWP_ASYNCWINDOWPOS | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER |
|
||||||
|
SWP_FRAMECHANGED | SWP_NOACTIVATE);
|
||||||
|
MoveWindow (window_win32->internal_win_id, rect.left, rect.top, rect.right,
|
||||||
|
rect.bottom, FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
gst_gl_window_win32_create_window (GstGLWindowWin32 * window_win32,
|
gst_gl_window_win32_create_window (GstGLWindowWin32 * window_win32,
|
||||||
GError ** error)
|
GError ** error)
|
||||||
|
@ -241,6 +281,9 @@ gst_gl_window_win32_create_window (GstGLWindowWin32 * window_win32,
|
||||||
ShowCursor (TRUE);
|
ShowCursor (TRUE);
|
||||||
|
|
||||||
GST_LOG ("Created a win32 window");
|
GST_LOG ("Created a win32 window");
|
||||||
|
|
||||||
|
set_parent_win_id (window_win32);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
failure:
|
failure:
|
||||||
|
@ -290,36 +333,9 @@ gst_gl_window_win32_set_window_handle (GstGLWindow * window, guintptr id)
|
||||||
|
|
||||||
RemoveProp (parent_id, "gl_window_parent_proc");
|
RemoveProp (parent_id, "gl_window_parent_proc");
|
||||||
}
|
}
|
||||||
//not 0
|
|
||||||
if (id) {
|
|
||||||
WNDPROC window_parent_proc =
|
|
||||||
(WNDPROC) GetWindowLongPtr ((HWND) id, GWLP_WNDPROC);
|
|
||||||
RECT rect;
|
|
||||||
|
|
||||||
GST_DEBUG ("set parent %" G_GUINTPTR_FORMAT, id);
|
|
||||||
|
|
||||||
SetProp ((HWND) id, "gl_window_id", window_win32->internal_win_id);
|
|
||||||
SetProp ((HWND) id, "gl_window_parent_proc", (WNDPROC) window_parent_proc);
|
|
||||||
SetWindowLongPtr ((HWND) id, GWLP_WNDPROC, (LONG_PTR) sub_class_proc);
|
|
||||||
|
|
||||||
SetWindowLongPtr (window_win32->internal_win_id, GWL_STYLE,
|
|
||||||
WS_CHILD | WS_MAXIMIZE);
|
|
||||||
SetParent (window_win32->internal_win_id, (HWND) id);
|
|
||||||
|
|
||||||
/* take changes into account: SWP_FRAMECHANGED */
|
|
||||||
GetClientRect ((HWND) id, &rect);
|
|
||||||
SetWindowPos (window_win32->internal_win_id, HWND_TOP, rect.left, rect.top,
|
|
||||||
rect.right, rect.bottom,
|
|
||||||
SWP_ASYNCWINDOWPOS | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER |
|
|
||||||
SWP_FRAMECHANGED | SWP_NOACTIVATE);
|
|
||||||
MoveWindow (window_win32->internal_win_id, rect.left, rect.top, rect.right,
|
|
||||||
rect.bottom, FALSE);
|
|
||||||
} else {
|
|
||||||
/* no parent so the internal window needs borders and system menu */
|
|
||||||
SetWindowLongPtr (window_win32->internal_win_id, GWL_STYLE,
|
|
||||||
WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_OVERLAPPEDWINDOW);
|
|
||||||
}
|
|
||||||
window_win32->parent_win_id = (HWND) id;
|
window_win32->parent_win_id = (HWND) id;
|
||||||
|
set_parent_win_id (window_win32);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
Loading…
Reference in a new issue