SFML community forums

General => General discussions => Topic started by: cg_sanz on March 21, 2010, 10:51:43 pm

Title: SFML Firefox Plugin like Flash Plugin
Post by: cg_sanz on March 21, 2010, 10:51:43 pm
Hi,

I'm trying to create a GPL plugin for firefox like the flash plugin to run my games on a firefox browser.
But when I run the browser with my sample, it crash and close the browser.

I'm trying to hook into the window such that
sf:: Window SFMLView1 (GDK_DRAWABLE_XID (GdkWindow));

And only with this line, crash

Paste all the function code

Code: [Select]
int16_t
NPP_HandleEvent(NPP instance, void* event) {
  InstanceData *instanceData = (InstanceData*)(instance->pdata);
  XEvent *nativeEvent = (XEvent*)event;

  if (nativeEvent->type != GraphicsExpose)
    return 0;

  XGraphicsExposeEvent *expose = &nativeEvent->xgraphicsexpose;
  instanceData->window.window = (void*)(expose->drawable);

  GdkNativeWindow nativeWinId = (XID)(instanceData->window.window);
  GdkDrawable* gdkWindow = GDK_DRAWABLE(gdk_window_foreign_new(nativeWinId));  
  drawWindow(instanceData, gdkWindow);
g_object_unref(gdkWindow);

sf::RenderWindow App(sf::VideoMode(800, 600), "SFML window");
}


What am I doing wrong? it's possible what I'm trying?

Thanks
Title: SFML Firefox Plugin like Flash Plugin
Post by: T.T.H. on March 23, 2010, 10:15:56 am
1. I can't help you as I don't have experience with Firefox plugins.
2. Such a plugin would totally rock, thought about making one myself.
3. List of eventually helpful links:

http://code.google.com/p/firebreath/
Python script based generation of C++ based plugins for Firefox and IE on Windows, including VS2008 project file generation, plenty repository activity in 2010

http://code.google.com/p/nixysa/
Python script based generation of C++ based plugins for Firefox/NPAPI, used for Google's O3D

http://www.codeproject.com/KB/openGL/FirefoxOpenGL.aspx
An OpenGL Sample as Firefox Plugin - CodeProject (Sept. 2007)

http://colonelpanic.net/2009/03/building-a-firefox-plugin-part-one/
series of blog posts about Firefox plugin coding, probably from one of the Firebreath coders

http://mxr.mozilla.org/seamonkey/source/modules/plugin/tools/sdk/
Some Mozilla Plugin SDK repository with quite old plugin code for Firefox but including windowless plugin
Title: SFML Firefox Plugin like Flash Plugin
Post by: nulloid on November 02, 2010, 02:02:31 pm
Are there any progression, or you gave up the idea? Cause probably I will need it :)
Title: SFML Firefox Plugin like Flash Plugin
Post by: Canadadry on November 02, 2010, 02:14:14 pm
Quote from: "nulloid"
I will need it :)


What kind of thing you can do with that? I mean thing cannot already do.
Title: SFML Firefox Plugin like Flash Plugin
Post by: nulloid on November 06, 2010, 07:12:44 am
To let the user play a game through a browser?
Btw, i thought about my idea, and it will probably be better to learn flash instead. I want to make a game, and make a standalone and a browser client for it.
Title: SFML Firefox Plugin like Flash Plugin
Post by: nfries88 on November 07, 2010, 03:43:26 pm
Quote from: "nulloid"
To let the user play a game through a browser?
Btw, i thought about my idea, and it will probably be better to learn flash instead. I want to make a game, and make a standalone and a browser client for it.


This would work if you fix it, and save you a ton of effort in the long run. If you released it into the wild, it'd also help other SFML users with similar goals.
Title: SFML Firefox Plugin like Flash Plugin
Post by: nulloid on November 07, 2010, 06:02:05 pm
I'd really like to, but I'm working on another project simultaneously with this. But if I'm done with my game, probably I will have enough time to investigate how to fix this.