зеркало из https://github.com/mozilla/gecko-dev.git
Bug 663393 - Maemo6/Meego VKB doues not work properly without meegotouch r=dougt
This commit is contained in:
Родитель
f4c8377505
Коммит
a789480817
16
configure.in
16
configure.in
|
@ -6855,6 +6855,22 @@ if test $MOZ_PLATFORM_MAEMO; then
|
|||
AC_SUBST(MOZ_ENABLE_CONTENTACTION)
|
||||
fi
|
||||
fi
|
||||
|
||||
MOZ_ARG_ENABLE_BOOL(meegotouch,
|
||||
[ --enable-meegotouch Enable meegotouch support],
|
||||
MOZ_MEEGOTOUCHENABLED=1,
|
||||
MOZ_MEEGOTOUCHENABLED=)
|
||||
|
||||
if test -n "$MOZ_MEEGOTOUCHENABLED"; then
|
||||
PKG_CHECK_MODULES(MOZ_MEEGOTOUCH, meegotouchcore, _LIB_FOUND=1, _LIB_FOUND=)
|
||||
if test "$_LIB_FOUND"; then
|
||||
MOZ_QT_CFLAGS="$MOZ_MEEGOTOUCH_CFLAGS $MOZ_QT_CFLAGS"
|
||||
MOZ_QT_LIBS="$MOZ_MEEGOTOUCH_LIBS $MOZ_QT_LIBS"
|
||||
AC_DEFINE(MOZ_ENABLE_MEEGOTOUCH)
|
||||
else
|
||||
AC_MSG_WARN([Cannot meegotouchcore-dev. Disabling Meegotouch support.])
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
PKG_CHECK_MODULES(LIBLOCATION,liblocation, _LIB_FOUND=1, _LIB_FOUND=)
|
||||
|
|
|
@ -54,6 +54,9 @@
|
|||
#include <QtGui/QApplication>
|
||||
#include <QtGui/QInputContextFactory>
|
||||
#include <QtGui/QInputContext>
|
||||
#ifdef MOZ_ENABLE_MEEGOTOUCH
|
||||
#include <MComponentData>
|
||||
#endif // MOZ_ENABLE_MEEGOTOUCH
|
||||
#endif // MOZ_WIDGET_QT
|
||||
|
||||
#include "mozilla/dom/ContentParent.h"
|
||||
|
@ -3007,6 +3010,11 @@ XRE_main(int argc, char* argv[], const nsXREAppData* aAppData)
|
|||
PR_SetEnv(PR_smprintf("MOZ_QT_GRAPHICSSYSTEM=%s", qgraphicssystemARG));
|
||||
|
||||
QScopedPointer<QApplication> app(new QApplication(gArgc, gArgv));
|
||||
#ifdef MOZ_ENABLE_MEEGOTOUCH
|
||||
gArgv[gArgc] = strdup("-software");
|
||||
gArgc++;
|
||||
QScopedPointer<MComponentData> meegotouch(new MComponentData(gArgc, gArgv));
|
||||
#endif
|
||||
|
||||
#if MOZ_PLATFORM_MAEMO > 5
|
||||
if (XRE_GetProcessType() == GeckoProcessType_Default) {
|
||||
|
|
|
@ -36,6 +36,11 @@
|
|||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "mozqorientationsensorfilter.h"
|
||||
#ifdef MOZ_ENABLE_MEEGOTOUCH
|
||||
#include <MApplication>
|
||||
#include <MWindow>
|
||||
#endif
|
||||
#include "nsXULAppAPI.h"
|
||||
|
||||
int MozQOrientationSensorFilter::mWindowRotationAngle = 0;
|
||||
QTransform MozQOrientationSensorFilter::mWindowRotationTransform;
|
||||
|
@ -73,7 +78,43 @@ MozQOrientationSensorFilter::filter(QOrientationReading* reading)
|
|||
mWindowRotationTransform = QTransform();
|
||||
mWindowRotationTransform.rotate(mWindowRotationAngle);
|
||||
|
||||
#ifdef MOZ_ENABLE_MEEGOTOUCH
|
||||
if (XRE_GetProcessType() == GeckoProcessType_Default) {
|
||||
MWindow* window = MApplication::activeWindow();
|
||||
if (window) {
|
||||
window->setOrientationAngle((M::OrientationAngle)mWindowRotationAngle);
|
||||
}
|
||||
}
|
||||
#else
|
||||
emit orientationChanged();
|
||||
#endif
|
||||
|
||||
return true; // don't store the reading in the sensor
|
||||
}
|
||||
|
||||
int
|
||||
MozQOrientationSensorFilter::GetWindowRotationAngle()
|
||||
{
|
||||
#ifdef MOZ_ENABLE_MEEGOTOUCH
|
||||
if (XRE_GetProcessType() == GeckoProcessType_Default) {
|
||||
MWindow* window = MApplication::activeWindow();
|
||||
if (window) {
|
||||
M::OrientationAngle angle = window->orientationAngle();
|
||||
if (mWindowRotationAngle != angle) {
|
||||
mWindowRotationAngle = angle;
|
||||
mWindowRotationTransform = QTransform();
|
||||
mWindowRotationTransform.rotate(mWindowRotationAngle);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return mWindowRotationAngle;
|
||||
}
|
||||
|
||||
QTransform&
|
||||
MozQOrientationSensorFilter::GetRotationTransform()
|
||||
{
|
||||
GetWindowRotationAngle();
|
||||
return mWindowRotationTransform;
|
||||
}
|
||||
|
||||
|
|
|
@ -59,8 +59,8 @@ public:
|
|||
|
||||
virtual bool filter(QOrientationReading* reading);
|
||||
|
||||
static int GetWindowRotationAngle() { return mWindowRotationAngle; }
|
||||
static QTransform& GetRotationTransform() { return mWindowRotationTransform; }
|
||||
static int GetWindowRotationAngle();
|
||||
static QTransform& GetRotationTransform();
|
||||
|
||||
signals:
|
||||
void orientationChanged();
|
||||
|
|
|
@ -52,6 +52,15 @@
|
|||
#include "mozqorientationsensorfilter.h"
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_ENABLE_MEEGOTOUCH
|
||||
#include <QtGui/QGraphicsSceneResizeEvent>
|
||||
#include <MSceneWindow>
|
||||
#include <MScene>
|
||||
#include <QTimer>
|
||||
#include <MInputMethodState>
|
||||
#include <MApplication>
|
||||
#endif
|
||||
|
||||
class QEvent;
|
||||
class QPixmap;
|
||||
class QWidget;
|
||||
|
@ -230,5 +239,123 @@ private:
|
|||
MozQWidget* mTopLevelWidget;
|
||||
};
|
||||
|
||||
#ifdef MOZ_ENABLE_MEEGOTOUCH
|
||||
class MozMSceneWindow : public MSceneWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
MozMSceneWindow(MozQWidget* aTopLevel)
|
||||
: MSceneWindow(aTopLevel->parentItem())
|
||||
, mTopLevelWidget(aTopLevel)
|
||||
{
|
||||
mTopLevelWidget->setParentItem(this);
|
||||
mTopLevelWidget->installEventFilter(this);
|
||||
MInputMethodState* inputMethodState = MInputMethodState::instance();
|
||||
if (inputMethodState) {
|
||||
connect(inputMethodState, SIGNAL(inputMethodAreaChanged(const QRect&)),
|
||||
this, SLOT(VisibleScreenAreaChanged(const QRect&)));
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual void resizeEvent(QGraphicsSceneResizeEvent* aEvent)
|
||||
{
|
||||
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()));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private slots:
|
||||
void CheckTopLevelSize()
|
||||
{
|
||||
if (mTopLevelWidget) {
|
||||
qreal xpos = 0;
|
||||
qreal ypos = 0;
|
||||
qreal width = mCurrentSize.width();
|
||||
qreal height = mCurrentSize.height();
|
||||
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void VisibleScreenAreaChanged(const QRect& rect) {
|
||||
if (mTopLevelWidget) {
|
||||
QRect r = mTopLevelWidget->geometry().toRect();
|
||||
if (rect.height()) {
|
||||
r.setHeight(rect.height());
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIObserverService> observerService = mozilla::services::GetObserverService();
|
||||
if (observerService) {
|
||||
QString rect = QString("{\"left\": %1, \"top\": %2, \"right\": %3, \"bottom\": %4}")
|
||||
.arg(r.x()).arg(r.y()).arg(r.width()).arg(r.height());
|
||||
observerService->NotifyObservers(nsnull, "softkb-change", rect.utf16());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
MozQWidget* mTopLevelWidget;
|
||||
QSizeF mCurrentSize;
|
||||
};
|
||||
|
||||
/**
|
||||
This is a helper class to synchronize the MWindow window with
|
||||
its contained QGraphicsWidget for things like resizing and closing
|
||||
by the user.
|
||||
*/
|
||||
class MozMGraphicsView : public MWindow
|
||||
{
|
||||
|
||||
public:
|
||||
MozMGraphicsView(MozQWidget* aTopLevel, QWidget* aParent = nsnull)
|
||||
: MWindow(aParent)
|
||||
, mEventHandler(this)
|
||||
, mTopLevelWidget(aTopLevel)
|
||||
{
|
||||
MozMSceneWindow* page = new MozMSceneWindow(aTopLevel);
|
||||
page->appear(this);
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual bool event(QEvent* aEvent) {
|
||||
mEventHandler.handleEvent(aEvent, mTopLevelWidget);
|
||||
return MWindow::event(aEvent);
|
||||
}
|
||||
|
||||
virtual void resizeEvent(QResizeEvent* aEvent)
|
||||
{
|
||||
setSceneRect(viewport()->rect());
|
||||
MWindow::resizeEvent(aEvent);
|
||||
}
|
||||
|
||||
virtual void closeEvent (QCloseEvent* aEvent)
|
||||
{
|
||||
if (!mEventHandler.handleCloseEvent(aEvent, mTopLevelWidget)) {
|
||||
MWindow::closeEvent(aEvent);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
MozQGraphicsViewEvents mEventHandler;
|
||||
MozQWidget* mTopLevelWidget;
|
||||
};
|
||||
|
||||
#endif /* MOZ_ENABLE_MEEGOTOUCH */
|
||||
#endif
|
||||
|
|
|
@ -2596,7 +2596,12 @@ nsWindow::createQWidget(MozQWidget *parent, nsWidgetInitData *aInitData)
|
|||
// create a QGraphicsView if this is a new toplevel window
|
||||
|
||||
if (mIsTopLevel) {
|
||||
QGraphicsView* newView = new MozQGraphicsView(widget, parentWidget);
|
||||
QGraphicsView* newView = nsnull;
|
||||
#if defined MOZ_ENABLE_MEEGOTOUCH
|
||||
newView = new MozMGraphicsView(widget, parentWidget);
|
||||
#else
|
||||
newView = new MozQGraphicsView(widget, parentWidget);
|
||||
#endif
|
||||
|
||||
if (!newView) {
|
||||
delete widget;
|
||||
|
|
Загрузка…
Ссылка в новой задаче