I'm embedding a Firefox browser into my Java application using
JavaXPCOM/Xulrunner, Win32 (Linux will be later and I suspect there are
a lot of problems there too...)
The next thing I want to make work is key events and focus handling. I
have found the following methods and interfaces related:
nsIWebBrowserChromeFocus.focusNextElement() - called by embedded browser
when focus is tabbed out from it in forward direction. This interface
must be implemented by embedder (by myself)
nsIWebBrowserChromeFocus.focusPrevElement() - the same as above but in
backward direction
nsIWebBrowserFocus - this interface can be obtainer from nsIWebBrowser
instance via queryInterface
nsIWebBrowserFocus.activate() - according to specification, this method
must be called when my top-level window (where the browser is embedded
within) is activated and the browser had focus when the window was
previously deactivated. However, it seems that this method should be
called each time I want the browser to get focus, not only when the
top-level window is activated. Is it right?
nsIWebBrowserFocus.deactivate() - opposite to the previous one
nsIWebBrowserFocus.setFocusAtFirstElement() - can be used by embedding
application to set focus at the first focusable element in embedded
browser. It seems that I need to call activate() before this method
nsIWebBrowserFocus.setFocusAtLastElement() - the same as the previous
one but for the last element
nsIDomEventListener.handleEvent() for event type "focus" - I'm not sure
but it seems that this event is sent by browser when it wants to get
focus. In event handler for this event I call activate() method in
nsIWebBrowser and it works, but... This "focus" event is sent, for
example, each time I click the browser by mouse, event if the browser
has already gained focus. Is it an intended behaviour or I should call
something else than activate()?
There are some other methods, I don't know when and why they are called:
nsIEmbeddingSiteWindow.setFocus()
nsIBaseWindow.setFocus()
Also, it would be fine to get some events when the browser is losing
focus like WM_FILLFOCUS in Win32.
Thanks in advance,
Artem
_______________________________________________
dev-embedding mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-embedding