Merge remote branch 'gerrit/master' into refactor
authorSamuel Rødal <samuel.rodal@nokia.com>
Tue, 12 Jul 2011 10:52:22 +0000 (12:52 +0200)
committerSamuel Rødal <samuel.rodal@nokia.com>
Tue, 12 Jul 2011 10:52:22 +0000 (12:52 +0200)
Conflicts:
src/gui/image/qicon.cpp
src/gui/image/qicon.h
src/gui/image/qicon_p.h
src/gui/text/qfontdatabase.cpp
src/plugins/platforms/wayland/gl_integration/qwaylandglwindowsurface.cpp
src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandglcontext.cpp
src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglwindow.cpp
sync.profile

Change-Id: Ie0a23a12177ff51bf562e15b2dd41f071afb19b4

21 files changed:
1  2 
examples/embedded/embedded.pro
examples/embedded/styleexample/styleexample.pro
examples/graphicsview/chip/mainwindow.cpp
examples/graphicsview/embeddeddialogs/main.cpp
qmake/qmake.pri
src/corelib/global/qglobal.h
src/corelib/kernel/qcoreapplication.cpp
src/corelib/kernel/qobject.cpp
src/gui/painting/qpainter.cpp
src/gui/text/qfontdatabase.cpp
src/gui/text/qfontdatabase_qpa.cpp
src/gui/text/qtextdocument.cpp
src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglwindow.cpp
src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglwindow.h
src/widgets/platforms/mac/qfontdatabase_mac.cpp
src/widgets/platforms/mac/qfontengine_coretext.mm
src/widgets/platforms/mac/qfontengine_coretext_p.h
src/widgets/platforms/s60/qfontdatabase_s60.cpp
src/widgets/platforms/win/qfontdatabase_win.cpp
src/widgets/platforms/x11/qfontdatabase_x11.cpp
sync.profile

Simple merge
@@@ -13,6 -13,5 +13,6 @@@ INSTALLS += target source
  
  symbian {
      TARGET.UID3 = 0xA000A63F
-     CONFIG += qt_demo
+     CONFIG += qt_example
  }
 +QT += widgets widgets
diff --cc qmake/qmake.pri
Simple merge
@@@ -1091,9 -1129,15 +1114,15 @@@ redefine to built-in booleans to make a
  #  define QT_FASTCALL
  #endif
  
+ #ifdef Q_COMPILER_CONSTEXPR
+ # define Q_DECL_CONSTEXPR constexpr
+ #else
+ # define Q_DECL_CONSTEXPR
+ #endif
  //defines the type for the WNDPROC on windows
  //the alignment needs to be forced for sse2 to not crash with mingw
 -#if defined(Q_WS_WIN)
 +#if defined(Q_OS_WIN)
  #  if defined(Q_CC_MINGW)
  #    define QT_ENSURE_STACK_ALIGNED_FOR_SSE __attribute__ ((force_align_arg_pointer))
  #  else
Simple merge
Simple merge
@@@ -2026,20 -2037,16 +2037,16 @@@ QFont QFontDatabase::font(const QStrin
      }
  
      QtFontStyle::Key styleKey(style);
-     QtFontStyle *s = bestStyle(&allStyles, styleKey);
+     QtFontStyle *s = bestStyle(&allStyles, styleKey, style);
  
      if (!s) // no styles found?
 -        return QApplication::font();
 +        return QGuiApplication::font();
-     if (s->key.styleName.isEmpty()) {
-         QFont fnt(family, pointSize, s->key.weight);
-         fnt.setStyle((QFont::Style)s->key.style);
-         return fnt;
-     } else {
-         // found a perfect match
-         QFont fnt(family, pointSize);
-         fnt.setStyleName(s->key.styleName);
-         return fnt;
-     }
+     QFont fnt(family, pointSize, s->key.weight);
+     fnt.setStyle((QFont::Style)s->key.style);
+     if (!s->styleName.isEmpty())
+         fnt.setStyleName(s->styleName);
+     return fnt;
  }
  
  
Simple merge
Simple merge
  ****************************************************************************/
  
  #include "qwaylandxcompositeeglwindow.h"
 +#include "qwaylandxcompositebuffer.h"
 +
 +#include <QtPlatformSupport/private/qeglconvenience_p.h>
 +#include <QtPlatformSupport/private/qxlibeglintegration_p.h>
 +
 +#include "wayland-xcomposite-client-protocol.h"
 +
 +#include <X11/extensions/Xcomposite.h>
+ #include "qwaylandxcompositeeglintegration.h"
+ #include "windowmanager_integration/qwaylandwindowmanagerintegration.h"
  
  #include <QtCore/QDebug>
  
