Bug 974335 - Refactor Qt Widget Backend implementation. Shared Widget part . r=doug
authorOleg Romashin <romaxa@gmail.com>
Thu, 20 Feb 2014 18:08:53 -0800
changeset 170148 269675d98f5d7f3bd17dbd1318131d5b78376fff
parent 170147 9531922178e3e8255c3cb61c121ede7c92e093a3
child 170149 4f4574e6f08e65bc591f5461c02789f80fae766c
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
reviewersdoug
bugs974335
milestone30.0a1
Bug 974335 - Refactor Qt Widget Backend implementation. Shared Widget part . r=doug
widget/shared/nsShmImage.cpp
widget/shared/nsShmImage.h
widget/xpwidgets/nsBaseWidget.cpp
--- a/widget/shared/nsShmImage.cpp
+++ b/widget/shared/nsShmImage.cpp
@@ -3,17 +3,17 @@
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #if defined(MOZ_WIDGET_GTK)
 #include <gtk/gtk.h>
 #include <gdk/gdkx.h>
 #elif defined(MOZ_WIDGET_QT)
-#include <QWidget>
+#include <QWindow>
 #endif
 
 #include "nsShmImage.h"
 #include "gfxPlatform.h"
 #include "gfxImageSurface.h"
 
 #ifdef MOZ_HAVE_SHMIMAGE
 
@@ -164,24 +164,24 @@ nsShmImage::Put(GdkWindow* aWindow, cair
     // synchronization mechanism; other options are possible.  If this
     // XSync is shown to hurt responsiveness, we need to explore the
     // other options.
     XSync(dpy, False);
 }
 
 #elif defined(MOZ_WIDGET_QT)
 void
-nsShmImage::Put(QWidget* aWindow, QRect& aRect)
+nsShmImage::Put(QWindow* aWindow, QRect& aRect)
 {
     Display* dpy = gfxQtPlatform::GetXDisplay(aWindow);
     Drawable d = aWindow->winId();
 
     GC gc = XCreateGC(dpy, d, 0, nullptr);
     // Avoid out of bounds painting
-    QRect inter = aRect.intersected(aWindow->rect());
+    QRect inter = aRect.intersected(aWindow->geometry());
     XShmPutImage(dpy, d, gc, mImage,
                  inter.x(), inter.y(),
                  inter.x(), inter.y(),
                  inter.width(), inter.height(),
                  False);
     XFreeGC(dpy, gc);
 }
 #endif
--- a/widget/shared/nsShmImage.h
+++ b/widget/shared/nsShmImage.h
@@ -26,17 +26,17 @@
 
 #if defined(MOZ_WIDGET_GTK)
 #define DISPLAY gdk_x11_get_default_xdisplay
 #elif defined(MOZ_WIDGET_QT)
 #define DISPLAY mozilla::DefaultXDisplay
 #endif
 
 class QRect;
-class QWidget;
+class QWindow;
 class gfxASurface;
 
 class nsShmImage {
     NS_INLINE_DECL_REFCOUNTING(nsShmImage)
 
     typedef mozilla::ipc::SharedMemorySysV SharedMemorySysV;
 
 public:
@@ -61,17 +61,17 @@ public:
 
     already_AddRefed<gfxASurface> AsSurface();
 
 #if (MOZ_WIDGET_GTK == 2)
     void Put(GdkWindow* aWindow, GdkRectangle* aRects, GdkRectangle* aEnd);
 #elif (MOZ_WIDGET_GTK == 3)
     void Put(GdkWindow* aWindow, cairo_rectangle_list_t* aRects);
 #elif defined(MOZ_WIDGET_QT)
-    void Put(QWidget* aWindow, QRect& aRect);
+    void Put(QWindow* aWindow, QRect& aRect);
 #endif
 
     gfxIntSize Size() const { return mSize; }
 
 private:
     nsShmImage()
         : mImage(nullptr)
         , mXAttached(false)
--- a/widget/xpwidgets/nsBaseWidget.cpp
+++ b/widget/xpwidgets/nsBaseWidget.cpp
@@ -833,17 +833,17 @@ nsBaseWidget::AutoUseBasicLayerManager::
   mWidget->mTemporarilyUseBasicLayerManager =
     mPreviousTemporarilyUseBasicLayerManager;
 }
 
 bool
 nsBaseWidget::ComputeShouldAccelerate(bool aDefault)
 {
 #if defined(XP_WIN) || defined(ANDROID) || \
-    defined(MOZ_GL_PROVIDER) || defined(XP_MACOSX)
+    defined(MOZ_GL_PROVIDER) || defined(XP_MACOSX) || defined(MOZ_WIDGET_QT)
   bool accelerateByDefault = true;
 #else
   bool accelerateByDefault = false;
 #endif
 
 #ifdef XP_MACOSX
   // 10.6.2 and lower have a bug involving textures and pixel buffer objects
   // that caused bug 629016, so we don't allow OpenGL-accelerated layers on