hust-marx / firebreath

Automatically exported from code.google.com/p/firebreath
0 stars 0 forks source link

ResizedEvent is not fired on Windows #105

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a new plugin (MyPlugin)
2. In MyPlugin.h, declare ResizedEvent:

    BEGIN_PLUGIN_EVENT_MAP()
    EVENTTYPE_CASE(FB::ResizedEvent, onResized, FB::PluginWindow)
    END_PLUGIN_EVENT_MAP()

    virtual bool onResized(FB::ResizedEvent *evt, FB::PluginWindow *);

3. Implement the handler in MyPlugin.cpp :

    bool MyPlugin::onResized(FB::ResizedEvent *evt, FB::PluginWindow* window)
{
    return false;
}

4. Put an breakpoint into the event handler and launch the debugguer.

The handler is never called.

My environment:
    FireBreath 1.3.0, Windows XP, Visual Studio 2008, IE7, Firefox3.6, Chrome7

----
ResizedEvent seems only referenced into Mac/PluginWindowMacQuickDraw.cpp

The WM_SIZE windows message should be handled into Win\PluginWindowWin.cpp
----
I have successfully overcome this issue implementing a custom class, 
PluginWindowWinCustom to override the CustomWinProc method.

Original issue reported on code.google.com by eloi.cha...@airbus.com on 10 Nov 2010 at 4:58

GoogleCodeExporter commented 9 years ago
To be honest, I don't think this has ever been implemented; you can, of course, 
create your own custom PluginWindow class. You could add this feature to 
PluginWindowWin, and submit a patch or put it in a clone so we can pull. You 
can also handle the WindowsEvent which will pass all windows events directly 
through so you can handle them however you want.

I can even throw it in real quick if you can give me an example of how to do 
it; I'm not a big UI guy, so I don't know how to handle the event properly.  
That's the main reason it hasn't been implemented yet =]

Original comment by taxilian on 10 Nov 2010 at 5:05

GoogleCodeExporter commented 9 years ago
Thanks you for the quick reply. I figure out now how to use WindowsEvent.

For the "patch", just append the following case into the switch into 
PluginWindowWin::WinProc(...) (file src\PluginWindow\Win\PluginWindowWin.cpp):

   case WM_SIZE:
   {
      ResizedEvent ev;
      return SendEvent(&ev);
   }

Original comment by eloi.cha...@airbus.com on 10 Nov 2010 at 5:45

GoogleCodeExporter commented 9 years ago
Hmm.  I had forgotten that we don't pass the new size as part of the event; I 
guess the theory is that you get the size from the PluginWindow. If you want to 
contribute a bit more, it'd be nice to have a function on PluginWindowWin that 
would return the new size of the HWND =]

I'll get resizedevent into trunk today; it'll be in the nightly build tomorrow 
and it will be in 1.3.1 when we release that (probably soon, just waiting to 
see if there are any issues with the bugfixes I put in yesterday)

Original comment by taxilian on 10 Nov 2010 at 6:25

GoogleCodeExporter commented 9 years ago

Original comment by taxilian on 19 Nov 2010 at 8:27