divyang4481 / firebreath

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

need convenient access to handle in AttachedEvent #20

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
FB::AttachedEvent should provide easier access to the native window handle, 
e.g. something like:

class AttachedEvent
{
public:
#ifdef WINDOWS
     typedef NativeWindowHandle HWND;
#elif
     /* ... */
#endif

     NativeWindowHandle getNativeWindowHandle() const;
};

Original issue reported on code.google.com by georg.fritzsche on 28 Dec 2009 at 10:00

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
I want to avoid having anything platform specific in that event, even using 
#ifdef. 
How about something like:

event->getWindow<FB::PluginWindowWin>()->getHWND();

AttachedEvent could just have a reference to the PluginWindow, and getWindow 
could be
a template function that does a dynamic cast, throws an exception if you try to 
get
an invalid type, etc.

Similarly, on Mac we could use 
event->getWindow<FB::PluginWindowMac>()->getPort() or
whatnot.

Original comment by taxilian on 28 Dec 2009 at 2:40

GoogleCodeExporter commented 8 years ago
Hm, would be an alternative... but makes the user type more and requires 
remembering 
more.

Personally i currently only care about the native window handle in the attached 
event 
and would expect that for other people too - thus i thought direct access to 
the 
native window handle would save some pain. 

Original comment by georg.fritzsche on 29 Dec 2009 at 10:34

GoogleCodeExporter commented 8 years ago
My concern with just doing the window handle is that I would like (as much as
possible) to keep things the same across platforms. When we get to Mac, there 
is more
than just a handle that needs to be passed.  Linux has even more to it than the 
mac does.

Thus I was thinking that the PluginWindow object can be dereferenced into the OS
specific component in the OS specific code and you can use it to get whatever OS
specific stuff you need.

However, if you have a better idea, I'm open to negotiation

Original comment by taxilian on 29 Dec 2009 at 4:48

GoogleCodeExporter commented 8 years ago
Well, after testing it out in the example plugin i am taking a step back and 
would 
propose to add this to FB::AttachedEvent:
FB::PluginWindow* getWindow();

Although it would be convenient to store window handle in a portable way (i.e. 
don't 
care yet what it is, only platform specific drawing code etc. will care) its 
probably 
not that important.

Original comment by georg.fritzsche on 29 Dec 2009 at 5:03

GoogleCodeExporter commented 8 years ago

Original comment by georg.fritzsche on 13 Jan 2010 at 1:09