Bug 683085 - NativeParentWidget used incorrectly in Widget Qt port r=dougt

This commit is contained in:
Oleg Romashin 2011-09-25 21:03:22 +02:00
parent 1f0d1d7bf8
commit 693d761e69
2 changed files with 18 additions and 6 deletions

View File

@ -142,6 +142,10 @@ static Atom sPluginIMEAtom;
#include "Layers.h"
#include "LayerManagerOGL.h"
// If embedding clients want to create widget without real parent window
// then nsIBaseWindow->Init() should have parent argument equal to PARENTLESS_WIDGET
#define PARENTLESS_WIDGET (void*)0x13579
#include "nsShmImage.h"
extern "C" {
#include "pixman.h"
@ -2278,11 +2282,9 @@ nsWindow::Create(nsIWidget *aParent,
if (aParent != nsnull)
parent = static_cast<MozQWidget*>(aParent->GetNativeData(NS_NATIVE_WIDGET));
else
parent = static_cast<MozQWidget*>(aNativeParent);
// ok, create our QGraphicsWidget
mWidget = createQWidget(parent, aInitData);
mWidget = createQWidget(parent, aNativeParent, aInitData);
if (!mWidget)
return NS_ERROR_OUT_OF_MEMORY;
@ -2628,7 +2630,9 @@ nsPopupWindow::~nsPopupWindow()
}
MozQWidget*
nsWindow::createQWidget(MozQWidget *parent, nsWidgetInitData *aInitData)
nsWindow::createQWidget(MozQWidget *parent,
nsNativeWidget nativeParent,
nsWidgetInitData *aInitData)
{
const char *windowName = NULL;
Qt::WindowFlags flags = Qt::Widget;
@ -2664,7 +2668,13 @@ nsWindow::createQWidget(MozQWidget *parent, nsWidgetInitData *aInitData)
break;
}
MozQWidget * widget = new MozQWidget(this, parent);
MozQWidget* parentQWidget = nsnull;
if (parent) {
parentQWidget = parent;
} else if (nativeParent && nativeParent != PARENTLESS_WIDGET) {
parentQWidget = static_cast<MozQWidget*>(nativeParent);
}
MozQWidget * widget = new MozQWidget(this, parentQWidget);
if (!widget)
return nsnull;

View File

@ -347,7 +347,9 @@ private:
void InitButtonEvent(nsMouseEvent &event, QGraphicsSceneMouseEvent *aEvent, int aClickCount = 1);
nsEventStatus DispatchCommandEvent(nsIAtom* aCommand);
nsEventStatus DispatchContentCommandEvent(PRInt32 aMsg);
MozQWidget* createQWidget(MozQWidget *parent, nsWidgetInitData *aInitData);
MozQWidget* createQWidget(MozQWidget* parent,
nsNativeWidget nativeParent,
nsWidgetInitData* aInitData);
void SetSoftwareKeyboardState(PRBool aOpen);
MozQWidget* mWidget;