* vlcshell.cpp: a VLC plugin for Mozilla
*****************************************************************************
* Copyright (C) 2002 VideoLAN
- * $Id: vlcshell.cpp,v 1.25 2003/10/15 07:34:25 gbazin Exp $
+ * $Id: vlcshell.cpp,v 1.29 2004/01/25 17:52:17 gbazin Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
/*****************************************************************************
* Preamble
*****************************************************************************/
+#include "config.h"
+
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#endif
/* Mozilla stuff */
+#ifdef HAVE_MOZILLA_CONFIG_H
+# include <mozilla-config.h>
+#endif
#include <nsISupports.h>
#include <nsMemory.h>
#include <npapi.h>
+#include <jri.h>
+
+#if !defined(XP_MACOSX) && !defined(XP_UNIX) && !defined(XP_WIN)
+#define XP_UNIX 1
+#elif defined(XP_MACOSX)
+#undef XP_UNIX
+#endif
#ifdef XP_WIN
/* Windows stuff */
# include <Quickdraw.h>
#endif
+#ifdef XP_UNIX
+ /* X11 stuff */
+# include <X11/Xlib.h>
+# include <X11/Intrinsic.h>
+# include <X11/StringDefs.h>
+#endif
+
#include "vlcpeer.h"
#include "vlcplugin.h"
# define WINDOW_TEXT "(no libvlc)"
#endif
-/* No, I really don't want to use XP_UNIX stuff on MacOSX */
-#ifdef XP_MACOSX
-#undef XP_UNIX
-#endif
-
-#ifdef XP_UNIX
- /* X11 stuff */
-# include <X11/Xlib.h>
-# include <X11/Intrinsic.h>
-# include <X11/StringDefs.h>
-#endif
-
/*****************************************************************************
* Unix-only declarations
******************************************************************************/
# define VOUT_PLUGINS "directx,wingdi,dummy"
# define AOUT_PLUGINS "directx,waveout,dummy"
-HINSTANCE g_hDllInstance = NULL;
-
-BOOL WINAPI DllMain( HINSTANCE hinstDLL, /* handle of DLL module */
- DWORD fdwReason, /* reason for calling the function */
- LPVOID lpvReserved )
-{
- switch( fdwReason )
- {
- case DLL_PROCESS_ATTACH:
- g_hDllInstance = hinstDLL;
- break;
- case DLL_THREAD_ATTACH:
- case DLL_PROCESS_DETACH:
- case DLL_THREAD_DETACH:
- break;
- }
- return TRUE;
-}
-
+#if defined(XP_WIN) && !USE_LIBVLC
LRESULT CALLBACK Manage( HWND, UINT, WPARAM, LPARAM );
#endif
+#endif
/******************************************************************************
* UNIX-only API calls
/* Window was destroyed. Invalidate everything. */
if( p_plugin->p_npwin )
{
+#if !USE_LIBVLC
SetWindowLong( p_plugin->p_hwnd, GWL_WNDPROC,
(LONG)p_plugin->pf_wndproc );
+#endif
p_plugin->pf_wndproc = NULL;
p_plugin->p_hwnd = NULL;
}
{
/* Same window, but something may have changed. First we
* update the plugin structure, then we redraw the window */
- InvalidateRect( p_plugin->p_hwnd, NULL, TRUE );
p_plugin->i_width = window->width;
p_plugin->i_height = window->height;
p_plugin->p_npwin = window;
+#if !USE_LIBVLC
+ InvalidateRect( p_plugin->p_hwnd, NULL, TRUE );
UpdateWindow( p_plugin->p_hwnd );
+#endif
return NPERR_NO_ERROR;
}
/* Window has changed. Destroy the one we have, and go
* on as if it was a real initialization. */
+#if !USE_LIBVLC
SetWindowLong( p_plugin->p_hwnd, GWL_WNDPROC,
(LONG)p_plugin->pf_wndproc );
+#endif
p_plugin->pf_wndproc = NULL;
p_plugin->p_hwnd = NULL;
}
+#if !USE_LIBVLC
p_plugin->pf_wndproc = (WNDPROC)SetWindowLong( (HWND)window->window,
GWL_WNDPROC, (LONG)Manage );
+#endif
+
p_plugin->p_hwnd = (HWND)window->window;
SetProp( p_plugin->p_hwnd, "w00t", (HANDLE)p_plugin );
InvalidateRect( p_plugin->p_hwnd, NULL, TRUE );
/******************************************************************************
* Windows-only methods
*****************************************************************************/
-#ifdef XP_WIN
+#if defined(XP_WIN) && !USE_LIBVLC
LRESULT CALLBACK Manage( HWND p_hwnd, UINT i_msg, WPARAM wpar, LPARAM lpar )
{
VlcPlugin* p_plugin = (VlcPlugin*) GetProp( p_hwnd, "w00t" );
switch( i_msg )
{
-#if !USE_LIBVLC
case WM_PAINT:
{
PAINTSTRUCT paintstruct;
EndPaint( p_hwnd, &paintstruct );
break;
}
-#endif
default:
p_plugin->pf_wndproc( p_hwnd, i_msg, wpar, lpar );
break;