Okay. got it to work by cobbling together calls seen in various mozilla
files. Loaded google.com on startup & from cmdline launched a mouse event
on(x:198,y:193 google/news )& it loaded the news page, just like a mouse
click would've. Don't know much about if this is the right way to do it, so
if you know better, please advise!nsEventStatus aStatus
=nsEventStatus_eConsumeDoDefault;

nsMouseEvent nsevent(PR_TRUE, NS_MOUSE_LEFT_BUTTON_DOWN, nsnull);
nsevent.eventStructType = NS_MOUSE_EVENT;
nsevent.message = NS_MOUSE_LEFT_BUTTON_DOWN;
nsevent.point.x = x ;
nsevent.point.y = y ;
nsevent.clickCount = 1;

 nsCOMPtr<nsIDOMWindow> win;
 // Get the nsIWebBrowser object for our embedded window.
 nsCOMPtr<nsIWebBrowser> webBrowser;

 nsCOMPtr<nsIDOMWindow> domWindow;
 nsCOMPtr<nsIDOMDocument> domDoc;
 nsresult rv;

 mWindow->GetWebBrowser(getter_AddRefs(webBrowser));

 webBrowser->GetContentDOMWindow(getter_AddRefs(domWindow));

 rv = domWindow->GetDocument(getter_AddRefs(domDoc));

 if (!domDoc) return;
 nsCOMPtr<nsIDocument> doc = do_QueryInterface(domDoc);
 nsIPresShell* presShell = doc->GetShellAt(0);
 if (!presShell) return;
 nsIViewManager* pViewMan =  presShell->GetViewManager();

 nsIView *view = nsnull;
 nsIWidget* qwidget;
 pViewMan->GetRootView (view);
 qwidget =  view->GetWidget();
 nsevent.widget = qwidget;

 pViewMan->DispatchEvent(&nsevent, &aStatus);
 nsevent.message =NS_MOUSE_LEFT_BUTTON_UP;
 pViewMan->DispatchEvent(&nsevent, &aStatus);
"JacobZ" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi, Can someone point me to code that shows how to generate synthetic
events
> for this scenario
> (RH Linux7.3 : mozilla-1.7.12 : gtk1.2, using example : TestGtkEmbed)
>
> Four non overlapping mozilla windows displayed on screen without chrome &
no
> mouse/keyboard. Events can come in from a host server or other methods..
> I will need to send the x, y coordinates as mouse events(?) to any one of
> the windows.
>
> I tried sending a gdk mouse event (GdkEvent), but the widget
> (mozEmbed->window) I sent the event to was not a superwin, so it didn't
> work. Looking at the X tree (XQueryTree) there is a window hierarchy down
> from mozEmbed & the lowermost window is what eats the event on a mouse
> click. I don't know how to get to that lowest window.
>
> But , instead of that..
>
> I see nsMouseEvent being used in the mozilla code to send a synthetic
event,
> but i'm not sure where in my example code, to send the event to... i.e
> should i send it  nsWidget, nsViewManager, nsWindow etc..etc
> Which would be the simplest, cheapest way to accomplish this? code would
be
> much appreciated.
>
> Thanks!
>
>


_______________________________________________
dev-embedding mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-embedding

Reply via email to