@@@ -69,81 -59,30 +71,90 @@@ QWaylandWindow::WindowType QWaylandXCom
      return QWaylandWindow::Egl;
  }
  
 -QPlatformGLContext * QWaylandXCompositeEGLWindow::glContext() const
 +void QWaylandXCompositeEGLWindow::setGeometry(const QRect &rect)
  {
 -    if (!mContext) {
 -        qDebug() << "creating glcontext;";
 -        QWaylandXCompositeEGLWindow *that = const_cast<QWaylandXCompositeEGLWindow *>(this);
 -        that->mContext = new QWaylandXCompositeEGLContext(mGlxIntegration,that);
 +    QWaylandWindow::setGeometry(rect);
 +
 +    if (m_surface) {
 +        eglDestroySurface(m_glxIntegration->eglDisplay(), m_surface);
 +        m_surface = 0;
      }
 -    return mContext;
  }
  
 -void QWaylandXCompositeEGLWindow::setGeometry(const QRect &rect)
 +EGLSurface QWaylandXCompositeEGLWindow::eglSurface() const
  {
 -    QWaylandWindow::setGeometry(rect);
 +    if (!m_surface)
 +        const_cast<QWaylandXCompositeEGLWindow *>(this)->createEglSurface();
 +    return m_surface;
 +}
 +
 +void QWaylandXCompositeEGLWindow::createEglSurface()
 +{
 +    QSize size(geometry().size());
 +    if (size.isEmpty()) {
 +        // QGLWidget wants a context for a window without geometry
 +        size = QSize(1,1);
 +    }
  
 -    if (mContext) {
 -        mContext->geometryChanged();
 +    delete m_buffer;
 +    //XFreePixmap deletes the glxPixmap as well
 +    if (m_xWindow) {
 +        XDestroyWindow(m_glxIntegration->xDisplay(), m_xWindow);
      }
 +
 +    VisualID visualId = QXlibEglIntegration::getCompatibleVisualId(m_glxIntegration->xDisplay(), m_glxIntegration->eglDisplay(), m_config);
 +
 +    XVisualInfo visualInfoTemplate;
 +    memset(&visualInfoTemplate, 0, sizeof(XVisualInfo));
 +    visualInfoTemplate.visualid = visualId;
 +
 +    int matchingCount = 0;
 +    XVisualInfo *visualInfo = XGetVisualInfo(m_glxIntegration->xDisplay(), VisualIDMask, &visualInfoTemplate, &matchingCount);
 +
 +    Colormap cmap = XCreateColormap(m_glxIntegration->xDisplay(),m_glxIntegration->rootWindow(),visualInfo->visual,AllocNone);
 +
 +    XSetWindowAttributes a;
 +    a.colormap = cmap;
 +    m_xWindow = XCreateWindow(m_glxIntegration->xDisplay(), m_glxIntegration->rootWindow(),0, 0, size.width(), size.height(),
 +                             0, visualInfo->depth, InputOutput, visualInfo->visual,
 +                             CWColormap, &a);
 +
 +    XCompositeRedirectWindow(m_glxIntegration->xDisplay(), m_xWindow, CompositeRedirectManual);
 +    XMapWindow(m_glxIntegration->xDisplay(), m_xWindow);
 +
 +    m_surface = eglCreateWindowSurface(m_glxIntegration->eglDisplay(), m_config, m_xWindow,0);
 +    if (m_surface == EGL_NO_SURFACE) {
 +        qFatal("Could not make eglsurface");
 +    }
 +
 +    XSync(m_glxIntegration->xDisplay(),False);
 +    mBuffer = new QWaylandXCompositeBuffer(m_glxIntegration->waylandXComposite(),
 +                                           (uint32_t)m_xWindow,
 +                                           size,
 +                                           m_glxIntegration->waylandDisplay()->argbVisual());
 +    attach(m_buffer);
 +    wl_display_sync_callback(m_glxIntegration->waylandDisplay()->wl_display(),
 +                             QWaylandXCompositeEGLWindow::sync_function,
 +                             this);
 +
 +    m_waitingForSync = true;
 +    wl_display_sync(m_glxIntegration->waylandDisplay()->wl_display(),0);
 +    m_glxIntegration->waylandDisplay()->flushRequests();
 +    while (m_waitingForSync)
 +        m_glxIntegration->waylandDisplay()->readEvents();
 +}
 +
 +void QWaylandXCompositeEGLWindow::sync_function(void *data)
 +{
 +    QWaylandXCompositeEGLWindow *that = static_cast<QWaylandXCompositeEGLWindow *>(data);
 +    that->m_waitingForSync = false;
  }
+ void QWaylandXCompositeEGLWindow::requestActivateWindow()
+ {
+ #ifdef QT_WAYLAND_WINDOWMANAGER_SUPPORT
+     mDisplay->windowManagerIntegration()->authenticateWithToken();
+ #endif
+     QWaylandWindow::requestActivateWindow();
+ }
  class QWaylandXCompositeEGLWindow : public QWaylandWindow
  {
  public:
 -    QWaylandXCompositeEGLWindow(QWidget *window, QWaylandXCompositeEGLIntegration *glxIntegration);
 +    QWaylandXCompositeEGLWindow(QWindow *window, QWaylandXCompositeEGLIntegration *glxIntegration);
      WindowType windowType() const;
  
 -    QPlatformGLContext *glContext() const;
 -
      void setGeometry(const QRect &rect);
+     void requestActivateWindow();
  
 +    EGLSurface eglSurface() const;
 +
  private:
 -    QWaylandXCompositeEGLIntegration *mGlxIntegration;
 -    QWaylandXCompositeEGLContext *mContext;
 +    void createEglSurface();
 +
 +    QWaylandXCompositeEGLIntegration *m_glxIntegration;
 +    QWaylandXCompositeEGLContext *m_context;
 +    QWaylandBuffer *m_buffer;
 +
 +    Window m_xWindow;
 +    EGLConfig m_config;
 +    EGLSurface m_surface;
 +
 +    bool m_waitingForSync;
  
 +    static void sync_function(void *data);
  };
  
  #endif // QWAYLANDXCOMPOSITEEGLWINDOW_H
diff --cc sync.profile
Simple merge