--- examples/simple/Source/_gen/Simple.h.orig Wed Jan 7 19:44:27 1998 +++ examples/simple/Source/_gen/Simple.h Wed Jan 7 20:35:55 1998 @@ -1,5 +1,5 @@ /* DO NOT EDIT THIS FILE - it is machine generated */ -#include "jri.h" +#include /* Header for class Simple */ --- examples/simple/Source/_gen/netscape_plugin_Plugin.h.orig Wed Jan 7 19:44:27 1998 +++ examples/simple/Source/_gen/netscape_plugin_Plugin.h Wed Jan 7 20:36:43 1998 @@ -1,5 +1,5 @@ /* DO NOT EDIT THIS FILE - it is machine generated */ -#include "jri.h" +#include /* Header for class netscape/plugin/Plugin */ --- examples/simple/Source/_stubs/Simple.c.orig Wed Jan 7 19:44:27 1998 +++ examples/simple/Source/_stubs/Simple.c Wed Jan 7 20:38:13 1998 @@ -1,5 +1,5 @@ /* DO NOT EDIT THIS FILE - it is machine generated */ -#include "jri.h" +#include /* Stubs for class Simple */ --- examples/simple/Source/_stubs/netscape_plugin_Plugin.c.orig Wed Jan 7 19:44:27 1998 +++ examples/simple/Source/_stubs/netscape_plugin_Plugin.c Wed Jan 7 20:38:52 1998 @@ -1,5 +1,5 @@ /* DO NOT EDIT THIS FILE - it is machine generated */ -#include "jri.h" +#include /* Stubs for class netscape/plugin/Plugin */ --- examples/simple/Source/npsimple.c.orig Wed Jan 7 19:44:27 1998 +++ examples/simple/Source/npsimple.c Wed Jan 7 20:33:24 1998 @@ -25,7 +25,7 @@ #include #include -#include "npapi.h" +#include /* ** Define IMPLEMENT_Simple before including Simple.h to state that we're @@ -33,21 +33,14 @@ ** need to access it's protected and private memebers. */ #define IMPLEMENT_Simple -#include "Simple.h" - -/* Windows Includes */ -#ifdef _WINDOWS -#include -#endif /* _WINDOWS */ +#include "Simple.h" /* ** Stuff for the NPP_SetWindow method: */ -#ifdef XP_UNIX #include #include #include -#endif /* XP_UNIX */ /******************************************************************************* * Instance state information about the plugin. @@ -62,58 +55,25 @@ NPWindow* fWindow; uint16 fMode; -/* Windows data members */ -#ifdef _WINDOWS - HWND fhWnd; - WNDPROC fDefaultWindowProc; -#endif /* _WINDOWS */ - /* UNIX data members */ -#ifdef XP_UNIX Window window; Display *display; uint32 x, y; uint32 width, height; -#endif /* XP_UNIX */ } PluginInstance; void DisplayJavaMessage(NPP instance, char* msg, int len); /******************************************************************************* - * Windows-only declarations - ******************************************************************************/ - -#ifdef _WINDOWS -LRESULT CALLBACK PluginWindowProc( HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam); -const char* gInstanceLookupString = "instance->pdata"; -#endif - -/******************************************************************************* - * Mac-only declarations - ******************************************************************************/ - -#ifdef macintosh -NPBool StartDraw(NPWindow* window); -void EndDraw(NPWindow* window); -void DoDraw(PluginInstance* This); -CGrafPort gSavePort; -CGrafPtr gOldPort; -#endif - -/******************************************************************************* * Unix-only declarations ******************************************************************************/ -#ifdef XP_UNIX void Redraw(Widget w, XtPointer closure, XEvent *event); -#endif /* XP_UNIX */ /******************************************************************************* * UNIX-only API calls ******************************************************************************/ -#ifdef XP_UNIX - char* NPP_GetMIMEDescription(void) { @@ -136,7 +96,6 @@ return err; } -#endif /* XP_UNIX */ /******************************************************************************* * General Plug-in Calls @@ -269,14 +228,7 @@ /* mode is NP_EMBED, NP_FULL, or NP_BACKGROUND (see npapi.h) */ This->fWindow = NULL; This->fMode = mode; - -#ifdef XP_UNIX This->window = 0; -#endif /* XP_UNIX */ -#ifdef _WINDOWS - This->fhWnd = NULL; - This->fDefaultWindowProc = NULL; -#endif /* _WIDOWS */ /* PLUGIN DEVELOPERS: * Initialize fields of your plugin @@ -358,7 +310,6 @@ * size changes, etc. */ -#ifdef XP_UNIX { Widget netscape_widget; @@ -373,59 +324,6 @@ XtAddEventHandler(netscape_widget, ExposureMask, FALSE, (XtEventHandler)Redraw, This); Redraw(netscape_widget, (XtPointer)This, NULL); } -#endif /* XP_UNIX */ -#ifdef _WINDOWS - { - if( This->fWindow != NULL ) // If we already have a window, clean - // it up before trying to subclass - // the new window. - { - if( (window == NULL) || ( window->window == NULL ) ) { - // There is now no window to use. get rid of the old - // one and exit. - SetWindowLong( This->fhWnd, GWL_WNDPROC, (LONG)This->fDefaultWindowProc); - This->fDefaultWindowProc = NULL; - This->fhWnd = NULL; - return NPERR_NO_ERROR; - } - - else if ( This->fWindow->window == window->window ) { - // The new window is the same as the old one. Exit now. - return NPERR_NO_ERROR; - } - else { - // Clean up the old window, so that we can subclass the new - // one later. - SetWindowLong( This->fhWnd, GWL_WNDPROC, (LONG)This->fDefaultWindowProc); - This->fDefaultWindowProc = NULL; - This->fhWnd = NULL; - } - } - else if( (window == NULL) || ( window->window == NULL ) ) { - // We can just get out of here if there is no current - // window and there is no new window to use. - return NPERR_NO_ERROR; - } - - // At this point, we will subclass - // window->window so that we can begin drawing and - // receiving window messages. - This->fDefaultWindowProc = (WNDPROC)SetWindowLong( (HWND)window->window, GWL_WNDPROC, (LONG)PluginWindowProc); - This->fhWnd = (HWND) window->window; - SetProp( This->fhWnd, gInstanceLookupString, (HANDLE)This); - - InvalidateRect( This->fhWnd, NULL, TRUE ); - UpdateWindow( This->fhWnd ); - } -#endif /* _WINDOWS */ - -#ifdef macintosh - This->fWindow = window; - if( StartDraw( window ) ) { - DoDraw(This); - EndDraw( window ); - } -#endif /* macintosh */ This->fWindow = window; return result; @@ -626,52 +524,10 @@ // return TRUE if you handle the event and FALSE if you ignore the event. ******************************************************************************/ -#ifndef XP_UNIX - -int16 -NPP_HandleEvent(NPP instance, void* event) -{ - int16 eventHandled = FALSE; - -#ifdef macintosh - PluginInstance* This = (PluginInstance*) instance->pdata; - EventRecord* ev = (EventRecord*) event; - - if (instance == NULL) - return eventHandled; - - if (This != NULL && event != NULL) - { - switch (ev->what) - { - // - // Draw ourselves on update events - // - case updateEvt: - if( StartDraw( This->fWindow ) ) { - DoDraw(This); - EndDraw( This->fWindow ); - } - eventHandled = true; - break; - - default: - break; - } - - } -#endif /* macintosh */ - - return eventHandled; -} - -#endif /* ndef XP_UNIX */ - /******************************************************************************* * UNIX-only methods ******************************************************************************/ -#ifdef XP_UNIX void Redraw(Widget w, XtPointer closure, XEvent *event) { @@ -690,116 +546,5 @@ This->width/2 - 100, This->height/2, text, strlen(text)); } -#endif /* XP_UNIX */ - -/******************************************************************************* - * Windows-only methods - ******************************************************************************/ - -#ifdef _WINDOWS -LRESULT CALLBACK PluginWindowProc( HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) -{ - PluginInstance* This = (PluginInstance*) GetProp(hWnd, gInstanceLookupString); - - switch( Msg ) { - case WM_PAINT: - { - PAINTSTRUCT paintStruct; - HDC hdc; - - hdc = BeginPaint( hWnd, &paintStruct ); - TextOut(hdc, 0, 0, "Hello, World!", 15); - - EndPaint( hWnd, &paintStruct ); - break; - } - default: - { - This->fDefaultWindowProc( hWnd, Msg, wParam, lParam); - } - } - return 0; -} -#endif /* _WINDOWS */ - -/******************************************************************************* - * Mac-only methods - ******************************************************************************/ - -#ifdef macintosh - -NPBool -StartDraw(NPWindow* window) -{ - NP_Port* port; - Rect clipRect; - RGBColor col; - - if (window == NULL) - return FALSE; - port = (NP_Port*) window->window; - if (window->clipRect.left < window->clipRect.right) - { - // Preserve the old port - GetPort((GrafPtr*)&gOldPort); - SetPort((GrafPtr)port->port); - // Preserve the old drawing environment - gSavePort.portRect = port->port->portRect; - gSavePort.txFont = port->port->txFont; - gSavePort.txFace = port->port->txFace; - gSavePort.txMode = port->port->txMode; - gSavePort.rgbFgColor = port->port->rgbFgColor; - gSavePort.rgbBkColor = port->port->rgbBkColor; - GetClip(gSavePort.clipRgn); - // Setup our drawing environment - clipRect.top = window->clipRect.top + port->porty; - clipRect.left = window->clipRect.left + port->portx; - clipRect.bottom = window->clipRect.bottom + port->porty; - clipRect.right = window->clipRect.right + port->portx; - SetOrigin(port->portx,port->porty); - ClipRect(&clipRect); - clipRect.top = clipRect.left = 0; - TextSize(12); - TextFont(geneva); - TextMode(srcCopy); - col.red = col.green = col.blue = 0; - RGBForeColor(&col); - col.red = col.green = col.blue = 65000; - RGBBackColor(&col); - return TRUE; - } - else - return FALSE; -} - -void -EndDraw(NPWindow* window) -{ - CGrafPtr myPort; - NP_Port* port = (NP_Port*) window->window; - SetOrigin(gSavePort.portRect.left, gSavePort.portRect.top); - SetClip(gSavePort.clipRgn); - GetPort((GrafPtr*)&myPort); - myPort->txFont = gSavePort.txFont; - myPort->txFace = gSavePort.txFace; - myPort->txMode = gSavePort.txMode; - RGBForeColor(&gSavePort.rgbFgColor); - RGBBackColor(&gSavePort.rgbBkColor); - SetPort((GrafPtr)gOldPort); -} - -void -DoDraw(PluginInstance* This) -{ - Rect drawRect; - drawRect.top = 0; - drawRect.left = 0; - drawRect.bottom = drawRect.top + This->fWindow->height; - drawRect.right = drawRect.left + This->fWindow->width; - EraseRect( &drawRect ); - MoveTo( 2, 12 ); - DrawString("\pHello, World!"); -} -#endif /* macintosh */ /******************************************************************************/ --- examples/simple/Source/stubs.c.orig Wed Jan 7 19:44:27 1998 +++ examples/simple/Source/stubs.c Wed Jan 7 20:28:30 1998 @@ -9,9 +9,7 @@ ** doing it here to avoid some fancy make rules. First pull in the common ** glue code: */ -#ifdef XP_UNIX -#include "../../../common/npunix.c" -#endif +#include /* ** Next, define IMPLEMENT_Simple in order to pull the stub code in when @@ -27,10 +25,5 @@ ** take advantage of the diagnostic code that javah creates for ** you. Otherwise your life will be hell. */ -#ifdef XP_UNIX #include "_stubs/Simple.c" #include "_stubs/netscape_plugin_Plugin.c" -#else -#include "Simple.c" -#include "netscape_plugin_Plugin.c" -#endif --- examples/UnixTemplate/Source/UnixShell.c.orig Wed Jan 7 19:44:28 1998 +++ examples/UnixTemplate/Source/UnixShell.c Wed Jan 7 19:53:19 1998 @@ -19,7 +19,7 @@ */ #include -#include "npapi.h" +#include /*********************************************************************** * Instance state information about the plugin. --- examples/UnixTemplate/Source/stubs.c.orig Wed Jan 7 19:44:28 1998 +++ examples/UnixTemplate/Source/stubs.c Wed Jan 7 19:54:50 1998 @@ -9,6 +9,4 @@ ** doing it here to avoid some fancy make rules. First pull in the common ** glue code: */ -#ifdef XP_UNIX -#include "../../../common/npunix.c" -#endif +#include --- examples/simple/Unix/Makefile.orig Wed Jan 7 19:44:27 1998 +++ examples/simple/Unix/Makefile Wed Jan 7 20:50:57 1998 @@ -27,7 +27,7 @@ # # PLUGIN_DEFINES= -DXP_UNIX -DPLUGIN_TRACE -PLUGIN_DEFINES= -DXP_UNIX -I../../../include -I../Source/_gen +PLUGIN_DEFINES= -I/usr/local/include -I../Source/_gen RM= /bin/rm CC= gcc --- examples/UnixTemplate/Unix/Makefile.orig Wed Jan 7 19:44:28 1998 +++ examples/UnixTemplate/Unix/Makefile Wed Jan 7 20:48:58 1998 @@ -27,7 +27,7 @@ # # PLUGIN_DEFINES= -DXP_UNIX -DPLUGIN_TRACE -PLUGIN_DEFINES= -DXP_UNIX -I../../../include -I../Source/_gen +PLUGIN_DEFINES= -I/usr/local/include -I../Source/_gen RM= /bin/rm CC= gcc