This is what i use to send mouse events to different windows.. doesn't work if on flash animations running in a window though.. hth -------------------- 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); "Richard" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I want my host app to send Mouse / Keyboard events that it has captured to > the gecko window. I'm assuming it's something like this (for mouse) : > > nsCOMPtr<nsIWidget> pWidget; > m_BaseWindow->GetMainWidget(getter_AddRefs(pWidget)); > > nsMouseEvent event(false,NS_MOUSE_LEFT_CLICK,pWidget,nsMouseEvent::eReal); > event.clickCount = 1; > nsEventStatus status; > pWidget->DispatchEvent(&event,status); > > Is this the right idea??? Also how do you pass in the mouse coords. Is there > a better way I should be doing this? > > Thanks > > --Richard > > _______________________________________________ dev-embedding mailing list [email protected] https://lists.mozilla.org/listinfo/dev-embedding
