IRC Log Viewer » #firebreath » 2011-04-22

IRC Nick Time (GMT-7) Message
gray 02:04 anybody
Andrew10111989 06:04 hi
taxilian 11:04 quiet in here lately… guess that means everything works? =]
kylehuff 11:04 sadly, I have not had time to even try out the latest changes...
taxilian 11:04 I am hereby mortally offended and will now hold a grudge forever. ;-)
yeah, I know how busy goes.
jshanab_wcw 11:04 If i want to load an image from disk to display in my plugin when, for example, a camera becomes disconnected, I assume i put it in the install directory of the plugin, but are there other tricks? i am using GDI+ load from file and it just fails silently (but thinks it succeds)
kylehuff 11:04 I had to just release my extension 'as-is' and wait for someone to report something broken since I couldn't dedicate chunks of time to it anymore. I hope to have some more time soon to update the plugin with a recent version of FB
taxilian 11:04 jshanab_wcw: AFAIK, that's as good a method as any; you could compile it into your DLL, if you wanted, but that seems silly
I guess it would make it harder for someone to replace the image
kylehuff: anyone seem to be using it?
kylehuff 11:04 taxilian: according to the google webstore it has ~34 installs a week if I am reading this right; but I honestly couldn't you tell you what the hell they are using it for... I don't know of a single site that supports it... lol
taxilian 11:04 lol
kylehuff 11:04 I have a guy who wants to use the NPAPI plugin as a generic API to gnupg to replace the now defunct FireGPG
jshanab_wcw 11:04 Thanks taxilian. I just can't seem to get it to work. :-(
taxilian 11:04 where are you installing it, and does it not work for any browsers or just only some?
jshanab_wcw 11:04 c:/program data/windy city wire, where my dll's are installed. Maybe I have to put it in the wix so the manifest knows about it?
taxilian 11:04 that shouldn't matter as long as they are in place
but you could potentially have a permissions issue
you are registering it machine-wide?
jshanab_wcw 11:04 Uh, I think so
taxilian 11:04 if you aren't, you either need to be or you need to not install in program files
you know your installer requires UAC elevation, right?
and/or administrator access?
jshanab_wcw 11:04 yeah, i think I am good with that. It must be something with the GDI+ Image::FromFile. It returns a pointer tot he Image object, but the members are nativeImage popinter is null and the "lastState" = out of memory and the load state is S_ok ; which is a bit confusing
taxilian 11:04 !findfile src/PluginConfig.cmake
FireBreathBot 11:04 Found 1 matching file(s) in the master branch. First 1 are:
taxilian 11:04 make sure you have FB_ATLREG_MACHINEWIDE set to 1 (
that's not related to your image problem, but it will cause problems if you don't and you're installing to program files
EL45 11:04 I am trying to pass m_host (the BrowserHostPtr) to another class in my plugin. Currently I receive an assertion error when I close the browser. Do I need to use a shared_ptr? If so, can someone please show me an example of how I would do this? I can;t seem to get it right.
taxilian 11:04 EL45: how are you passing it?
EL45 11:04 setting a global variable :-/ Probably not recommended
ie: BluetoothAPI BT; BT.m_host = m_host;
taxilian 11:04 EL45: never, ever, ever use global variables unless you absolutely know what you're doing
you can pass a BrowserHostPtr (which is a shared_ptr) as long as the object you pass it to gets destroyed before your plugin instances does
EL45 11:04 The problem that I am facing is that I need to be able to make a js call that has access to a bluetooth socket already created. Can't figure out a way to do this without using a global variable.
jshanab_wcw 11:04 I put in an absolute path and I can get the image fine. :-/
taxilian 11:04 EL45: if you have a global object, make sure you're cleaning it up in StaticDeinitialize and setting it up in StaticInitialize
you can't store a browserhost in that object
but when you call something you could pass in a browserhost for the duration of the call
browserhost objects are linked to a plugin instance (object tag instance), so when the obj tag goes away the host needs to as well
EL45 12:04 Ok. I think that make sense
Thank you.
taxilian 12:04 yw
starakaj 12:04 hey all
easy question:
how do I get from a windowattached event to the NP_CGContextRef I need to start an opengl context?
taxilian 12:04 you can't use the CGContextRef except during the draw event
starakaj 12:04 merde
taxilian 12:04 I guess it might be possible if you're only supporting Carbon...
starakaj 12:04 well, I don't want to do anything with it, I just want to make an opengl context
taxilian 12:04 why do you need the CGContextRef to create an offscreen opengl context?
starakaj 12:04 I don't, I don't think
taxilian 12:04 that was an easy problem to solve =]
starakaj 12:04 I call aglCreateContext
jshanab_wcw 12:04 I was using SFML I am moving away from it because of a focus bug but it gave me an opengl Context easily. Maybe that would help?
starakaj 12:04 and then set th window reference to be the window that gets passed to me by NPP_Set_Window or whatever
taxilian 12:04 right; that only works in Carbon; so you could probably get away with that for now, but it'll be a problem whenever you finally need to support cocoa, which will not be too far in the future, I suspect
64 bit browsers don't support carbon, for example
in 64 bit mode
starakaj 12:04 oh dip
taxilian 12:04 but again: why do you need the CGContext to create an ogl context?
you can only draw to the screen on a draw event, and you have it there
starakaj 12:04 well wait, hold on
carbon != core graphics, right?
!= in this case meaning "is a separate entity"
taxilian 12:04 right
starakaj 12:04 okay, well I'm pretty sure we're exclusively using core graphics
taxilian 12:04 right
but core graphics you are not supposed to draw to the context except during a draw event; Carbon you get the context early, but should not use it, Cocoa you don't get it until the event fires
starakaj 12:04 so we're using a carbon-only technique to setup core graphics, a carbon-free entity
taxilian 12:04 no coregraphics works with both carbon and cocoa
you're just using a deprecated method
but again; why do you need it that early?
starakaj 12:04 sorry, I guess I don't
taxilian 12:04 so no problem
starakaj 12:04 what's the name of the event I should be waiting for?
taxilian 12:04 CoreGraphicsDraw
and the type of the event source is PluginWindowMacCG
!find BasicMediaPlayerMac
FireBreathBot 12:04 Could not find any tags matching BasicMediaPlayerMac
taxilian 12:04 !findfile BasicMediaPlayerMac
starakaj 12:04 "MacEventCocoaDraw" ?
taxilian 12:04 no; CoreGraphicsDraw
!find CoreGraphicsDraw
FireBreathBot 12:04 Found 2 possible matches. Displaying 2
/^ CoreGraphicsDraw(CGContextRef context, const FB::Rect& bounds, const FB::Rect& clip) $/ (f) found in src/PluginCore/PluginEvents/DrawingEvents.h:
/^ class CoreGraphicsDraw : public RefreshEvent$/ (c) found in src/PluginCore/PluginEvents/DrawingEvents.h:
starakaj 12:04 cool, and excuse my complete ignorance here
taxilian 12:04 =]
this stuff is actually new as of 1.5
it used to work differently
s/differently/not as well/
starakaj 12:04 but then how do I do opengl drawing when I'm given that PluginWindowMacCG?
taxilian 12:04 I don't know; how were you drawing before?
CG doesn't support OGL directly
starakaj 12:04 merde encore
taxilian 12:04 most people who use CG to draw w/ OGL draw OGL offscreen and then blit
starakaj 12:04 hmm
1 sec, let me take a look at this code
so it looks like at NPP_SetWindow
we create an agl context
then set the agl window reference to the NP_Window
which has a NP_CGContext*
then when we're told to draw we just render to that opengl context
that's it
taxilian 12:04 great; but AGL does not know anything about NP_CGContext so there must be something else going on
that does the actual drawing to the CGContext
starakaj 12:04 hmm
taxilian 12:04 NP_CGContext as well as NPWindow are both npapi types
starakaj 12:04 sorry, of course
I misread it
the specific call is aglSetWindowRef(ctx, ((NP_CGContext*)window.window)->window)
is there any reason that I can just do exactly what I'm doing now, but when I get the call from window attached rather than NPP_SetWindow?
stuartmorgan 12:04 starakaj: what you are trying to do is a bad idea; don't do it
starakaj 12:04 ah
stuartmorgan 12:04 Use Core Animation
starakaj 12:04 well, two questions then: why is it a bad idea and what's a good idea?
if you don't mind my asking
stuartmorgan 12:04 It's a bad idea because it's a hack that already doesn't work in many browsers
And won't work anywhere before too much longer
starakaj 12:04 ew, okay, good enough for me
stuartmorgan 12:04 What you are describing is not CoreGraphics
The fact that you negotiate CoreGraphics in the model you are describing is a lie, plain and simple
starakaj 12:04 really
stuartmorgan 12:04 If you do what you are doing, you should negotiate QD+Carobn
starakaj 12:04 no, I want to avoid carbon
stuartmorgan 12:04 Because that's the legacy mode, and that's where people did this kind of crazy stuff
starakaj 12:04 well, am I making this much harder than it is?
stuartmorgan 12:04 starakaj: the way to do what you want is Core Animation
starakaj: key point I think you are missing: you don't have a window ref in Cocoa
It's simply not there
starakaj 12:04 in the windows version I just use the HWND handle to make an opengl context with wglCreateContext
stuartmorgan 12:04 And in practice all browsers now use out-of-process rendering in at least the 64-bit case, so it's not just that you don't get the window ref, it's that you physically can't have a window ref
starakaj: yeah, Mac != Windows
starakaj 12:04 something analogous doesn't exist on mac, I guess
stuartmorgan 12:04 You can't refer to windows across processes
starakaj 12:04 okay
thanks for explaining
this doesn't mean I can't use opengl, does it?
stuartmorgan 12:04 You want to make a CAOpenGLLayer, and use the Core Animation drawing model
See also
Which will help you understand what to do based on what browsers you are targetting
starakaj 12:04 thanks so much, I really appreciate the help
It did feel like we were doing something wrong
when we did our opengl rendering before it would just draw whereever it felt like
stuartmorgan 12:04 It was a hack
Lots of people did it
But it was always a hack
It bypassed the whole drawing API and made assumptions about the browser window's implementation
Led to fun bugs where plugins persisted across tab switches sometimes, etc.
back later; if you have questions I can answer them when I get back
starakaj 13:04 cool, I'll read that article and see how far I can get
thanks bundles
jshanab_wcw 14:04 I have a bit of a problem on my plugin drawing using GDI an image where the plugin window would be for video that says "directx needed" and a littel graphic. There are 5 instances on the page and the drawing interupts each other. When I have seperate threads in the same code, i use mutexes and such to protect such areas. How does this work when i have multiple instances in the same page?
taxilian 14:04 jshanab_wcw: why is the drawing code related?
why are they using shared memory?
jshanab_wcw 14:04 I do not know what is going on, but when i debug it is obvious that it is interuppted mid draw and starts drawing in a different instance of the plugin.
I guess i have worked on linux too long. Not sure how the memory is divided when there are multiple instances in windows, would a boost mutex protect acroos instances of a class?
taxilian 14:04 I guess I'm confused; if the instances aren't related, why would it matter?
jshanab_wcw: if you're doing the drawing correctly all your instances should each have their own thread to do drawing, which each draw in their own context… there shouldn't be any connection between them (unless you have some reason that shouldn't be the case) and thus it shouldn't matter what order they draw in or whether or not the thread is interrupted
jshanab_wcw 14:04 I would agree, but apparently windows does not. It treats them as threads not processes, but a class mutex will not work. I guess it is a system resource and I cannot lock it.
taxilian 14:04 you shouldn't need a mutex
unless you're doing something I don't know about
how are you drawing?
jshanab_wcw 14:04 All blogs I saw said it would actually block on each draw and be slow. Maybe windows 7 "fixed" the block issue :-)
taxilian 14:04 back up; how are you drawing?
jshanab_wcw 14:04 Gdiplus::Graphics --> DrawImage(image)
taxilian 14:04 okay; and your concern is that it takes too long to draw on the main thread?
jshanab_wcw 14:04 I have a 5 camera view, just an html table with 5 cameras . In each cell is an instance of the plugin. DirectX draws video nicely in each table without any issues, but on failure to init directX I wanted to throw a little graphic in each that said you need directX and it fills in from 2 to 5 and never the big one. It just stops and goes on to another therad and i end up with half shots.
taxilian 14:04 okay; this is not an issue that a mutex will help with
guarantee that
if it was, the mutex would have to be static or global, but as it turns out drawing events always come on the same thread
for all instances
and there is only one process (something you said earlier seemed to indicate you might not be sure of that)
jshanab_wcw 14:04 Well for windows , yeah there can be only one
taxilian 14:04 windows, mac, linux; doesn't matter
there is only one process for all of your plugin instances
activex or npapi, the rule is the same
jshanab_wcw 14:04 ah, ok. But how do you serialize between instances of the plugin if i wanted to. Static Mutex and conditions?
taxilian 14:04 you don't; they are all a single thread
they *are* serial
unless the thread has some sort of interrupt set up on it to allow other windows messages to be processed, in which case there is probably nothing you can do about it
but that's beside the point; that's not what your issue is
I'm not sure what your issue is, but it isn't your call getting interrupted; if something *is* interrupting your call it isnt' going to matter because it will come back when its done
where is DisplayWarning called from?
jshanab_wcw 14:04
taxilian 14:04 definitely strange; but also definitely nothing to do iwth a mutex or a need to serialize your plugin drawing
jshanab_wcw 14:04 Maybe it does come back and there is no re-fresh to repaint, caus I am not handling a repaint :-)
taxilian 14:04 wait, you arne't handling RefreshEvent / WM_PAINT?
jshanab_wcw 14:04 No, not yet, not sure where that goes in the plugin just yet.
taxilian 14:04 if that isn't your problem then you just haven't seen your problem yet
where are you calling DisplayWarning from, then?
jshanab_wcw 14:04 On start of display theread for video, before i enter the loop, I try to init DirectX, if i get back a fail code I use GDI to draw in the "error image" then exit the run thread.
taxilian 14:04 yeah, most likely your issue is that you aren't handling WM_PAINT
drag a window across in front of the pane
you'll see
jshanab_wcw 14:04 ok, Sounds probable, I will get on it. draging windows over it are no problem but a resize clears the screen
taxilian 14:04 huh
FireBreath's RefreshEvent fires when you need to redraw
or you can handle the windows event directly
with WindowsEvent and checking for WM_PAINT
jshanab_wcw 14:04 ok, thanks!
I use to do win32 programming, but what am i gonna do in this case? I get the paint message but it is not a redraw, i never finished the last draw. Do i just invalidate the rectangle, (that will just send me a WM_PAINT again :-( ) I don't need to go the full double buffering bit again? I thought this GDIPlus was better than that.
taxilian 14:04 just draw
I have no idea what GDIPlus does; if it were directx you'd do a present
you just want to draw whatever should be there
jshanab_wcw 14:04 Right, I seem to be fine in directX, this is for when directX fails. That is what i am not sure about, I call draw and it doesn't finish, (last pastebin)
taxilian 14:04 try just calling draw again, see if that fixes it
from the refresh event
!findfile FBTestPlugin.cpp
FireBreathBot 15:04 Found 1 matching file(s) in the master branch. First 1 are:
taxilian 15:04
notice the EndPaint call? are you doing that?
'cause if not, that could be the issue as well
jshanab_wcw 15:04 ok
humm, I don't have a begin paint :-)
taxilian 15:04 that could do it too
amazing what you can find in the examples, huh? ;-)
jshanab_wcw 15:04 Well the gdiplus is a higher level wrapper, It Should be taking care of it. but...
taxilian 15:04 yeah, I have no idea on that one. I have only used GDI+ to resize images
jshanab_wcw 15:04 I have no trouble finding soultions anymore, the web is great. Now finding complete ones that work and are the cuurent way of doing it, sheesh. MSDN docs suck
taxilian 15:04 tell me about it