mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 584454 - Support MeegoTouch status bar in Fennec browser. r=romaxa,doug.turner a=npodb
This commit is contained in:
parent
b9bf8841c5
commit
1897be54c2
@ -8,6 +8,8 @@
|
||||
#ifdef MOZ_ENABLE_MEEGOTOUCH
|
||||
#include <QtGui/QGraphicsSceneResizeEvent>
|
||||
#include <MSceneWindow>
|
||||
#include <QTimer>
|
||||
#include <mstatusbar.h>
|
||||
#endif
|
||||
|
||||
#include "nsIWidget.h"
|
||||
@ -186,26 +188,66 @@ private:
|
||||
#ifdef MOZ_ENABLE_MEEGOTOUCH
|
||||
class MozMSceneWindow : public MSceneWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
MozMSceneWindow(MozQWidget* aTopLevel)
|
||||
: MSceneWindow(aTopLevel->parentItem())
|
||||
, mTopLevelWidget(aTopLevel)
|
||||
, mStatusBar(nsnull)
|
||||
{
|
||||
mTopLevelWidget->setParentItem(this);
|
||||
mTopLevelWidget->installEventFilter(this);
|
||||
mStatusBar = new MStatusBar();
|
||||
mStatusBar->appear();
|
||||
connect(mStatusBar, SIGNAL(appeared()), this, SLOT(CheckTopLevelSize()));
|
||||
connect(mStatusBar, SIGNAL(disappeared()), this, SLOT(CheckTopLevelSize()));
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual void resizeEvent(QGraphicsSceneResizeEvent* aEvent) {
|
||||
if (mTopLevelWidget) {
|
||||
// transfer new size to graphics widget
|
||||
mTopLevelWidget->setGeometry(0.0, 0.0,
|
||||
static_cast<qreal>(aEvent->newSize().width()),
|
||||
static_cast<qreal>(aEvent->newSize().height()));
|
||||
}
|
||||
mCurrentSize = aEvent->newSize();
|
||||
MSceneWindow::resizeEvent(aEvent);
|
||||
CheckTopLevelSize();
|
||||
}
|
||||
|
||||
virtual bool eventFilter(QObject* watched, QEvent* e)
|
||||
{
|
||||
if (e->type() == QEvent::GraphicsSceneResize ||
|
||||
e->type() == QEvent::GraphicsSceneMove) {
|
||||
|
||||
//Do this in next event loop, or we are in recursion!
|
||||
QTimer::singleShot(0, this, SLOT(CheckTopLevelSize()));
|
||||
}
|
||||
|
||||
//false == let event processing continue
|
||||
return false;
|
||||
}
|
||||
|
||||
private slots:
|
||||
void CheckTopLevelSize() {
|
||||
if (mTopLevelWidget) {
|
||||
qreal xpos = 0;
|
||||
qreal ypos = 0;
|
||||
qreal width = mCurrentSize.width();
|
||||
qreal height = mCurrentSize.height();
|
||||
|
||||
//If statusbar is visible, move toplevel widget down
|
||||
if (mStatusBar->isVisible()) {
|
||||
ypos = mStatusBar->size().height();
|
||||
height -= ypos;
|
||||
}
|
||||
|
||||
// transfer new size to graphics widget if changed
|
||||
QRectF r = mTopLevelWidget->geometry();
|
||||
if (r != QRectF(xpos, ypos, width, height))
|
||||
mTopLevelWidget->setGeometry(xpos, ypos, width, height);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
MozQWidget* mTopLevelWidget;
|
||||
MStatusBar* mStatusBar;
|
||||
QSizeF mCurrentSize;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -1738,9 +1738,11 @@ nsWindow::NativeResize(PRInt32 aWidth, PRInt32 aHeight, PRBool aRepaint)
|
||||
|
||||
mNeedsResize = PR_FALSE;
|
||||
|
||||
if (mIsTopLevel) {
|
||||
GetViewWidget()->resize( aWidth, aHeight);
|
||||
}
|
||||
#ifndef MOZ_ENABLE_MEEGOTOUCH
|
||||
if (mIsTopLevel && XRE_GetProcessType() == GeckoProcessType_Default)
|
||||
GetViewWidget()->resize(aWidth, aHeight);
|
||||
#endif
|
||||
|
||||
mWidget->resize( aWidth, aHeight);
|
||||
|
||||
if (aRepaint)
|
||||
@ -1758,12 +1760,13 @@ nsWindow::NativeResize(PRInt32 aX, PRInt32 aY,
|
||||
mNeedsResize = PR_FALSE;
|
||||
mNeedsMove = PR_FALSE;
|
||||
|
||||
#ifndef MOZ_ENABLE_MEEGOTOUCH
|
||||
if (mIsTopLevel) {
|
||||
#ifdef MOZ_ENABLE_MEEGOTOUCH
|
||||
if (XRE_GetProcessType() != GeckoProcessType_Default)
|
||||
#endif
|
||||
GetViewWidget()->setGeometry(aX, aY, aWidth, aHeight);
|
||||
if (XRE_GetProcessType() == GeckoProcessType_Default)
|
||||
GetViewWidget()->setGeometry(aX, aY, aWidth, aHeight);
|
||||
}
|
||||
#endif
|
||||
|
||||
mWidget->setGeometry(aX, aY, aWidth, aHeight);
|
||||
|
||||
if (aRepaint)
|
||||
|
Loading…
Reference in New Issue
Block a user