[501/906] Fix building on 64 bit mingw-w64

https://bugzilla.gnome.org/show_bug.cgi?id=676428
This commit is contained in:
Raimo Järvi 2012-05-20 18:45:06 +03:00 committed by Tim-Philipp Müller
parent 20c429684e
commit 563f0f2e57
2 changed files with 32 additions and 29 deletions

View file

@ -79,12 +79,12 @@ struct _GstGLWindowClass {
GQuark gst_gl_window_error_quark (void); GQuark gst_gl_window_error_quark (void);
GType gst_gl_window_get_type (void); GType gst_gl_window_get_type (void);
GstGLWindow * gst_gl_window_new (gulong external_gl_context); GstGLWindow * gst_gl_window_new (guintptr external_gl_context);
gulong gst_gl_window_get_internal_gl_context (GstGLWindow *window); guintptr gst_gl_window_get_internal_gl_context (GstGLWindow *window);
void gst_gl_window_activate_gl_context (GstGLWindow *window, gboolean activate); void gst_gl_window_activate_gl_context (GstGLWindow *window, gboolean activate);
void gst_gl_window_set_external_window_id (GstGLWindow *window, gulong id); void gst_gl_window_set_external_window_id (GstGLWindow *window, guintptr id);
void gst_gl_window_set_draw_callback (GstGLWindow *window, GstGLWindowCB callback, gpointer data); void gst_gl_window_set_draw_callback (GstGLWindow *window, GstGLWindowCB callback, gpointer data);
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);

View file

