Re: Performer event handling, Image loading..

New Message Reply Date view Thread view Subject view Author view

From: Don Burns (don_burns++at++peru.engr.sgi.com)
Date: 02/29/2000 11:37:40


On Feb 29, 11:54am, Bryan Housel wrote:
> Subject: Performer event handling, Image loading..
> This message has 2 questions:
>
> First, I have a question about the way that Performer handles events..
> We are trying to implement a browser plugin version of our software that
> uses an X window created by Netscape to draw into.. I added the
> following to the InitPipe() function in perfly:
> pw->setWSWindow((pfWSConnection)display, (pfWSWindow)window);
> pw->setSize(width, height);
>
> This effectively uses the Netscape window for drawing..
> (kind of cool.. see http://www.openworlds.com/images/plugin.jpg)
> However we are unable to process any events (Keyboard, Mouse, Expose,
> etc), even after calling:
> pfuInitInput(ViewState->masterChan->getPWin(), ViewState->input);
>
> So I took a look at the libpfutil code (input.c), and it is using
> XEventsQueued() and XNextEvent() to get the events.. It looks like the
> events aren't properly queued...
>
> However, I was able to call XtAddRawEventHandler() to register a
> callback that prints a message whenever events occur.. All of the normal
> events are occuring as expected.. Any ideas why I can register a
> callback to receive events, but Performer's XEventsQueued() and
> XNextEvent() calls don't work?
>

There is a fundamental problem with getting events sent to the window parented
(eventually), but the netscape window. That is, there already is a
XNextEvent() or some equivalent in the netscape client, such that events
occuring on the Performer window will already have been processed before your
call to XNextEvent(). One client, one input event queue.

My suggestion for fixing this problem is to keep your own Display variable and
open a new connection to the Xserver with XOpenDisplay(). Select the desired
input with XSelectInput() and call XNextEvent() in your work proc. Now you
have a client that is separate from the netscape client and your own input
queue. You have to take care to empty the queue each time you are called by
whatever mechanism netscape uses to call you.

An alternative is to fork() or sproc() or pthread() a process, open display,
select your inputs and call callbacks on incoming events, which set values in
shared memory between the netscape process and the X input process.

Here's a deal. I've always been confused at netscape mechanisms for embedded
windows. If you'll send me (privately) a code snip for the embedded netscape
window, I'll add the event code.

-don


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Tue Feb 29 2000 - 11:37:48 PST

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.