summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r--src/plugins/platforms/windows/qwindowsopengltester.cpp19
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.cpp3
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection.cpp1
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection.h1
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.cpp49
5 files changed, 66 insertions, 7 deletions
diff --git a/src/plugins/platforms/windows/qwindowsopengltester.cpp b/src/plugins/platforms/windows/qwindowsopengltester.cpp
index 67548a0836..f5065a22b8 100644
--- a/src/plugins/platforms/windows/qwindowsopengltester.cpp
+++ b/src/plugins/platforms/windows/qwindowsopengltester.cpp
@@ -208,15 +208,22 @@ static inline QString resolveBugListFile(const QString &fileName)
return QStandardPaths::locate(QStandardPaths::ConfigLocation, fileName);
}
+# ifndef QT_NO_OPENGL
typedef QHash<QOpenGLConfig::Gpu, QWindowsOpenGLTester::Renderers> SupportedRenderersCache;
Q_GLOBAL_STATIC(SupportedRenderersCache, supportedRenderersCache)
+# endif
#endif // !Q_OS_WINCE
QWindowsOpenGLTester::Renderers QWindowsOpenGLTester::detectSupportedRenderers(const GpuDescription &gpu, bool glesOnly)
{
Q_UNUSED(gpu)
-#ifndef Q_OS_WINCE
+ Q_UNUSED(glesOnly)
+#if defined(QT_NO_OPENGL)
+ return 0;
+#elif defined(Q_OS_WINCE)
+ return QWindowsOpenGLTester::Gles;
+#else
QOpenGLConfig::Gpu qgpu;
qgpu.deviceId = gpu.deviceId;
qgpu.vendorId = gpu.vendorId;
@@ -265,9 +272,7 @@ QWindowsOpenGLTester::Renderers QWindowsOpenGLTester::detectSupportedRenderers(c
srCache->insert(qgpu, result);
return result;
-#else // !Q_OS_WINCE
- return QWindowsOpenGLTester::Gles;
-#endif
+#endif // !Q_OS_WINCE && !QT_NO_OPENGL
}
QWindowsOpenGLTester::Renderers QWindowsOpenGLTester::supportedGlesRenderers()
@@ -288,7 +293,7 @@ QWindowsOpenGLTester::Renderers QWindowsOpenGLTester::supportedRenderers()
bool QWindowsOpenGLTester::testDesktopGL()
{
-#ifndef Q_OS_WINCE
+#if !defined(QT_NO_OPENGL) && !defined(Q_OS_WINCE)
HMODULE lib = 0;
HWND wnd = 0;
HDC dc = 0;
@@ -414,9 +419,9 @@ cleanup:
// No FreeLibrary. Some implementations, Mesa in particular, deadlock when trying to unload.
return result;
-#else // !Q_OS_WINCE
+#else
return false;
-#endif
+#endif // !QT_NO_OPENGL && !Q_OS_WINCE
}
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp
index a43bf53fa3..6afa4e6591 100644
--- a/src/plugins/platforms/windows/qwindowswindow.cpp
+++ b/src/plugins/platforms/windows/qwindowswindow.cpp
@@ -2265,6 +2265,7 @@ void QWindowsWindow::setCustomMargins(const QMargins &newCustomMargins)
void *QWindowsWindow::surface(void *nativeConfig, int *err)
{
#ifdef QT_NO_OPENGL
+ Q_UNUSED(nativeConfig)
return 0;
#else
if (!m_surface) {
@@ -2278,11 +2279,13 @@ void *QWindowsWindow::surface(void *nativeConfig, int *err)
void QWindowsWindow::invalidateSurface()
{
+#ifndef QT_NO_OPENGL
if (m_surface) {
if (QWindowsStaticOpenGLContext *staticOpenGLContext = QWindowsIntegration::staticOpenGLContext())
staticOpenGLContext->destroyWindowSurface(m_surface);
m_surface = 0;
}
+#endif // QT_NO_OPENGL
}
void QWindowsWindow::setTouchWindowTouchTypeStatic(QWindow *window, QWindowsWindowFunctions::TouchWindowTouchTypes touchTypes)
diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp
index 2084d7ea5d..f4c633e2d7 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection.cpp
@@ -1480,6 +1480,7 @@ static const char * xcb_atomnames = {
"WM_STATE\0"
"WM_CHANGE_STATE\0"
"WM_CLASS\0"
+ "WM_NAME\0"
// Session management
"WM_CLIENT_LEADER\0"
diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h
index de454b5eae..f479c1bc80 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.h
+++ b/src/plugins/platforms/xcb/qxcbconnection.h
@@ -107,6 +107,7 @@ namespace QXcbAtom {
WM_STATE,
WM_CHANGE_STATE,
WM_CLASS,
+ WM_NAME,
// Session management
WM_CLIENT_LEADER,
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp
index eed8b19013..b06b41a77b 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.cpp
+++ b/src/plugins/platforms/xcb/qxcbwindow.cpp
@@ -86,6 +86,7 @@
#include <qpa/qplatformbackingstore.h>
#include <qpa/qwindowsysteminterface.h>
+#include <QTextCodec>
#include <stdio.h>
#ifdef XCB_USE_XLIB
@@ -243,6 +244,48 @@ static inline bool positionIncludesFrame(QWindow *w)
return qt_window_private(w)->positionPolicy == QWindowPrivate::WindowFrameInclusive;
}
+#ifdef XCB_USE_XLIB
+static inline XTextProperty* qstringToXTP(Display *dpy, const QString& s)
+{
+ #include <X11/Xatom.h>
+
+ static XTextProperty tp = { 0, 0, 0, 0 };
+ static bool free_prop = true; // we can't free tp.value in case it references
+ // the data of the static QByteArray below.
+ if (tp.value) {
+ if (free_prop)
+ XFree(tp.value);
+ tp.value = 0;
+ free_prop = true;
+ }
+
+ static const QTextCodec* mapper = QTextCodec::codecForLocale();
+ int errCode = 0;
+ if (mapper) {
+ QByteArray mapped = mapper->fromUnicode(s);
+ char* tl[2];
+ tl[0] = mapped.data();
+ tl[1] = 0;
+ errCode = XmbTextListToTextProperty(dpy, tl, 1, XStdICCTextStyle, &tp);
+ if (errCode < 0)
+ qDebug("XmbTextListToTextProperty result code %d", errCode);
+ }
+ if (!mapper || errCode < 0) {
+ mapper = QTextCodec::codecForName("latin1");
+ if (!mapper || !mapper->canEncode(s))
+ return Q_NULLPTR;
+ static QByteArray qcs;
+ qcs = s.toLatin1();
+ tp.value = (uchar*)qcs.data();
+ tp.encoding = XA_STRING;
+ tp.format = 8;
+ tp.nitems = qcs.length();
+ free_prop = false;
+ }
+ return &tp;
+}
+#endif // XCB_USE_XLIB
+
static const char *wm_window_type_property_id = "_q_xcb_wm_window_type";
QXcbWindow::QXcbWindow(QWindow *window)
@@ -1421,6 +1464,12 @@ void QXcbWindow::setWindowTitle(const QString &title)
8,
ba.length(),
ba.constData()));
+
+#ifdef XCB_USE_XLIB
+ XTextProperty *text = qstringToXTP(DISPLAY_FROM_XCB(this), title);
+ if (text)
+ XSetWMName(DISPLAY_FROM_XCB(this), m_window, text);
+#endif
xcb_flush(xcb_connection());
}