summaryrefslogtreecommitdiffstats
Side-by-side diff
-rw-r--r--src/plugin/plugin.c40
1 files changed, 31 insertions, 9 deletions
diff --git a/src/plugin/plugin.c b/src/plugin/plugin.c
index 300e2f3..ac8db93 100644
--- a/src/plugin/plugin.c
+++ b/src/plugin/plugin.c
@@ -1,13 +1,16 @@
#include "plugin.h"
+#include "../view/view.h"
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
+#include <pthread.h>
+#include <GL/glut.h>
/*
* This code is based on the Basic Plugin Example from Mozilla on-line
* at
- * http://mxr.mozilla.org/mozilla-central/source/modules/plugin/sdk/samples/basic/unix/BasicPlugin.c.
+ * http://mxr.mozilla.org/mozilla-central/source/modules/plugin/sdk/samples/basic/unix/BasicPlugin.c
*/
#define PLUGIN_NAME "Influenza Sequence Mapping Project Visualization Tool"
@@ -22,6 +25,15 @@ typedef struct InstanceData
NPWindow window;
} InstanceData;
+static void*
+tool_thread (void *threadid)
+{
+ view ();
+ glutMainLoop ();
+
+ return (void*) 0;
+}
+
static void
fillPluginFunctionTable (NPPluginFuncs* pFuncs)
{
@@ -44,9 +56,14 @@ fillPluginFunctionTable (NPPluginFuncs* pFuncs)
return;
}
-NP_EXPORT(NPError)
+NPError
NP_Initialize(NPNetscapeFuncs* bFuncs, NPPluginFuncs* pFuncs)
{
+ int argc = 1;
+ char *argv[] = {"MyApp", NULL};
+ glutInit (&argc, argv);
+ glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
+
sBrowserFuncs = bFuncs;
fillPluginFunctionTable(pFuncs);
@@ -54,19 +71,19 @@ NP_Initialize(NPNetscapeFuncs* bFuncs, NPPluginFuncs* pFuncs)
return NPERR_NO_ERROR;
}
-NP_EXPORT(char*)
+char*
NP_GetPluginVersion()
{
return PLUGIN_VERSION;
}
-NP_EXPORT(char*)
+char*
NP_GetMIMEDescription()
{
- return "application/x-flumap::Visualization Tool";
+ return "application/x-donpellegrino-flumap::Visualization Tool";
}
-NP_EXPORT(NPError)
+NPError
NP_GetValue(void* future, NPPVariable aVariable, void* aValue)
{
switch (aVariable)
@@ -85,7 +102,7 @@ NP_GetValue(void* future, NPPVariable aVariable, void* aValue)
return NPERR_NO_ERROR;
}
-NP_EXPORT(NPError)
+NPError
NP_Shutdown()
{
return NPERR_NO_ERROR;
@@ -111,6 +128,13 @@ NPP_New(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char*
memset(instanceData, 0, sizeof(InstanceData));
instanceData->npp = instance;
instance->pdata = instanceData;
+
+ pthread_t threads;
+ static long tid = 0;
+ tid++;
+ pthread_create (&threads, NULL,
+ tool_thread,
+ (void*)tid);
return NPERR_NO_ERROR;
}
@@ -175,8 +199,6 @@ NPP_HandleEvent(NPP instance, void* event)
// if (nativeEvent->type != GraphicsExpose)
//return 0;
- printf ("In NPP_HandleEvent for the plugin.\n");
-
return 1;
}

Valid XHTML 1.0 Strict

Copyright © 2009 Don Pellegrino All Rights Reserved.