mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 683099 - NS_NATIVE_WINDOW value should not be used as IPC shareable . r=roc
This commit is contained in:
parent
49c706d2b5
commit
0773035af1
@ -627,7 +627,7 @@ TabParent::RecvGetWidgetNativeData(WindowsHandle* aValue)
|
||||
vm->GetRootWidget(getter_AddRefs(widget));
|
||||
if (widget) {
|
||||
*aValue = reinterpret_cast<WindowsHandle>(
|
||||
widget->GetNativeData(NS_NATIVE_WINDOW));
|
||||
widget->GetNativeData(NS_NATIVE_SHAREABLE_WINDOW));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -717,32 +717,13 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetNetscapeWindow(void *value)
|
||||
}
|
||||
|
||||
return rv;
|
||||
#elif defined(MOZ_WIDGET_GTK2)
|
||||
#elif defined(MOZ_WIDGET_GTK2) || defined(MOZ_WIDGET_QT)
|
||||
// X11 window managers want the toplevel window for WM_TRANSIENT_FOR.
|
||||
nsIWidget* win = mObjectFrame->GetNearestWidget();
|
||||
if (!win)
|
||||
return NS_ERROR_FAILURE;
|
||||
GdkWindow* gdkWindow = static_cast<GdkWindow*>(win->GetNativeData(NS_NATIVE_WINDOW));
|
||||
if (!gdkWindow)
|
||||
return NS_ERROR_FAILURE;
|
||||
gdkWindow = gdk_window_get_toplevel(gdkWindow);
|
||||
#ifdef MOZ_X11
|
||||
*static_cast<Window*>(value) = GDK_WINDOW_XID(gdkWindow);
|
||||
#endif
|
||||
*static_cast<Window*>(value) = (long unsigned int)win->GetNativeData(NS_NATIVE_SHAREABLE_WINDOW);
|
||||
return NS_OK;
|
||||
#elif defined(MOZ_WIDGET_QT)
|
||||
// X11 window managers want the toplevel window for WM_TRANSIENT_FOR.
|
||||
nsIWidget* win = mObjectFrame->GetNearestWidget();
|
||||
if (!win)
|
||||
return NS_ERROR_FAILURE;
|
||||
QWidget* widget = static_cast<QWidget*>(win->GetNativeData(NS_NATIVE_WINDOW));
|
||||
if (!widget)
|
||||
return NS_ERROR_FAILURE;
|
||||
#ifdef MOZ_X11
|
||||
*static_cast<Window*>(value) = widget->handle();
|
||||
return NS_OK;
|
||||
#endif
|
||||
return NS_ERROR_FAILURE;
|
||||
#else
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
#endif
|
||||
|
@ -107,6 +107,9 @@ typedef nsEventStatus (* EVENT_CALLBACK)(nsGUIEvent *event);
|
||||
#define NS_NATIVE_PLUGIN_PORT 8
|
||||
#define NS_NATIVE_SCREEN 9
|
||||
#define NS_NATIVE_SHELLWIDGET 10 // Get the shell GtkWidget
|
||||
// Has to match to NPNVnetscapeWindow, and shareable across processes
|
||||
// HWND on Windows and XID on X11
|
||||
#define NS_NATIVE_SHAREABLE_WINDOW 11
|
||||
#ifdef XP_MACOSX
|
||||
#define NS_NATIVE_PLUGIN_PORT_QD 100
|
||||
#define NS_NATIVE_PLUGIN_PORT_CG 101
|
||||
|
@ -1844,6 +1844,9 @@ nsWindow::GetNativeData(PRUint32 aDataType)
|
||||
case NS_NATIVE_SHELLWIDGET:
|
||||
return (void *) mShell;
|
||||
|
||||
case NS_NATIVE_SHAREABLE_WINDOW:
|
||||
return (void *) GDK_WINDOW_XID(gdk_window_get_toplevel(mGdkWindow));
|
||||
|
||||
default:
|
||||
NS_WARNING("nsWindow::GetNativeData called with bad value");
|
||||
return nsnull;
|
||||
|
@ -817,6 +817,12 @@ nsWindow::GetNativeData(PRUint32 aDataType)
|
||||
widget = mWidget->scene()->views()[0]->viewport();
|
||||
return (void *) widget;
|
||||
}
|
||||
|
||||
case NS_NATIVE_SHAREABLE_WINDOW: {
|
||||
QWidget *widget = GetViewWidget();
|
||||
return widget ? (void*)widget->winId() : nsnull;
|
||||
}
|
||||
|
||||
default:
|
||||
NS_WARNING("nsWindow::GetNativeData called with bad value");
|
||||
return nsnull;
|
||||
|
@ -2785,6 +2785,7 @@ void* nsWindow::GetNativeData(PRUint32 aDataType)
|
||||
case NS_NATIVE_PLUGIN_PORT:
|
||||
case NS_NATIVE_WIDGET:
|
||||
case NS_NATIVE_WINDOW:
|
||||
case NS_NATIVE_SHAREABLE_WINDOW:
|
||||
return (void*)mWnd;
|
||||
case NS_NATIVE_GRAPHIC:
|
||||
// XXX: This is sleezy!! Remember to Release the DC after using it!
|
||||
|
@ -621,5 +621,30 @@ PuppetWidget::GetDPI()
|
||||
return mDPI;
|
||||
}
|
||||
|
||||
void*
|
||||
PuppetWidget::GetNativeData(PRUint32 aDataType)
|
||||
{
|
||||
switch (aDataType) {
|
||||
case NS_NATIVE_SHAREABLE_WINDOW: {
|
||||
NS_ABORT_IF_FALSE(mTabChild, "Need TabChild to get the nativeWindow from!");
|
||||
mozilla::WindowsHandle nativeData = nsnull;
|
||||
mTabChild->SendGetWidgetNativeData(&nativeData);
|
||||
return (void*)nativeData;
|
||||
}
|
||||
case NS_NATIVE_WINDOW:
|
||||
case NS_NATIVE_DISPLAY:
|
||||
case NS_NATIVE_PLUGIN_PORT:
|
||||
case NS_NATIVE_GRAPHIC:
|
||||
case NS_NATIVE_SHELLWIDGET:
|
||||
case NS_NATIVE_WIDGET:
|
||||
NS_WARNING("nsWindow::GetNativeData not implemented for this type");
|
||||
break;
|
||||
default:
|
||||
NS_WARNING("nsWindow::GetNativeData called with bad value");
|
||||
break;
|
||||
}
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
} // namespace widget
|
||||
} // namespace mozilla
|
||||
|
@ -138,8 +138,7 @@ public:
|
||||
{ /* dead man walking */ }
|
||||
|
||||
// PuppetWidgets don't have native data, as they're purely nonnative.
|
||||
virtual void* GetNativeData(PRUint32 aDataType)
|
||||
{ return nsnull; }
|
||||
virtual void* GetNativeData(PRUint32 aDataType);
|
||||
NS_IMETHOD ReparentNativeWidget(nsIWidget* aNewParent)
|
||||
{ return NS_ERROR_UNEXPECTED; }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user