Comment out X11-specific code to enable Qt Embedded builds
authorVladimir Vukicevic <vladimir@pobox.com>
Sun, 20 Apr 2008 06:54:27 -0700
changeset 16900 881e4a3e9e219083220a158cb7e6e94657462d81
parent 16899 d0f610cf77cd268a0de069149498ae2cf9681065
child 16901 5e41bb64857be7e0f79dca19af29d1907338cd60
push id1298
push userpavlov@mozilla.com
push dateSun, 17 Aug 2008 05:03:09 +0000
treeherderautoland@4a506fa751d8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone2.0a1pre
Comment out X11-specific code to enable Qt Embedded builds
configure.in
widget/src/qt/nsIdleServiceQt.cpp
widget/src/qt/nsWidgetFactory.cpp
widget/src/qt/nsWindow.cpp
--- a/configure.in
+++ b/configure.in
@@ -4771,17 +4771,17 @@ AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION
 AC_SUBST(MOZ_STARTUP_NOTIFICATION_CFLAGS)
 AC_SUBST(MOZ_STARTUP_NOTIFICATION_LIBS)
 
 dnl ========================================================
 dnl = QT support
 dnl ========================================================
 if test "$MOZ_ENABLE_QT"
 then
-    PKG_CHECK_MODULES(MOZ_QT, QtGui QtNetwork QtScript QtTest QtAssistantClient QtXml QtUiTools QtCore QtSvg)
+    PKG_CHECK_MODULES(MOZ_QT, QtGui QtNetwork QtUiTools QtCore)
     AC_SUBST(MOZ_QT_CFLAGS)
     AC_SUBST(MOZ_QT_LIBS)
 
     MOZ_ARG_WITH_STRING(qtdir,
     [  --with-qtdir=\$dir       Specify Qt directory ],
     [ QTDIR=$withval])
 
     if test -z "$QTDIR"; then
--- a/widget/src/qt/nsIdleServiceQt.cpp
+++ b/widget/src/qt/nsIdleServiceQt.cpp
@@ -32,23 +32,25 @@
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
-#include <QX11Info>
-
 #include "nsIdleServiceQt.h"
 #include "nsIServiceManager.h"
 #include "nsDebug.h"
 #include "prlink.h"
 
+
+#ifdef Q_WS_X11
+#include <QX11Info>
+
 typedef PRBool (*_XScreenSaverQueryExtension_fn)(Display* dpy, int* event_base,
                                                  int* error_base);
 
 typedef XScreenSaverInfo* (*_XScreenSaverAllocInfo_fn)(void);
 
 typedef void (*_XScreenSaverQueryInfo_fn)(Display* dpy, Drawable drw,
                                           XScreenSaverInfo *info);
 
@@ -127,8 +129,32 @@ nsIdleServiceQt::GetIdleTime(PRUint32 *a
 
         _XSSQueryInfo(dplay, QX11Info::appRootWindow(), mXssInfo);
         *aTimeDiff = mXssInfo->idle;
         return NS_OK;
     }
 
     return NS_ERROR_FAILURE;
 }
+
+#else
+
+NS_IMPL_ISUPPORTS1(nsIdleServiceQt, nsIIdleService)
+
+nsIdleServiceQt::nsIdleServiceQt()
+{
+}
+
+static void Initialize()
+{
+}
+
+nsIdleServiceQt::~nsIdleServiceQt()
+{
+}
+
+NS_IMETHODIMP
+nsIdleServiceQt::GetIdleTime(PRUint32 *aTimeDiff)
+{
+    return NS_ERROR_FAILURE;
+}
+
+#endif
--- a/widget/src/qt/nsWidgetFactory.cpp
+++ b/widget/src/qt/nsWidgetFactory.cpp
@@ -155,20 +155,22 @@ static const nsModuleComponentInfo compo
     { "Qt Drag Service",
       NS_DRAGSERVICE_CID,
       "@mozilla.org/widget/dragservice;1",
       nsDragServiceConstructor },
     { "Qt Bidi Keyboard",
       NS_BIDIKEYBOARD_CID,
       "@mozilla.org/widget/bidikeyboard;1",
       nsBidiKeyboardConstructor },
+#ifdef Q_WS_X11
     { "Qt Idle Service",
        NS_IDLE_SERVICE_CID,
        "@mozilla.org/widget/idleservice;1",
        nsIdleServiceQtConstructor },
