[254/906] Better handle when the parent window is resizing, and cleanup some code

This commit is contained in:
Julien Isorce 2008-10-28 01:38:45 +01:00 committed by Tim-Philipp Müller
parent c7ca0d5c2f
commit 9169b822e7
2 changed files with 1 additions and 55 deletions

View file

@ -68,12 +68,6 @@ void gst_gl_window_set_draw_callback (GstGLWindow *window, GstGLWindowCB callbac
void gst_gl_window_set_resize_callback (GstGLWindow *window, GstGLWindowCB2 callback, gpointer data); void gst_gl_window_set_resize_callback (GstGLWindow *window, GstGLWindowCB2 callback, gpointer data);
void gst_gl_window_set_close_callback (GstGLWindow *window, GstGLWindowCB callback, gpointer data); void gst_gl_window_set_close_callback (GstGLWindow *window, GstGLWindowCB callback, gpointer data);
gboolean gst_gl_window_has_external_window_id (GstGLWindow *window);
gboolean gst_gl_window_has_external_gl_context (GstGLWindow *window);
guint64 gst_gl_window_get_window_id (GstGLWindow *window);
guint64 gst_gl_window_get_gl_context (GstGLWindow *window);
void gst_gl_window_visible (GstGLWindow *window, gboolean visible); void gst_gl_window_visible (GstGLWindow *window, gboolean visible);
void gst_gl_window_draw (GstGLWindow *window); void gst_gl_window_draw (GstGLWindow *window);
void gst_gl_window_run_loop (GstGLWindow *window); void gst_gl_window_run_loop (GstGLWindow *window);

View file

@ -46,11 +46,8 @@ enum
struct _GstGLWindowPrivate struct _GstGLWindowPrivate
{ {
HWND internal_win_id; HWND internal_win_id;
HWND external_win_id;
HDC device; HDC device;
HGLRC gl_context; HGLRC gl_context;
gboolean has_external_window_id;
gboolean has_external_gl_context;
GstGLWindowCB draw_cb; GstGLWindowCB draw_cb;
gpointer draw_data; gpointer draw_data;
GstGLWindowCB2 resize_cb; GstGLWindowCB2 resize_cb;
@ -157,11 +154,8 @@ gst_gl_window_new (gint width, gint height)
y += 20; y += 20;
priv->internal_win_id = 0; priv->internal_win_id = 0;
priv->external_win_id = 0;
priv->device = 0; priv->device = 0;
priv->gl_context = 0; priv->gl_context = 0;
priv->has_external_window_id = FALSE;
priv->has_external_gl_context = FALSE;
priv->draw_cb = NULL; priv->draw_cb = NULL;
priv->draw_data = NULL; priv->draw_data = NULL;
priv->resize_cb = NULL; priv->resize_cb = NULL;
@ -218,7 +212,6 @@ gst_gl_window_set_external_window_id (GstGLWindow *window, guint64 id)
SetParent (priv->internal_win_id, (HWND)id); SetParent (priv->internal_win_id, (HWND)id);
SetProp ((HWND)id, "gl_window_parent_proc", (WNDPROC) window_parent_proc); SetProp ((HWND)id, "gl_window_parent_proc", (WNDPROC) window_parent_proc);
SetProp ((HWND)id, "gl_window_id", priv->internal_win_id); SetProp ((HWND)id, "gl_window_id", priv->internal_win_id);
priv->has_external_window_id = TRUE;
//take changes into account: SWP_FRAMECHANGED //take changes into account: SWP_FRAMECHANGED
SetWindowPos (priv->internal_win_id, HWND_TOP, rect.left, rect.top, rect.right, rect.bottom, SetWindowPos (priv->internal_win_id, HWND_TOP, rect.left, rect.top, rect.right, rect.bottom,
@ -262,43 +255,6 @@ gst_gl_window_set_close_callback (GstGLWindow *window, GstGLWindowCB callback, g
priv->close_data = data; priv->close_data = data;
} }
/* Must be called in the gl thread */
gboolean
gst_gl_window_has_external_window_id (GstGLWindow *window)
{
gboolean has_internal_window_id = TRUE;
GstGLWindowPrivate *priv = window->priv;
return priv->has_external_window_id;
}
/* Must be called in the gl thread */
gboolean
gst_gl_window_has_external_gl_context (GstGLWindow *window)
{
gboolean has_external_gl_context = TRUE;
GstGLWindowPrivate *priv = window->priv;
return priv->has_external_gl_context;
}
/* Must be called in the gl thread */
guint64 gst_gl_window_get_window_id (GstGLWindow *window)
{
g_warning ("gst_gl_window_get_window_id: not implemented\n");
return 0;
}
/* Must be called in the gl thread */
guint64
gst_gl_window_get_gl_context (GstGLWindow *window)
{
g_warning ("gst_gl_window_get_gl_context: not implemented\n");
return 0;
}
/* Thread safe */ /* Thread safe */
void void
gst_gl_window_visible (GstGLWindow *window, gboolean visible) gst_gl_window_visible (GstGLWindow *window, gboolean visible)
@ -472,11 +428,7 @@ LRESULT CALLBACK window_proc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
case WM_SIZE: case WM_SIZE:
{ {
if (priv->resize_cb) if (priv->resize_cb)
{
if (priv->has_external_window_id)
MoveWindow (hWnd, 0, 0, LOWORD(lParam), HIWORD(lParam), FALSE);
priv->resize_cb (priv->resize_data, LOWORD(lParam), HIWORD(lParam)); priv->resize_cb (priv->resize_data, LOWORD(lParam), HIWORD(lParam));
}
break; break;
} }
@ -558,7 +510,7 @@ LRESULT FAR PASCAL sub_class_proc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM l
if (uMsg == WM_SIZE) if (uMsg == WM_SIZE)
{ {
HWND gl_window_id = GetProp (hWnd, "gl_window_id"); HWND gl_window_id = GetProp (hWnd, "gl_window_id");
PostMessage (gl_window_id, WM_SIZE, wParam, lParam); MoveWindow (gl_window_id, 0, 0, LOWORD(lParam), HIWORD(lParam), FALSE);
} }
return CallWindowProc (window_parent_proc, hWnd, uMsg, wParam, lParam); return CallWindowProc (window_parent_proc, hWnd, uMsg, wParam, lParam);