summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/accessible/widgets/main.cpp2
-rw-r--r--src/plugins/accessible/widgets/qaccessiblewidgets.cpp96
-rw-r--r--src/plugins/accessible/widgets/qaccessiblewidgets.h30
-rw-r--r--src/plugins/accessible/widgets/widgets.json1
-rw-r--r--src/plugins/platforms/cocoa/qpaintengine_mac.mm4
-rw-r--r--src/plugins/platforms/directfb/qdirectfbblitter.cpp4
-rw-r--r--src/plugins/platforms/qnx/qqnxintegration.cpp17
-rw-r--r--src/plugins/platforms/qnx/qqnxintegration.h11
-rw-r--r--src/plugins/platforms/windows/qtwindowsglobal.h5
-rw-r--r--src/plugins/platforms/windows/qwindowscontext.cpp36
-rw-r--r--src/plugins/platforms/windows/qwindowscontext.h5
-rw-r--r--src/plugins/platforms/windows/qwindowseglcontext.cpp2
-rw-r--r--src/plugins/platforms/windows/qwindowsintegration.cpp15
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.cpp6
-rw-r--r--src/plugins/platforms/xcb/README6
-rw-r--r--src/plugins/platforms/xcb/qdri2context.cpp273
-rw-r--r--src/plugins/platforms/xcb/qdri2context.h81
-rw-r--r--src/plugins/platforms/xcb/qxcbbackingstore.cpp5
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection.cpp155
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection.h25
-rw-r--r--src/plugins/platforms/xcb/qxcbdrag.cpp25
-rw-r--r--src/plugins/platforms/xcb/qxcbintegration.cpp14
-rw-r--r--src/plugins/platforms/xcb/qxcbnativeinterface.cpp40
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.cpp13
-rw-r--r--src/plugins/platforms/xcb/xcb.pro16
25 files changed, 297 insertions, 590 deletions
diff --git a/src/plugins/accessible/widgets/main.cpp b/src/plugins/accessible/widgets/main.cpp
index 2db039f9e5..55b1d375dd 100644
--- a/src/plugins/accessible/widgets/main.cpp
+++ b/src/plugins/accessible/widgets/main.cpp
@@ -202,6 +202,8 @@ QAccessibleInterface *AccessibleFactory::create(const QString &classname, QObjec
#ifndef QT_NO_TEXTEDIT
} else if (classname == QLatin1String("QTextEdit")) {
iface = new QAccessibleTextEdit(widget);
+ } else if (classname == QLatin1String("QPlainTextEdit")) {
+ iface = new QAccessiblePlainTextEdit(widget);
#endif
} else if (classname == QLatin1String("QTipLabel")) {
iface = new QAccessibleDisplay(widget, QAccessible::ToolTip);
diff --git a/src/plugins/accessible/widgets/qaccessiblewidgets.cpp b/src/plugins/accessible/widgets/qaccessiblewidgets.cpp
index ad5ef69da4..eac31b8068 100644
--- a/src/plugins/accessible/widgets/qaccessiblewidgets.cpp
+++ b/src/plugins/accessible/widgets/qaccessiblewidgets.cpp
@@ -47,6 +47,7 @@
#include "private/qtextedit_p.h"
#include "qtextdocument.h"
#include "qtextobject.h"
+#include "qplaintextedit.h"
#include "qtextboundaryfinder.h"
#include "qscrollbar.h"
#include "qdebug.h"
@@ -100,6 +101,90 @@ QList<QWidget*> childWidgets(const QWidget *widget, bool includeTopLevel)
#ifndef QT_NO_TEXTEDIT
+QAccessiblePlainTextEdit::QAccessiblePlainTextEdit(QWidget* o)
+ :QAccessibleTextWidget(o)
+{
+ Q_ASSERT(widget()->inherits("QPlainTextEdit"));
+}
+
+QPlainTextEdit* QAccessiblePlainTextEdit::plainTextEdit() const
+{
+ return static_cast<QPlainTextEdit *>(widget());
+}
+
+QString QAccessiblePlainTextEdit::text(QAccessible::Text t) const
+{
+ if (t == QAccessible::Value)
+ return plainTextEdit()->toPlainText();
+
+ return QAccessibleWidget::text(t);
+}
+
+void QAccessiblePlainTextEdit::setText(QAccessible::Text t, const QString &text)
+{
+ if (t != QAccessible::Value) {
+ QAccessibleWidget::setText(t, text);
+ return;
+ }
+ if (plainTextEdit()->isReadOnly())
+ return;
+
+ plainTextEdit()->setPlainText(text);
+}
+
+QAccessible::State QAccessiblePlainTextEdit::state() const
+{
+ QAccessible::State st = QAccessibleWidget::state();
+ if (plainTextEdit()->isReadOnly())
+ st.readOnly = true;
+ else
+ st.editable = true;
+ return st;
+}
+
+void *QAccessiblePlainTextEdit::interface_cast(QAccessible::InterfaceType t)
+{
+ if (t == QAccessible::TextInterface)
+ return static_cast<QAccessibleTextInterface*>(this);
+ return QAccessibleWidget::interface_cast(t);
+}
+
+QPoint QAccessiblePlainTextEdit::scrollBarPosition() const
+{
+ QPoint result;
+ result.setX(plainTextEdit()->horizontalScrollBar() ? plainTextEdit()->horizontalScrollBar()->sliderPosition() : 0);
+ result.setY(plainTextEdit()->verticalScrollBar() ? plainTextEdit()->verticalScrollBar()->sliderPosition() : 0);
+ return result;
+}
+
+QTextCursor QAccessiblePlainTextEdit::textCursor() const
+{
+ return plainTextEdit()->textCursor();
+}
+
+void QAccessiblePlainTextEdit::setTextCursor(const QTextCursor &textCursor)
+{
+ plainTextEdit()->setTextCursor(textCursor);
+}
+
+QTextDocument* QAccessiblePlainTextEdit::textDocument() const
+{
+ return plainTextEdit()->document();
+}
+
+QWidget* QAccessiblePlainTextEdit::viewport() const
+{
+ return plainTextEdit()->viewport();
+}
+
+void QAccessiblePlainTextEdit::scrollToSubstring(int startIndex, int endIndex)
+{
+ //TODO: Not implemented
+ Q_UNUSED(startIndex);
+ Q_UNUSED(endIndex);
+}
+
+
/*!
\class QAccessibleTextEdit
\brief The QAccessibleTextEdit class implements the QAccessibleInterface for richtext editors.
@@ -143,9 +228,9 @@ QWidget *QAccessibleTextEdit::viewport() const
return textEdit()->viewport();
}
-QPoint QAccessibleTextEdit::scrollBarsCurrentPosition() const
+QPoint QAccessibleTextEdit::scrollBarPosition() const
{
- QPoint result(0, 0);
+ QPoint result;
result.setX(textEdit()->horizontalScrollBar() ? textEdit()->horizontalScrollBar()->sliderPosition() : 0);
result.setY(textEdit()->verticalScrollBar() ? textEdit()->verticalScrollBar()->sliderPosition() : 0);
return result;
@@ -750,10 +835,9 @@ QRect QAccessibleTextWidget::characterRect(int offset) const
w, h);
r.moveTo(viewport()->mapToGlobal(r.topLeft()));
}
+ r.translate(-scrollBarPosition());
}
- r.translate(-scrollBarsCurrentPosition());
-
return r;
}
@@ -761,7 +845,7 @@ int QAccessibleTextWidget::offsetAtPoint(const QPoint &point) const
{
QPoint p = viewport()->mapFromGlobal(point);
// convert to document coordinates
- p += scrollBarsCurrentPosition();
+ p += scrollBarPosition();
return textDocument()->documentLayout()->hitTest(p, Qt::ExactHit);
}
@@ -907,7 +991,7 @@ QString QAccessibleTextWidget::text(int startOffset, int endOffset) const
return cursor.selectedText();
}
-QPoint QAccessibleTextWidget::scrollBarsCurrentPosition() const
+QPoint QAccessibleTextWidget::scrollBarPosition() const
{
return QPoint(0, 0);
}
diff --git a/src/plugins/accessible/widgets/qaccessiblewidgets.h b/src/plugins/accessible/widgets/qaccessiblewidgets.h
index b740bf7a6d..ec2583235f 100644
--- a/src/plugins/accessible/widgets/qaccessiblewidgets.h
+++ b/src/plugins/accessible/widgets/qaccessiblewidgets.h
@@ -64,6 +64,7 @@ class QAbstractItemView;
class QDockWidget;
class QDockWidgetLayout;
class QMainWindow;
+class QPlainTextEdit;
class QTextCursor;
class QTextDocument;
@@ -111,7 +112,7 @@ public:
protected:
QTextCursor textCursorForRange(int startOffset, int endOffset) const;
QPair<int, int> getBoundaries(int offset, QAccessible2::BoundaryType boundaryType) const;
- virtual QPoint scrollBarsCurrentPosition() const;
+ virtual QPoint scrollBarPosition() const;
virtual QTextCursor textCursor() const = 0;
virtual void setTextCursor(const QTextCursor &) = 0;
virtual QTextDocument *textDocument() const = 0;
@@ -120,6 +121,29 @@ protected:
#endif //QT_NO_CURSOR
#ifndef QT_NO_TEXTEDIT
+class QAccessiblePlainTextEdit : public QAccessibleTextWidget
+{
+public:
+ explicit QAccessiblePlainTextEdit(QWidget *o);
+
+ QString text(QAccessible::Text t) const;
+ void setText(QAccessible::Text t, const QString &text);
+ QAccessible::State state() const;
+
+ void *interface_cast(QAccessible::InterfaceType t);
+
+ // QAccessibleTextInterface
+ void scrollToSubstring(int startIndex, int endIndex);
+protected:
+ QPlainTextEdit *plainTextEdit() const;
+
+ QPoint scrollBarPosition() const;
+ QTextCursor textCursor() const;
+ void setTextCursor(const QTextCursor &textCursor);
+ QTextDocument *textDocument() const;
+ QWidget *viewport() const;
+};
+
class QAccessibleTextEdit : public QAccessibleTextWidget
{
public:
@@ -137,13 +161,11 @@ public:
protected:
QTextEdit *textEdit() const;
- QPoint scrollBarsCurrentPosition() const;
+ QPoint scrollBarPosition() const;
QTextCursor textCursor() const;
void setTextCursor(const QTextCursor &textCursor);
QTextDocument *textDocument() const;
QWidget *viewport() const;
-private:
- int childOffset;
};
#endif // QT_NO_TEXTEDIT
diff --git a/src/plugins/accessible/widgets/widgets.json b/src/plugins/accessible/widgets/widgets.json
index 21c0157144..69584b9bc8 100644
--- a/src/plugins/accessible/widgets/widgets.json
+++ b/src/plugins/accessible/widgets/widgets.json
@@ -21,6 +21,7 @@
"QGroupBox",
"QStatusBar",
"QProgressBar",
+ "QPlainTextEdit",
"QMenuBar",
"QMenu",
"QHeaderView",
diff --git a/src/plugins/platforms/cocoa/qpaintengine_mac.mm b/src/plugins/platforms/cocoa/qpaintengine_mac.mm
index 8c47527648..404c03dd30 100644
--- a/src/plugins/platforms/cocoa/qpaintengine_mac.mm
+++ b/src/plugins/platforms/cocoa/qpaintengine_mac.mm
@@ -717,8 +717,8 @@ QCoreGraphicsPaintEngine::updateState(const QPaintEngineState &state)
if (flags & DirtyCompositionMode)
updateCompositionMode(state.compositionMode());
- if (flags & (DirtyPen | DirtyTransform)) {
- if (!d->current.pen.isCosmetic()) {
+ if (flags & (DirtyPen | DirtyTransform | DirtyHints)) {
+ if (!qt_pen_is_cosmetic(d->current.pen, state.renderHints())) {
d->cosmeticPen = QCoreGraphicsPaintEnginePrivate::CosmeticNone;
} else if (d->current.transform.m11() < d->current.transform.m22()-1.0 ||
d->current.transform.m11() > d->current.transform.m22()+1.0) {
diff --git a/src/plugins/platforms/directfb/qdirectfbblitter.cpp b/src/plugins/platforms/directfb/qdirectfbblitter.cpp
index 428ee72f9e..cac250fb9d 100644
--- a/src/plugins/platforms/directfb/qdirectfbblitter.cpp
+++ b/src/plugins/platforms/directfb/qdirectfbblitter.cpp
@@ -197,7 +197,9 @@ void QDirectFbBlitter::drawPixmapOpacity(const QRectF &rect, const QPixmap &pixm
m_surface->SetBlittingFlags(m_surface.data(), DFBSurfaceBlittingFlags(blittingFlags));
m_surface->SetPorterDuff(m_surface.data(), porterDuff);
- m_surface->SetDstBlendFunction(m_surface.data(), DSBF_INVSRCALPHA);
+
+ if (cmode == QPainter::CompositionMode_SourceOver)
+ m_surface->SetDstBlendFunction(m_surface.data(), DSBF_INVSRCALPHA);
if ((sRect.w == dRect.w) && (sRect.h == dRect.h))
result = m_surface->Blit(m_surface.data(), s, &sRect, dRect.x, dRect.y);
diff --git a/src/plugins/platforms/qnx/qqnxintegration.cpp b/src/plugins/platforms/qnx/qqnxintegration.cpp
index a45c65db08..adb92741f9 100644
--- a/src/plugins/platforms/qnx/qqnxintegration.cpp
+++ b/src/plugins/platforms/qnx/qqnxintegration.cpp
@@ -89,6 +89,8 @@
#include <QtGui/QOpenGLContext>
#endif
+#include <QtPlatformSupport/private/qsimpledrag_p.h>
+
#include <QtCore/QDebug>
#include <QtCore/QHash>
@@ -128,6 +130,9 @@ QQnxIntegration::QQnxIntegration()
#if !defined(QT_NO_CLIPBOARD)
, m_clipboard(0)
#endif
+#if !defined(QT_NO_DRAGANDDROP)
+ , m_drag(new QSimpleDrag())
+#endif
{
qIntegrationDebug() << Q_FUNC_INFO;
// Open connection to QNX composition manager
@@ -224,6 +229,11 @@ QQnxIntegration::~QQnxIntegration()
qIntegrationDebug() << Q_FUNC_INFO << "platform plugin shutdown begin";
delete m_nativeInterface;
+#if !defined(QT_NO_DRAGANDDROP)
+ // Destroy the drag object
+ delete m_drag;
+#endif
+
#if defined(QQNX_PPS)
// Destroy the hardware button notifier
delete m_buttonsNotifier;
@@ -364,6 +374,13 @@ QPlatformClipboard *QQnxIntegration::clipboard() const
}
#endif
+#if !defined(QT_NO_DRAGANDDROP)
+QPlatformDrag *QQnxIntegration::drag() const
+{
+ return m_drag;
+}
+#endif
+
QVariant QQnxIntegration::styleHint(QPlatformIntegration::StyleHint hint) const
{
qIntegrationDebug() << Q_FUNC_INFO;
diff --git a/src/plugins/platforms/qnx/qqnxintegration.h b/src/plugins/platforms/qnx/qqnxintegration.h
index acedda51c6..441e2c9d68 100644
--- a/src/plugins/platforms/qnx/qqnxintegration.h
+++ b/src/plugins/platforms/qnx/qqnxintegration.h
@@ -62,6 +62,8 @@ class QQnxAbstractNavigator;
class QQnxAbstractVirtualKeyboard;
class QQnxServices;
+class QSimpleDrag;
+
#if defined(QQNX_PPS)
class QQnxInputContext;
class QQnxNavigatorEventNotifier;
@@ -105,7 +107,9 @@ public:
#if !defined(QT_NO_CLIPBOARD)
QPlatformClipboard *clipboard() const;
#endif
-
+#if !defined(QT_NO_DRAGANDDROP)
+ QPlatformDrag *drag() const;
+#endif
QVariant styleHint(StyleHint hint) const;
QPlatformServices *services() const;
@@ -151,9 +155,10 @@ private:
#if !defined(QT_NO_CLIPBOARD)
mutable QQnxClipboard* m_clipboard;
#endif
-
QQnxAbstractNavigator *m_navigator;
-
+#if !defined(QT_NO_DRAGANDDROP)
+ QSimpleDrag *m_drag;
+#endif
static QQnxWindowMapper ms_windowMapper;
static QMutex ms_windowMapperMutex;
diff --git a/src/plugins/platforms/windows/qtwindowsglobal.h b/src/plugins/platforms/windows/qtwindowsglobal.h
index 73f963b6b8..7ff8edb588 100644
--- a/src/plugins/platforms/windows/qtwindowsglobal.h
+++ b/src/plugins/platforms/windows/qtwindowsglobal.h
@@ -105,6 +105,7 @@ enum WindowsEventType // Simplify event types
ThemeChanged = ThemingEventFlag + 1,
DisplayChangedEvent = 437,
SettingChangedEvent = DisplayChangedEvent + 1,
+ ContextMenu = 123,
UnknownEvent = 542
};
@@ -194,6 +195,10 @@ inline QtWindows::WindowsEventType windowsEventType(UINT message, WPARAM wParamI
return QtWindows::DisplayChangedEvent;
case WM_THEMECHANGED:
return QtWindows::ThemeChanged;
+#ifndef QT_NO_CONTEXTMENU
+ case WM_CONTEXTMENU:
+ return QtWindows::ContextMenu;
+#endif
default:
break;
}
diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp
index 3d4871d7a2..a0749388f9 100644
--- a/src/plugins/platforms/windows/qwindowscontext.cpp
+++ b/src/plugins/platforms/windows/qwindowscontext.cpp
@@ -259,6 +259,7 @@ struct QWindowsContextPrivate {
const HRESULT m_oleInitializeResult;
const QByteArray m_eventType;
QWindow *m_lastActiveWindow;
+ bool m_asyncExpose;
};
QWindowsContextPrivate::QWindowsContextPrivate() :
@@ -267,7 +268,7 @@ QWindowsContextPrivate::QWindowsContextPrivate() :
m_defaultDPI(GetDeviceCaps(m_displayContext,LOGPIXELSY)),
m_oleInitializeResult(OleInitialize(NULL)),
m_eventType(QByteArrayLiteral("windows_generic_MSG")),
- m_lastActiveWindow(0)
+ m_lastActiveWindow(0), m_asyncExpose(0)
{
#ifndef Q_OS_WINCE
QWindowsContext::user32dll.init();
@@ -869,6 +870,11 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message,
QWindowsWindow::baseWindowOf(modalWindow)->alertWindow();
break;
#endif
+#ifndef QT_NO_CONTEXTMENU
+ case QtWindows::ContextMenu:
+ handleContextMenuEvent(platformWindow->window(), msg);
+ return true;
+#endif
default:
break;
}
@@ -900,6 +906,34 @@ void QWindowsContext::handleFocusEvent(QtWindows::WindowsEventType et,
}
}
+#ifndef QT_NO_CONTEXTMENU
+void QWindowsContext::handleContextMenuEvent(QWindow *window, const MSG &msg)
+{
+ bool mouseTriggered = false;
+ QPoint globalPos;
+ QPoint pos;
+ if (msg.lParam != (int)0xffffffff) {
+ mouseTriggered = true;
+ globalPos.setX(msg.pt.x);
+ globalPos.setY(msg.pt.y);
+ pos = QWindowsGeometryHint::mapFromGlobal(msg.hwnd, globalPos);
+ }
+
+ QWindowSystemInterface::handleContextMenuEvent(window, mouseTriggered, pos, globalPos,
+ QWindowsKeyMapper::queryKeyboardModifiers());
+}
+#endif
+
+bool QWindowsContext::asyncExpose() const
+{
+ return d->m_asyncExpose;
+}
+
+void QWindowsContext::setAsyncExpose(bool value)
+{
+ d->m_asyncExpose = value;
+}
+
/*!
\brief Windows functions for actual windows.
diff --git a/src/plugins/platforms/windows/qwindowscontext.h b/src/plugins/platforms/windows/qwindowscontext.h
index dcc636bfc0..21a846ef97 100644
--- a/src/plugins/platforms/windows/qwindowscontext.h
+++ b/src/plugins/platforms/windows/qwindowscontext.h
@@ -184,9 +184,14 @@ public:
#endif
static QByteArray comErrorString(HRESULT hr);
+ bool asyncExpose() const;
+ void setAsyncExpose(bool value);
private:
void handleFocusEvent(QtWindows::WindowsEventType et, QWindowsWindow *w);
+#ifndef QT_NO_CONTEXTMENU
+ void handleContextMenuEvent(QWindow *window, const MSG &msg);
+#endif
void unregisterWindowClasses();
QScopedPointer<QWindowsContextPrivate> d;
diff --git a/src/plugins/platforms/windows/qwindowseglcontext.cpp b/src/plugins/platforms/windows/qwindowseglcontext.cpp
index 6680a9dc2b..0ad07fe5cf 100644
--- a/src/plugins/platforms/windows/qwindowseglcontext.cpp
+++ b/src/plugins/platforms/windows/qwindowseglcontext.cpp
@@ -115,7 +115,7 @@ QWindowsEGLStaticContext::~QWindowsEGLStaticContext()
When building for 64bit, de-activate the "WarnAsError" option
in every project file (as otherwise integer conversion
warnings will break the build).
- \o Run configure.exe with the options "-opengl es2 -angle <path>".
+ \o Run configure.exe with the options "-opengl es2".
\o Build qtbase and test some examples.
\endlist
diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp
index 50ffb85b01..b7309c3f7c 100644
--- a/src/plugins/platforms/windows/qwindowsintegration.cpp
+++ b/src/plugins/platforms/windows/qwindowsintegration.cpp
@@ -96,6 +96,7 @@ QT_BEGIN_NAMESPACE
class QWindowsNativeInterface : public QPlatformNativeInterface
{
Q_OBJECT
+ Q_PROPERTY(bool asyncExpose READ asyncExpose WRITE setAsyncExpose)
public:
#ifndef QT_NO_OPENGL
virtual void *nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context);
@@ -106,6 +107,8 @@ public:
Q_INVOKABLE void *createMessageWindow(const QString &classNameTemplate,
const QString &windowName,
void *eventProc) const;
+ bool asyncExpose() const;
+ void setAsyncExpose(bool value);
};
void *QWindowsNativeInterface::nativeResourceForWindow(const QByteArray &resource, QWindow *window)
@@ -183,6 +186,16 @@ void *QWindowsNativeInterface::createMessageWindow(const QString &classNameTempl
return hwnd;
}
+bool QWindowsNativeInterface::asyncExpose() const
+{
+ return QWindowsContext::instance()->asyncExpose();
+}
+
+void QWindowsNativeInterface::setAsyncExpose(bool value)
+{
+ QWindowsContext::instance()->setAsyncExpose(value);
+}
+
/*!
\class QWindowsIntegration
\brief QPlatformIntegration implementation for Windows.
@@ -375,7 +388,7 @@ QPlatformOpenGLContext
return 0;
d->m_staticEGLContext = QSharedPointer<QWindowsEGLStaticContext>(staticContext);
}
- return new QWindowsEGLContext(d->m_staticEGLContext, context->format(), context->handle());
+ return new QWindowsEGLContext(d->m_staticEGLContext, context->format(), context->shareHandle());
#else // QT_OPENGL_ES_2
if (d->m_staticOpenGLContext.isNull())
d->m_staticOpenGLContext =
diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp
index 99b8922768..9aada91e73 100644
--- a/src/plugins/platforms/windows/qwindowswindow.cpp
+++ b/src/plugins/platforms/windows/qwindowswindow.cpp
@@ -1158,7 +1158,8 @@ bool QWindowsWindow::handleWmPaint(HWND hwnd, UINT message,
InvalidateRect(hwnd, 0, false);
BeginPaint(hwnd, &ps);
QWindowSystemInterface::handleExposeEvent(window(), QRegion(qrectFromRECT(ps.rcPaint)));
- QWindowSystemInterface::flushWindowSystemEvents();
+ if (!QWindowsContext::instance()->asyncExpose())
+ QWindowSystemInterface::flushWindowSystemEvents();
EndPaint(hwnd, &ps);
} else {
@@ -1169,7 +1170,8 @@ bool QWindowsWindow::handleWmPaint(HWND hwnd, UINT message,
qDebug() << __FUNCTION__ << this << window() << updateRect;
QWindowSystemInterface::handleExposeEvent(window(), QRegion(updateRect));
- QWindowSystemInterface::flushWindowSystemEvents();
+ if (!QWindowsContext::instance()->asyncExpose())
+ QWindowSystemInterface::flushWindowSystemEvents();
EndPaint(hwnd, &ps);
}
return true;
diff --git a/src/plugins/platforms/xcb/README b/src/plugins/platforms/xcb/README
index 264d28c6b4..59d9ffe39b 100644
--- a/src/plugins/platforms/xcb/README
+++ b/src/plugins/platforms/xcb/README
@@ -1,14 +1,14 @@
Requires libxcb >= 1.5.
Required packages:
-libxcb1 libxcb1-dev libx11-xcb1 libx11-xcb-dev libxcb-keysyms1 libxcb-keysyms1-dev libxcb-image0 libxcb-image0-dev libxcb-shm0 libxcb-shm0-dev libxcb-icccm1 libxcb-icccm1-dev libxcb-sync0 libxcb-sync0-dev libxcb-render-util0 libxcb-render-util0-dev libxcb-xfixes0-dev libxrender-dev libxcb-shape0-dev libxcb-randr0-dev
+libxcb1 libxcb1-dev libx11-xcb1 libx11-xcb-dev libxcb-keysyms1 libxcb-keysyms1-dev libxcb-image0 libxcb-image0-dev libxcb-shm0 libxcb-shm0-dev libxcb-icccm1 libxcb-icccm1-dev libxcb-sync0 libxcb-sync0-dev libxcb-render-util0 libxcb-render-util0-dev libxcb-xfixes0-dev libxrender-dev libxcb-shape0-dev libxcb-randr0-dev libxcb-glx0-dev
On Ubuntu 11.10 icccm1 is replaced by icccm4 and xcb-render-util is not available:
-libxcb1 libxcb1-dev libx11-xcb1 libx11-xcb-dev libxcb-keysyms1 libxcb-keysyms1-dev libxcb-image0 libxcb-image0-dev libxcb-shm0 libxcb-shm0-dev libxcb-icccm4 libxcb-icccm4-dev libxcb-sync0 libxcb-sync0-dev libxcb-xfixes0-dev libxrender-dev libxcb-shape0-dev libxcb-randr0-dev
+libxcb1 libxcb1-dev libx11-xcb1 libx11-xcb-dev libxcb-keysyms1 libxcb-keysyms1-dev libxcb-image0 libxcb-image0-dev libxcb-shm0 libxcb-shm0-dev libxcb-icccm4 libxcb-icccm4-dev libxcb-sync0 libxcb-sync0-dev libxcb-xfixes0-dev libxrender-dev libxcb-shape0-dev libxcb-randr0-dev libxcb-glx0-dev
The packages for xcb-render-util can be installed manually from http://packages.ubuntu.com/natty/libxcb-render-util0 and http://packages.ubuntu.com/natty/libxcb-render-util0-dev
On Ubuntu 12.04 icccm1 is replaced by icccm4 and xcb-render-util can be installed automatically:
-libxcb1 libxcb1-dev libx11-xcb1 libx11-xcb-dev libxcb-keysyms1 libxcb-keysyms1-dev libxcb-image0 libxcb-image0-dev libxcb-shm0 libxcb-shm0-dev libxcb-icccm4 libxcb-icccm4-dev libxcb-sync0 libxcb-sync0-dev libxcb-xfixes0-dev libxrender-dev libxcb-shape0-dev libxcb-randr0-dev libxcb-render-util0 libxcb-render-util0-dev
+libxcb1 libxcb1-dev libx11-xcb1 libx11-xcb-dev libxcb-keysyms1 libxcb-keysyms1-dev libxcb-image0 libxcb-image0-dev libxcb-shm0 libxcb-shm0-dev libxcb-icccm4 libxcb-icccm4-dev libxcb-sync0 libxcb-sync0-dev libxcb-xfixes0-dev libxrender-dev libxcb-shape0-dev libxcb-randr0-dev libxcb-render-util0 libxcb-render-util0-dev libxcb-glx0-dev
On Fedora, the following packages are required:
diff --git a/src/plugins/platforms/xcb/qdri2context.cpp b/src/plugins/platforms/xcb/qdri2context.cpp
deleted file mode 100644
index 5f116fe0f6..0000000000
--- a/src/plugins/platforms/xcb/qdri2context.cpp
+++ /dev/null
@@ -1,273 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qdri2context.h"
-
-#include "qxcbwindow.h"
-#include "qxcbconnection.h"
-
-#include <QtCore/QDebug>
-#include <QtWidgets/QWidget>
-
-#include <xcb/dri2.h>
-#include <xcb/xfixes.h>
-
-#define MESA_EGL_NO_X11_HEADERS
-#define EGL_EGLEXT_PROTOTYPES
-#include <EGL/egl.h>
-#include <EGL/eglext.h>
-
-#define GL_GLEXT_PROTOTYPES
-#include <GLES2/gl2.h>
-#include <GLES2/gl2ext.h>
-
-QT_BEGIN_NAMESPACE
-
-class QDri2ContextPrivate
-{
-public:
- QDri2ContextPrivate(QXcbWindow *window)
- : qXcbWindow(window)
- , windowFormat(window->widget()->platformWindowFormat())
- , image(0)
- {
- }
-
- xcb_window_t xcbWindow() { return qXcbWindow->window(); }
- xcb_connection_t *xcbConnection() { return qXcbWindow->xcb_connection(); }
-
- QXcbWindow *qXcbWindow;
- QPlatformWindowFormat windowFormat;
-
- EGLContext eglContext;
-
- EGLImageKHR image;
-
- GLuint fbo;
- GLuint rbo;
- GLuint depth;
-
- QSize size;
-};
-
-QDri2Context::QDri2Context(QXcbWindow *window)
- : d_ptr(new QDri2ContextPrivate(window))
-{
- Q_D(QDri2Context);
-
- static const EGLint contextAttribs[] = {
- EGL_CONTEXT_CLIENT_VERSION, 2,
- EGL_NONE
- };
-
- eglBindAPI(EGL_OPENGL_ES_API);
-
- EGLContext shareContext = EGL_NO_CONTEXT;
- if (window->widget()->platformWindowFormat().sharedGLContext()) {
- QDri2Context *context = static_cast<QDri2Context *>(window->widget()->platformWindowFormat().sharedGLContext());
- shareContext = context->d_func()->eglContext;
- }
- d->eglContext = eglCreateContext(EGL_DISPLAY_FROM_XCB(d->qXcbWindow), NULL,
- shareContext, contextAttribs);
-
- if (d->eglContext == EGL_NO_CONTEXT) {
- qDebug() << "No eglContext!" << eglGetError();
- }
-
- EGLBoolean makeCurrentSuccess = eglMakeCurrent(EGL_DISPLAY_FROM_XCB(d->qXcbWindow),EGL_NO_SURFACE,EGL_NO_SURFACE,d->eglContext);
- if (!makeCurrentSuccess) {
- qDebug() << "eglMakeCurrent failed!" << eglGetError();
- }
-
- xcb_dri2_create_drawable (d->xcbConnection(), d->xcbWindow());
-
- glGenFramebuffers(1,&d->fbo);
- glBindFramebuffer(GL_FRAMEBUFFER,d->fbo);
- glActiveTexture(GL_TEXTURE0);
-
- glGenRenderbuffers(1, &d->rbo);
- glBindRenderbuffer(GL_RENDERBUFFER, d->rbo);
-
- glGenRenderbuffers(1,&d->depth);
- glBindRenderbuffer(GL_RENDERBUFFER, d->depth);
-
- resize(d->qXcbWindow->widget()->geometry().size());
-
- glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, d->rbo);
- glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERER,d->depth);
- glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERER,d->depth);
-
- //restore the old current context
- const QPlatformOpenGLContext *currentContext = QPlatformOpenGLContext::currentContext();
- if (currentContext)
- const_cast<QPlatformOpenGLContext*>(currentContext)->makeCurrent();
-}
-
-QDri2Context::~QDri2Context()
-{
- //cleanup
-}
-
-void QDri2Context::makeCurrent()
-{
- Q_D(QDri2Context);
-
- eglMakeCurrent(EGL_DISPLAY_FROM_XCB(d->qXcbWindow),EGL_NO_SURFACE,EGL_NO_SURFACE,d->eglContext);
- glBindFramebuffer(GL_FRAMEBUFFER,d->fbo);
-
-}
-
-void QDri2Context::doneCurrent()
-{
- Q_D(QDri2Context);
- eglMakeCurrent(EGL_DISPLAY_FROM_XCB(d->qXcbWindow),EGL_NO_SURFACE,EGL_NO_SURFACE,EGL_NO_CONTEXT);
-}
-
-void QDri2Context::swapBuffers()
-{
- Q_D(QDri2Context);
- xcb_rectangle_t rectangle;
- rectangle.x = 0;
- rectangle.y = 0;
- rectangle.width = d->qXcbWindow->widget()->geometry().width();
- rectangle.height = d->qXcbWindow->widget()->geometry().height();
-
- xcb_xfixes_region_t xfixesRegion = xcb_generate_id(d->xcbConnection());
- xcb_xfixes_create_region(d->xcbConnection(), xfixesRegion,
- 1, &rectangle);
-
- xcb_dri2_copy_region_cookie_t cookie = xcb_dri2_copy_region_unchecked(d->xcbConnection(),
- d->qXcbWindow->window(),
- xfixesRegion,
- XCB_DRI2_ATTACHMENT_BUFFER_FRONT_LEFT,
- XCB_DRI2_ATTACHMENT_BUFFER_BACK_LEFT);
-
- xcb_dri2_copy_region_reply_t *reply = xcb_dri2_copy_region_reply(d->xcbConnection(),cookie,NULL);
-
- //cleanup
- delete reply;
- xcb_xfixes_destroy_region(d->xcbConnection(), xfixesRegion);
-
-}
-
-void * QDri2Context::getProcAddress(const QString &procName)
-{
- return (void *)eglGetProcAddress(qPrintable(procName));
-}
-
-void QDri2Context::resize(const QSize &size)
-{
- Q_D(QDri2Context);
- d->size= size;
-
- glBindFramebuffer(GL_FRAMEBUFFER,d->fbo);
-
- xcb_dri2_dri2_buffer_t *backBfr = backBuffer();
-
- if (d->image) {
- qDebug() << "destroing image";
- eglDestroyImageKHR(EGL_DISPLAY_FROM_XCB(d->qXcbWindow),d->image);
- }
-
- EGLint imgAttribs[] = {
- EGL_WIDTH, d->size.width(),
- EGL_HEIGHT, d->size.height(),
- EGL_DRM_BUFFER_STRIDE_MESA, backBfr->pitch /4,
- EGL_DRM_BUFFER_FORMAT_MESA, EGL_DRM_BUFFER_FORMAT_ARGB32_MESA,
- EGL_NONE
- };
-
- d->image = eglCreateImageKHR(EGL_DISPLAY_FROM_XCB(d->qXcbWindow),
- EGL_NO_CONTEXT,
- EGL_DRM_BUFFER_MESA,
- (EGLClientBuffer) backBfr->name,
- imgAttribs);
-
- glBindRenderbuffer(GL_RENDERBUFFER, d->rbo);
- glEGLImageTargetRenderbufferStorageOES(GL_RENDERBUFFER,
- d->image);
-
- glBindRenderbuffer(GL_RENDERBUFFER, d->depth);
- glRenderbufferStorage(GL_RENDERBUFFER,GL_DEPTH24_STENCIL8_OES,d->size.width(), d->size.height());
-
-}
-
-QPlatformWindowFormat QDri2Context::platformWindowFormat() const
-{
- Q_D(const QDri2Context);
- return d->windowFormat;
-}
-
-xcb_dri2_dri2_buffer_t * QDri2Context::backBuffer()
-{
- Q_D(QDri2Context);
-
- unsigned int backBufferAttachment = XCB_DRI2_ATTACHMENT_BUFFER_BACK_LEFT;
- xcb_dri2_get_buffers_cookie_t cookie = xcb_dri2_get_buffers_unchecked (d->xcbConnection(),
- d->xcbWindow(),
- 1, 1, &backBufferAttachment);
-
- xcb_dri2_get_buffers_reply_t *reply = xcb_dri2_get_buffers_reply (d->xcbConnection(), cookie, NULL);
- if (!reply) {
- qDebug() << "failed to get buffers reply";
- return 0;
- }
-
- xcb_dri2_dri2_buffer_t *buffers = xcb_dri2_get_buffers_buffers (reply);
- if (!buffers) {
- qDebug() << "failed to get buffers";
- return 0;
- }
-
- Q_ASSERT(reply->count == 1);
-
- delete reply;
-
- return buffers;
-}
-
-void * QDri2Context::eglContext() const
-{
- Q_D(const QDri2Context);
- return d->eglContext;
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/platforms/xcb/qdri2context.h b/src/plugins/platforms/xcb/qdri2context.h
deleted file mode 100644
index e355eb5c28..0000000000
--- a/src/plugins/platforms/xcb/qdri2context.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QDRI2CONTEXT_H
-#define QDRI2CONTEXT_H
-
-#include <qpa/qplatformopenglcontext.h>
-
-struct xcb_dri2_dri2_buffer_t;
-
-QT_BEGIN_NAMESPACE
-
-class QXcbWindow;
-class QDri2ContextPrivate;
-
-class QDri2Context : public QPlatformOpenGLContext
-{
- Q_DECLARE_PRIVATE(QDri2Context);
-public:
- QDri2Context(QXcbWindow *window);
- ~QDri2Context();
-
- void makeCurrent();
- void doneCurrent();
- void swapBuffers();
- void* getProcAddress(const QString& procName);
-
- void resize(const QSize &size);
-
- QPlatformWindowFormat platformWindowFormat() const;
-
- void *eglContext() const;
-
-protected:
- xcb_dri2_dri2_buffer_t *backBuffer();
- QScopedPointer<QDri2ContextPrivate> d_ptr;
-private:
- Q_DISABLE_COPY(QDri2Context)
-};
-
-QT_END_NAMESPACE
-
-#endif // QDRI2CONTEXT_H
diff --git a/src/plugins/platforms/xcb/qxcbbackingstore.cpp b/src/plugins/platforms/xcb/qxcbbackingstore.cpp
index 847fd67047..649469ab9d 100644
--- a/src/plugins/platforms/xcb/qxcbbackingstore.cpp
+++ b/src/plugins/platforms/xcb/qxcbbackingstore.cpp
@@ -262,11 +262,14 @@ QXcbBackingStore::~QXcbBackingStore()
QPaintDevice *QXcbBackingStore::paintDevice()
{
- return m_image->image();
+ return m_image ? m_image->image() : 0;
}
void QXcbBackingStore::beginPaint(const QRegion &region)
{
+ if (!m_image)
+ return;
+
m_image->preparePaint(region);
#if 0
diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp
index ad9fb1d19c..85f6fc9213 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection.cpp
@@ -60,6 +60,8 @@
#include <stdio.h>
#include <errno.h>
+#include <xcb/shm.h>
+#include <xcb/sync.h>
#include <xcb/xfixes.h>
#ifdef XCB_USE_XLIB
@@ -72,19 +74,12 @@
#include <xcb/render.h>
#endif
-#ifdef XCB_USE_EGL //don't pull in eglext prototypes
-#include <EGL/egl.h>
+#if defined(XCB_HAS_XCB_GLX)
+#include <xcb/glx.h>
#endif
-#ifdef XCB_USE_DRI2
-#include <xcb/dri2.h>
-extern "C" {
-#include <xf86drm.h>
-}
-#define MESA_EGL_NO_X11_HEADERS
-#define EGL_EGLEXT_PROTOTYPES
+#ifdef XCB_USE_EGL //don't pull in eglext prototypes
#include <EGL/egl.h>
-#include <EGL/eglext.h>
#endif
#if defined(XCB_USE_XINPUT2) || defined(XCB_USE_XINPUT2_MAEMO)
@@ -255,14 +250,9 @@ QXcbConnection::QXcbConnection(QXcbNativeInterface *nativeInterface, const char
#ifdef XCB_USE_XINPUT2_MAEMO
, m_xinputData(0)
#endif
-#ifdef XCB_USE_DRI2
- , m_dri2_major(0)
- , m_dri2_minor(0)
- , m_dri2_support_probed(false)
- , m_has_support_for_dri2(false)
-#endif
, xfixes_first_event(0)
, xrandr_first_event(0)
+ , has_glx_extension(false)
, has_shape_extension(false)
, has_randr_extension(false)
, has_input_shape(false)
@@ -303,7 +293,19 @@ QXcbConnection::QXcbConnection(QXcbNativeInterface *nativeInterface, const char
connect(dispatcher, SIGNAL(awake()), this, SLOT(processXcbEvents()));
#endif
- xcb_prefetch_extension_data (m_connection, &xcb_xfixes_id);
+ xcb_extension_t *extensions[] = {
+ &xcb_shm_id, &xcb_xfixes_id, &xcb_randr_id, &xcb_shape_id, &xcb_sync_id,
+#ifdef XCB_USE_RENDER
+ &xcb_render_id,
+#endif
+#ifdef XCB_HAS_XCB_GLX
+ &xcb_glx_id,
+#endif
+ 0
+ };
+
+ for (xcb_extension_t **ext_it = extensions; *ext_it; ++ext_it)
+ xcb_prefetch_extension_data (m_connection, *ext_it);
m_setup = xcb_get_setup(xcb_connection());
@@ -320,6 +322,7 @@ QXcbConnection::QXcbConnection(QXcbNativeInterface *nativeInterface, const char
0, 0, 1, 1, 0, XCB_WINDOW_CLASS_INPUT_ONLY,
m_screens.at(0)->screen()->root_visual, 0, 0);
+ initializeGLX();
initializeXFixes();
initializeXRender();
m_xi2Enabled = false;
@@ -339,9 +342,6 @@ QXcbConnection::QXcbConnection(QXcbNativeInterface *nativeInterface, const char
m_drag = new QXcbDrag(this);
#endif
-#ifdef XCB_USE_DRI2
- initializeDri2();
-#endif
sync();
}
@@ -1312,6 +1312,33 @@ void QXcbConnection::initializeXRender()
#endif
}
+void QXcbConnection::initializeGLX()
+{
+#ifdef XCB_HAS_XCB_GLX
+ const xcb_query_extension_reply_t *reply = xcb_get_extension_data(m_connection, &xcb_glx_id);
+ if (!reply || !reply->present)
+ return;
+
+ has_glx_extension = true;
+
+ xcb_generic_error_t *error = 0;
+ xcb_glx_query_version_cookie_t xglx_query_cookie = xcb_glx_query_version(m_connection,
+ XCB_GLX_MAJOR_VERSION,
+ XCB_GLX_MINOR_VERSION);
+ xcb_glx_query_version_reply_t *xglx_query = xcb_glx_query_version_reply(m_connection,
+ xglx_query_cookie, &error);
+ if (!xglx_query || error) {
+ qWarning("QXcbConnection: Failed to initialize GLX");
+ free(error);
+ has_glx_extension = false;
+ }
+ free(xglx_query);
+#else
+ // no way to check, assume GLX is present
+ has_glx_extension = true;
+#endif
+}
+
void QXcbConnection::initializeXRandr()
{
const xcb_query_extension_reply_t *reply = xcb_get_extension_data(m_connection, &xcb_randr_id);
@@ -1363,94 +1390,6 @@ bool QXcbConnection::hasEgl() const
}
#endif // defined(XCB_USE_EGL)
-#ifdef XCB_USE_DRI2
-void QXcbConnection::initializeDri2()
-{
- xcb_dri2_connect_cookie_t connect_cookie = xcb_dri2_connect_unchecked (m_connection,
- m_screens[0]->root(),
- XCB_DRI2_DRIVER_TYPE_DRI);
-
- xcb_dri2_connect_reply_t *connect = xcb_dri2_connect_reply (m_connection,
- connect_cookie, NULL);
-
- if (! connect || connect->driver_name_length + connect->device_name_length == 0) {
- qWarning("QXcbConnection: Failed to connect to DRI2");
- return;
- }
-
- m_dri2_device_name = QByteArray(xcb_dri2_connect_device_name (connect),
- xcb_dri2_connect_device_name_length (connect));
- delete connect;
-
- int fd = open(m_dri2_device_name.constData(), O_RDWR);
- if (fd < 0) {
- qWarning() << "QXcbConnection: Couldn't open DRI2 device" << m_dri2_device_name;
- m_dri2_device_name = QByteArray();
- return;
- }
-
- drm_magic_t magic;
- if (drmGetMagic(fd, &magic)) {
- qWarning("QXcbConnection: Failed to get drmMagic");
- return;
- }
-
- xcb_dri2_authenticate_cookie_t authenticate_cookie = xcb_dri2_authenticate_unchecked(m_connection,
- m_screens[0]->root(), magic);
- xcb_dri2_authenticate_reply_t *authenticate = xcb_dri2_authenticate_reply(m_connection,
- authenticate_cookie, NULL);
- if (authenticate == NULL || !authenticate->authenticated) {
- qWarning("QXcbConnection: DRI2: failed to authenticate");
- free(authenticate);
- return;
- }
-
- delete authenticate;
-
- EGLDisplay display = eglGetDRMDisplayMESA(fd);
- if (!display) {
- qWarning("QXcbConnection: Failed to create EGL display using DRI2");
- return;
- }
-
- m_egl_display = display;
- EGLint major,minor;
- if (!eglInitialize(display, &major, &minor)) {
- qWarning("QXcbConnection: Failed to initialize EGL display using DRI2");
- return;
- }
-}
-
-bool QXcbConnection::hasSupportForDri2() const
-{
- if (!m_dri2_support_probed) {
- xcb_generic_error_t *error = 0;
-
- xcb_prefetch_extension_data (m_connection, &xcb_dri2_id);
-
- xcb_dri2_query_version_cookie_t dri2_query_cookie = xcb_dri2_query_version (m_connection,
- XCB_DRI2_MAJOR_VERSION,
- XCB_DRI2_MINOR_VERSION);
-
- xcb_dri2_query_version_reply_t *dri2_query = xcb_dri2_query_version_reply (m_connection,
- dri2_query_cookie, &error);
- if (!dri2_query || error) {
- delete error;
- delete dri2_query;
- return false;
- }
-
- QXcbConnection *that = const_cast<QXcbConnection *>(this);
- that->m_dri2_major = dri2_query->major_version;
- that->m_dri2_minor = dri2_query->minor_version;
-
- that->m_has_support_for_dri2 = true;
- that->m_dri2_support_probed = true;
- }
- return m_has_support_for_dri2;
-}
-#endif //XCB_USE_DRI2
-
#if defined(XCB_USE_XINPUT2) || defined(XCB_USE_XINPUT2_MAEMO)
// Borrowed from libXi.
int QXcbConnection::xi2CountBits(unsigned char *ptr, int len)
diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h
index 8a6c418788..8b2315c67e 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.h
+++ b/src/plugins/platforms/xcb/qxcbconnection.h
@@ -338,14 +338,10 @@ public:
void *xlib_display() const { return m_xlib_display; }
#endif
-#ifdef XCB_USE_DRI2
- bool hasSupportForDri2() const;
- QByteArray dri2DeviceName() const { return m_dri2_device_name; }
-#endif
#ifdef XCB_USE_EGL
bool hasEgl() const;
#endif
-#if defined(XCB_USE_EGL) || defined(XCB_USE_DRI2)
+#if defined(XCB_USE_EGL)
void *egl_display() const { return m_egl_display; }
#endif
#ifdef XCB_USE_XINPUT2_MAEMO
@@ -374,6 +370,7 @@ public:
inline xcb_timestamp_t time() const { return m_time; }
inline void setTime(xcb_timestamp_t t) { if (t > m_time) m_time = t; }
+ bool hasGLX() const { return has_glx_extension; }
bool hasXFixes() const { return xfixes_first_event > 0; }
bool hasXShape() const { return has_shape_extension; }
bool hasXRandr() const { return has_randr_extension; }
@@ -387,13 +384,11 @@ private slots:
private:
void initializeAllAtoms();
void sendConnectionEvent(QXcbAtom::Atom atom, uint id = 0);
+ void initializeGLX();
void initializeXFixes();
void initializeXRender();
void initializeXRandr();
void initializeXShape();
-#ifdef XCB_USE_DRI2
- void initializeDri2();
-#endif
#ifdef XCB_USE_XINPUT2_MAEMO
void initializeXInput2Maemo();
void finalizeXInput2Maemo();
@@ -476,14 +471,7 @@ private:
QHash<int, QWindowSystemInterface::TouchPoint> m_touchPoints;
QHash<int, XInput2DeviceData*> m_touchDevices;
#endif
-#ifdef XCB_USE_DRI2
- uint32_t m_dri2_major;
- uint32_t m_dri2_minor;
- bool m_dri2_support_probed;
- bool m_has_support_for_dri2;
- QByteArray m_dri2_device_name;
-#endif
-#if defined(XCB_USE_EGL) || defined(XCB_USE_DRI2)
+#if defined(XCB_USE_EGL)
void *m_egl_display;
bool m_has_egl;
#endif
@@ -507,6 +495,7 @@ private:
uint32_t xfixes_first_event;
uint32_t xrandr_first_event;
+ bool has_glx_extension;
bool has_shape_extension;
bool has_randr_extension;
bool has_input_shape;
@@ -549,9 +538,9 @@ cookie_t q_xcb_call_template(const cookie_t &cookie, QXcbConnection *connection,
#endif
-#if defined(XCB_USE_DRI2) || defined(XCB_USE_EGL)
+#if defined(XCB_USE_EGL)
#define EGL_DISPLAY_FROM_XCB(object) ((EGLDisplay)(object->connection()->egl_display()))
-#endif //endifXCB_USE_DRI2
+#endif
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/xcb/qxcbdrag.cpp b/src/plugins/platforms/xcb/qxcbdrag.cpp
index 5d887cd06d..27a926eca2 100644
--- a/src/plugins/platforms/xcb/qxcbdrag.cpp
+++ b/src/plugins/platforms/xcb/qxcbdrag.cpp
@@ -680,8 +680,6 @@ void QXcbDrag::handleEnter(QWindow *window, const xcb_client_message_event_t *ev
DEBUG() << "handleEnter" << window;
xdnd_types.clear();
-// motifdnd_active = false;
-// last_enter_event.xclient = xe->xclient;
int version = (int)(event->data.data32[1] >> 24);
if (version > xdnd_version)
@@ -1217,9 +1215,7 @@ QXcbDropData::~QXcbDropData()
QVariant QXcbDropData::retrieveData_sys(const QString &mimetype, QVariant::Type requestedType) const
{
QByteArray mime = mimetype.toLatin1();
- QVariant data = /*X11->motifdnd_active
- ? X11->motifdndObtainData(mime)
- :*/ xdndObtainData(mime, requestedType);
+ QVariant data = xdndObtainData(mime, requestedType);
return data;
}
@@ -1260,20 +1256,11 @@ bool QXcbDropData::hasFormat_sys(const QString &format) const
QStringList QXcbDropData::formats_sys() const
{
QStringList formats;
-// if (X11->motifdnd_active) {
-// int i = 0;
-// QByteArray fmt;
-// while (!(fmt = X11->motifdndFormat(i)).isEmpty()) {
-// formats.append(QLatin1String(fmt));
-// ++i;
-// }
-// } else {
- for (int i = 0; i < drag->xdnd_types.size(); ++i) {
- QString f = mimeAtomToString(drag->connection(), drag->xdnd_types.at(i));
- if (!formats.contains(f))
- formats.append(f);
- }
-// }
+ for (int i = 0; i < drag->xdnd_types.size(); ++i) {
+ QString f = mimeAtomToString(drag->connection(), drag->xdnd_types.at(i));
+ if (!formats.contains(f))
+ formats.append(f);
+ }
return formats;
}
diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp
index 2ace68036b..5170ff9e10 100644
--- a/src/plugins/platforms/xcb/qxcbintegration.cpp
+++ b/src/plugins/platforms/xcb/qxcbintegration.cpp
@@ -190,11 +190,11 @@ QPlatformOpenGLContext *QXcbIntegration::createPlatformOpenGLContext(QOpenGLCont
#elif defined(XCB_USE_EGL)
return new QEGLXcbPlatformContext(context->format(), context->shareHandle(),
screen->connection()->egl_display(), screen->connection());
-#elif defined(XCB_USE_DRI2)
- return new QDri2Context(context->format(), context->shareHandle());
-#endif
- qWarning("QXcbIntegration: Cannot create platform OpenGL context, none of GLX, EGL, or DRI2 are enabled");
+#else
+ Q_UNUSED(screen);
+ qWarning("QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled");
return 0;
+#endif
}
#endif
@@ -207,7 +207,13 @@ bool QXcbIntegration::hasCapability(QPlatformIntegration::Capability cap) const
{
switch (cap) {
case ThreadedPixmaps: return true;
+#if defined(XCB_USE_GLX)
+ case OpenGL: return m_connections.at(0)->hasGLX();
+#elif defined(XCB_USE_EGL)
case OpenGL: return true;
+#else
+ case OpenGL: return false;
+#endif
case ThreadedOpenGL: return false;
case WindowMasks: return true;
default: return QPlatformIntegration::hasCapability(cap);
diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp
index 335866dc9d..2a36fb7369 100644
--- a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp
+++ b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp
@@ -53,8 +53,6 @@
#if defined(XCB_USE_EGL)
#include "QtPlatformSupport/private/qeglplatformcontext_p.h"
-#elif defined (XCB_USE_DRI2)
-#include "qdri2context.h"
#endif
QT_BEGIN_NAMESPACE
@@ -69,7 +67,6 @@ public:
insert("egldisplay",QXcbNativeInterface::EglDisplay);
insert("connection",QXcbNativeInterface::Connection);
insert("screen",QXcbNativeInterface::Screen);
- insert("graphicsdevice",QXcbNativeInterface::GraphicsDevice);
insert("eglcontext",QXcbNativeInterface::EglContext);
}
};
@@ -122,9 +119,6 @@ void *QXcbNativeInterface::nativeResourceForWindow(const QByteArray &resourceStr
case Screen:
result = qPlatformScreenForWindow(window);
break;
- case GraphicsDevice:
- result = graphicsDeviceForWindow(window);
- break;
default:
break;
}
@@ -165,7 +159,7 @@ void *QXcbNativeInterface::displayForWindow(QWindow *window)
void *QXcbNativeInterface::eglDisplayForWindow(QWindow *window)
{
-#if defined(XCB_USE_DRI2) || defined(XCB_USE_EGL)
+#if defined(XCB_USE_EGL)
QXcbScreen *screen = qPlatformScreenForWindow(window);
return screen->connection()->egl_display();
#else
@@ -186,45 +180,13 @@ void *QXcbNativeInterface::screenForWindow(QWindow *window)
return screen->screen();
}
-void *QXcbNativeInterface::graphicsDeviceForWindow(QWindow *window)
-{
-#if defined(XCB_USE_DRI2)
- QXcbScreen *screen = qPlatformScreenForWindow(window);
- QByteArray deviceName = screen->connection()->dri2DeviceName();
- return deviceName.data();
-#else
- Q_UNUSED(window);
- return 0;
-#endif
-
-}
-
void * QXcbNativeInterface::eglContextForContext(QOpenGLContext *context)
{
Q_ASSERT(context);
#if defined(XCB_USE_EGL)
QEGLPlatformContext *eglPlatformContext = static_cast<QEGLPlatformContext *>(context->handle());
return eglPlatformContext->eglContext();
-#endif
-#if 0
- Q_ASSERT(window);
- QPlatformOpenGLContext *platformContext = window->glContext()->handle();
- if (!platformContext) {
- qDebug() << "QWindow" << window << "does not have a glContext"
- << "cannot return EGLContext";
- return 0;
- }
-#if defined(XCB_USE_EGL)
- QEGLPlatformContext *eglPlatformContext = static_cast<QEGLPlatformContext *>(platformContext);
- return eglPlatformContext->eglContext();
-#elif defined (XCB_USE_DRI2)
- QDri2Context *dri2Context = static_cast<QDri2Context *>(platformContext);
- return dri2Context->eglContext();
-#else
- return 0;
-#endif
#else
- Q_UNUSED(context)
return 0;
#endif
}
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp
index bab1884a9a..48754b0a60 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.cpp
+++ b/src/plugins/platforms/xcb/qxcbwindow.cpp
@@ -55,10 +55,6 @@
#include <qpa/qplatformintegration.h>
-#ifdef XCB_USE_DRI2
-#include "qdri2context.h"
-#endif
-
// FIXME This workaround can be removed for xcb-icccm > 3.8
#define class class_name
#include <xcb/xcb_icccm.h>
@@ -233,9 +229,7 @@ void QXcbWindow::create()
m_format = window()->requestedFormat();
#if (defined(XCB_USE_GLX) || defined(XCB_USE_EGL)) && defined(XCB_USE_XLIB)
- if (QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::OpenGL)
- || m_format.hasAlpha())
- {
+ if (QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::OpenGL)) {
#if defined(XCB_USE_GLX)
XVisualInfo *visualInfo = qglx_findVisualInfo(DISPLAY_FROM_XCB(m_screen), m_screen->screenNumber(), &m_format);
if (!visualInfo && window()->surfaceType() == QSurface::OpenGLSurface)
@@ -1393,11 +1387,6 @@ void QXcbWindow::handleConfigureNotifyEvent(const xcb_configure_notify_event_t *
}
m_dirtyFrameMargins = true;
-
-#if XCB_USE_DRI2
- if (m_context)
- static_cast<QDri2Context *>(m_context)->resize(rect.size());
-#endif
}
bool QXcbWindow::isExposed() const
diff --git a/src/plugins/platforms/xcb/xcb.pro b/src/plugins/platforms/xcb/xcb.pro
index 116951d36d..58521686aa 100644
--- a/src/plugins/platforms/xcb/xcb.pro
+++ b/src/plugins/platforms/xcb/xcb.pro
@@ -74,17 +74,7 @@ contains(QT_CONFIG, xcb-render) {
!contains(DEFINES, QT_NO_SHAPE):LIBS += -lxcb-shape
-# DEFINES += XCB_USE_DRI2
-contains(DEFINES, XCB_USE_DRI2) {
- LIBS += -lxcb-dri2 -lEGL
-
- CONFIG += link_pkgconfig
- PKGCONFIG += libdrm
-
- HEADERS += qdri2context.h
- SOURCES += qdri2context.cpp
-
-} else:contains(QT_CONFIG, opengl) {
+contains(QT_CONFIG, opengl) {
contains(QT_CONFIG, opengles2) {
DEFINES += XCB_USE_EGL
LIBS += -lEGL
@@ -98,6 +88,10 @@ contains(DEFINES, XCB_USE_DRI2) {
HEADERS += qglxintegration.h
SOURCES += qglxintegration.cpp
LIBS += $$QMAKE_LIBS_DYNLOAD
+ contains(QT_CONFIG, xcb-glx) {
+ DEFINES += XCB_HAS_XCB_GLX
+ LIBS += -lxcb-glx
+ }
}
}