+#endif
     { "Qt Sound",
       NS_SOUND_CID,
       "@mozilla.org/sound;1",
       nsSoundConstructor },
 #ifndef QT_XLIB_SURFACE
     { "Native Theme Renderer",
       NS_THEMERENDERER_CID,
       "@mozilla.org/chrome/chrome-native-theme;1",
--- a/widget/src/qt/nsWindow.cpp
+++ b/widget/src/qt/nsWindow.cpp
@@ -54,17 +54,19 @@
 #include "nsIMenuRollup.h"
 #include "nsIDOMNode.h"
 
 #include "nsWidgetsCID.h"
 #include "nsIDragService.h"
 
 #include "nsQtKeyUtils.h"
 
+#ifdef Q_WS_X11
 #include <X11/XF86keysym.h>
+#endif
 
 #include "nsWidgetAtoms.h"
 
 #ifdef MOZ_ENABLE_STARTUP_NOTIFICATION
 #define SN_API_NOT_YET_FROZEN
 #include <startup-notification-1.0/libsn/sn.h>
 #endif
 
@@ -92,22 +94,25 @@
 #include "gfxXlibSurface.h"
 #include "gfxQPainterSurface.h"
 #include "gfxContext.h"
 #include "gfxImageSurface.h"
 
 #include <qapplication.h>
 #include <qdesktopwidget.h>
 #include <qwidget.h>
-#include "qx11info_x11.h"
 #include <qcursor.h>
 #include <qobject.h>
 #include <execinfo.h>
 #include <stdlib.h>
 
+#ifdef Q_WS_X11
+#include "qx11info_x11.h"
+#endif
+
 #include <execinfo.h>
 
 #include "mozqwidget.h"
 
 /* For PrepareNativeWidget */
 static NS_DEFINE_IID(kDeviceContextCID, NS_DEVICE_CONTEXT_CID);
 
 /* utility functions */
@@ -816,19 +821,21 @@ nsWindow::GetNativeData(PRUint32 aDataTy
         return mDrawingarea;
         break;
     }
 
     case NS_NATIVE_PLUGIN_PORT:
         return SetupPluginPort();
         break;
 
+#ifdef Q_WS_X11
     case NS_NATIVE_DISPLAY:
         return mDrawingarea->x11Info().display();
         break;
+#endif
 
     case NS_NATIVE_GRAPHIC: {
         NS_ASSERTION(nsnull != mToolkit, "NULL toolkit, unable to get a GC");
         return (void *)static_cast<nsToolkit *>(mToolkit)->GetSharedGC();
         break;
     }
 
     case NS_NATIVE_SHELLWIDGET:
@@ -1037,22 +1044,17 @@ nsWindow::LoseFocus(void)
     LOGFOCUS(("  widget lost focus [%p]\n", (void *)this));
 }
 
 static int gDoubleBuffering = -1;
 
 nsEventStatus
 nsWindow::OnExposeEvent(QPaintEvent *aEvent)
 {
-    if (gDoubleBuffering == -1) {
-        if (getenv("MOZ_NO_DOUBLEBUFFER"))
-            gDoubleBuffering = 0;
-        else
-            gDoubleBuffering = 1;
-    }
+    //fprintf (stderr, "===== Expose start\n");
 
     if (mIsDestroyed) {
         LOG(("Expose event on destroyed window [%p] window %p\n",
              (void *)this, mDrawingarea));
         return nsEventStatus_eIgnore;
     }
 
     if (!mDrawingarea)
@@ -1224,16 +1226,18 @@ nsWindow::OnExposeEvent(QPaintEvent *aEv
     }
 #endif
 
     LOGDRAW(("[%p] draw done\n", this));
 
     ctx = nsnull;
     targetSurface = nsnull;
 
+    //fprintf (stderr, "===== Expose end\n");
+
     // check the return value!
     return status;
 }
 
 nsEventStatus
 nsWindow::OnConfigureEvent(QMoveEvent *aEvent)
 {
     LOG(("configure event [%p] %d %d\n", (void *)this,
@@ -1869,16 +1873,17 @@ NS_IMETHODIMP
 nsWindow::SetWindowClass(const nsAString &xulWinType)
 {
   if (!mDrawingarea)
     return NS_ERROR_FAILURE;
 
   nsXPIDLString brandName;
   GetBrandName(brandName);
 
+#ifdef Q_WS_X11
   XClassHint *class_hint = XAllocClassHint();
   if (!class_hint)
     return NS_ERROR_OUT_OF_MEMORY;
   const char *role = NULL;
   class_hint->res_name = ToNewCString(xulWinType);
   if (!class_hint->res_name) {
     XFree(class_hint);
     return NS_ERROR_OUT_OF_MEMORY;
@@ -1910,16 +1915,18 @@ nsWindow::SetWindowClass(const nsAString
   // Can't use gtk_window_set_wmclass() for this; it prints
   // a warning & refuses to make the change.
   XSetClassHint(mDrawingarea->x11Info().display(),
                 mDrawingarea->handle(),
                 class_hint);
   nsMemory::Free(class_hint->res_class);
   nsMemory::Free(class_hint->res_name);
   XFree(class_hint);
+#endif
+
   return NS_OK;
 }
 
 void
 nsWindow::NativeResize(PRInt32 aWidth, PRInt32 aHeight, PRBool  aRepaint)
 {
     LOG(("nsWindow::NativeResize [%p] %d %d\n", (void *)this,
          aWidth, aHeight));
@@ -2386,17 +2393,19 @@ nsWindow::HideWindowChrome(PRBool aShoul
         mDrawingarea->show();
     }
 
     // For some window managers, adding or removing window decorations
     // requires unmapping and remapping our toplevel window.  Go ahead
     // and flush the queue here so that we don't end up with a BadWindow
     // error later when this happens (when the persistence timer fires
     // and GetWindowPos is called)
+#ifdef Q_WS_X11
     XSync(mDrawingarea->x11Info().display(), False);
+#endif
 
     return NS_OK;
 }
 
 /* static */
 /*
 PRBool
 is_mouse_in_window (QWidget* aWindow, double aMouseX, double aMouseY)
@@ -2584,16 +2593,23 @@ nsPopupWindow::~nsPopupWindow()
 }
 
 QWidget*
 nsWindow::createQWidget(QWidget *parent, nsWidgetInitData *aInitData)
 {
     Qt::WFlags flags = Qt::Widget;
     const char *windowName = NULL;
 
+    if (gDoubleBuffering == -1) {
+        if (getenv("MOZ_NO_DOUBLEBUFFER"))
+            gDoubleBuffering = 0;
+        else
+            gDoubleBuffering = 1;
+    }
+
 #ifdef DEBUG_WIDGETS
     qDebug("NEW WIDGET\n\tparent is %p (%s)", (void*)parent,
            parent ? qPrintable(parent->objectName()) : "null");
 #endif
     // ok, create our windows
     switch (mWindowType) {
     case eWindowType_dialog:
         flags |= Qt::Dialog;