mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 703155 - Port Mozilla Qt to Qt5. r=mark.finkle,mh+mozilla,dougt
This commit is contained in:
parent
67d8714fd8
commit
6b5cad0bce
20
configure.in
20
configure.in
@ -4969,6 +4969,15 @@ then
|
||||
|
||||
if test -z "$QTDIR"; then
|
||||
PKG_CHECK_MODULES(MOZ_QT, QtGui QtNetwork QtCore QtOpenGL)
|
||||
PKG_CHECK_MODULES(MOZ_QT5, QtWidgets QtMultimedia QtPrintSupport QtQuick1,
|
||||
MOZ_ENABLE_QT5=1,
|
||||
MOZ_ENABLE_QT5=)
|
||||
if test "$MOZ_ENABLE_QT5"; then
|
||||
echo "Using qt5"
|
||||
MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $MOZ_QT5_CFLAGS"
|
||||
MOZ_QT_LIBS="$MOZ_QT_LIBS $MOZ_QT5_LIBS"
|
||||
fi
|
||||
|
||||
AC_CHECK_PROGS(HOST_MOC, $MOC moc, "")
|
||||
AC_CHECK_PROGS(HOST_RCC, $RCC rcc, "")
|
||||
else
|
||||
@ -4981,8 +4990,19 @@ then
|
||||
MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtCore"
|
||||
MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtNetwork"
|
||||
MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtXml"
|
||||
MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtDeclarative"
|
||||
HOST_MOC="$QTDIR/bin/moc"
|
||||
HOST_RCC="$QTDIR/bin/rcc"
|
||||
|
||||
# QtWidgets was introduced only in Qt5
|
||||
if test -d $QTDIR/include/QtWidgets; then
|
||||
echo "Using qt5"
|
||||
MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtWidgets"
|
||||
MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtMultimedia"
|
||||
MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtPrintSupport"
|
||||
MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtQuick1"
|
||||
MOZ_QT_LIBS="$MOZ_QT_LIBS -lQtWidgets -lQtMultimedia -lQtPrintSupport -lQtQuick1"
|
||||
fi
|
||||
fi
|
||||
if test -z "$HOST_MOC"; then
|
||||
AC_MSG_ERROR([No acceptable moc preprocessor found. Qt SDK is not installed or --with-qt is
|
||||
|
@ -36,10 +36,6 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifdef MOZ_WIDGET_QT
|
||||
#include <QX11Info>
|
||||
#endif
|
||||
|
||||
#include "base/basictypes.h"
|
||||
|
||||
/* This must occur *after* layers/PLayers.h to avoid typedefs conflicts. */
|
||||
|
@ -47,8 +47,12 @@
|
||||
#ifdef MOZ_WIDGET_QT
|
||||
#include <QWidget>
|
||||
#include <QKeyEvent>
|
||||
#ifdef MOZ_X11
|
||||
#if defined(MOZ_X11)
|
||||
#if defined(Q_WS_X11)
|
||||
#include <QX11Info>
|
||||
#else
|
||||
#include "gfxQtPlatform.h"
|
||||
#endif
|
||||
#endif
|
||||
#undef slots
|
||||
#endif
|
||||
@ -2431,7 +2435,7 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const nsGUIEvent& anEvent)
|
||||
#ifdef MOZ_WIDGET_GTK2
|
||||
Window root = GDK_ROOT_WINDOW();
|
||||
#elif defined(MOZ_WIDGET_QT)
|
||||
Window root = QX11Info::appRootWindow();
|
||||
Window root = RootWindowOfScreen(DefaultScreenOfDisplay(mozilla::DefaultXDisplay()));
|
||||
#else
|
||||
Window root = None; // Could XQueryTree, but this is not important.
|
||||
#endif
|
||||
@ -2547,8 +2551,13 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const nsGUIEvent& anEvent)
|
||||
event.time = anEvent.time;
|
||||
|
||||
QWidget* qWidget = static_cast<QWidget*>(widget->GetNativeData(NS_NATIVE_WINDOW));
|
||||
|
||||
if (qWidget)
|
||||
#if defined(Q_WS_X11)
|
||||
event.root = qWidget->x11Info().appRootWindow();
|
||||
#else
|
||||
event.root = RootWindowOfScreen(DefaultScreenOfDisplay(gfxQtPlatform::GetXDisplay(qWidget)));
|
||||
#endif
|
||||
|
||||
// deduce keycode from the information in the attached QKeyEvent
|
||||
const QKeyEvent* qtEvent = static_cast<const QKeyEvent*>(anEvent.pluginEvent);
|
||||
@ -3065,9 +3074,9 @@ void nsPluginInstanceOwner::Paint(gfxContext* aContext,
|
||||
gdk_x11_screen_get_xscreen(gdk_visual_get_screen(gdkVisual));
|
||||
#endif
|
||||
#ifdef MOZ_WIDGET_QT
|
||||
Display* dpy = QX11Info().display();
|
||||
Screen* screen = ScreenOfDisplay(dpy, QX11Info().screen());
|
||||
Visual* visual = static_cast<Visual*>(QX11Info().visual());
|
||||
Display* dpy = mozilla::DefaultXDisplay();
|
||||
Screen* screen = DefaultScreenOfDisplay(dpy);
|
||||
Visual* visual = DefaultVisualOfScreen(screen);
|
||||
#endif
|
||||
renderer.Draw(aContext, nsIntSize(window->width, window->height),
|
||||
rendererFlags, screen, visual, nsnull);
|
||||
|
@ -85,7 +85,6 @@ using namespace std;
|
||||
#include "gtk2xtbin.h"
|
||||
|
||||
#elif defined(MOZ_WIDGET_QT)
|
||||
#include <QX11Info>
|
||||
#undef KeyPress
|
||||
#undef KeyRelease
|
||||
#elif defined(OS_WIN)
|
||||
|
@ -121,6 +121,7 @@ pluginDrawWindow(InstanceData* instanceData, void* event)
|
||||
const XGraphicsExposeEvent& expose = nsEvent->xgraphicsexpose;
|
||||
|
||||
QColor drawColor((QColor)instanceData->scriptableObject->drawColor);//QRgb qRgba ( int r, int g, int b, int a )
|
||||
#ifdef Q_WS_X11
|
||||
QPixmap pixmap = QPixmap::fromX11Pixmap(expose.drawable, QPixmap::ExplicitlyShared);
|
||||
|
||||
QRect exposeRect(expose.x, expose.y, expose.width, expose.height);
|
||||
@ -133,6 +134,7 @@ pluginDrawWindow(InstanceData* instanceData, void* event)
|
||||
return;
|
||||
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
NPP npp = instanceData->npp;
|
||||
@ -144,6 +146,7 @@ pluginDrawWindow(InstanceData* instanceData, void* event)
|
||||
return;
|
||||
|
||||
#ifdef MOZ_X11
|
||||
#ifdef Q_WS_X11
|
||||
//printf("Drawing Default\n");
|
||||
// drawing a solid color for reftests
|
||||
QColor color;
|
||||
@ -156,6 +159,7 @@ pluginDrawWindow(InstanceData* instanceData, void* event)
|
||||
painter.drawRect(theRect);
|
||||
painter.drawText(QRect(theRect), Qt::AlignCenter, text);
|
||||
notifyDidPaint(instanceData);
|
||||
#endif
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
@ -40,8 +40,7 @@
|
||||
#define GET_NATIVE_WINDOW(aWidget) GDK_WINDOW_XID((GdkWindow *) aWidget->GetNativeData(NS_NATIVE_WINDOW))
|
||||
#elif defined(MOZ_WIDGET_QT)
|
||||
#include <QWidget>
|
||||
#include <QX11Info>
|
||||
#define GET_NATIVE_WINDOW(aWidget) static_cast<QWidget*>(aWidget->GetNativeData(NS_NATIVE_SHELLWIDGET))->handle()
|
||||
#define GET_NATIVE_WINDOW(aWidget) static_cast<QWidget*>(aWidget->GetNativeData(NS_NATIVE_SHELLWIDGET))->winId()
|
||||
#endif
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
|
@ -45,10 +45,8 @@
|
||||
#if defined(MOZ_WIDGET_GTK2)
|
||||
# include <gdk/gdkx.h>
|
||||
#elif defined(MOZ_WIDGET_QT)
|
||||
// X11/X.h has #define CursorShape 0, but Qt's qnamespace.h defines
|
||||
// enum CursorShape { ... }. Good times!
|
||||
#include "gfxQtPlatform.h"
|
||||
#undef CursorShape
|
||||
# include <QX11Info>
|
||||
# include <X11/Xlib.h>
|
||||
#else
|
||||
# error Unknown toolkit
|
||||
@ -68,7 +66,7 @@ DefaultXDisplay()
|
||||
#if defined(MOZ_WIDGET_GTK2)
|
||||
return GDK_DISPLAY();
|
||||
#elif defined(MOZ_WIDGET_QT)
|
||||
return QX11Info::display();
|
||||
return gfxQtPlatform::GetXDisplay();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -37,7 +37,12 @@
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include <QPixmap>
|
||||
#include <QX11Info>
|
||||
#include <qglobal.h>
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(5,0,0))
|
||||
# include <QX11Info>
|
||||
#else
|
||||
# include <QPlatformNativeInterface>
|
||||
#endif
|
||||
#include <QApplication>
|
||||
#include <QDesktopWidget>
|
||||
#include <QPaintEngine>
|
||||
@ -85,7 +90,11 @@ using namespace mozilla;
|
||||
using namespace mozilla::unicode;
|
||||
using namespace mozilla::gfx;
|
||||
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(5,0,0))
|
||||
#define DEFAULT_RENDER_MODE RENDER_DIRECT
|
||||
#else
|
||||
#define DEFAULT_RENDER_MODE RENDER_BUFFERED
|
||||
#endif
|
||||
|
||||
static QPaintEngine::Type sDefaultQtPaintEngineType = QPaintEngine::Raster;
|
||||
gfxFontconfigUtils *gfxQtPlatform::sFontconfigUtils = nsnull;
|
||||
@ -197,6 +206,40 @@ gfxQtPlatform::~gfxQtPlatform()
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef MOZ_X11
|
||||
Display*
|
||||
gfxQtPlatform::GetXDisplay(QWidget* aWindow)
|
||||
{
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(5,0,0))
|
||||
#ifdef Q_WS_X11
|
||||
return aWindow ? aWindow->x11Info().display() : QX11Info::display();
|
||||
#else
|
||||
return nsnull;
|
||||
#endif
|
||||
#else
|
||||
return (Display*)(qApp->platformNativeInterface()->
|
||||
nativeResourceForWindow("display", aWindow ? aWindow->windowHandle() : nsnull));
|
||||
#endif
|
||||
}
|
||||
|
||||
Screen*
|
||||
gfxQtPlatform::GetXScreen(QWidget* aWindow)
|
||||
{
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(5,0,0))
|
||||
#ifdef Q_WS_X11
|
||||
return ScreenOfDisplay(GetXDisplay(aWindow), aWindow ? aWindow->x11Info().screen() : QX11Info().screen());
|
||||
#else
|
||||
return nsnull;
|
||||
#endif
|
||||
#else
|
||||
return ScreenOfDisplay(GetXDisplay(aWindow),
|
||||
(int)qApp->platformNativeInterface()->
|
||||
nativeResourceForWindow("screen",
|
||||
aWindow ? aWindow->windowHandle() : nsnull));
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
already_AddRefed<gfxASurface>
|
||||
gfxQtPlatform::CreateOffscreenSurface(const gfxIntSize& size,
|
||||
gfxASurface::gfxContentType contentType)
|
||||
@ -224,9 +267,9 @@ gfxQtPlatform::CreateOffscreenSurface(const gfxIntSize& size,
|
||||
|
||||
#ifdef MOZ_X11
|
||||
XRenderPictFormat* xrenderFormat =
|
||||
gfxXlibSurface::FindRenderFormat(QX11Info().display(), imageFormat);
|
||||
gfxXlibSurface::FindRenderFormat(GetXDisplay(), imageFormat);
|
||||
|
||||
Screen* screen = ScreenOfDisplay(QX11Info().display(), QX11Info().screen());
|
||||
Screen* screen = GetXScreen();
|
||||
newSurface = gfxXlibSurface::Create(screen, xrenderFormat, size);
|
||||
#endif
|
||||
|
||||
|
@ -43,8 +43,12 @@
|
||||
#include "nsAutoRef.h"
|
||||
#include "nsDataHashtable.h"
|
||||
#include "nsTArray.h"
|
||||
#ifdef MOZ_X11
|
||||
#include "X11/Xlib.h"
|
||||
#endif
|
||||
|
||||
class gfxFontconfigUtils;
|
||||
class QWidget;
|
||||
#ifndef MOZ_PANGO
|
||||
typedef struct FT_LibraryRec_ *FT_Library;
|
||||
|
||||
@ -138,6 +142,10 @@ public:
|
||||
static PRInt32 GetDPI();
|
||||
|
||||
virtual gfxImageFormat GetOffscreenFormat();
|
||||
#ifdef MOZ_X11
|
||||
static Display* GetXDisplay(QWidget* aWindow = 0);
|
||||
static Screen* GetXScreen(QWidget* aWindow = 0);
|
||||
#endif
|
||||
|
||||
protected:
|
||||
static gfxFontconfigUtils *sFontconfigUtils;
|
||||
|
@ -2,13 +2,13 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "base/message_pump_qt.h"
|
||||
|
||||
#include <qabstracteventdispatcher.h>
|
||||
#include <qevent.h>
|
||||
#include <qapplication.h>
|
||||
#include <QApplication>
|
||||
#include <qtimer.h>
|
||||
|
||||
#include "base/message_pump_qt.h"
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <limits>
|
||||
#include <math.h>
|
||||
|
@ -44,8 +44,8 @@
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_WIDGET_QT
|
||||
#include <QtGui/QApplication>
|
||||
#include <QtGui/QWidget>
|
||||
#include <QApplication>
|
||||
#include <QWidget>
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
|
@ -40,10 +40,10 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
#include <QWidget>
|
||||
#include <QX11Info>
|
||||
#include "nsQtRemoteService.h"
|
||||
|
||||
#include "mozilla/ModuleUtils.h"
|
||||
#include "mozilla/X11Util.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIAppShellService.h"
|
||||
|
||||
@ -137,7 +137,7 @@ void
|
||||
nsQtRemoteService::PropertyNotifyEvent(XEvent *aEvt)
|
||||
{
|
||||
HandleNewProperty(aEvt->xproperty.window,
|
||||
QX11Info::display(),
|
||||
mozilla::DefaultXDisplay(),
|
||||
aEvt->xproperty.time,
|
||||
aEvt->xproperty.atom,
|
||||
0);
|
||||
|
@ -49,10 +49,13 @@
|
||||
#define XPCOM_TRANSLATE_NSGM_ENTRY_POINT 1
|
||||
|
||||
#if defined(MOZ_WIDGET_QT)
|
||||
#include <QtGui/QApplication>
|
||||
#include <QApplication>
|
||||
#include <QStringList>
|
||||
#include "nsQAppInstance.h"
|
||||
#include <QtGui/QInputContextFactory>
|
||||
#include <QtGui/QInputContext>
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
|
||||
#include <QInputContextFactory>
|
||||
#include <QInputContext>
|
||||
#endif
|
||||
#endif // MOZ_WIDGET_QT
|
||||
|
||||
#include "mozilla/dom/ContentParent.h"
|
||||
|
@ -36,7 +36,7 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include <QtGui/QApplication>
|
||||
#include <QApplication>
|
||||
#include "nsQAppInstance.h"
|
||||
#include <QtOpenGL/QGLWidget>
|
||||
#include <QThread>
|
||||
|
@ -38,9 +38,9 @@
|
||||
#ifndef MOZIQWIDGET_H
|
||||
#define MOZIQWIDGET_H
|
||||
|
||||
#include <QtGui/QApplication>
|
||||
#include <QtGui/QGraphicsWidget>
|
||||
#include <QtGui/QGraphicsView>
|
||||
#include <QApplication>
|
||||
#include <QGraphicsWidget>
|
||||
#include <QGraphicsView>
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
|
@ -35,9 +35,11 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include <QtGui/QInputContext>
|
||||
#include <QtGui/QGraphicsSceneHoverEvent>
|
||||
#include <QtGui/QGraphicsSceneMouseEvent>
|
||||
#include <QGraphicsSceneHoverEvent>
|
||||
#include <QGraphicsSceneMouseEvent>
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
|
||||
#include <QInputContext>
|
||||
#endif
|
||||
#include <QtCore/QTimer>
|
||||
|
||||
#include "mozqwidget.h"
|
||||
@ -584,7 +586,7 @@ void MozQWidget::showVKB()
|
||||
|
||||
gPendingVKBOpen = false;
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(4, 6, 0))
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)) && (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
|
||||
QWidget* focusWidget = qApp->focusWidget();
|
||||
|
||||
if (focusWidget) {
|
||||
@ -622,7 +624,7 @@ void MozQWidget::hideVKB()
|
||||
return;
|
||||
}
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(4, 6, 0))
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)) && (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
|
||||
QInputContext *inputContext = qApp->inputContext();
|
||||
if (!inputContext) {
|
||||
NS_WARNING("Closing SIP: but no input context");
|
||||
|
@ -37,10 +37,9 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#if !defined(MOZ_PLATFORM_MAEMO) && defined(MOZ_X11)
|
||||
#include <QX11Info>
|
||||
#ifdef MOZ_X11
|
||||
#include "mozilla/X11Util.h"
|
||||
#endif
|
||||
|
||||
#include "nsIdleServiceQt.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsDebug.h"
|
||||
@ -117,7 +116,7 @@ nsIdleServiceQt::PollIdleTime(PRUint32 *aIdleTime)
|
||||
*aIdleTime = 0;
|
||||
|
||||
// We might not have a display (cf. in xpcshell)
|
||||
Display *dplay = QX11Info::display();
|
||||
Display *dplay = mozilla::DefaultXDisplay();
|
||||
if (!dplay) {
|
||||
return false;
|
||||
}
|
||||
@ -136,7 +135,7 @@ nsIdleServiceQt::PollIdleTime(PRUint32 *aIdleTime)
|
||||
if (!mXssInfo)
|
||||
return false;
|
||||
|
||||
_XSSQueryInfo(dplay, QX11Info::appRootWindow(), mXssInfo);
|
||||
_XSSQueryInfo(dplay, RootWindowOfScreen(DefaultScreenOfDisplay(mozilla::DefaultXDisplay())), mXssInfo);
|
||||
*aIdleTime = mXssInfo->idle;
|
||||
return true;
|
||||
}
|
||||
|
@ -153,7 +153,7 @@ nsNativeThemeQt::DrawWidgetBackground(nsRenderingContext* aContext,
|
||||
aFrame, aWidgetType,
|
||||
aRect, aClipRect);
|
||||
}
|
||||
#ifdef MOZ_X11
|
||||
#if defined(MOZ_X11) && defined(Q_WS_X11)
|
||||
else if (surface->GetType() == gfxASurface::SurfaceTypeXlib) {
|
||||
gfxXlibSurface* qSurface = (gfxXlibSurface*) (surface.get());
|
||||
QPixmap pixmap(QPixmap::fromX11Pixmap(qSurface->XDrawable()));
|
||||
|
@ -49,7 +49,6 @@
|
||||
|
||||
class QComboBox;
|
||||
class QStyleOptionButton;
|
||||
class QStyleOptionFrameV2;
|
||||
class QStyleOptionComboBox;
|
||||
class QRect;
|
||||
class nsIFrame;
|
||||
|
@ -45,21 +45,21 @@
|
||||
|
||||
#include "mozilla/Util.h"
|
||||
|
||||
#include <QtGui/QApplication>
|
||||
#include <QtGui/QDesktopWidget>
|
||||
#include <QApplication>
|
||||
#include <QDesktopWidget>
|
||||
#include <QtGui/QCursor>
|
||||
#include <QtGui/QIcon>
|
||||
#include <QtGui/QX11Info>
|
||||
#include <QtGui/QGraphicsScene>
|
||||
#include <QtGui/QGraphicsView>
|
||||
#include <QtGui/QGraphicsSceneContextMenuEvent>
|
||||
#include <QtGui/QGraphicsSceneDragDropEvent>
|
||||
#include <QtGui/QGraphicsSceneMouseEvent>
|
||||
#include <QtGui/QGraphicsSceneHoverEvent>
|
||||
#include <QtGui/QGraphicsSceneWheelEvent>
|
||||
#include <QtGui/QGraphicsSceneResizeEvent>
|
||||
#include <QtGui/QStyleOptionGraphicsItem>
|
||||
#include <QIcon>
|
||||
#include <QGraphicsScene>
|
||||
#include <QGraphicsView>
|
||||
#include <QGraphicsSceneContextMenuEvent>
|
||||
#include <QGraphicsSceneDragDropEvent>
|
||||
#include <QGraphicsSceneMouseEvent>
|
||||
#include <QGraphicsSceneHoverEvent>
|
||||
#include <QGraphicsSceneWheelEvent>
|
||||
#include <QGraphicsSceneResizeEvent>
|
||||
#include <QStyleOptionGraphicsItem>
|
||||
#include <QPaintEngine>
|
||||
#include <QMimeData>
|
||||
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtCore/QEvent>
|
||||
@ -80,7 +80,6 @@ using namespace QtMobility;
|
||||
#endif // QT version check 4.6
|
||||
|
||||
#ifdef MOZ_X11
|
||||
#include <QX11Info>
|
||||
#include <X11/Xlib.h>
|
||||
#endif //MOZ_X11
|
||||
|
||||
@ -264,7 +263,7 @@ nsWindow::nsWindow()
|
||||
#if defined(MOZ_X11) && (MOZ_PLATFORM_MAEMO == 6)
|
||||
// This cannot be called on non-main thread
|
||||
if (QThread::currentThread() == qApp->thread()) {
|
||||
sPluginIMEAtom = XInternAtom(QX11Info::display(), PLUGIN_VKB_REQUEST_PROP, False);
|
||||
sPluginIMEAtom = XInternAtom(mozilla::DefaultXDisplay(), PLUGIN_VKB_REQUEST_PROP, False);
|
||||
}
|
||||
#endif
|
||||
// It's OK if either of these fail, but it may not be one day.
|
||||
@ -345,8 +344,9 @@ UpdateOffScreenBuffers(int aDepth, QSize aSize, QWidget* aWidget = nsnull)
|
||||
if (aWidget) {
|
||||
if (gfxPlatform::GetPlatform()->ScreenReferenceSurface()->GetType() ==
|
||||
gfxASurface::SurfaceTypeImage) {
|
||||
Display* dpy = mozilla::DefaultXDisplay();
|
||||
gShmImage = nsShmImage::Create(gBufferMaxSize,
|
||||
(Visual*)aWidget->x11Info().visual(),
|
||||
DefaultVisualOfScreen(gfxQtPlatform::GetXScreen(aWidget)),
|
||||
aDepth);
|
||||
gBufferSurface = gShmImage->AsSurface();
|
||||
return true;
|
||||
@ -801,8 +801,7 @@ nsWindow::GetNativeData(PRUint32 aDataType)
|
||||
case NS_NATIVE_DISPLAY:
|
||||
{
|
||||
#ifdef MOZ_X11
|
||||
QWidget *widget = GetViewWidget();
|
||||
return widget ? widget->x11Info().display() : nsnull;
|
||||
return gfxQtPlatform::GetXDisplay(GetViewWidget());
|
||||
#else
|
||||
return nsnull;
|
||||
#endif
|
||||
@ -1019,9 +1018,9 @@ static already_AddRefed<gfxASurface>
|
||||
GetSurfaceForQWidget(QWidget* aDrawable)
|
||||
{
|
||||
gfxASurface* result =
|
||||
new gfxXlibSurface(aDrawable->x11Info().display(),
|
||||
aDrawable->handle(),
|
||||
(Visual*)aDrawable->x11Info().visual(),
|
||||
new gfxXlibSurface(gfxQtPlatform::GetXDisplay(aDrawable),
|
||||
aDrawable->winId(),
|
||||
DefaultVisualOfScreen(gfxQtPlatform::GetXScreen(aDrawable)),
|
||||
gfxIntSize(aDrawable->size().width(),
|
||||
aDrawable->size().height()));
|
||||
NS_IF_ADDREF(result);
|
||||
@ -1173,7 +1172,7 @@ nsWindow::DoPaint(QPainter* aPainter, const QStyleOptionGraphicsItem* aOption, Q
|
||||
|
||||
// Handle buffered painting mode
|
||||
if (renderMode == gfxQtPlatform::RENDER_BUFFERED) {
|
||||
#ifdef MOZ_X11
|
||||
#if defined(MOZ_X11) && defined(Q_WS_X11)
|
||||
if (gBufferSurface->GetType() == gfxASurface::SurfaceTypeXlib) {
|
||||
// Paint offscreen pixmap to QPainter
|
||||
static QPixmap gBufferPixmap;
|
||||
@ -1575,7 +1574,7 @@ nsWindow::OnKeyPressEvent(QKeyEvent *aEvent)
|
||||
PRUint32 domKeyCode = QtKeyCodeToDOMKeyCode(aEvent->key());
|
||||
|
||||
// get keymap and modifier map from the Xserver
|
||||
Display *display = QX11Info::display();
|
||||
Display *display = mozilla::DefaultXDisplay();
|
||||
int x_min_keycode = 0, x_max_keycode = 0, xkeysyms_per_keycode;
|
||||
XDisplayKeycodes(display, &x_min_keycode, &x_max_keycode);
|
||||
XModifierKeymap *xmodmap = XGetModifierMapping(display);
|
||||
@ -1933,7 +1932,7 @@ nsWindow::OnKeyReleaseEvent(QKeyEvent *aEvent)
|
||||
#ifdef MOZ_X11
|
||||
if (!domKeyCode) {
|
||||
// get keymap from the Xserver
|
||||
Display *display = QX11Info::display();
|
||||
Display *display = mozilla::DefaultXDisplay();
|
||||
int x_min_keycode = 0, x_max_keycode = 0, xkeysyms_per_keycode;
|
||||
XDisplayKeycodes(display, &x_min_keycode, &x_max_keycode);
|
||||
KeySym *xkeymap = XGetKeyboardMapping(display, x_min_keycode, x_max_keycode - x_min_keycode,
|
||||
@ -2371,9 +2370,9 @@ nsWindow::SetWindowClass(const nsAString &xulWinType)
|
||||
|
||||
QWidget *widget = GetViewWidget();
|
||||
// If widget not show, handle might be null
|
||||
if (widget && widget->handle())
|
||||
XSetClassHint(widget->x11Info().display(),
|
||||
widget->handle(),
|
||||
if (widget && widget->winId())
|
||||
XSetClassHint(gfxQtPlatform::GetXDisplay(widget),
|
||||
widget->winId(),
|
||||
class_hint);
|
||||
|
||||
nsMemory::Free(class_hint->res_class);
|
||||
@ -2571,7 +2570,7 @@ nsWindow::HideWindowChrome(bool aShouldHide)
|
||||
QWidget *widget = GetViewWidget();
|
||||
NS_ENSURE_TRUE(widget, NS_ERROR_FAILURE);
|
||||
#ifdef MOZ_X11
|
||||
XSync(widget->x11Info().display(), False);
|
||||
XSync(gfxQtPlatform::GetXDisplay(widget), False);
|
||||
#endif
|
||||
|
||||
return NS_OK;
|
||||
@ -2721,7 +2720,7 @@ nsWindow::createQWidget(MozQWidget *parent,
|
||||
|
||||
if (gfxQtPlatform::GetPlatform()->GetRenderMode() == gfxQtPlatform::RENDER_DIRECT) {
|
||||
// Disable double buffer and system background rendering
|
||||
#ifdef MOZ_X11
|
||||
#if defined(MOZ_X11) && (QT_VERSION < QT_VERSION_CHECK(5,0,0))
|
||||
newView->viewport()->setAttribute(Qt::WA_PaintOnScreen, true);
|
||||
#endif
|
||||
newView->viewport()->setAttribute(Qt::WA_NoSystemBackground, true);
|
||||
@ -2750,7 +2749,7 @@ nsWindow::createQWidget(MozQWidget *parent,
|
||||
|
||||
#ifdef MOZ_X11
|
||||
if (newView->effectiveWinId()) {
|
||||
XSetWindowBackgroundPixmap(QX11Info::display(),
|
||||
XSetWindowBackgroundPixmap(mozilla::DefaultXDisplay(),
|
||||
newView->effectiveWinId(), None);
|
||||
}
|
||||
#endif
|
||||
@ -3171,7 +3170,7 @@ GetPluginVKBState(Window aWinId)
|
||||
{
|
||||
// Set default value as unexpected error
|
||||
PluginVKBState imeState = VKBUndefined;
|
||||
Display *display = QX11Info::display();
|
||||
Display *display = mozilla::DefaultXDisplay();
|
||||
|
||||
Atom actualType;
|
||||
int actualFormat;
|
||||
@ -3201,7 +3200,7 @@ GetPluginVKBState(Window aWinId)
|
||||
static void
|
||||
SetVKBState(Window aWinId, PluginVKBState aState)
|
||||
{
|
||||
Display *display = QX11Info::display();
|
||||
Display *display = mozilla::DefaultXDisplay();
|
||||
if (aState != VKBUndefined) {
|
||||
unsigned long isOpen = aState == VKBOpen ? 1 : 0;
|
||||
XChangeProperty(display, aWinId, sPluginIMEAtom, XA_CARDINAL, 32,
|
||||
|
@ -42,6 +42,7 @@
|
||||
#define __nsWindow_h__
|
||||
|
||||
#include <QKeyEvent>
|
||||
#include <QGestureEvent>
|
||||
#include <qgraphicswidget.h>
|
||||
#include <QTime>
|
||||
|
||||
|
@ -205,8 +205,8 @@ nsShmImage::Put(GdkWindow* aWindow, cairo_rectangle_list_t* aRects)
|
||||
void
|
||||
nsShmImage::Put(QWidget* aWindow, QRect& aRect)
|
||||
{
|
||||
Display* dpy = aWindow->x11Info().display();
|
||||
Drawable d = aWindow->handle();
|
||||
Display* dpy = gfxQtPlatform::GetXDisplay(aWindow);
|
||||
Drawable d = aWindow->winId();
|
||||
|
||||
GC gc = XCreateGC(dpy, d, 0, nsnull);
|
||||
// Avoid out of bounds painting
|
||||
|
@ -52,6 +52,7 @@
|
||||
#include "nsIWidget.h"
|
||||
#include "gfxASurface.h"
|
||||
|
||||
#include "mozilla/X11Util.h"
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/extensions/XShm.h>
|
||||
@ -59,8 +60,7 @@
|
||||
#if defined(MOZ_WIDGET_GTK2) || defined(MOZ_WIDGET_GTK3)
|
||||
#define DISPLAY gdk_x11_get_default_xdisplay
|
||||
#elif defined(MOZ_WIDGET_QT)
|
||||
#include "QX11Info"
|
||||
#define DISPLAY QX11Info().display
|
||||
#define DISPLAY mozilla::DefaultXDisplay
|
||||
#endif
|
||||
|
||||
class QRect;
|
||||
|
Loading…
Reference in New Issue
Block a user