@ -141,7 +141,7 @@ gst_gl_window_init (GstGLWindow * window)
/* Must be called in the gl thread */ /* Must be called in the gl thread */
GstGLWindow * GstGLWindow *
gst_gl_window_new (DWORD_PTR external_gl_context) gst_gl_window_new (guintptr external_gl_context)
{ {
GstGLWindow *window = g_object_new (GST_GL_TYPE_WINDOW, NULL); GstGLWindow *window = g_object_new (GST_GL_TYPE_WINDOW, NULL);
GstGLWindowPrivate *priv = window->priv; GstGLWindowPrivate *priv = window->priv;
@ -178,7 +178,8 @@ gst_gl_window_new (DWORD_PTR external_gl_context)
goto failure; goto failure;
} }
g_debug ("gl window created: %lud\n", (gulong) priv->internal_win_id); g_debug ("gl window created: %" G_GUINTPTR_FORMAT "\n",
(guintptr) priv->internal_win_id);
//device is set in the window_proc //device is set in the window_proc
if (!priv->device) { if (!priv->device) {
@ -201,11 +202,11 @@ gst_gl_window_error_quark (void)
return g_quark_from_static_string ("gst-gl-window-error"); return g_quark_from_static_string ("gst-gl-window-error");
} }
gulong guintptr
gst_gl_window_get_internal_gl_context (GstGLWindow * window) gst_gl_window_get_internal_gl_context (GstGLWindow * window)
{ {
GstGLWindowPrivate *priv = window->priv; GstGLWindowPrivate *priv = window->priv;
return (gulong) priv->gl_context; return (guintptr) priv->gl_context;
} }
void void
@ -235,7 +236,7 @@ gst_gl_window_activate_gl_context (GstGLWindow * window, gboolean activate)
} }
void void
gst_gl_window_set_external_window_id (GstGLWindow * window, gulong id) gst_gl_window_set_external_window_id (GstGLWindow * window, guintptr id)
{ {
GstGLWindowPrivate *priv = window->priv; GstGLWindowPrivate *priv = window->priv;
@ -250,11 +251,11 @@ gst_gl_window_set_external_window_id (GstGLWindow * window, gulong id)
if (parent_id) { if (parent_id) {
WNDPROC parent_proc = GetProp (parent_id, "gl_window_parent_proc"); WNDPROC parent_proc = GetProp (parent_id, "gl_window_parent_proc");
g_debug ("release parent %lud\n", (gulong) parent_id); g_debug ("release parent %" G_GUINTPTR_FORMAT "\n", (guintptr) parent_id);
g_return_if_fail (parent_proc); g_return_if_fail (parent_proc);
SetWindowLongPtr (parent_id, GWL_WNDPROC, (LONG) parent_proc); SetWindowLongPtr (parent_id, GWLP_WNDPROC, (LONG_PTR) parent_proc);
SetParent (priv->internal_win_id, NULL); SetParent (priv->internal_win_id, NULL);
RemoveProp (parent_id, "gl_window_parent_proc"); RemoveProp (parent_id, "gl_window_parent_proc");
@ -263,15 +264,15 @@ gst_gl_window_set_external_window_id (GstGLWindow * window, gulong id)
//not 0 //not 0
if (id) { if (id) {
WNDPROC window_parent_proc = WNDPROC window_parent_proc =
(WNDPROC) GetWindowLongPtr ((HWND) id, GWL_WNDPROC); (WNDPROC) GetWindowLongPtr ((HWND) id, GWLP_WNDPROC);
RECT rect; RECT rect;
g_debug ("set parent %lud\n", (gulong) id); g_debug ("set parent %" G_GUINTPTR_FORMAT "\n", id);
SetProp (priv->internal_win_id, "gl_window_parent_id", (HWND) id); SetProp (priv->internal_win_id, "gl_window_parent_id", (HWND) id);
SetProp ((HWND) id, "gl_window_id", priv->internal_win_id); SetProp ((HWND) id, "gl_window_id", priv->internal_win_id);
SetProp ((HWND) id, "gl_window_parent_proc", (WNDPROC) window_parent_proc); SetProp ((HWND) id, "gl_window_parent_proc", (WNDPROC) window_parent_proc);
SetWindowLongPtr ((HWND) id, GWL_WNDPROC, (LONG_PTR) sub_class_proc); SetWindowLongPtr ((HWND) id, GWLP_WNDPROC, (LONG_PTR) sub_class_proc);
SetWindowLongPtr (priv->internal_win_id, GWL_STYLE, WS_CHILD | WS_MAXIMIZE); SetWindowLongPtr (priv->internal_win_id, GWL_STYLE, WS_CHILD | WS_MAXIMIZE);
SetParent (priv->internal_win_id, (HWND) id); SetParent (priv->internal_win_id, (HWND) id);
@ -474,23 +475,25 @@ window_proc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
gst_gl_window_set_pixel_format (window); gst_gl_window_set_pixel_format (window);
priv->gl_context = wglCreateContext (priv->device); priv->gl_context = wglCreateContext (priv->device);
if (priv->gl_context) if (priv->gl_context)
g_debug ("gl context created: %lud\n", (gulong) priv->gl_context); g_debug ("gl context created: %" G_GUINTPTR_FORMAT "\n",
(guintptr) priv->gl_context);
else else
g_debug ("failed to create glcontext %lud, %lud\n", (gulong) hWnd, g_debug ("failed to create glcontext %" G_GUINTPTR_FORMAT ", %lud\n",
GetLastError ()); (guintptr) hWnd, GetLastError ());
g_assert (priv->gl_context); g_assert (priv->gl_context);
ReleaseDC (hWnd, priv->device); ReleaseDC (hWnd, priv->device);
if (!wglMakeCurrent (priv->device, priv->gl_context)) if (!wglMakeCurrent (priv->device, priv->gl_context))
g_debug ("failed to make opengl context current %lud, %lud\n", g_debug ("failed to make opengl context current %" G_GUINTPTR_FORMAT
(gulong) hWnd, GetLastError ()); ", %lud\n", (guintptr) hWnd, GetLastError ());
if (priv->external_gl_context) { if (priv->external_gl_context) {
if (!wglShareLists (priv->external_gl_context, priv->gl_context)) if (!wglShareLists (priv->external_gl_context, priv->gl_context))
g_debug ("failed to share opengl context %lud with %lud\n", g_debug ("failed to share opengl context %" G_GUINTPTR_FORMAT
(gulong) priv->gl_context, (gulong) priv->external_gl_context); " with %" G_GUINTPTR_FORMAT "\n", (guintptr) priv->gl_context,
(guintptr) priv->external_gl_context);
else else
g_debug ("share opengl context succeed %lud\n", g_debug ("share opengl context succeed %" G_GUINTPTR_FORMAT "\n",
(gulong) priv->external_gl_context); (guintptr) priv->external_gl_context);
} }
} }
@ -566,7 +569,7 @@ window_proc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
g_assert (parent_proc); g_assert (parent_proc);
SetWindowLongPtr (parent_id, GWL_WNDPROC, (LONG) parent_proc); SetWindowLongPtr (parent_id, GWLP_WNDPROC, (LONG_PTR) parent_proc);
SetParent (hWnd, NULL); SetParent (hWnd, NULL);
RemoveProp (parent_id, "gl_window_parent_proc"); RemoveProp (parent_id, "gl_window_parent_proc");
@ -577,19 +580,19 @@ window_proc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
RemoveProp (hWnd, "gl_window"); RemoveProp (hWnd, "gl_window");
if (!wglMakeCurrent (NULL, NULL)) if (!wglMakeCurrent (NULL, NULL))
g_debug ("failed to make current %lud, %lud\n", (gulong) hWnd, g_debug ("failed to make current %" G_GUINTPTR_FORMAT ", %lud\n",
GetLastError ()); (guintptr) hWnd, GetLastError ());
if (priv->gl_context) { if (priv->gl_context) {
if (!wglDeleteContext (priv->gl_context)) if (!wglDeleteContext (priv->gl_context))
g_debug ("failed to destroy context %lud, %lud\n", g_debug ("failed to destroy context %" G_GUINTPTR_FORMAT ", %lud\n",
(gulong) priv->gl_context, GetLastError ()); (guintptr) priv->gl_context, GetLastError ());
} }
if (priv->internal_win_id) { if (priv->internal_win_id) {
if (!DestroyWindow (priv->internal_win_id)) if (!DestroyWindow (priv->internal_win_id))
g_debug ("failed to destroy window %lud, %lud\n", (gulong) hWnd, g_debug ("failed to destroy window %" G_GUINTPTR_FORMAT ", %lud\n",
GetLastError ()); (guintptr) hWnd, GetLastError ());
} }
PostQuitMessage (0); PostQuitMessage (0);