From c8684662c20deacb791afb4ae3169af997793c2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Thu, 27 Jan 2011 12:36:20 +0100 Subject: Only const_cast can remove const :) --- src/plugins/platforms/testlite/qtestliteintegration.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/testlite/qtestliteintegration.cpp b/src/plugins/platforms/testlite/qtestliteintegration.cpp index 9b641d1..dc8a6d7 100644 --- a/src/plugins/platforms/testlite/qtestliteintegration.cpp +++ b/src/plugins/platforms/testlite/qtestliteintegration.cpp @@ -140,7 +140,7 @@ bool QTestLiteIntegration::hasOpenGL() const static bool wasEglInitialized = false; if (!eglHasbeenInitialized) { eglHasbeenInitialized = true; - QTestLiteScreen *screen = static_cast(mScreens.at(0)); + const QTestLiteScreen *screen = static_cast(mScreens.at(0)); EGLint major, minor; eglBindAPI(EGL_OPENGL_ES_API); EGLDisplay disp = eglGetDisplay(screen->display()); -- cgit v0.12 From a98c8058e76e8e0418e16a0cbc4b700e81cdcd3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Thu, 27 Jan 2011 12:36:51 +0100 Subject: Remove unneeded include --- src/plugins/platforms/wayland/qwaylandglcontext.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandglcontext.cpp b/src/plugins/platforms/wayland/qwaylandglcontext.cpp index 4bf68c4..23631d9 100644 --- a/src/plugins/platforms/wayland/qwaylandglcontext.cpp +++ b/src/plugins/platforms/wayland/qwaylandglcontext.cpp @@ -51,11 +51,7 @@ #include #include -extern "C" { -#include -} - -Q_GLOBAL_STATIC(QMutex,qt_defaultSharedContextMutex); +Q_GLOBAL_STATIC(QMutex,qt_defaultSharedContextMutex) EGLint QWaylandGLContext::contextAttibutes[] = { EGL_CONTEXT_CLIENT_VERSION, 2, -- cgit v0.12 From dbb0f9bfbe98dfd789948ed65fe906b3c2b757f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Thu, 27 Jan 2011 15:21:28 +0100 Subject: Precision specifiers are not allowed for shader variables Reviewed-by: sroedal --- .../gl2paintengineex/qglengineshadersource_p.h | 28 +++++++++++----------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/opengl/gl2paintengineex/qglengineshadersource_p.h b/src/opengl/gl2paintengineex/qglengineshadersource_p.h index 1aacc96..fc8b9ef 100644 --- a/src/opengl/gl2paintengineex/qglengineshadersource_p.h +++ b/src/opengl/gl2paintengineex/qglengineshadersource_p.h @@ -148,7 +148,7 @@ static const char* const qglslAffinePositionWithPatternBrushVertexShader = qglslPositionWithPatternBrushVertexShader; static const char* const qglslPatternBrushSrcFragmentShader = "\n\ - uniform lowp sampler2D brushTexture; \n\ + uniform sampler2D brushTexture; \n\ uniform lowp vec4 patternColor; \n\ varying highp vec2 patternTexCoords;\n\ lowp vec4 srcPixel() \n\ @@ -183,7 +183,7 @@ static const char* const qglslAffinePositionWithLinearGradientBrushVertexShader = qglslPositionWithLinearGradientBrushVertexShader; static const char* const qglslLinearGradientBrushSrcFragmentShader = "\n\ - uniform lowp sampler2D brushTexture; \n\ + uniform sampler2D brushTexture; \n\ varying mediump float index; \n\ lowp vec4 srcPixel() \n\ { \n\ @@ -218,7 +218,7 @@ static const char* const qglslAffinePositionWithConicalGradientBrushVertexShader static const char* const qglslConicalGradientBrushSrcFragmentShader = "\n\ #define INVERSE_2PI 0.1591549430918953358 \n\ - uniform lowp sampler2D brushTexture; \n\ + uniform sampler2D brushTexture; \n\ uniform mediump float angle; \n\ varying highp vec2 A; \n\ lowp vec4 srcPixel() \n\ @@ -260,7 +260,7 @@ static const char* const qglslAffinePositionWithRadialGradientBrushVertexShader = qglslPositionWithRadialGradientBrushVertexShader; static const char* const qglslRadialGradientBrushSrcFragmentShader = "\n\ - uniform lowp sampler2D brushTexture; \n\ + uniform sampler2D brushTexture; \n\ uniform highp float fmp2_m_radius2; \n\ uniform highp float inverse_2_fmp2_m_radius2; \n\ varying highp float b; \n\ @@ -304,14 +304,14 @@ static const char* const qglslAffinePositionWithTextureBrushVertexShader // TODO: Special case POT textures which don't need this emulation static const char* const qglslTextureBrushSrcFragmentShader = "\n\ varying highp vec2 brushTextureCoords; \n\ - uniform lowp sampler2D brushTexture; \n\ + uniform sampler2D brushTexture; \n\ lowp vec4 srcPixel() { \n\ return texture2D(brushTexture, fract(brushTextureCoords)); \n\ }\n"; #else static const char* const qglslTextureBrushSrcFragmentShader = "\n\ varying highp vec2 brushTextureCoords; \n\ - uniform lowp sampler2D brushTexture; \n\ + uniform sampler2D brushTexture; \n\ lowp vec4 srcPixel() \n\ { \n\ return texture2D(brushTexture, brushTextureCoords); \n\ @@ -321,7 +321,7 @@ static const char* const qglslTextureBrushSrcFragmentShader = "\n\ static const char* const qglslTextureBrushSrcWithPatternFragmentShader = "\n\ varying highp vec2 brushTextureCoords; \n\ uniform lowp vec4 patternColor; \n\ - uniform lowp sampler2D brushTexture; \n\ + uniform sampler2D brushTexture; \n\ lowp vec4 srcPixel() \n\ { \n\ return patternColor * (1.0 - texture2D(brushTexture, brushTextureCoords).r); \n\ @@ -337,7 +337,7 @@ static const char* const qglslSolidBrushSrcFragmentShader = "\n\ static const char* const qglslImageSrcFragmentShader = "\n\ varying highp vec2 textureCoords; \n\ - uniform lowp sampler2D imageTexture; \n\ + uniform sampler2D imageTexture; \n\ lowp vec4 srcPixel() \n\ { \n" "return texture2D(imageTexture, textureCoords); \n" @@ -345,7 +345,7 @@ static const char* const qglslImageSrcFragmentShader = "\n\ static const char* const qglslCustomSrcFragmentShader = "\n\ varying highp vec2 textureCoords; \n\ - uniform lowp sampler2D imageTexture; \n\ + uniform sampler2D imageTexture; \n\ lowp vec4 srcPixel() \n\ { \n\ return customShader(imageTexture, textureCoords); \n\ @@ -354,7 +354,7 @@ static const char* const qglslCustomSrcFragmentShader = "\n\ static const char* const qglslImageSrcWithPatternFragmentShader = "\n\ varying highp vec2 textureCoords; \n\ uniform lowp vec4 patternColor; \n\ - uniform lowp sampler2D imageTexture; \n\ + uniform sampler2D imageTexture; \n\ lowp vec4 srcPixel() \n\ { \n\ return patternColor * (1.0 - texture2D(imageTexture, textureCoords).r); \n\ @@ -362,7 +362,7 @@ static const char* const qglslImageSrcWithPatternFragmentShader = "\n\ static const char* const qglslNonPremultipliedImageSrcFragmentShader = "\n\ varying highp vec2 textureCoords; \n\ - uniform lowp sampler2D imageTexture; \n\ + uniform sampler2D imageTexture; \n\ lowp vec4 srcPixel() \n\ { \n\ lowp vec4 sample = texture2D(imageTexture, textureCoords); \n\ @@ -454,7 +454,7 @@ static const char* const qglslMainFragmentShader = "\n\ static const char* const qglslMaskFragmentShader = "\n\ varying highp vec2 textureCoords;\n\ - uniform lowp sampler2D maskTexture;\n\ + uniform sampler2D maskTexture;\n\ lowp vec4 applyMask(lowp vec4 src) \n\ {\n\ lowp vec4 mask = texture2D(maskTexture, textureCoords); \n\ @@ -478,7 +478,7 @@ static const char* const qglslMaskFragmentShader = "\n\ static const char* const qglslRgbMaskFragmentShaderPass1 = "\n\ varying highp vec2 textureCoords;\n\ - uniform lowp sampler2D maskTexture;\n\ + uniform sampler2D maskTexture;\n\ lowp vec4 applyMask(lowp vec4 src) \n\ { \n\ lowp vec4 mask = texture2D(maskTexture, textureCoords); \n\ @@ -487,7 +487,7 @@ static const char* const qglslRgbMaskFragmentShaderPass1 = "\n\ static const char* const qglslRgbMaskFragmentShaderPass2 = "\n\ varying highp vec2 textureCoords;\n\ - uniform lowp sampler2D maskTexture;\n\ + uniform sampler2D maskTexture;\n\ lowp vec4 applyMask(lowp vec4 src) \n\ { \n\ lowp vec4 mask = texture2D(maskTexture, textureCoords); \n\ -- cgit v0.12 From 2ab07dd167e05fe60525fde9b7b180738e431b9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Thu, 27 Jan 2011 15:25:00 +0100 Subject: Lighthouse: Wayland plugin. Only create depth and stencil buffers once --- src/plugins/platforms/wayland/qwaylandcursor.cpp | 2 +- src/plugins/platforms/wayland/qwaylanddrmsurface.cpp | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandcursor.cpp b/src/plugins/platforms/wayland/qwaylandcursor.cpp index 29c6abd..f51281d 100644 --- a/src/plugins/platforms/wayland/qwaylandcursor.cpp +++ b/src/plugins/platforms/wayland/qwaylandcursor.cpp @@ -48,7 +48,7 @@ #include -#define DATADIR "/home/jlind/install/share" +#define DATADIR "/usr/share" static const struct pointer_image { const char *filename; diff --git a/src/plugins/platforms/wayland/qwaylanddrmsurface.cpp b/src/plugins/platforms/wayland/qwaylanddrmsurface.cpp index 76c8c33..603c018 100644 --- a/src/plugins/platforms/wayland/qwaylanddrmsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylanddrmsurface.cpp @@ -77,7 +77,6 @@ QWaylandDrmBuffer::QWaylandDrmBuffer(QWaylandDisplay *display, mImage = eglCreateDRMImageMESA(mDisplay->eglDisplay(), imageAttribs); - glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, mImage); glGenTextures(1, &mTexture); glBindTexture(GL_TEXTURE_2D, mTexture); glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, mImage); @@ -112,7 +111,6 @@ QWaylandDrmBuffer::~QWaylandDrmBuffer(void) void QWaylandDrmBuffer::bindToCurrentFbo() { Q_ASSERT(QPlatformGLContext::currentContext()); - glBindTexture(GL_TEXTURE_2D, mTexture); glFramebufferTexture2D(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, mTexture, 0); QT_CHECK_GLERROR(); @@ -135,6 +133,13 @@ QWaylandPaintDevice::QWaylandPaintDevice(QWaylandDisplay *display, QWindowSurfac glGenFramebuffers(1, &m_thisFBO); glBindFramebuffer(GL_FRAMEBUFFER_EXT, m_thisFBO); + glGenRenderbuffers(1, &mDepthStencil); + glBindRenderbuffer(GL_RENDERBUFFER_EXT, mDepthStencil); + glFramebufferRenderbuffer(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, + GL_RENDERBUFFER_EXT, mDepthStencil); + glFramebufferRenderbuffer(GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT_EXT, + GL_RENDERBUFFER_EXT, mDepthStencil); + if (windowSurface->size().isValid()) resize(windowSurface->size()); } @@ -184,15 +189,9 @@ void QWaylandPaintDevice::resize(const QSize &size) } } - glDeleteRenderbuffers(1,&mDepthStencil); - glGenRenderbuffers(1,&mDepthStencil); glBindRenderbuffer(GL_RENDERBUFFER_EXT,mDepthStencil); glRenderbufferStorage(GL_RENDERBUFFER_EXT, GL_DEPTH24_STENCIL8_EXT, size.width(), size.height()); - glFramebufferRenderbuffer(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, - GL_RENDERBUFFER_EXT, mDepthStencil); - glFramebufferRenderbuffer(GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT_EXT, - GL_RENDERBUFFER_EXT, mDepthStencil); GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER_EXT); @@ -247,6 +246,7 @@ void QWaylandDrmWindowSurface::flush(QWidget *widget, const QRegion ®ion, con Q_UNUSED(offset); QWaylandWindow *ww = (QWaylandWindow *) widget->platformWindow(); + glFlush(); ww->attach(mPaintDevice->currentDrmBufferAndSwap()); QVector rects = region.rects(); -- cgit v0.12 From b3a8877f54bbd60a4f54439f5d551e1dfec7a9a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Thu, 27 Jan 2011 13:52:40 -0500 Subject: wayland: Handle keyboard focus correctly Activate the window widget and update modifiers. --- src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 03edc07..102a213 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -282,19 +282,28 @@ void QWaylandInputDevice::inputHandleKeyboardFocus(void *data, { Q_UNUSED(input_device); Q_UNUSED(time); - Q_UNUSED(keys); QWaylandInputDevice *inputDevice = (QWaylandInputDevice *) data; QWaylandWindow *window; - - if (inputDevice->mKeyboardFocus) { - window = inputDevice->mKeyboardFocus; - inputDevice->mKeyboardFocus = NULL; + uint32_t *k, *end; + uint32_t code; + + end = (uint32_t *) ((char *) keys->data + keys->size); + inputDevice->mModifiers = 0; + for (k = (uint32_t *) keys->data; k < end; k++) { + code = *k + inputDevice->mXkb->min_key_code; + inputDevice->mModifiers |= + translateModifiers(inputDevice->mXkb->map->modmap[code]); } if (surface) { window = (QWaylandWindow *) wl_surface_get_user_data(surface); inputDevice->mKeyboardFocus = window; + QWindowSystemInterface::handleWindowActivated(window->widget()); + } else { + inputDevice->mKeyboardFocus = NULL; + QWindowSystemInterface::handleWindowActivated(0); } + } const struct wl_input_device_listener QWaylandInputDevice::inputDeviceListener = { -- cgit v0.12 From 7386d37ae301092a3eecc9a3bf94dfd42509f666 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Fri, 28 Jan 2011 08:38:10 +0100 Subject: Lighthouse: Wayland, if we don't have cursors installed or the configuration is faulty, then don't change cursors --- src/plugins/platforms/wayland/qwaylandcursor.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandcursor.cpp b/src/plugins/platforms/wayland/qwaylandcursor.cpp index f51281d..0ad0702 100644 --- a/src/plugins/platforms/wayland/qwaylandcursor.cpp +++ b/src/plugins/platforms/wayland/qwaylandcursor.cpp @@ -164,6 +164,9 @@ void QWaylandCursor::changeCursor(QCursor *cursor, QWidget *widget) QImageReader reader(p->filename); + if (!reader.canRead()) + return; + if (mBuffer == NULL || mBuffer->size() != reader.size()) { if (mBuffer) delete mBuffer; -- cgit v0.12 From 6d3b5e1cdb3858ab8fe650493bf36a2b5260da1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Sat, 5 Feb 2011 09:20:19 -0500 Subject: wayland: Use wayland-egl instead of drm specific code --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 116 +++------------------ src/plugins/platforms/wayland/qwaylanddisplay.h | 11 +- .../platforms/wayland/qwaylanddrmsurface.cpp | 40 +++---- src/plugins/platforms/wayland/qwaylanddrmsurface.h | 1 + src/plugins/platforms/wayland/wayland.pro | 2 +- 5 files changed, 38 insertions(+), 132 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 70713ec..2e30c2f 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -50,9 +50,7 @@ #include #include -extern "C" { -#include -} +#include struct wl_surface *QWaylandDisplay::createSurface() { @@ -67,14 +65,6 @@ struct wl_buffer *QWaylandDisplay::createShmBuffer(int fd, return wl_shm_create_buffer(mShm, fd, width, height, stride, visual); } -struct wl_buffer *QWaylandDisplay::createDrmBuffer(int name, - int width, int height, - uint32_t stride, - struct wl_visual *visual) -{ - return wl_drm_create_buffer(mDrm, name, width, height, stride, visual); -} - struct wl_visual *QWaylandDisplay::rgbVisual() { return wl_display_get_rgb_visual(mDisplay); @@ -90,62 +80,11 @@ struct wl_visual *QWaylandDisplay::argbPremultipliedVisual() return wl_display_get_premultiplied_argb_visual(mDisplay); } -void QWaylandDisplay::drmHandleDevice(void *data, - struct wl_drm *drm, const char *device) +struct wl_egl_display *QWaylandDisplay::nativeDisplay() { - Q_UNUSED(drm); - QWaylandDisplay *qwd = (QWaylandDisplay *) data; - drm_magic_t magic; - - qwd->mDeviceName = strdup(device); - - qwd->mFd = open(qwd->mDeviceName, O_RDWR); - if (qwd->mFd < 0) { - qWarning("drm open failed: %m"); - return; - } - - if (drmGetMagic(qwd->mFd, &magic)) { - qWarning("DRI2: failed to get drm magic"); - return; - } - - wl_drm_authenticate(qwd->mDrm, magic); + return mNativeEglDisplay; } -void QWaylandDisplay::drmHandleAuthenticated(void *data, struct wl_drm *drm) -{ - Q_UNUSED(drm); - QWaylandDisplay *qwd = (QWaylandDisplay *) data; - EGLint major, minor; - const char *extensions; - - qwd->mEglDisplay = eglGetDRMDisplayMESA(qwd->mFd); - if (qwd->mEglDisplay == NULL) { - qWarning("failed to create display"); - return; - } - - if (!eglInitialize(qwd->mEglDisplay, &major, &minor)) { - qWarning("failed to initialize display"); - qwd->mEglDisplay = NULL; - return; - } - - extensions = eglQueryString(qwd->mEglDisplay, EGL_EXTENSIONS); - if (!strstr(extensions, "EGL_KHR_surfaceless_gles2")) { - qWarning("EGL_KHR_surfaceless_opengles2 not available"); - eglTerminate(qwd->mEglDisplay); - qwd->mEglDisplay = NULL; - return; - } -} - -const struct wl_drm_listener QWaylandDisplay::drmListener = { - QWaylandDisplay::drmHandleDevice, - QWaylandDisplay::drmHandleAuthenticated -}; - void QWaylandDisplay::shellHandleConfigure(void *data, struct wl_shell *shell, uint32_t time, uint32_t edges, struct wl_surface *surface, @@ -189,9 +128,6 @@ void QWaylandDisplay::displayHandleGlobal(struct wl_display *display, if (strcmp(interface, "compositor") == 0) { qwd->mCompositor = wl_compositor_create(display, id); - } else if (strcmp(interface, "drm") == 0) { - qwd->mDrm = wl_drm_create(display, id); - wl_drm_add_listener(qwd->mDrm, &drmListener, qwd); } else if (strcmp(interface, "shm") == 0) { qwd->mShm = wl_shm_create(display, id); } else if (strcmp(interface, "shell") == 0) { @@ -207,26 +143,6 @@ void QWaylandDisplay::displayHandleGlobal(struct wl_display *display, } } -static void roundtripCallback(void *data) -{ - bool *done = (bool *) data; - - *done = true; -} - -static void forceRoundtrip(struct wl_display *display) -{ - bool done; - - wl_display_sync_callback(display, roundtripCallback, &done); - wl_display_iterate(display, WL_DISPLAY_WRITABLE); - done = false; - while (!done) - wl_display_iterate(display, WL_DISPLAY_READABLE); -} - -static const char *socket_name = NULL; - void QWaylandDisplay::eventDispatcher(void) { wl_display_iterate(mDisplay, WL_DISPLAY_READABLE); @@ -257,7 +173,9 @@ void QWaylandDisplay::flushRequests(void) QWaylandDisplay::QWaylandDisplay(void) : mWriteNotifier(0) { - mDisplay = wl_display_connect(socket_name); + EGLint major, minor; + + mDisplay = wl_display_connect(NULL); if (mDisplay == NULL) { fprintf(stderr, "failed to create display: %m\n"); return; @@ -266,18 +184,17 @@ QWaylandDisplay::QWaylandDisplay(void) wl_display_add_global_listener(mDisplay, QWaylandDisplay::displayHandleGlobal, this); - /* Process connection events. */ - wl_display_iterate(mDisplay, WL_DISPLAY_READABLE); - if (!mShm || !mDeviceName) - forceRoundtrip(mDisplay); + mNativeEglDisplay = wl_egl_native_display_create(mDisplay); - /* Force a roundtrip to finish the drm authentication so we - * initialize EGL before proceeding */ - forceRoundtrip(mDisplay); - if (mEglDisplay == NULL) - qDebug("EGL not available"); - else - qDebug("EGL initialized"); + mEglDisplay = eglGetDisplay(mNativeEglDisplay); + if (mEglDisplay == NULL) { + qWarning("EGL not available"); + } else { + if (!eglInitialize(mEglDisplay, &major, &minor)) { + qWarning("failed to initialize EGL display"); + return; + } + } int fd = wl_display_get_fd(mDisplay, sourceUpdate, this); mReadNotifier = new QSocketNotifier(fd, QSocketNotifier::Read, this); @@ -293,6 +210,7 @@ QWaylandDisplay::QWaylandDisplay(void) QWaylandDisplay::~QWaylandDisplay(void) { close(mFd); + eglTerminate(mEglDisplay); wl_display_destroy(mDisplay); } diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.h b/src/plugins/platforms/wayland/qwaylanddisplay.h index f179713..375a9c1 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay.h @@ -71,12 +71,10 @@ public: struct wl_buffer *createShmBuffer(int fd, int width, int height, uint32_t stride, struct wl_visual *visual); - struct wl_buffer *createDrmBuffer(int name, int width, int height, - uint32_t stride, - struct wl_visual *visual); struct wl_visual *rgbVisual(); struct wl_visual *argbVisual(); struct wl_visual *argbPremultipliedVisual(); + struct wl_egl_display *nativeDisplay(); EGLDisplay eglDisplay() { return mEglDisplay; } void setCursor(QWaylandBuffer *buffer, int32_t x, int32_t y); @@ -91,7 +89,6 @@ public slots: private: struct wl_display *mDisplay; struct wl_compositor *mCompositor; - struct wl_drm *mDrm; struct wl_shm *mShm; struct wl_shell *mShell; char *mDeviceName; @@ -101,16 +98,13 @@ private: QSocketNotifier *mReadNotifier; QSocketNotifier *mWriteNotifier; EGLDisplay mEglDisplay; + struct wl_egl_display *mNativeEglDisplay; static void displayHandleGlobal(struct wl_display *display, uint32_t id, const char *interface, uint32_t version, void *data); - static void drmHandleDevice(void *data, - struct wl_drm *drm, const char *device); - static void drmHandleAuthenticated(void *data, struct wl_drm *drm); - static void outputHandleGeometry(void *data, struct wl_output *output, int32_t x, int32_t y, @@ -123,7 +117,6 @@ private: static int sourceUpdate(uint32_t mask, void *data); - static const struct wl_drm_listener drmListener; static const struct wl_output_listener outputListener; static const struct wl_shell_listener shellListener; }; diff --git a/src/plugins/platforms/wayland/qwaylanddrmsurface.cpp b/src/plugins/platforms/wayland/qwaylanddrmsurface.cpp index 603c018..a9a8046 100644 --- a/src/plugins/platforms/wayland/qwaylanddrmsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylanddrmsurface.cpp @@ -50,10 +50,7 @@ #include #include -#include -#include -#include -#include +#include QT_BEGIN_NAMESPACE @@ -66,23 +63,6 @@ QWaylandDrmBuffer::QWaylandDrmBuffer(QWaylandDisplay *display, , mSize(size) { struct wl_visual *visual; - EGLint name, stride; - EGLint imageAttribs[] = { - EGL_WIDTH, size.width(), - EGL_HEIGHT, size.height(), - EGL_DRM_BUFFER_FORMAT_MESA, EGL_DRM_BUFFER_FORMAT_ARGB32_MESA, - EGL_DRM_BUFFER_USE_MESA, EGL_DRM_BUFFER_USE_SCANOUT_MESA, - EGL_NONE - }; - - mImage = eglCreateDRMImageMESA(mDisplay->eglDisplay(), imageAttribs); - - glGenTextures(1, &mTexture); - glBindTexture(GL_TEXTURE_2D, mTexture); - glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, mImage); - - eglExportDRMImageMESA(mDisplay->eglDisplay(), - mImage, &name, NULL, &stride); switch (format) { case QImage::Format_ARGB32: @@ -97,14 +77,28 @@ QWaylandDrmBuffer::QWaylandDrmBuffer(QWaylandDisplay *display, break; } - mBuffer = display->createDrmBuffer(name, size.width(), size.height(), - stride, visual); + mPixmap = wl_egl_native_pixmap_create(display->nativeDisplay(), + size.width(), size.height(), + visual, 0); + + mImage = eglCreateImageKHR(display->eglDisplay(), + NULL, EGL_NATIVE_PIXMAP_KHR, + (EGLClientBuffer) mPixmap, NULL); + + glGenTextures(1, &mTexture); + qDebug() << "generating mTexture" << mTexture; + glBindTexture(GL_TEXTURE_2D, mTexture); + glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, mImage); + + mBuffer = wl_egl_native_pixmap_create_buffer(display->nativeDisplay(), + mPixmap); } QWaylandDrmBuffer::~QWaylandDrmBuffer(void) { glDeleteTextures(1, &mTexture); eglDestroyImageKHR(mDisplay->eglDisplay(), mImage); + wl_egl_native_pixmap_destroy(mPixmap); wl_buffer_destroy(mBuffer); } diff --git a/src/plugins/platforms/wayland/qwaylanddrmsurface.h b/src/plugins/platforms/wayland/qwaylanddrmsurface.h index eafea13..f49263b 100644 --- a/src/plugins/platforms/wayland/qwaylanddrmsurface.h +++ b/src/plugins/platforms/wayland/qwaylanddrmsurface.h @@ -76,6 +76,7 @@ public: QSize size() const { return mSize; } private: + struct wl_egl_pixmap *mPixmap; EGLImageKHR mImage; QWaylandDisplay *mDisplay; QSize mSize; diff --git a/src/plugins/platforms/wayland/wayland.pro b/src/plugins/platforms/wayland/wayland.pro index 8ba1408..803a8e9 100644 --- a/src/plugins/platforms/wayland/wayland.pro +++ b/src/plugins/platforms/wayland/wayland.pro @@ -27,7 +27,7 @@ HEADERS = qwaylandintegration.h \ contains(QT_CONFIG, opengl) { QT += opengl } -LIBS += -lwayland-client -lxkbcommon -lEGL +LIBS += -lwayland-client -lwayland-egl -lxkbcommon -lEGL unix { CONFIG += link_pkgconfig PKGCONFIG += libdrm -- cgit v0.12 From a39b6c89efe78ab74767f70d60a2a9238a31c34a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Tue, 1 Feb 2011 16:01:57 +0100 Subject: Lighthouse: Fix if context isSharing setup for QGLContext --- src/opengl/qgl.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 0ec3a15..9f31c62 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -3310,8 +3310,10 @@ bool QGLContext::create(const QGLContext* shareContext) QWidgetPrivate *wd = qt_widget_private(static_cast(d->paintDevice)); wd->usesDoubleBufferedGLContext = d->glFormat.doubleBuffer(); } +#ifndef Q_WS_QPA //We do this in choose context->setupSharing() if (d->sharing) // ok, we managed to share QGLContextGroup::addShare(this, shareContext); +#endif return d->valid; } -- cgit v0.12 From d7043ed404982efc67fd252c04a055e4ed783d6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Tue, 1 Feb 2011 16:02:32 +0100 Subject: Lighthouse: QGLWidgetPropogate the resizeEvent down to the Widget before doing the QGLWidget event handling --- src/opengl/qgl_qpa.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/opengl/qgl_qpa.cpp b/src/opengl/qgl_qpa.cpp index 0f4b305..b865086 100644 --- a/src/opengl/qgl_qpa.cpp +++ b/src/opengl/qgl_qpa.cpp @@ -331,13 +331,14 @@ bool QGLWidget::event(QEvent *e) void QGLWidget::resizeEvent(QResizeEvent *e) { Q_D(QGLWidget); + + QWidget::resizeEvent(e); if (!isValid()) return; makeCurrent(); if (!d->glcx->initialized()) glInit(); resizeGL(width(), height()); - return QWidget::resizeEvent(e); } -- cgit v0.12 From 7ea1dd46966ae7cfa07fa18c001704e3c981b669 Mon Sep 17 00:00:00 2001 From: con Date: Mon, 7 Feb 2011 09:59:33 +0100 Subject: Move Mac specific include into Q_WS_MAC scope for QScroller abstraction Reviewed-by: jorgen --- src/gui/util/qscroller_mac.mm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/util/qscroller_mac.mm b/src/gui/util/qscroller_mac.mm index 3203036..d85a51b 100644 --- a/src/gui/util/qscroller_mac.mm +++ b/src/gui/util/qscroller_mac.mm @@ -39,12 +39,13 @@ ** ****************************************************************************/ -#import #include "qscroller_p.h" #ifdef Q_WS_MAC +#import + QPointF QScrollerPrivate::realDpi(int screen) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; -- cgit v0.12 From ed4dddfb3f2a357875fb9e471e7d5db98633f34c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Mon, 7 Feb 2011 10:21:47 +0100 Subject: Moving mac specific functionality into correct place in pri file --- src/gui/painting/painting.pri | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri index 51f2538..65e7af4 100644 --- a/src/gui/painting/painting.pri +++ b/src/gui/painting/painting.pri @@ -234,8 +234,10 @@ x11 { } !embedded:!qpa:mac { - HEADERS += painting/qwindowsurface_mac_p.h - SOURCES += painting/qwindowsurface_mac.cpp + HEADERS += painting/qwindowsurface_mac_p.h \ + painting/qunifiedtoolbarsurface_mac_p.h + SOURCES += painting/qwindowsurface_mac.cpp \ + painting/qunifiedtoolbarsurface_mac.cpp } embedded { @@ -260,12 +262,6 @@ symbian { QMAKE_CXXFLAGS.ARMCC *= -O3 } -mac { - HEADERS += painting/qunifiedtoolbarsurface_mac_p.h - SOURCES += painting/qunifiedtoolbarsurface_mac.cpp -} - - NEON_SOURCES += painting/qdrawhelper_neon.cpp NEON_HEADERS += painting/qdrawhelper_neon_p.h NEON_ASM += ../3rdparty/pixman/pixman-arm-neon-asm.S painting/qdrawhelper_neon_asm.S -- cgit v0.12 From 8298a9d4190de1d2055da8be446c8ae4b22b6618 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Mon, 7 Feb 2011 16:29:19 +0100 Subject: Initial (incomplete) XCB platform port. --- src/plugins/platforms/xcb/main.cpp | 72 +++++++++ src/plugins/platforms/xcb/qxcbconnection.cpp | 110 ++++++++++++++ src/plugins/platforms/xcb/qxcbconnection.h | 75 ++++++++++ src/plugins/platforms/xcb/qxcbintegration.cpp | 116 +++++++++++++++ src/plugins/platforms/xcb/qxcbintegration.h | 78 ++++++++++ src/plugins/platforms/xcb/qxcbscreen.cpp | 77 ++++++++++ src/plugins/platforms/xcb/qxcbscreen.h | 72 +++++++++ src/plugins/platforms/xcb/qxcbwindow.cpp | 189 ++++++++++++++++++++++++ src/plugins/platforms/xcb/qxcbwindow.h | 90 +++++++++++ src/plugins/platforms/xcb/qxcbwindowsurface.cpp | 106 +++++++++++++ src/plugins/platforms/xcb/qxcbwindowsurface.h | 66 +++++++++ src/plugins/platforms/xcb/xcb.pro | 26 ++++ 12 files changed, 1077 insertions(+) create mode 100644 src/plugins/platforms/xcb/main.cpp create mode 100644 src/plugins/platforms/xcb/qxcbconnection.cpp create mode 100644 src/plugins/platforms/xcb/qxcbconnection.h create mode 100644 src/plugins/platforms/xcb/qxcbintegration.cpp create mode 100644 src/plugins/platforms/xcb/qxcbintegration.h create mode 100644 src/plugins/platforms/xcb/qxcbscreen.cpp create mode 100644 src/plugins/platforms/xcb/qxcbscreen.h create mode 100644 src/plugins/platforms/xcb/qxcbwindow.cpp create mode 100644 src/plugins/platforms/xcb/qxcbwindow.h create mode 100644 src/plugins/platforms/xcb/qxcbwindowsurface.cpp create mode 100644 src/plugins/platforms/xcb/qxcbwindowsurface.h create mode 100644 src/plugins/platforms/xcb/xcb.pro diff --git a/src/plugins/platforms/xcb/main.cpp b/src/plugins/platforms/xcb/main.cpp new file mode 100644 index 0000000..1966003 --- /dev/null +++ b/src/plugins/platforms/xcb/main.cpp @@ -0,0 +1,72 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include "qxcbintegration.h" + +QT_BEGIN_NAMESPACE + +class QXcbIntegrationPlugin : public QPlatformIntegrationPlugin +{ +public: + QStringList keys() const; + QPlatformIntegration *create(const QString&, const QStringList&); +}; + +QStringList QXcbIntegrationPlugin::keys() const +{ + QStringList list; + list << "xcb"; + return list; +} + +QPlatformIntegration* QXcbIntegrationPlugin::create(const QString& system, const QStringList& paramList) +{ + Q_UNUSED(paramList); + if (system.toLower() == "xcb") + return new QXcbIntegration; + + return 0; +} + +Q_EXPORT_PLUGIN2(xcb, QXcbIntegrationPlugin) + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp new file mode 100644 index 0000000..d5e44ad --- /dev/null +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -0,0 +1,110 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qxcbconnection.h" +#include "qxcbscreen.h" +#include "qxcbwindow.h" + +#include +#include + +#include + +QXcbConnection::QXcbConnection(const char *displayName) +{ + int primaryScreen; + + m_connection = xcb_connect(displayName, &primaryScreen); + + m_setup = xcb_get_setup(m_connection); + + xcb_screen_iterator_t it = xcb_setup_roots_iterator(m_setup); + + while (it.rem) { + m_screens << new QXcbScreen(this, it.data); + xcb_screen_next(&it); + } + + QSocketNotifier *socket = new QSocketNotifier(xcb_get_file_descriptor(m_connection), QSocketNotifier::Read, this); + connect(socket, SIGNAL(activated(int)), this, SLOT(eventDispatcher())); +} + +QXcbConnection::~QXcbConnection() +{ + qDeleteAll(m_screens); + + xcb_disconnect(m_connection); +} + +QXcbWindow *platformWindowFromId(xcb_window_t id) +{ + QWidget *widget = QWidget::find(id); + if (widget) + return static_cast(widget->platformWindow()); + return 0; +} + +#define HANDLE_PLATFORM_WINDOW_EVENT(event_t, window, handler) \ +{ \ + event_t *e = (event_t *)event; \ + if (QXcbWindow *platformWindow = platformWindowFromId(e->window)) \ + platformWindow->handler(e); \ +} \ +break; + +void QXcbConnection::eventDispatcher() +{ + while (xcb_generic_event_t *event = xcb_poll_for_event(m_connection)) { + switch (event->response_type & ~0x80) { + case XCB_EXPOSE: + HANDLE_PLATFORM_WINDOW_EVENT(xcb_expose_event_t, window, handleExposeEvent); + case XCB_BUTTON_PRESS: + HANDLE_PLATFORM_WINDOW_EVENT(xcb_button_press_event_t, event, handleButtonPressEvent); + case XCB_BUTTON_RELEASE: + HANDLE_PLATFORM_WINDOW_EVENT(xcb_button_release_event_t, event, handleButtonReleaseEvent); + case XCB_MOTION_NOTIFY: + HANDLE_PLATFORM_WINDOW_EVENT(xcb_motion_notify_event_t, event, handleMotionNotifyEvent); + default: + break; + + } + } +} diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h new file mode 100644 index 0000000..509e798 --- /dev/null +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -0,0 +1,75 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QXCBCONNECTION_H +#define QXCBCONNECTION_H + +#include + +#include +#include + +class QXcbScreen; + +class QXcbConnection : public QObject +{ + Q_OBJECT +public: + QXcbConnection(const char *displayName = 0); + ~QXcbConnection(); + + QList screens() const { return m_screens; } + int primaryScreen() const { return m_primaryScreen; } + + xcb_connection_t *connection() const { return m_connection; } + +private slots: + void eventDispatcher(); + +private: + xcb_connection_t *m_connection; + const xcb_setup_t *m_setup; + + QList m_screens; + int m_primaryScreen; +}; + +#endif diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp new file mode 100644 index 0000000..5da86010 --- /dev/null +++ b/src/plugins/platforms/xcb/qxcbintegration.cpp @@ -0,0 +1,116 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qxcbintegration.h" +#include "qxcbconnection.h" +#include "qxcbscreen.h" +#include "qxcbwindow.h" +#include "qxcbwindowsurface.h" + +#include + +#include + +#include "qgenericunixfontdatabase.h" + +#include + +QXcbIntegration::QXcbIntegration() + : m_connection(new QXcbConnection) +{ + foreach (QXcbScreen *screen, m_connection->screens()) + m_screens << screen; + + m_fontDatabase = new QGenericUnixFontDatabase(); +} + +QXcbIntegration::~QXcbIntegration() +{ + delete m_connection; +} + +QPixmapData *QXcbIntegration::createPixmapData(QPixmapData::PixelType type) const +{ + return new QRasterPixmapData(type); +} + +QPlatformWindow *QXcbIntegration::createPlatformWindow(QWidget *widget, WId winId) const +{ + Q_UNUSED(winId); + return new QXcbWindow(widget); +} + +QWindowSurface *QXcbIntegration::createWindowSurface(QWidget *widget, WId winId) const +{ + Q_UNUSED(winId); + return new QXcbWindowSurface(widget); +} + +QList QXcbIntegration::screens() const +{ + return m_screens; +} + +void QXcbIntegration::moveToScreen(QWidget *window, int screen) +{ + Q_UNUSED(window); + Q_UNUSED(screen); +} + +bool QXcbIntegration::isVirtualDesktop() +{ + return false; +} + +QPlatformFontDatabase *QXcbIntegration::fontDatabase() const +{ + return m_fontDatabase; +} + +QPixmap QXcbIntegration::grabWindow(WId window, int x, int y, int width, int height) const +{ + Q_UNUSED(window); + Q_UNUSED(x); + Q_UNUSED(y); + Q_UNUSED(width); + Q_UNUSED(height); + return QPixmap(); +} diff --git a/src/plugins/platforms/xcb/qxcbintegration.h b/src/plugins/platforms/xcb/qxcbintegration.h new file mode 100644 index 0000000..8b599b3 --- /dev/null +++ b/src/plugins/platforms/xcb/qxcbintegration.h @@ -0,0 +1,78 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QXCBINTEGRATION_H +#define QXCBINTEGRATION_H + +#include +#include + +QT_BEGIN_NAMESPACE + +class QXcbConnection; + +class QXcbIntegration : public QPlatformIntegration +{ +public: + QXcbIntegration(); + ~QXcbIntegration(); + + QPixmapData *createPixmapData(QPixmapData::PixelType type) const; + QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId) const; + QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const; + + QList screens() const; + void moveToScreen(QWidget *window, int screen); + bool isVirtualDesktop(); + QPixmap grabWindow(WId window, int x, int y, int width, int height) const; + + QPlatformFontDatabase *fontDatabase() const; + +private: + QList m_screens; + QXcbConnection *m_connection; + + QPlatformFontDatabase *m_fontDatabase; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp new file mode 100644 index 0000000..bbd3fd4 --- /dev/null +++ b/src/plugins/platforms/xcb/qxcbscreen.cpp @@ -0,0 +1,77 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qxcbscreen.h" + +#include + +QXcbScreen::QXcbScreen(QXcbConnection *connection, xcb_screen_t *screen) + : m_connection(connection) + , m_screen(screen) +{ + printf ("\n"); + printf ("Informations of screen %d:\n", screen->root); + printf (" width.........: %d\n", screen->width_in_pixels); + printf (" height........: %d\n", screen->height_in_pixels); + printf (" depth.........: %d\n", screen->root_depth); + printf (" white pixel...: %x\n", screen->white_pixel); + printf (" black pixel...: %x\n", screen->black_pixel); + printf ("\n"); +} + +QXcbScreen::~QXcbScreen() +{ +} + +QRect QXcbScreen::geometry() const +{ + return QRect(0, 0, m_screen->width_in_pixels, m_screen->height_in_pixels); +} + +int QXcbScreen::depth() const +{ + return m_screen->root_depth; +} + +QImage::Format QXcbScreen::format() const +{ + return QImage::Format_RGB32; +} diff --git a/src/plugins/platforms/xcb/qxcbscreen.h b/src/plugins/platforms/xcb/qxcbscreen.h new file mode 100644 index 0000000..22b182b --- /dev/null +++ b/src/plugins/platforms/xcb/qxcbscreen.h @@ -0,0 +1,72 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QXCBSCREEN_H +#define QXCBSCREEN_H + +#include + +#include + +class QXcbConnection; + +class QXcbScreen : public QPlatformScreen +{ +public: + QXcbScreen(QXcbConnection *connection, xcb_screen_t *screen); + ~QXcbScreen(); + + QRect geometry() const; + int depth() const; + QImage::Format format() const; + + QXcbConnection *connection() const { return m_connection; } + + xcb_screen_t *screen() const { return m_screen; } + xcb_window_t root() const { return m_screen->root; } + +private: + QXcbConnection *m_connection; + + xcb_screen_t *m_screen; +}; + +#endif diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp new file mode 100644 index 0000000..71bef2f --- /dev/null +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -0,0 +1,189 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qxcbwindow.h" + +#include "qxcbconnection.h" +#include "qxcbscreen.h" + +#include + +#include + +#include + +QXcbWindow::QXcbWindow(QWidget *tlw) + : QPlatformWindow(tlw) +{ + m_screen = static_cast(QPlatformScreen::platformScreenForWidget(tlw)); + + const quint32 mask = XCB_CW_BACK_PIXMAP | XCB_CW_EVENT_MASK; + const quint32 values[] = { + // XCB_CW_BACK_PIXMAP + XCB_NONE, + // XCB_CW_EVENT_MASK + XCB_EVENT_MASK_EXPOSURE + | XCB_EVENT_MASK_BUTTON_PRESS + | XCB_EVENT_MASK_BUTTON_RELEASE + | XCB_EVENT_MASK_BUTTON_MOTION + }; + + m_window = xcb_generate_id(connection()); + xcb_create_window(connection(), + XCB_COPY_FROM_PARENT, // depth -- same as root + m_window, // window id + m_screen->root(), // parent window id + tlw->x(), + tlw->y(), + tlw->width(), + tlw->height(), + 0, // border width + XCB_WINDOW_CLASS_INPUT_OUTPUT, // window class + m_screen->screen()->root_visual, // visual + mask, // value mask + values); // value list + + printf("m_window: %d\n", m_window); +} + +QXcbWindow::~QXcbWindow() +{ + xcb_destroy_window(connection(), m_window); +} + +void QXcbWindow::setGeometry(const QRect &rect) +{ + QPlatformWindow::setGeometry(rect); +} + +void QXcbWindow::setVisible(bool visible) +{ + if (visible) + xcb_map_window(connection(), m_window); + else + xcb_unmap_window(connection(), m_window); +} + +Qt::WindowFlags QXcbWindow::setWindowFlags(Qt::WindowFlags flags) +{ + return flags; +} + +Qt::WindowFlags QXcbWindow::windowFlags() const +{ + return 0; +} + +WId QXcbWindow::winId() const +{ + return m_window; +} + +void QXcbWindow::setParent(const QPlatformWindow *) +{ +} + +void QXcbWindow::setWindowTitle(const QString &) +{ +} + +void QXcbWindow::raise() +{ +} + +void QXcbWindow::lower() +{ +} + +void QXcbWindow::requestActivateWindow() +{ +} + +xcb_connection_t *QXcbWindow::connection() const +{ + return m_screen->connection()->connection(); +} + +void QXcbWindow::handleExposeEvent(xcb_expose_event_t *event) +{ + if (event->count != 0) + return; + + QWindowSurface *surface = widget()->windowSurface(); + if (surface) + surface->flush(widget(), widget()->geometry(), QPoint()); +} + +static Qt::MouseButtons translateMouseButtons(int s) +{ + Qt::MouseButtons ret = 0; + if (s & XCB_BUTTON_MASK_1) + ret |= Qt::LeftButton; + if (s & XCB_BUTTON_MASK_2) + ret |= Qt::MidButton; + if (s & XCB_BUTTON_MASK_3) + ret |= Qt::RightButton; + return ret; +} + +void QXcbWindow::handleButtonPressEvent(xcb_button_press_event_t *event) +{ + handleMouseEvent(event->detail, event->state, event->time, QPoint(event->event_x, event->event_y), QPoint(event->root_x, event->root_y)); +} + +void QXcbWindow::handleButtonReleaseEvent(xcb_button_release_event_t *event) +{ + handleMouseEvent(event->detail, event->state, event->time, QPoint(event->event_x, event->event_y), QPoint(event->root_x, event->root_y)); +} + +void QXcbWindow::handleMouseEvent(xcb_button_t detail, uint16_t state, xcb_timestamp_t time, const QPoint &local, const QPoint &global) +{ + Qt::MouseButtons buttons = translateMouseButtons(state); + Qt::MouseButtons button = translateMouseButtons(detail); + buttons ^= button; // X event uses state *before*, Qt uses state *after* + + QWindowSystemInterface::handleMouseEvent(widget(), time, local, global, buttons); +} + +void QXcbWindow::handleMotionNotifyEvent(xcb_motion_notify_event_t *event) +{ +} + diff --git a/src/plugins/platforms/xcb/qxcbwindow.h b/src/plugins/platforms/xcb/qxcbwindow.h new file mode 100644 index 0000000..51c1856 --- /dev/null +++ b/src/plugins/platforms/xcb/qxcbwindow.h @@ -0,0 +1,90 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QXCBWINDOW_H +#define QXCBWINDOW_H + +#include + +#include + +class QXcbScreen; + +class QXcbWindow : public QPlatformWindow +{ +public: + QXcbWindow(QWidget *tlw); + ~QXcbWindow(); + + void setGeometry(const QRect &rect); + + void setVisible(bool visible); + Qt::WindowFlags setWindowFlags(Qt::WindowFlags flags); + Qt::WindowFlags windowFlags() const; + WId winId() const; + void setParent(const QPlatformWindow *window); + + void setWindowTitle(const QString &title); + void raise(); + void lower(); + + void requestActivateWindow(); + + QPlatformGLContext *glContext() const { return 0; } + + xcb_window_t window() const { return m_window; } + + void handleExposeEvent(xcb_expose_event_t *event); + void handleButtonPressEvent(xcb_button_press_event_t *event); + void handleButtonReleaseEvent(xcb_button_release_event_t *event); + void handleMotionNotifyEvent(xcb_motion_notify_event_t *event); + + void handleMouseEvent(xcb_button_t detail, uint16_t state, xcb_timestamp_t time, const QPoint &local, const QPoint &global); + +private: + xcb_connection_t *connection() const; + + QXcbScreen *m_screen; + + xcb_window_t m_window; +}; + +#endif diff --git a/src/plugins/platforms/xcb/qxcbwindowsurface.cpp b/src/plugins/platforms/xcb/qxcbwindowsurface.cpp new file mode 100644 index 0000000..27912cc --- /dev/null +++ b/src/plugins/platforms/xcb/qxcbwindowsurface.cpp @@ -0,0 +1,106 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qxcbwindowsurface.h" + +#include "qxcbconnection.h" +#include "qxcbscreen.h" +#include "qxcbwindow.h" + +#include + +QXcbWindowSurface::QXcbWindowSurface(QWidget *widget, bool setDefaultSurface) + : QWindowSurface(widget, setDefaultSurface) +{ + setStaticContentsSupport(false); + setPartialUpdateSupport(false); +} + +QXcbWindowSurface::~QXcbWindowSurface() +{ +} + +QPaintDevice *QXcbWindowSurface::paintDevice() +{ + return &m_image; +} + +void QXcbWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) +{ + Q_UNUSED(region); + Q_UNUSED(offset); + + QXcbScreen *screen = static_cast(QPlatformScreen::platformScreenForWidget(widget)); + QXcbWindow *window = static_cast(widget->window()->platformWindow()); + + xcb_connection_t *xcb_con = screen->connection()->connection(); + + m_gc = xcb_generate_id(xcb_con); + xcb_create_gc(xcb_con, m_gc, window->window(), 0, 0); + + xcb_put_image(xcb_con, + XCB_IMAGE_FORMAT_Z_PIXMAP, + window->window(), + m_gc, + m_image.width(), + m_image.height(), + 0, + 0, + 0, + 24, + m_image.numBytes(), + m_image.bits()); + + xcb_free_gc(xcb_con, m_gc); + xcb_flush(xcb_con); +} + +void QXcbWindowSurface::resize(const QSize &size) +{ + QWindowSurface::resize(size); + m_image = QImage(size, QImage::Format_RGB32); +} + +bool QXcbWindowSurface::scroll(const QRegion &area, int dx, int dy) +{ + return false; +} + diff --git a/src/plugins/platforms/xcb/qxcbwindowsurface.h b/src/plugins/platforms/xcb/qxcbwindowsurface.h new file mode 100644 index 0000000..74be9a2 --- /dev/null +++ b/src/plugins/platforms/xcb/qxcbwindowsurface.h @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QXCBWINDOWSURFACE_H +#define QXCBWINDOWSURFACE_H + +#include + +#include + +class QXcbWindowSurface : public QWindowSurface +{ +public: + QXcbWindowSurface(QWidget *widget, bool setDefaultSurface = true); + ~QXcbWindowSurface(); + + QPaintDevice *paintDevice(); + void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); + void resize(const QSize &size); + bool scroll(const QRegion &area, int dx, int dy); + +private: + QImage m_image; + + xcb_gcontext_t m_gc; +}; + +#endif diff --git a/src/plugins/platforms/xcb/xcb.pro b/src/plugins/platforms/xcb/xcb.pro new file mode 100644 index 0000000..cbbda0d --- /dev/null +++ b/src/plugins/platforms/xcb/xcb.pro @@ -0,0 +1,26 @@ +TARGET = xcb + +include(../../qpluginbase.pri) +QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforms + +SOURCES = \ + main.cpp \ + qxcbintegration.cpp \ + qxcbconnection.cpp \ + qxcbscreen.cpp \ + qxcbwindow.cpp \ + qxcbwindowsurface.cpp + +HEADERS = \ + qxcbintegration.h \ + qxcbconnection.h \ + qxcbscreen.h \ + qxcbwindow.h \ + qxcbwindowsurface.h + +LIBS += -lxcb + +include (../fontdatabases/genericunix/genericunix.pri) + +target.path += $$[QT_INSTALL_PLUGINS]/platforms +INSTALLS += target -- cgit v0.12 From eef89ebc2abe0f095a4ad186a449ff78f1e57dcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Mon, 7 Feb 2011 16:19:01 +0100 Subject: Make sure its possible to use qpa scope in use applications In user applications it should be possible to write something like qpa { HEADERS += Lighthousespecificheader.h } Reviewed-by: paul --- configure | 1 + 1 file changed, 1 insertion(+) diff --git a/configure b/configure index 9730e25..bacd2e4 100755 --- a/configure +++ b/configure @@ -6996,6 +6996,7 @@ fi if [ "$PLATFORM_QPA" = "yes" ]; then QMAKE_CONFIG="$QMAKE_CONFIG qpa" QT_CONFIG="$QT_CONFIG qpa" + QTCONFIG_CONFIG="$QTCONFIG_CONFIG qpa" rm -f "src/.moc/$QMAKE_OUTDIR/allmoc.cpp" # needs remaking if config changes fi -- cgit v0.12 From 5708dba6b3661d69446802c9a83d348520d5cd60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Mon, 7 Feb 2011 17:45:49 +0100 Subject: Improve mouse input handling in XCB lighthouse backend. --- src/plugins/platforms/xcb/qxcbwindow.cpp | 53 +++++++++++++++++++++++++++----- 1 file changed, 46 insertions(+), 7 deletions(-) diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 71bef2f..7d18d52 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -164,26 +164,65 @@ static Qt::MouseButtons translateMouseButtons(int s) return ret; } +static Qt::MouseButton translateMouseButton(xcb_button_t s) +{ + switch (s) { + case 1: + return Qt::LeftButton; + case 2: + return Qt::MidButton; + case 3: + return Qt::RightButton; + default: + return Qt::NoButton; + } +} + void QXcbWindow::handleButtonPressEvent(xcb_button_press_event_t *event) { - handleMouseEvent(event->detail, event->state, event->time, QPoint(event->event_x, event->event_y), QPoint(event->root_x, event->root_y)); + QPoint local(event->event_x, event->event_y); + QPoint global(event->root_x, event->root_y); + + Qt::KeyboardModifiers modifiers = Qt::NoModifier; + + if (event->detail >= 4 && event->detail <= 7) { + //logic borrowed from qapplication_x11.cpp + int delta = 120 * ((event->detail == 4 || event->detail == 6) ? 1 : -1); + bool hor = (((event->detail == 4 || event->detail == 5) + && (modifiers & Qt::AltModifier)) + || (event->detail == 6 || event->detail == 7)); + + QWindowSystemInterface::handleWheelEvent(widget(), event->time, + local, global, delta, hor ? Qt::Horizontal : Qt::Vertical); + return; + } + + handleMouseEvent(event->detail, event->state, event->time, local, global); } void QXcbWindow::handleButtonReleaseEvent(xcb_button_release_event_t *event) { - handleMouseEvent(event->detail, event->state, event->time, QPoint(event->event_x, event->event_y), QPoint(event->root_x, event->root_y)); + QPoint local(event->event_x, event->event_y); + QPoint global(event->root_x, event->root_y); + + handleMouseEvent(event->detail, event->state, event->time, local, global); +} + +void QXcbWindow::handleMotionNotifyEvent(xcb_motion_notify_event_t *event) +{ + QPoint local(event->event_x, event->event_y); + QPoint global(event->root_x, event->root_y); + + handleMouseEvent(event->detail, event->state, event->time, local, global); } void QXcbWindow::handleMouseEvent(xcb_button_t detail, uint16_t state, xcb_timestamp_t time, const QPoint &local, const QPoint &global) { Qt::MouseButtons buttons = translateMouseButtons(state); - Qt::MouseButtons button = translateMouseButtons(detail); + Qt::MouseButton button = translateMouseButton(detail); + buttons ^= button; // X event uses state *before*, Qt uses state *after* QWindowSystemInterface::handleMouseEvent(widget(), time, local, global, buttons); } -void QXcbWindow::handleMotionNotifyEvent(xcb_motion_notify_event_t *event) -{ -} - -- cgit v0.12 From 3c603d35d46257ceee50bfe315d4cd5abd97b24f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Mon, 7 Feb 2011 18:14:32 +0100 Subject: Lighthouse Wayland: wayland-egl entry points where renamed Conflicts: src/plugins/platforms/wayland/qwaylanddisplay.cpp src/plugins/platforms/wayland/qwaylanddrmsurface.cpp --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 2 +- src/plugins/platforms/wayland/qwaylanddrmsurface.cpp | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 2e30c2f..0747afd 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -184,7 +184,7 @@ QWaylandDisplay::QWaylandDisplay(void) wl_display_add_global_listener(mDisplay, QWaylandDisplay::displayHandleGlobal, this); - mNativeEglDisplay = wl_egl_native_display_create(mDisplay); + mNativeEglDisplay = wl_egl_display_create(mDisplay); mEglDisplay = eglGetDisplay(mNativeEglDisplay); if (mEglDisplay == NULL) { diff --git a/src/plugins/platforms/wayland/qwaylanddrmsurface.cpp b/src/plugins/platforms/wayland/qwaylanddrmsurface.cpp index a9a8046..aaf4a5c 100644 --- a/src/plugins/platforms/wayland/qwaylanddrmsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylanddrmsurface.cpp @@ -77,9 +77,9 @@ QWaylandDrmBuffer::QWaylandDrmBuffer(QWaylandDisplay *display, break; } - mPixmap = wl_egl_native_pixmap_create(display->nativeDisplay(), - size.width(), size.height(), - visual, 0); + mPixmap = wl_egl_pixmap_create(display->nativeDisplay(), + size.width(), size.height(), + visual, 0); mImage = eglCreateImageKHR(display->eglDisplay(), NULL, EGL_NATIVE_PIXMAP_KHR, @@ -90,15 +90,14 @@ QWaylandDrmBuffer::QWaylandDrmBuffer(QWaylandDisplay *display, glBindTexture(GL_TEXTURE_2D, mTexture); glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, mImage); - mBuffer = wl_egl_native_pixmap_create_buffer(display->nativeDisplay(), - mPixmap); + mBuffer = wl_egl_pixmap_create_buffer(display->nativeDisplay(), mPixmap); } QWaylandDrmBuffer::~QWaylandDrmBuffer(void) { glDeleteTextures(1, &mTexture); eglDestroyImageKHR(mDisplay->eglDisplay(), mImage); - wl_egl_native_pixmap_destroy(mPixmap); + wl_egl_pixmap_destroy(mPixmap); wl_buffer_destroy(mBuffer); } -- cgit v0.12 From 573901d760414ad7c1fd74bad75b2c21532d0ce0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Mon, 7 Feb 2011 17:50:31 +0100 Subject: Added support for scrolling in XCB window surface. --- src/plugins/platforms/xcb/qxcbwindowsurface.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/xcb/qxcbwindowsurface.cpp b/src/plugins/platforms/xcb/qxcbwindowsurface.cpp index 27912cc..ad91c34 100644 --- a/src/plugins/platforms/xcb/qxcbwindowsurface.cpp +++ b/src/plugins/platforms/xcb/qxcbwindowsurface.cpp @@ -99,8 +99,17 @@ void QXcbWindowSurface::resize(const QSize &size) m_image = QImage(size, QImage::Format_RGB32); } +extern void qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &offset); + bool QXcbWindowSurface::scroll(const QRegion &area, int dx, int dy) { - return false; + if (m_image.isNull()) + return false; + + const QVector rects = area.rects(); + for (int i = 0; i < rects.size(); ++i) + qt_scrollRectInImage(m_image, rects.at(i), QPoint(dx, dy)); + + return true; } -- cgit v0.12 From 864e16ad2858ba752070528b1ba03edeafa54579 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Mon, 7 Feb 2011 18:30:47 +0100 Subject: Added atom resolving, resizing, and window title support to XCB backend. --- src/plugins/platforms/xcb/qxcbconnection.cpp | 198 ++++++++++++++++++++++++++- src/plugins/platforms/xcb/qxcbconnection.h | 173 +++++++++++++++++++++++ src/plugins/platforms/xcb/qxcbwindow.cpp | 25 +++- src/plugins/platforms/xcb/qxcbwindow.h | 1 + 4 files changed, 395 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index d5e44ad..df655a3 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -49,10 +49,11 @@ #include QXcbConnection::QXcbConnection(const char *displayName) + : m_displayName(displayName ? QByteArray(displayName) : qgetenv("DISPLAY")) { int primaryScreen; - m_connection = xcb_connect(displayName, &primaryScreen); + m_connection = xcb_connect(m_displayName.constData(), &primaryScreen); m_setup = xcb_get_setup(m_connection); @@ -65,6 +66,8 @@ QXcbConnection::QXcbConnection(const char *displayName) QSocketNotifier *socket = new QSocketNotifier(xcb_get_file_descriptor(m_connection), QSocketNotifier::Read, this); connect(socket, SIGNAL(activated(int)), this, SLOT(eventDispatcher())); + + initializeAllAtoms(); } QXcbConnection::~QXcbConnection() @@ -102,9 +105,202 @@ void QXcbConnection::eventDispatcher() HANDLE_PLATFORM_WINDOW_EVENT(xcb_button_release_event_t, event, handleButtonReleaseEvent); case XCB_MOTION_NOTIFY: HANDLE_PLATFORM_WINDOW_EVENT(xcb_motion_notify_event_t, event, handleMotionNotifyEvent); + case XCB_CONFIGURE_NOTIFY: + HANDLE_PLATFORM_WINDOW_EVENT(xcb_configure_notify_event_t, event, handleConfigureNotifyEvent); default: break; } } } + +static const char * xcb_atomnames = { + // window-manager <-> client protocols + "WM_PROTOCOLS\0" + "WM_DELETE_WINDOW\0" + "WM_TAKE_FOCUS\0" + "_NET_WM_PING\0" + "_NET_WM_CONTEXT_HELP\0" + "_NET_WM_SYNC_REQUEST\0" + "_NET_WM_SYNC_REQUEST_COUNTER\0" + + // ICCCM window state + "WM_STATE\0" + "WM_CHANGE_STATE\0" + + // Session management + "WM_CLIENT_LEADER\0" + "WM_WINDOW_ROLE\0" + "SM_CLIENT_ID\0" + + // Clipboard + "CLIPBOARD\0" + "INCR\0" + "TARGETS\0" + "MULTIPLE\0" + "TIMESTAMP\0" + "SAVE_TARGETS\0" + "CLIP_TEMPORARY\0" + "_QT_SELECTION\0" + "_QT_CLIPBOARD_SENTINEL\0" + "_QT_SELECTION_SENTINEL\0" + "CLIPBOARD_MANAGER\0" + + "RESOURCE_MANAGER\0" + + "_XSETROOT_ID\0" + + "_QT_SCROLL_DONE\0" + "_QT_INPUT_ENCODING\0" + + "_MOTIF_WM_HINTS\0" + + "DTWM_IS_RUNNING\0" + "ENLIGHTENMENT_DESKTOP\0" + "_DT_SAVE_MODE\0" + "_SGI_DESKS_MANAGER\0" + + // EWMH (aka NETWM) + "_NET_SUPPORTED\0" + "_NET_VIRTUAL_ROOTS\0" + "_NET_WORKAREA\0" + + "_NET_MOVERESIZE_WINDOW\0" + "_NET_WM_MOVERESIZE\0" + + "_NET_WM_NAME\0" + "_NET_WM_ICON_NAME\0" + "_NET_WM_ICON\0" + + "_NET_WM_PID\0" + + "_NET_WM_WINDOW_OPACITY\0" + + "_NET_WM_STATE\0" + "_NET_WM_STATE_ABOVE\0" + "_NET_WM_STATE_BELOW\0" + "_NET_WM_STATE_FULLSCREEN\0" + "_NET_WM_STATE_MAXIMIZED_HORZ\0" + "_NET_WM_STATE_MAXIMIZED_VERT\0" + "_NET_WM_STATE_MODAL\0" + "_NET_WM_STATE_STAYS_ON_TOP\0" + "_NET_WM_STATE_DEMANDS_ATTENTION\0" + + "_NET_WM_USER_TIME\0" + "_NET_WM_USER_TIME_WINDOW\0" + "_NET_WM_FULL_PLACEMENT\0" + + "_NET_WM_WINDOW_TYPE\0" + "_NET_WM_WINDOW_TYPE_DESKTOP\0" + "_NET_WM_WINDOW_TYPE_DOCK\0" + "_NET_WM_WINDOW_TYPE_TOOLBAR\0" + "_NET_WM_WINDOW_TYPE_MENU\0" + "_NET_WM_WINDOW_TYPE_UTILITY\0" + "_NET_WM_WINDOW_TYPE_SPLASH\0" + "_NET_WM_WINDOW_TYPE_DIALOG\0" + "_NET_WM_WINDOW_TYPE_DROPDOWN_MENU\0" + "_NET_WM_WINDOW_TYPE_POPUP_MENU\0" + "_NET_WM_WINDOW_TYPE_TOOLTIP\0" + "_NET_WM_WINDOW_TYPE_NOTIFICATION\0" + "_NET_WM_WINDOW_TYPE_COMBO\0" + "_NET_WM_WINDOW_TYPE_DND\0" + "_NET_WM_WINDOW_TYPE_NORMAL\0" + "_KDE_NET_WM_WINDOW_TYPE_OVERRIDE\0" + + "_KDE_NET_WM_FRAME_STRUT\0" + + "_NET_STARTUP_INFO\0" + "_NET_STARTUP_INFO_BEGIN\0" + + "_NET_SUPPORTING_WM_CHECK\0" + + "_NET_WM_CM_S0\0" + + "_NET_SYSTEM_TRAY_VISUAL\0" + + "_NET_ACTIVE_WINDOW\0" + + // Property formats + "COMPOUND_TEXT\0" + "TEXT\0" + "UTF8_STRING\0" + + // xdnd + "XdndEnter\0" + "XdndPosition\0" + "XdndStatus\0" + "XdndLeave\0" + "XdndDrop\0" + "XdndFinished\0" + "XdndTypeList\0" + "XdndActionList\0" + + "XdndSelection\0" + + "XdndAware\0" + "XdndProxy\0" + + "XdndActionCopy\0" + "XdndActionLink\0" + "XdndActionMove\0" + "XdndActionPrivate\0" + + // Motif DND + "_MOTIF_DRAG_AND_DROP_MESSAGE\0" + "_MOTIF_DRAG_INITIATOR_INFO\0" + "_MOTIF_DRAG_RECEIVER_INFO\0" + "_MOTIF_DRAG_WINDOW\0" + "_MOTIF_DRAG_TARGETS\0" + + "XmTRANSFER_SUCCESS\0" + "XmTRANSFER_FAILURE\0" + + // Xkb + "_XKB_RULES_NAMES\0" + + // XEMBED + "_XEMBED\0" + "_XEMBED_INFO\0" + + // Wacom old. (before version 0.10) + "Wacom Stylus\0" + "Wacom Cursor\0" + "Wacom Eraser\0" + + // Tablet + "STYLUS\0" + "ERASER\0" +}; + +xcb_atom_t QXcbConnection::atom(QXcbAtom::Atom atom) +{ + return m_allAtoms[atom]; +} + +void QXcbConnection::initializeAllAtoms() { + const char *names[QXcbAtom::NAtoms]; + const char *ptr = xcb_atomnames; + + int i = 0; + while (*ptr) { + names[i++] = ptr; + while (*ptr) + ++ptr; + ++ptr; + } + + Q_ASSERT(i == QXcbAtom::NPredefinedAtoms); + + QByteArray settings_atom_name("_QT_SETTINGS_TIMESTAMP_"); + settings_atom_name += m_displayName; + names[i++] = settings_atom_name; + + xcb_intern_atom_cookie_t cookies[QXcbAtom::NAtoms]; + + Q_ASSERT(i == QXcbAtom::NAtoms); + for (i = 0; i < QXcbAtom::NAtoms; ++i) + cookies[i] = xcb_intern_atom(m_connection, false, strlen(names[i]), names[i]); + + for (i = 0; i < QXcbAtom::NAtoms; ++i) + m_allAtoms[i] = xcb_intern_atom_reply(m_connection, cookies[i], 0)->atom; +} diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index 509e798..e0b506f 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -49,6 +49,169 @@ class QXcbScreen; +namespace QXcbAtom { + enum Atom { + // window-manager <-> client protocols + WM_PROTOCOLS, + WM_DELETE_WINDOW, + WM_TAKE_FOCUS, + _NET_WM_PING, + _NET_WM_CONTEXT_HELP, + _NET_WM_SYNC_REQUEST, + _NET_WM_SYNC_REQUEST_COUNTER, + + // ICCCM window state + WM_STATE, + WM_CHANGE_STATE, + + // Session management + WM_CLIENT_LEADER, + WM_WINDOW_ROLE, + SM_CLIENT_ID, + + // Clipboard + CLIPBOARD, + INCR, + TARGETS, + MULTIPLE, + TIMESTAMP, + SAVE_TARGETS, + CLIP_TEMPORARY, + _QT_SELECTION, + _QT_CLIPBOARD_SENTINEL, + _QT_SELECTION_SENTINEL, + CLIPBOARD_MANAGER, + + RESOURCE_MANAGER, + + _XSETROOT_ID, + + _QT_SCROLL_DONE, + _QT_INPUT_ENCODING, + + _MOTIF_WM_HINTS, + + DTWM_IS_RUNNING, + ENLIGHTENMENT_DESKTOP, + _DT_SAVE_MODE, + _SGI_DESKS_MANAGER, + + // EWMH (aka NETWM) + _NET_SUPPORTED, + _NET_VIRTUAL_ROOTS, + _NET_WORKAREA, + + _NET_MOVERESIZE_WINDOW, + _NET_WM_MOVERESIZE, + + _NET_WM_NAME, + _NET_WM_ICON_NAME, + _NET_WM_ICON, + + _NET_WM_PID, + + _NET_WM_WINDOW_OPACITY, + + _NET_WM_STATE, + _NET_WM_STATE_ABOVE, + _NET_WM_STATE_BELOW, + _NET_WM_STATE_FULLSCREEN, + _NET_WM_STATE_MAXIMIZED_HORZ, + _NET_WM_STATE_MAXIMIZED_VERT, + _NET_WM_STATE_MODAL, + _NET_WM_STATE_STAYS_ON_TOP, + _NET_WM_STATE_DEMANDS_ATTENTION, + + _NET_WM_USER_TIME, + _NET_WM_USER_TIME_WINDOW, + _NET_WM_FULL_PLACEMENT, + + _NET_WM_WINDOW_TYPE, + _NET_WM_WINDOW_TYPE_DESKTOP, + _NET_WM_WINDOW_TYPE_DOCK, + _NET_WM_WINDOW_TYPE_TOOLBAR, + _NET_WM_WINDOW_TYPE_MENU, + _NET_WM_WINDOW_TYPE_UTILITY, + _NET_WM_WINDOW_TYPE_SPLASH, + _NET_WM_WINDOW_TYPE_DIALOG, + _NET_WM_WINDOW_TYPE_DROPDOWN_MENU, + _NET_WM_WINDOW_TYPE_POPUP_MENU, + _NET_WM_WINDOW_TYPE_TOOLTIP, + _NET_WM_WINDOW_TYPE_NOTIFICATION, + _NET_WM_WINDOW_TYPE_COMBO, + _NET_WM_WINDOW_TYPE_DND, + _NET_WM_WINDOW_TYPE_NORMAL, + _KDE_NET_WM_WINDOW_TYPE_OVERRIDE, + + _KDE_NET_WM_FRAME_STRUT, + + _NET_STARTUP_INFO, + _NET_STARTUP_INFO_BEGIN, + + _NET_SUPPORTING_WM_CHECK, + + _NET_WM_CM_S0, + + _NET_SYSTEM_TRAY_VISUAL, + + _NET_ACTIVE_WINDOW, + + // Property formats + COMPOUND_TEXT, + TEXT, + UTF8_STRING, + + // Xdnd + XdndEnter, + XdndPosition, + XdndStatus, + XdndLeave, + XdndDrop, + XdndFinished, + XdndTypelist, + XdndActionList, + + XdndSelection, + + XdndAware, + XdndProxy, + + XdndActionCopy, + XdndActionLink, + XdndActionMove, + XdndActionPrivate, + + // Motif DND + _MOTIF_DRAG_AND_DROP_MESSAGE, + _MOTIF_DRAG_INITIATOR_INFO, + _MOTIF_DRAG_RECEIVER_INFO, + _MOTIF_DRAG_WINDOW, + _MOTIF_DRAG_TARGETS, + + XmTRANSFER_SUCCESS, + XmTRANSFER_FAILURE, + + // Xkb + _XKB_RULES_NAMES, + + // XEMBED + _XEMBED, + _XEMBED_INFO, + + XWacomStylus, + XWacomCursor, + XWacomEraser, + + XTabletStylus, + XTabletEraser, + + NPredefinedAtoms, + + _QT_SETTINGS_TIMESTAMP = NPredefinedAtoms, + NAtoms + }; +} + class QXcbConnection : public QObject { Q_OBJECT @@ -61,15 +224,25 @@ public: xcb_connection_t *connection() const { return m_connection; } + xcb_atom_t atom(QXcbAtom::Atom atom); + + const char *displayName() const { return m_displayName.constData(); } + private slots: void eventDispatcher(); private: + void initializeAllAtoms(); + xcb_connection_t *m_connection; const xcb_setup_t *m_setup; QList m_screens; int m_primaryScreen; + + xcb_atom_t m_allAtoms[QXcbAtom::NAtoms]; + + QByteArray m_displayName; }; #endif diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 7d18d52..c6bb6d7 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -61,6 +61,7 @@ QXcbWindow::QXcbWindow(QWidget *tlw) XCB_NONE, // XCB_CW_EVENT_MASK XCB_EVENT_MASK_EXPOSURE + | XCB_EVENT_MASK_STRUCTURE_NOTIFY | XCB_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE | XCB_EVENT_MASK_BUTTON_MOTION @@ -121,8 +122,17 @@ void QXcbWindow::setParent(const QPlatformWindow *) { } -void QXcbWindow::setWindowTitle(const QString &) +void QXcbWindow::setWindowTitle(const QString &title) { + QByteArray ba = title.toUtf8(); + xcb_change_property (connection(), + XCB_PROP_MODE_REPLACE, + m_window, + m_screen->connection()->atom(QXcbAtom::_NET_WM_NAME), + m_screen->connection()->atom(QXcbAtom::UTF8_STRING), + 8, + ba.length(), + ba.constData()); } void QXcbWindow::raise() @@ -152,6 +162,19 @@ void QXcbWindow::handleExposeEvent(xcb_expose_event_t *event) surface->flush(widget(), widget()->geometry(), QPoint()); } +void QXcbWindow::handleConfigureNotifyEvent(xcb_configure_notify_event_t *event) +{ + int xpos = geometry().x(); + int ypos = geometry().y(); + + if ((event->width == geometry().width() && event->height == geometry().height()) || event->x != 0 || event->y != 0) { + xpos = event->x; + ypos = event->y; + } + + QWindowSystemInterface::handleGeometryChange(widget(), QRect(xpos, ypos, event->width, event->height)); +} + static Qt::MouseButtons translateMouseButtons(int s) { Qt::MouseButtons ret = 0; diff --git a/src/plugins/platforms/xcb/qxcbwindow.h b/src/plugins/platforms/xcb/qxcbwindow.h index 51c1856..d74786b 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.h +++ b/src/plugins/platforms/xcb/qxcbwindow.h @@ -73,6 +73,7 @@ public: xcb_window_t window() const { return m_window; } void handleExposeEvent(xcb_expose_event_t *event); + void handleConfigureNotifyEvent(xcb_configure_notify_event_t *event); void handleButtonPressEvent(xcb_button_press_event_t *event); void handleButtonReleaseEvent(xcb_button_release_event_t *event); void handleMotionNotifyEvent(xcb_motion_notify_event_t *event); -- cgit v0.12 From 4d6150a045a37fe82ec4abad2721eba4374a8c37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Tue, 8 Feb 2011 10:11:32 +0100 Subject: Add WM_DELETE_WINDOW support and clean up atom / connection handling. --- src/plugins/platforms/xcb/qxcbconnection.cpp | 14 +++--- src/plugins/platforms/xcb/qxcbconnection.h | 4 +- src/plugins/platforms/xcb/qxcbobject.h | 62 +++++++++++++++++++++++++ src/plugins/platforms/xcb/qxcbscreen.cpp | 2 +- src/plugins/platforms/xcb/qxcbscreen.h | 8 ++-- src/plugins/platforms/xcb/qxcbwindow.cpp | 45 ++++++++++++------ src/plugins/platforms/xcb/qxcbwindow.h | 7 +-- src/plugins/platforms/xcb/qxcbwindowsurface.cpp | 16 +++---- src/plugins/platforms/xcb/qxcbwindowsurface.h | 4 +- src/plugins/platforms/xcb/xcb.pro | 1 + 10 files changed, 124 insertions(+), 39 deletions(-) create mode 100644 src/plugins/platforms/xcb/qxcbobject.h diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index df655a3..023f673 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -55,7 +55,7 @@ QXcbConnection::QXcbConnection(const char *displayName) m_connection = xcb_connect(m_displayName.constData(), &primaryScreen); - m_setup = xcb_get_setup(m_connection); + m_setup = xcb_get_setup(xcb_connection()); xcb_screen_iterator_t it = xcb_setup_roots_iterator(m_setup); @@ -64,7 +64,7 @@ QXcbConnection::QXcbConnection(const char *displayName) xcb_screen_next(&it); } - QSocketNotifier *socket = new QSocketNotifier(xcb_get_file_descriptor(m_connection), QSocketNotifier::Read, this); + QSocketNotifier *socket = new QSocketNotifier(xcb_get_file_descriptor(xcb_connection()), QSocketNotifier::Read, this); connect(socket, SIGNAL(activated(int)), this, SLOT(eventDispatcher())); initializeAllAtoms(); @@ -74,7 +74,7 @@ QXcbConnection::~QXcbConnection() { qDeleteAll(m_screens); - xcb_disconnect(m_connection); + xcb_disconnect(xcb_connection()); } QXcbWindow *platformWindowFromId(xcb_window_t id) @@ -95,7 +95,7 @@ break; void QXcbConnection::eventDispatcher() { - while (xcb_generic_event_t *event = xcb_poll_for_event(m_connection)) { + while (xcb_generic_event_t *event = xcb_poll_for_event(xcb_connection())) { switch (event->response_type & ~0x80) { case XCB_EXPOSE: HANDLE_PLATFORM_WINDOW_EVENT(xcb_expose_event_t, window, handleExposeEvent); @@ -107,6 +107,8 @@ void QXcbConnection::eventDispatcher() HANDLE_PLATFORM_WINDOW_EVENT(xcb_motion_notify_event_t, event, handleMotionNotifyEvent); case XCB_CONFIGURE_NOTIFY: HANDLE_PLATFORM_WINDOW_EVENT(xcb_configure_notify_event_t, event, handleConfigureNotifyEvent); + case XCB_CLIENT_MESSAGE: + HANDLE_PLATFORM_WINDOW_EVENT(xcb_client_message_event_t, window, handleClientMessageEvent); default: break; @@ -299,8 +301,8 @@ void QXcbConnection::initializeAllAtoms() { Q_ASSERT(i == QXcbAtom::NAtoms); for (i = 0; i < QXcbAtom::NAtoms; ++i) - cookies[i] = xcb_intern_atom(m_connection, false, strlen(names[i]), names[i]); + cookies[i] = xcb_intern_atom(xcb_connection(), false, strlen(names[i]), names[i]); for (i = 0; i < QXcbAtom::NAtoms; ++i) - m_allAtoms[i] = xcb_intern_atom_reply(m_connection, cookies[i], 0)->atom; + m_allAtoms[i] = xcb_intern_atom_reply(xcb_connection(), cookies[i], 0)->atom; } diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index e0b506f..9fb641e 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -222,12 +222,12 @@ public: QList screens() const { return m_screens; } int primaryScreen() const { return m_primaryScreen; } - xcb_connection_t *connection() const { return m_connection; } - xcb_atom_t atom(QXcbAtom::Atom atom); const char *displayName() const { return m_displayName.constData(); } + xcb_connection_t *xcb_connection() const { return m_connection; } + private slots: void eventDispatcher(); diff --git a/src/plugins/platforms/xcb/qxcbobject.h b/src/plugins/platforms/xcb/qxcbobject.h new file mode 100644 index 0000000..cabfd7c --- /dev/null +++ b/src/plugins/platforms/xcb/qxcbobject.h @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QXCBOBJECT_H +#define QXCBOBJECT_H + +#include "qxcbconnection.h" + +class QXcbObject +{ +public: + QXcbObject(QXcbConnection *connection = 0) : m_connection(connection) {} + + void setConnection(QXcbConnection *connection) { m_connection = connection; } + QXcbConnection *connection() const { return m_connection; } + + xcb_atom_t atom(QXcbAtom::Atom atom) const { return m_connection->atom(atom); } + xcb_connection_t *xcb_connection() const { return m_connection->xcb_connection(); } + +private: + QXcbConnection *m_connection; +}; + +#endif diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp index bbd3fd4..1adde6b 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.cpp +++ b/src/plugins/platforms/xcb/qxcbscreen.cpp @@ -44,7 +44,7 @@ #include QXcbScreen::QXcbScreen(QXcbConnection *connection, xcb_screen_t *screen) - : m_connection(connection) + : QXcbObject(connection) , m_screen(screen) { printf ("\n"); diff --git a/src/plugins/platforms/xcb/qxcbscreen.h b/src/plugins/platforms/xcb/qxcbscreen.h index 22b182b..88de1a8 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.h +++ b/src/plugins/platforms/xcb/qxcbscreen.h @@ -46,9 +46,11 @@ #include +#include "qxcbobject.h" + class QXcbConnection; -class QXcbScreen : public QPlatformScreen +class QXcbScreen : public QXcbObject, public QPlatformScreen { public: QXcbScreen(QXcbConnection *connection, xcb_screen_t *screen); @@ -58,14 +60,10 @@ public: int depth() const; QImage::Format format() const; - QXcbConnection *connection() const { return m_connection; } - xcb_screen_t *screen() const { return m_screen; } xcb_window_t root() const { return m_screen->root; } private: - QXcbConnection *m_connection; - xcb_screen_t *m_screen; }; diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index c6bb6d7..c7bcd38 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -55,6 +55,8 @@ QXcbWindow::QXcbWindow(QWidget *tlw) { m_screen = static_cast(QPlatformScreen::platformScreenForWidget(tlw)); + setConnection(m_screen->connection()); + const quint32 mask = XCB_CW_BACK_PIXMAP | XCB_CW_EVENT_MASK; const quint32 values[] = { // XCB_CW_BACK_PIXMAP @@ -67,8 +69,8 @@ QXcbWindow::QXcbWindow(QWidget *tlw) | XCB_EVENT_MASK_BUTTON_MOTION }; - m_window = xcb_generate_id(connection()); - xcb_create_window(connection(), + m_window = xcb_generate_id(xcb_connection()); + xcb_create_window(xcb_connection(), XCB_COPY_FROM_PARENT, // depth -- same as root m_window, // window id m_screen->root(), // parent window id @@ -82,12 +84,25 @@ QXcbWindow::QXcbWindow(QWidget *tlw) mask, // value mask values); // value list + xcb_atom_t properties[] = { + atom(QXcbAtom::WM_DELETE_WINDOW) + }; + + xcb_change_property(xcb_connection(), + XCB_PROP_MODE_REPLACE, + m_window, + atom(QXcbAtom::WM_PROTOCOLS), + 4, + 32, + sizeof(properties) / sizeof(xcb_atom_t), + properties); + printf("m_window: %d\n", m_window); } QXcbWindow::~QXcbWindow() { - xcb_destroy_window(connection(), m_window); + xcb_destroy_window(xcb_connection(), m_window); } void QXcbWindow::setGeometry(const QRect &rect) @@ -98,9 +113,9 @@ void QXcbWindow::setGeometry(const QRect &rect) void QXcbWindow::setVisible(bool visible) { if (visible) - xcb_map_window(connection(), m_window); + xcb_map_window(xcb_connection(), m_window); else - xcb_unmap_window(connection(), m_window); + xcb_unmap_window(xcb_connection(), m_window); } Qt::WindowFlags QXcbWindow::setWindowFlags(Qt::WindowFlags flags) @@ -125,11 +140,11 @@ void QXcbWindow::setParent(const QPlatformWindow *) void QXcbWindow::setWindowTitle(const QString &title) { QByteArray ba = title.toUtf8(); - xcb_change_property (connection(), + xcb_change_property (xcb_connection(), XCB_PROP_MODE_REPLACE, m_window, - m_screen->connection()->atom(QXcbAtom::_NET_WM_NAME), - m_screen->connection()->atom(QXcbAtom::UTF8_STRING), + atom(QXcbAtom::_NET_WM_NAME), + atom(QXcbAtom::UTF8_STRING), 8, ba.length(), ba.constData()); @@ -147,11 +162,6 @@ void QXcbWindow::requestActivateWindow() { } -xcb_connection_t *QXcbWindow::connection() const -{ - return m_screen->connection()->connection(); -} - void QXcbWindow::handleExposeEvent(xcb_expose_event_t *event) { if (event->count != 0) @@ -162,6 +172,15 @@ void QXcbWindow::handleExposeEvent(xcb_expose_event_t *event) surface->flush(widget(), widget()->geometry(), QPoint()); } +void QXcbWindow::handleClientMessageEvent(xcb_client_message_event_t *event) +{ + if (event->format == 32 && event->type == atom(QXcbAtom::WM_PROTOCOLS)) { + if (event->data.data32[0] == atom(QXcbAtom::WM_DELETE_WINDOW)) { + QWindowSystemInterface::handleCloseEvent(widget()); + } + } +} + void QXcbWindow::handleConfigureNotifyEvent(xcb_configure_notify_event_t *event) { int xpos = geometry().x(); diff --git a/src/plugins/platforms/xcb/qxcbwindow.h b/src/plugins/platforms/xcb/qxcbwindow.h index d74786b..a772d30 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.h +++ b/src/plugins/platforms/xcb/qxcbwindow.h @@ -46,9 +46,11 @@ #include +#include "qxcbobject.h" + class QXcbScreen; -class QXcbWindow : public QPlatformWindow +class QXcbWindow : public QXcbObject, public QPlatformWindow { public: QXcbWindow(QWidget *tlw); @@ -73,6 +75,7 @@ public: xcb_window_t window() const { return m_window; } void handleExposeEvent(xcb_expose_event_t *event); + void handleClientMessageEvent(xcb_client_message_event_t *event); void handleConfigureNotifyEvent(xcb_configure_notify_event_t *event); void handleButtonPressEvent(xcb_button_press_event_t *event); void handleButtonReleaseEvent(xcb_button_release_event_t *event); @@ -81,8 +84,6 @@ public: void handleMouseEvent(xcb_button_t detail, uint16_t state, xcb_timestamp_t time, const QPoint &local, const QPoint &global); private: - xcb_connection_t *connection() const; - QXcbScreen *m_screen; xcb_window_t m_window; diff --git a/src/plugins/platforms/xcb/qxcbwindowsurface.cpp b/src/plugins/platforms/xcb/qxcbwindowsurface.cpp index ad91c34..e3b2c6c 100644 --- a/src/plugins/platforms/xcb/qxcbwindowsurface.cpp +++ b/src/plugins/platforms/xcb/qxcbwindowsurface.cpp @@ -52,6 +52,9 @@ QXcbWindowSurface::QXcbWindowSurface(QWidget *widget, bool setDefaultSurface) { setStaticContentsSupport(false); setPartialUpdateSupport(false); + + QXcbScreen *screen = static_cast(QPlatformScreen::platformScreenForWidget(widget)); + setConnection(screen->connection()); } QXcbWindowSurface::~QXcbWindowSurface() @@ -68,15 +71,12 @@ void QXcbWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoi Q_UNUSED(region); Q_UNUSED(offset); - QXcbScreen *screen = static_cast(QPlatformScreen::platformScreenForWidget(widget)); QXcbWindow *window = static_cast(widget->window()->platformWindow()); - xcb_connection_t *xcb_con = screen->connection()->connection(); - - m_gc = xcb_generate_id(xcb_con); - xcb_create_gc(xcb_con, m_gc, window->window(), 0, 0); + m_gc = xcb_generate_id(xcb_connection()); + xcb_create_gc(xcb_connection(), m_gc, window->window(), 0, 0); - xcb_put_image(xcb_con, + xcb_put_image(xcb_connection(), XCB_IMAGE_FORMAT_Z_PIXMAP, window->window(), m_gc, @@ -89,8 +89,8 @@ void QXcbWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoi m_image.numBytes(), m_image.bits()); - xcb_free_gc(xcb_con, m_gc); - xcb_flush(xcb_con); + xcb_free_gc(xcb_connection(), m_gc); + xcb_flush(xcb_connection()); } void QXcbWindowSurface::resize(const QSize &size) diff --git a/src/plugins/platforms/xcb/qxcbwindowsurface.h b/src/plugins/platforms/xcb/qxcbwindowsurface.h index 74be9a2..66b9c29 100644 --- a/src/plugins/platforms/xcb/qxcbwindowsurface.h +++ b/src/plugins/platforms/xcb/qxcbwindowsurface.h @@ -46,7 +46,9 @@ #include -class QXcbWindowSurface : public QWindowSurface +#include "qxcbobject.h" + +class QXcbWindowSurface : public QXcbObject, public QWindowSurface { public: QXcbWindowSurface(QWidget *widget, bool setDefaultSurface = true); diff --git a/src/plugins/platforms/xcb/xcb.pro b/src/plugins/platforms/xcb/xcb.pro index cbbda0d..f63495c 100644 --- a/src/plugins/platforms/xcb/xcb.pro +++ b/src/plugins/platforms/xcb/xcb.pro @@ -12,6 +12,7 @@ SOURCES = \ qxcbwindowsurface.cpp HEADERS = \ + qxcbobject.h \ qxcbintegration.h \ qxcbconnection.h \ qxcbscreen.h \ -- cgit v0.12 From 6a4ef30a8f585a3dc20b337eb336ab028c97ddb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Tue, 8 Feb 2011 14:34:52 +0100 Subject: Optimized XCB window surface using partial updates and shared images. --- src/plugins/platforms/xcb/qxcbconnection.cpp | 1 - src/plugins/platforms/xcb/qxcbwindow.cpp | 12 +- src/plugins/platforms/xcb/qxcbwindowsurface.cpp | 149 ++++++++++++++++++++---- src/plugins/platforms/xcb/qxcbwindowsurface.h | 8 +- src/plugins/platforms/xcb/xcb.pro | 2 +- 5 files changed, 138 insertions(+), 34 deletions(-) diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index 023f673..70c6a63 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -111,7 +111,6 @@ void QXcbConnection::eventDispatcher() HANDLE_PLATFORM_WINDOW_EVENT(xcb_client_message_event_t, window, handleClientMessageEvent); default: break; - } } } diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index c7bcd38..6dfccba 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -96,8 +96,6 @@ QXcbWindow::QXcbWindow(QWidget *tlw) 32, sizeof(properties) / sizeof(xcb_atom_t), properties); - - printf("m_window: %d\n", m_window); } QXcbWindow::~QXcbWindow() @@ -164,12 +162,12 @@ void QXcbWindow::requestActivateWindow() void QXcbWindow::handleExposeEvent(xcb_expose_event_t *event) { - if (event->count != 0) - return; - QWindowSurface *surface = widget()->windowSurface(); - if (surface) - surface->flush(widget(), widget()->geometry(), QPoint()); + if (surface) { + QRect rect(event->x, event->y, event->width, event->height); + + surface->flush(widget(), rect, QPoint()); + } } void QXcbWindow::handleClientMessageEvent(xcb_client_message_event_t *event) diff --git a/src/plugins/platforms/xcb/qxcbwindowsurface.cpp b/src/plugins/platforms/xcb/qxcbwindowsurface.cpp index e3b2c6c..513de08 100644 --- a/src/plugins/platforms/xcb/qxcbwindowsurface.cpp +++ b/src/plugins/platforms/xcb/qxcbwindowsurface.cpp @@ -45,13 +45,119 @@ #include "qxcbscreen.h" #include "qxcbwindow.h" +#include +#include + +#include +#include + #include +class QXcbShmImage : public QXcbObject +{ +public: + QXcbShmImage(QXcbScreen *connection, const QSize &size); + ~QXcbShmImage() { destroy(); } + + QImage *image() { return &m_qimage; } + + void put(xcb_window_t window, const QPoint &dst, const QRect &source); + void preparePaint(const QRegion ®ion); + +private: + void destroy(); + + xcb_shm_segment_info_t m_shm_info; + + xcb_image_t *m_xcb_image; + + QImage m_qimage; + + xcb_gcontext_t m_gc; + xcb_window_t m_gc_window; + + QRegion m_dirty; +}; + +QXcbShmImage::QXcbShmImage(QXcbScreen *screen, const QSize &size) + : QXcbObject(screen->connection()) + , m_gc(0) + , m_gc_window(0) +{ + m_xcb_image = xcb_image_create_native(xcb_connection(), + size.width(), + size.height(), + XCB_IMAGE_FORMAT_Z_PIXMAP, + screen->depth(), + 0, + ~0, + 0); + m_shm_info.shmid = shmget (IPC_PRIVATE, + m_xcb_image->stride * m_xcb_image->height, IPC_CREAT|0777); + + m_shm_info.shmaddr = m_xcb_image->data = (quint8 *)shmat (m_shm_info.shmid, 0, 0); + m_shm_info.shmseg = xcb_generate_id(xcb_connection()); + + xcb_shm_attach(xcb_connection(), m_shm_info.shmseg, m_shm_info.shmid, false); + + m_qimage = QImage( (uchar*) m_xcb_image->data, m_xcb_image->width, m_xcb_image->height, m_xcb_image->stride, screen->format()); +} + +void QXcbShmImage::destroy() +{ + xcb_shm_detach(xcb_connection(), m_shm_info.shmseg); + xcb_image_destroy(m_xcb_image); + shmdt(m_shm_info.shmaddr); + shmctl(m_shm_info.shmid, IPC_RMID, 0); + + xcb_free_gc(xcb_connection(), m_gc); +} + +void QXcbShmImage::put(xcb_window_t window, const QPoint &target, const QRect &source) +{ + if (m_gc_window != window) { + xcb_free_gc(xcb_connection(), m_gc); + + m_gc = xcb_generate_id(xcb_connection()); + xcb_create_gc(xcb_connection(), m_gc, window, 0, 0); + + m_gc_window = window; + } + + xcb_image_shm_put(xcb_connection(), + window, + m_gc, + m_xcb_image, + m_shm_info, + source.x(), + source.y(), + target.x(), + target.y(), + source.width(), + source.height(), + false); + + m_dirty = m_dirty | source; + + xcb_flush(xcb_connection()); +} + +void QXcbShmImage::preparePaint(const QRegion ®ion) +{ + // to prevent X from reading from the image region while we're writing to it + if (m_dirty.intersects(region)) { + // from xcb_aux_sync + free(xcb_get_input_focus_reply(xcb_connection(), xcb_get_input_focus(xcb_connection()), 0)); + m_dirty = QRegion(); + } +} + QXcbWindowSurface::QXcbWindowSurface(QWidget *widget, bool setDefaultSurface) : QWindowSurface(widget, setDefaultSurface) + , m_image(0) { setStaticContentsSupport(false); - setPartialUpdateSupport(false); + setPartialUpdateSupport(true); QXcbScreen *screen = static_cast(QPlatformScreen::platformScreenForWidget(widget)); setConnection(screen->connection()); @@ -63,7 +169,12 @@ QXcbWindowSurface::~QXcbWindowSurface() QPaintDevice *QXcbWindowSurface::paintDevice() { - return &m_image; + return m_image->image(); +} + +void QXcbWindowSurface::beginPaint(const QRegion ®ion) +{ + m_image->preparePaint(region); } void QXcbWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) @@ -73,42 +184,36 @@ void QXcbWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoi QXcbWindow *window = static_cast(widget->window()->platformWindow()); - m_gc = xcb_generate_id(xcb_connection()); - xcb_create_gc(xcb_connection(), m_gc, window->window(), 0, 0); - - xcb_put_image(xcb_connection(), - XCB_IMAGE_FORMAT_Z_PIXMAP, - window->window(), - m_gc, - m_image.width(), - m_image.height(), - 0, - 0, - 0, - 24, - m_image.numBytes(), - m_image.bits()); + extern QWidgetData* qt_widget_data(QWidget *); + QPoint widgetOffset = qt_qwidget_data(widget)->wrect.topLeft(); - xcb_free_gc(xcb_connection(), m_gc); - xcb_flush(xcb_connection()); + QVector rects = region.rects(); + for (int i = 0; i < rects.size(); ++i) + m_image->put(window->window(), rects.at(i).topLeft() - widgetOffset, rects.at(i).translated(offset)); } void QXcbWindowSurface::resize(const QSize &size) { QWindowSurface::resize(size); - m_image = QImage(size, QImage::Format_RGB32); + + QXcbScreen *screen = static_cast(QPlatformScreen::platformScreenForWidget(window())); + + delete m_image; + m_image = new QXcbShmImage(screen, size); } extern void qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &offset); bool QXcbWindowSurface::scroll(const QRegion &area, int dx, int dy) { - if (m_image.isNull()) + if (m_image->image()->isNull()) return false; + m_image->preparePaint(area); + const QVector rects = area.rects(); for (int i = 0; i < rects.size(); ++i) - qt_scrollRectInImage(m_image, rects.at(i), QPoint(dx, dy)); + qt_scrollRectInImage(*m_image->image(), rects.at(i), QPoint(dx, dy)); return true; } diff --git a/src/plugins/platforms/xcb/qxcbwindowsurface.h b/src/plugins/platforms/xcb/qxcbwindowsurface.h index 66b9c29..ee63190 100644 --- a/src/plugins/platforms/xcb/qxcbwindowsurface.h +++ b/src/plugins/platforms/xcb/qxcbwindowsurface.h @@ -48,6 +48,8 @@ #include "qxcbobject.h" +class QXcbShmImage; + class QXcbWindowSurface : public QXcbObject, public QWindowSurface { public: @@ -59,10 +61,10 @@ public: void resize(const QSize &size); bool scroll(const QRegion &area, int dx, int dy); -private: - QImage m_image; + void beginPaint(const QRegion &); - xcb_gcontext_t m_gc; +private: + QXcbShmImage *m_image; }; #endif diff --git a/src/plugins/platforms/xcb/xcb.pro b/src/plugins/platforms/xcb/xcb.pro index f63495c..a4f9246 100644 --- a/src/plugins/platforms/xcb/xcb.pro +++ b/src/plugins/platforms/xcb/xcb.pro @@ -19,7 +19,7 @@ HEADERS = \ qxcbwindow.h \ qxcbwindowsurface.h -LIBS += -lxcb +LIBS += -lxcb -lxcb-image include (../fontdatabases/genericunix/genericunix.pri) -- cgit v0.12 From 9d808132dbf2de191e3d1ab2a1222e584d7ff1bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Tue, 8 Feb 2011 14:45:09 +0100 Subject: Made XCB report correct physical size. --- src/plugins/platforms/xcb/qxcbscreen.cpp | 5 +++++ src/plugins/platforms/xcb/qxcbscreen.h | 1 + 2 files changed, 6 insertions(+) diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp index 1adde6b..a9a24dd 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.cpp +++ b/src/plugins/platforms/xcb/qxcbscreen.cpp @@ -75,3 +75,8 @@ QImage::Format QXcbScreen::format() const { return QImage::Format_RGB32; } + +QSize QXcbScreen::physicalSize() const +{ + return QSize(m_screen->width_in_millimeters, m_screen->height_in_millimeters); +} diff --git a/src/plugins/platforms/xcb/qxcbscreen.h b/src/plugins/platforms/xcb/qxcbscreen.h index 88de1a8..abebcd9 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.h +++ b/src/plugins/platforms/xcb/qxcbscreen.h @@ -59,6 +59,7 @@ public: QRect geometry() const; int depth() const; QImage::Format format() const; + QSize physicalSize() const; xcb_screen_t *screen() const { return m_screen; } xcb_window_t root() const { return m_screen->root; } -- cgit v0.12 From 6c19992488d1aa820e860575533f2e2c1d3351d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Tue, 8 Feb 2011 16:07:19 +0100 Subject: Initial key event handling for XCB backend. As there is no XLookupString equivalent in XCB, the key handling is still incomplete. --- src/plugins/platforms/xcb/qxcbconnection.cpp | 28 + src/plugins/platforms/xcb/qxcbconnection.h | 6 + src/plugins/platforms/xcb/qxcbkeyboard.cpp | 949 +++++++++++++++++++++++++++ src/plugins/platforms/xcb/qxcbkeyboard.h | 79 +++ src/plugins/platforms/xcb/qxcbscreen.cpp | 11 + src/plugins/platforms/xcb/qxcbwindow.cpp | 38 +- src/plugins/platforms/xcb/qxcbwindow.h | 17 +- src/plugins/platforms/xcb/xcb.pro | 14 +- 8 files changed, 1124 insertions(+), 18 deletions(-) create mode 100644 src/plugins/platforms/xcb/qxcbkeyboard.cpp create mode 100644 src/plugins/platforms/xcb/qxcbkeyboard.h diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index 70c6a63..2977d76 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -40,6 +40,7 @@ ****************************************************************************/ #include "qxcbconnection.h" +#include "qxcbkeyboard.h" #include "qxcbscreen.h" #include "qxcbwindow.h" @@ -67,6 +68,8 @@ QXcbConnection::QXcbConnection(const char *displayName) QSocketNotifier *socket = new QSocketNotifier(xcb_get_file_descriptor(xcb_connection()), QSocketNotifier::Read, this); connect(socket, SIGNAL(activated(int)), this, SLOT(eventDispatcher())); + m_keyboard = new QXcbKeyboard(this); + initializeAllAtoms(); } @@ -75,6 +78,8 @@ QXcbConnection::~QXcbConnection() qDeleteAll(m_screens); xcb_disconnect(xcb_connection()); + + delete m_keyboard; } QXcbWindow *platformWindowFromId(xcb_window_t id) @@ -93,6 +98,14 @@ QXcbWindow *platformWindowFromId(xcb_window_t id) } \ break; +#define HANDLE_KEYBOARD_EVENT(event_t, handler) \ +{ \ + event_t *e = (event_t *)event; \ + if (QXcbWindow *platformWindow = platformWindowFromId(e->event)) \ + m_keyboard->handler(platformWindow->widget(), e); \ +} \ +break; + void QXcbConnection::eventDispatcher() { while (xcb_generic_event_t *event = xcb_poll_for_event(xcb_connection())) { @@ -109,6 +122,21 @@ void QXcbConnection::eventDispatcher() HANDLE_PLATFORM_WINDOW_EVENT(xcb_configure_notify_event_t, event, handleConfigureNotifyEvent); case XCB_CLIENT_MESSAGE: HANDLE_PLATFORM_WINDOW_EVENT(xcb_client_message_event_t, window, handleClientMessageEvent); + case XCB_ENTER_NOTIFY: + HANDLE_PLATFORM_WINDOW_EVENT(xcb_enter_notify_event_t, event, handleEnterNotifyEvent); + case XCB_LEAVE_NOTIFY: + HANDLE_PLATFORM_WINDOW_EVENT(xcb_leave_notify_event_t, event, handleLeaveNotifyEvent); + case XCB_FOCUS_IN: + HANDLE_PLATFORM_WINDOW_EVENT(xcb_focus_in_event_t, event, handleFocusInEvent); + case XCB_FOCUS_OUT: + HANDLE_PLATFORM_WINDOW_EVENT(xcb_focus_out_event_t, event, handleFocusOutEvent); + case XCB_KEY_PRESS: + HANDLE_KEYBOARD_EVENT(xcb_key_press_event_t, handleKeyPressEvent); + case XCB_KEY_RELEASE: + HANDLE_KEYBOARD_EVENT(xcb_key_release_event_t, handleKeyReleaseEvent); + case XCB_MAPPING_NOTIFY: + m_keyboard->handleMappingNotifyEvent((xcb_mapping_notify_event_t *)event); + break; default: break; } diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index 9fb641e..97f9ba5 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -212,6 +212,8 @@ namespace QXcbAtom { }; } +class QXcbKeyboard; + class QXcbConnection : public QObject { Q_OBJECT @@ -228,6 +230,8 @@ public: xcb_connection_t *xcb_connection() const { return m_connection; } + QXcbKeyboard *keyboard() const { return m_keyboard; } + private slots: void eventDispatcher(); @@ -243,6 +247,8 @@ private: xcb_atom_t m_allAtoms[QXcbAtom::NAtoms]; QByteArray m_displayName; + + QXcbKeyboard *m_keyboard; }; #endif diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.cpp b/src/plugins/platforms/xcb/qxcbkeyboard.cpp new file mode 100644 index 0000000..b226e3e --- /dev/null +++ b/src/plugins/platforms/xcb/qxcbkeyboard.cpp @@ -0,0 +1,949 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qxcbkeyboard.h" + +#include + +#include + +#include +#include + +#include + +#ifndef XK_ISO_Left_Tab +#define XK_ISO_Left_Tab 0xFE20 +#endif + +#ifndef XK_dead_hook +#define XK_dead_hook 0xFE61 +#endif + +#ifndef XK_dead_horn +#define XK_dead_horn 0xFE62 +#endif + +#ifndef XK_Codeinput +#define XK_Codeinput 0xFF37 +#endif + +#ifndef XK_Kanji_Bangou +#define XK_Kanji_Bangou 0xFF37 /* same as codeinput */ +#endif + +// Fix old X libraries +#ifndef XK_KP_Home +#define XK_KP_Home 0xFF95 +#endif +#ifndef XK_KP_Left +#define XK_KP_Left 0xFF96 +#endif +#ifndef XK_KP_Up +#define XK_KP_Up 0xFF97 +#endif +#ifndef XK_KP_Right +#define XK_KP_Right 0xFF98 +#endif +#ifndef XK_KP_Down +#define XK_KP_Down 0xFF99 +#endif +#ifndef XK_KP_Prior +#define XK_KP_Prior 0xFF9A +#endif +#ifndef XK_KP_Next +#define XK_KP_Next 0xFF9B +#endif +#ifndef XK_KP_End +#define XK_KP_End 0xFF9C +#endif +#ifndef XK_KP_Insert +#define XK_KP_Insert 0xFF9E +#endif +#ifndef XK_KP_Delete +#define XK_KP_Delete 0xFF9F +#endif + +// the next lines are taken on 10/2009 from X.org (X11/XF86keysym.h), defining some special +// multimedia keys. They are included here as not every system has them. +#define XF86XK_MonBrightnessUp 0x1008FF02 +#define XF86XK_MonBrightnessDown 0x1008FF03 +#define XF86XK_KbdLightOnOff 0x1008FF04 +#define XF86XK_KbdBrightnessUp 0x1008FF05 +#define XF86XK_KbdBrightnessDown 0x1008FF06 +#define XF86XK_Standby 0x1008FF10 +#define XF86XK_AudioLowerVolume 0x1008FF11 +#define XF86XK_AudioMute 0x1008FF12 +#define XF86XK_AudioRaiseVolume 0x1008FF13 +#define XF86XK_AudioPlay 0x1008FF14 +#define XF86XK_AudioStop 0x1008FF15 +#define XF86XK_AudioPrev 0x1008FF16 +#define XF86XK_AudioNext 0x1008FF17 +#define XF86XK_HomePage 0x1008FF18 +#define XF86XK_Mail 0x1008FF19 +#define XF86XK_Start 0x1008FF1A +#define XF86XK_Search 0x1008FF1B +#define XF86XK_AudioRecord 0x1008FF1C +#define XF86XK_Calculator 0x1008FF1D +#define XF86XK_Memo 0x1008FF1E +#define XF86XK_ToDoList 0x1008FF1F +#define XF86XK_Calendar 0x1008FF20 +#define XF86XK_PowerDown 0x1008FF21 +#define XF86XK_ContrastAdjust 0x1008FF22 +#define XF86XK_Back 0x1008FF26 +#define XF86XK_Forward 0x1008FF27 +#define XF86XK_Stop 0x1008FF28 +#define XF86XK_Refresh 0x1008FF29 +#define XF86XK_PowerOff 0x1008FF2A +#define XF86XK_WakeUp 0x1008FF2B +#define XF86XK_Eject 0x1008FF2C +#define XF86XK_ScreenSaver 0x1008FF2D +#define XF86XK_WWW 0x1008FF2E +#define XF86XK_Sleep 0x1008FF2F +#define XF86XK_Favorites 0x1008FF30 +#define XF86XK_AudioPause 0x1008FF31 +#define XF86XK_AudioMedia 0x1008FF32 +#define XF86XK_MyComputer 0x1008FF33 +#define XF86XK_LightBulb 0x1008FF35 +#define XF86XK_Shop 0x1008FF36 +#define XF86XK_History 0x1008FF37 +#define XF86XK_OpenURL 0x1008FF38 +#define XF86XK_AddFavorite 0x1008FF39 +#define XF86XK_HotLinks 0x1008FF3A +#define XF86XK_BrightnessAdjust 0x1008FF3B +#define XF86XK_Finance 0x1008FF3C +#define XF86XK_Community 0x1008FF3D +#define XF86XK_AudioRewind 0x1008FF3E +#define XF86XK_BackForward 0x1008FF3F +#define XF86XK_Launch0 0x1008FF40 +#define XF86XK_Launch1 0x1008FF41 +#define XF86XK_Launch2 0x1008FF42 +#define XF86XK_Launch3 0x1008FF43 +#define XF86XK_Launch4 0x1008FF44 +#define XF86XK_Launch5 0x1008FF45 +#define XF86XK_Launch6 0x1008FF46 +#define XF86XK_Launch7 0x1008FF47 +#define XF86XK_Launch8 0x1008FF48 +#define XF86XK_Launch9 0x1008FF49 +#define XF86XK_LaunchA 0x1008FF4A +#define XF86XK_LaunchB 0x1008FF4B +#define XF86XK_LaunchC 0x1008FF4C +#define XF86XK_LaunchD 0x1008FF4D +#define XF86XK_LaunchE 0x1008FF4E +#define XF86XK_LaunchF 0x1008FF4F +#define XF86XK_ApplicationLeft 0x1008FF50 +#define XF86XK_ApplicationRight 0x1008FF51 +#define XF86XK_Book 0x1008FF52 +#define XF86XK_CD 0x1008FF53 +#define XF86XK_Calculater 0x1008FF54 +#define XF86XK_Clear 0x1008FF55 +#define XF86XK_ClearGrab 0x1008FE21 +#define XF86XK_Close 0x1008FF56 +#define XF86XK_Copy 0x1008FF57 +#define XF86XK_Cut 0x1008FF58 +#define XF86XK_Display 0x1008FF59 +#define XF86XK_DOS 0x1008FF5A +#define XF86XK_Documents 0x1008FF5B +#define XF86XK_Excel 0x1008FF5C +#define XF86XK_Explorer 0x1008FF5D +#define XF86XK_Game 0x1008FF5E +#define XF86XK_Go 0x1008FF5F +#define XF86XK_iTouch 0x1008FF60 +#define XF86XK_LogOff 0x1008FF61 +#define XF86XK_Market 0x1008FF62 +#define XF86XK_Meeting 0x1008FF63 +#define XF86XK_MenuKB 0x1008FF65 +#define XF86XK_MenuPB 0x1008FF66 +#define XF86XK_MySites 0x1008FF67 +#define XF86XK_News 0x1008FF69 +#define XF86XK_OfficeHome 0x1008FF6A +#define XF86XK_Option 0x1008FF6C +#define XF86XK_Paste 0x1008FF6D +#define XF86XK_Phone 0x1008FF6E +#define XF86XK_Reply 0x1008FF72 +#define XF86XK_Reload 0x1008FF73 +#define XF86XK_RotateWindows 0x1008FF74 +#define XF86XK_RotationPB 0x1008FF75 +#define XF86XK_RotationKB 0x1008FF76 +#define XF86XK_Save 0x1008FF77 +#define XF86XK_Send 0x1008FF7B +#define XF86XK_Spell 0x1008FF7C +#define XF86XK_SplitScreen 0x1008FF7D +#define XF86XK_Support 0x1008FF7E +#define XF86XK_TaskPane 0x1008FF7F +#define XF86XK_Terminal 0x1008FF80 +#define XF86XK_Tools 0x1008FF81 +#define XF86XK_Travel 0x1008FF82 +#define XF86XK_Video 0x1008FF87 +#define XF86XK_Word 0x1008FF89 +#define XF86XK_Xfer 0x1008FF8A +#define XF86XK_ZoomIn 0x1008FF8B +#define XF86XK_ZoomOut 0x1008FF8C +#define XF86XK_Away 0x1008FF8D +#define XF86XK_Messenger 0x1008FF8E +#define XF86XK_WebCam 0x1008FF8F +#define XF86XK_MailForward 0x1008FF90 +#define XF86XK_Pictures 0x1008FF91 +#define XF86XK_Music 0x1008FF92 +#define XF86XK_Battery 0x1008FF93 +#define XF86XK_Bluetooth 0x1008FF94 +#define XF86XK_WLAN 0x1008FF95 +#define XF86XK_UWB 0x1008FF96 +#define XF86XK_AudioForward 0x1008FF97 +#define XF86XK_AudioRepeat 0x1008FF98 +#define XF86XK_AudioRandomPlay 0x1008FF99 +#define XF86XK_Subtitle 0x1008FF9A +#define XF86XK_AudioCycleTrack 0x1008FF9B +#define XF86XK_Time 0x1008FF9F +#define XF86XK_Select 0x1008FFA0 +#define XF86XK_View 0x1008FFA1 +#define XF86XK_TopMenu 0x1008FFA2 +#define XF86XK_Suspend 0x1008FFA7 +#define XF86XK_Hibernate 0x1008FFA8 + + +// end of XF86keysyms.h + +// Special keys used by Qtopia, mapped into the X11 private keypad range. +#define QTOPIAXK_Select 0x11000601 +#define QTOPIAXK_Yes 0x11000602 +#define QTOPIAXK_No 0x11000603 +#define QTOPIAXK_Cancel 0x11000604 +#define QTOPIAXK_Printer 0x11000605 +#define QTOPIAXK_Execute 0x11000606 +#define QTOPIAXK_Sleep 0x11000607 +#define QTOPIAXK_Play 0x11000608 +#define QTOPIAXK_Zoom 0x11000609 +#define QTOPIAXK_Context1 0x1100060A +#define QTOPIAXK_Context2 0x1100060B +#define QTOPIAXK_Context3 0x1100060C +#define QTOPIAXK_Context4 0x1100060D +#define QTOPIAXK_Call 0x1100060E +#define QTOPIAXK_Hangup 0x1100060F +#define QTOPIAXK_Flip 0x11000610 + +// keyboard mapping table +static const unsigned int KeyTbl[] = { + + // misc keys + + XK_Escape, Qt::Key_Escape, + XK_Tab, Qt::Key_Tab, + XK_ISO_Left_Tab, Qt::Key_Backtab, + XK_BackSpace, Qt::Key_Backspace, + XK_Return, Qt::Key_Return, + XK_Insert, Qt::Key_Insert, + XK_Delete, Qt::Key_Delete, + XK_Clear, Qt::Key_Delete, + XK_Pause, Qt::Key_Pause, + XK_Print, Qt::Key_Print, + 0x1005FF60, Qt::Key_SysReq, // hardcoded Sun SysReq + 0x1007ff00, Qt::Key_SysReq, // hardcoded X386 SysReq + + // cursor movement + + XK_Home, Qt::Key_Home, + XK_End, Qt::Key_End, + XK_Left, Qt::Key_Left, + XK_Up, Qt::Key_Up, + XK_Right, Qt::Key_Right, + XK_Down, Qt::Key_Down, + XK_Prior, Qt::Key_PageUp, + XK_Next, Qt::Key_PageDown, + + // modifiers + + XK_Shift_L, Qt::Key_Shift, + XK_Shift_R, Qt::Key_Shift, + XK_Shift_Lock, Qt::Key_Shift, + XK_Control_L, Qt::Key_Control, + XK_Control_R, Qt::Key_Control, + XK_Meta_L, Qt::Key_Meta, + XK_Meta_R, Qt::Key_Meta, + XK_Alt_L, Qt::Key_Alt, + XK_Alt_R, Qt::Key_Alt, + XK_Caps_Lock, Qt::Key_CapsLock, + XK_Num_Lock, Qt::Key_NumLock, + XK_Scroll_Lock, Qt::Key_ScrollLock, + XK_Super_L, Qt::Key_Super_L, + XK_Super_R, Qt::Key_Super_R, + XK_Menu, Qt::Key_Menu, + XK_Hyper_L, Qt::Key_Hyper_L, + XK_Hyper_R, Qt::Key_Hyper_R, + XK_Help, Qt::Key_Help, + 0x1000FF74, Qt::Key_Backtab, // hardcoded HP backtab + 0x1005FF10, Qt::Key_F11, // hardcoded Sun F36 (labeled F11) + 0x1005FF11, Qt::Key_F12, // hardcoded Sun F37 (labeled F12) + + // numeric and function keypad keys + + XK_KP_Space, Qt::Key_Space, + XK_KP_Tab, Qt::Key_Tab, + XK_KP_Enter, Qt::Key_Enter, + //XK_KP_F1, Qt::Key_F1, + //XK_KP_F2, Qt::Key_F2, + //XK_KP_F3, Qt::Key_F3, + //XK_KP_F4, Qt::Key_F4, + XK_KP_Home, Qt::Key_Home, + XK_KP_Left, Qt::Key_Left, + XK_KP_Up, Qt::Key_Up, + XK_KP_Right, Qt::Key_Right, + XK_KP_Down, Qt::Key_Down, + XK_KP_Prior, Qt::Key_PageUp, + XK_KP_Next, Qt::Key_PageDown, + XK_KP_End, Qt::Key_End, + XK_KP_Begin, Qt::Key_Clear, + XK_KP_Insert, Qt::Key_Insert, + XK_KP_Delete, Qt::Key_Delete, + XK_KP_Equal, Qt::Key_Equal, + XK_KP_Multiply, Qt::Key_Asterisk, + XK_KP_Add, Qt::Key_Plus, + XK_KP_Separator, Qt::Key_Comma, + XK_KP_Subtract, Qt::Key_Minus, + XK_KP_Decimal, Qt::Key_Period, + XK_KP_Divide, Qt::Key_Slash, + + // International input method support keys + + // International & multi-key character composition + XK_ISO_Level3_Shift, Qt::Key_AltGr, + XK_Multi_key, Qt::Key_Multi_key, + XK_Codeinput, Qt::Key_Codeinput, + XK_SingleCandidate, Qt::Key_SingleCandidate, + XK_MultipleCandidate, Qt::Key_MultipleCandidate, + XK_PreviousCandidate, Qt::Key_PreviousCandidate, + + // Misc Functions + XK_Mode_switch, Qt::Key_Mode_switch, + XK_script_switch, Qt::Key_Mode_switch, + + // Japanese keyboard support + XK_Kanji, Qt::Key_Kanji, + XK_Muhenkan, Qt::Key_Muhenkan, + //XK_Henkan_Mode, Qt::Key_Henkan_Mode, + XK_Henkan_Mode, Qt::Key_Henkan, + XK_Henkan, Qt::Key_Henkan, + XK_Romaji, Qt::Key_Romaji, + XK_Hiragana, Qt::Key_Hiragana, + XK_Katakana, Qt::Key_Katakana, + XK_Hiragana_Katakana, Qt::Key_Hiragana_Katakana, + XK_Zenkaku, Qt::Key_Zenkaku, + XK_Hankaku, Qt::Key_Hankaku, + XK_Zenkaku_Hankaku, Qt::Key_Zenkaku_Hankaku, + XK_Touroku, Qt::Key_Touroku, + XK_Massyo, Qt::Key_Massyo, + XK_Kana_Lock, Qt::Key_Kana_Lock, + XK_Kana_Shift, Qt::Key_Kana_Shift, + XK_Eisu_Shift, Qt::Key_Eisu_Shift, + XK_Eisu_toggle, Qt::Key_Eisu_toggle, + //XK_Kanji_Bangou, Qt::Key_Kanji_Bangou, + //XK_Zen_Koho, Qt::Key_Zen_Koho, + //XK_Mae_Koho, Qt::Key_Mae_Koho, + XK_Kanji_Bangou, Qt::Key_Codeinput, + XK_Zen_Koho, Qt::Key_MultipleCandidate, + XK_Mae_Koho, Qt::Key_PreviousCandidate, + +#ifdef XK_KOREAN + // Korean keyboard support + XK_Hangul, Qt::Key_Hangul, + XK_Hangul_Start, Qt::Key_Hangul_Start, + XK_Hangul_End, Qt::Key_Hangul_End, + XK_Hangul_Hanja, Qt::Key_Hangul_Hanja, + XK_Hangul_Jamo, Qt::Key_Hangul_Jamo, + XK_Hangul_Romaja, Qt::Key_Hangul_Romaja, + //XK_Hangul_Codeinput, Qt::Key_Hangul_Codeinput, + XK_Hangul_Codeinput, Qt::Key_Codeinput, + XK_Hangul_Jeonja, Qt::Key_Hangul_Jeonja, + XK_Hangul_Banja, Qt::Key_Hangul_Banja, + XK_Hangul_PreHanja, Qt::Key_Hangul_PreHanja, + XK_Hangul_PostHanja, Qt::Key_Hangul_PostHanja, + //XK_Hangul_SingleCandidate,Qt::Key_Hangul_SingleCandidate, + //XK_Hangul_MultipleCandidate,Qt::Key_Hangul_MultipleCandidate, + //XK_Hangul_PreviousCandidate,Qt::Key_Hangul_PreviousCandidate, + XK_Hangul_SingleCandidate, Qt::Key_SingleCandidate, + XK_Hangul_MultipleCandidate,Qt::Key_MultipleCandidate, + XK_Hangul_PreviousCandidate,Qt::Key_PreviousCandidate, + XK_Hangul_Special, Qt::Key_Hangul_Special, + //XK_Hangul_switch, Qt::Key_Hangul_switch, + XK_Hangul_switch, Qt::Key_Mode_switch, +#endif // XK_KOREAN + + // dead keys + XK_dead_grave, Qt::Key_Dead_Grave, + XK_dead_acute, Qt::Key_Dead_Acute, + XK_dead_circumflex, Qt::Key_Dead_Circumflex, + XK_dead_tilde, Qt::Key_Dead_Tilde, + XK_dead_macron, Qt::Key_Dead_Macron, + XK_dead_breve, Qt::Key_Dead_Breve, + XK_dead_abovedot, Qt::Key_Dead_Abovedot, + XK_dead_diaeresis, Qt::Key_Dead_Diaeresis, + XK_dead_abovering, Qt::Key_Dead_Abovering, + XK_dead_doubleacute, Qt::Key_Dead_Doubleacute, + XK_dead_caron, Qt::Key_Dead_Caron, + XK_dead_cedilla, Qt::Key_Dead_Cedilla, + XK_dead_ogonek, Qt::Key_Dead_Ogonek, + XK_dead_iota, Qt::Key_Dead_Iota, + XK_dead_voiced_sound, Qt::Key_Dead_Voiced_Sound, + XK_dead_semivoiced_sound, Qt::Key_Dead_Semivoiced_Sound, + XK_dead_belowdot, Qt::Key_Dead_Belowdot, + XK_dead_hook, Qt::Key_Dead_Hook, + XK_dead_horn, Qt::Key_Dead_Horn, + + // Special keys from X.org - This include multimedia keys, + // wireless/bluetooth/uwb keys, special launcher keys, etc. + XF86XK_Back, Qt::Key_Back, + XF86XK_Forward, Qt::Key_Forward, + XF86XK_Stop, Qt::Key_Stop, + XF86XK_Refresh, Qt::Key_Refresh, + XF86XK_Favorites, Qt::Key_Favorites, + XF86XK_AudioMedia, Qt::Key_LaunchMedia, + XF86XK_OpenURL, Qt::Key_OpenUrl, + XF86XK_HomePage, Qt::Key_HomePage, + XF86XK_Search, Qt::Key_Search, + XF86XK_AudioLowerVolume, Qt::Key_VolumeDown, + XF86XK_AudioMute, Qt::Key_VolumeMute, + XF86XK_AudioRaiseVolume, Qt::Key_VolumeUp, + XF86XK_AudioPlay, Qt::Key_MediaPlay, + XF86XK_AudioStop, Qt::Key_MediaStop, + XF86XK_AudioPrev, Qt::Key_MediaPrevious, + XF86XK_AudioNext, Qt::Key_MediaNext, + XF86XK_AudioRecord, Qt::Key_MediaRecord, + XF86XK_Mail, Qt::Key_LaunchMail, + XF86XK_MyComputer, Qt::Key_Launch0, // ### Qt 5: remap properly + XF86XK_Calculator, Qt::Key_Launch1, + XF86XK_Memo, Qt::Key_Memo, + XF86XK_ToDoList, Qt::Key_ToDoList, + XF86XK_Calendar, Qt::Key_Calendar, + XF86XK_PowerDown, Qt::Key_PowerDown, + XF86XK_ContrastAdjust, Qt::Key_ContrastAdjust, + XF86XK_Standby, Qt::Key_Standby, + XF86XK_MonBrightnessUp, Qt::Key_MonBrightnessUp, + XF86XK_MonBrightnessDown, Qt::Key_MonBrightnessDown, + XF86XK_KbdLightOnOff, Qt::Key_KeyboardLightOnOff, + XF86XK_KbdBrightnessUp, Qt::Key_KeyboardBrightnessUp, + XF86XK_KbdBrightnessDown, Qt::Key_KeyboardBrightnessDown, + XF86XK_PowerOff, Qt::Key_PowerOff, + XF86XK_WakeUp, Qt::Key_WakeUp, + XF86XK_Eject, Qt::Key_Eject, + XF86XK_ScreenSaver, Qt::Key_ScreenSaver, + XF86XK_WWW, Qt::Key_WWW, + XF86XK_Sleep, Qt::Key_Sleep, + XF86XK_LightBulb, Qt::Key_LightBulb, + XF86XK_Shop, Qt::Key_Shop, + XF86XK_History, Qt::Key_History, + XF86XK_AddFavorite, Qt::Key_AddFavorite, + XF86XK_HotLinks, Qt::Key_HotLinks, + XF86XK_BrightnessAdjust, Qt::Key_BrightnessAdjust, + XF86XK_Finance, Qt::Key_Finance, + XF86XK_Community, Qt::Key_Community, + XF86XK_AudioRewind, Qt::Key_AudioRewind, + XF86XK_BackForward, Qt::Key_BackForward, + XF86XK_ApplicationLeft, Qt::Key_ApplicationLeft, + XF86XK_ApplicationRight, Qt::Key_ApplicationRight, + XF86XK_Book, Qt::Key_Book, + XF86XK_CD, Qt::Key_CD, + XF86XK_Calculater, Qt::Key_Calculator, + XF86XK_Clear, Qt::Key_Clear, + XF86XK_ClearGrab, Qt::Key_ClearGrab, + XF86XK_Close, Qt::Key_Close, + XF86XK_Copy, Qt::Key_Copy, + XF86XK_Cut, Qt::Key_Cut, + XF86XK_Display, Qt::Key_Display, + XF86XK_DOS, Qt::Key_DOS, + XF86XK_Documents, Qt::Key_Documents, + XF86XK_Excel, Qt::Key_Excel, + XF86XK_Explorer, Qt::Key_Explorer, + XF86XK_Game, Qt::Key_Game, + XF86XK_Go, Qt::Key_Go, + XF86XK_iTouch, Qt::Key_iTouch, + XF86XK_LogOff, Qt::Key_LogOff, + XF86XK_Market, Qt::Key_Market, + XF86XK_Meeting, Qt::Key_Meeting, + XF86XK_MenuKB, Qt::Key_MenuKB, + XF86XK_MenuPB, Qt::Key_MenuPB, + XF86XK_MySites, Qt::Key_MySites, + XF86XK_News, Qt::Key_News, + XF86XK_OfficeHome, Qt::Key_OfficeHome, + XF86XK_Option, Qt::Key_Option, + XF86XK_Paste, Qt::Key_Paste, + XF86XK_Phone, Qt::Key_Phone, + XF86XK_Reply, Qt::Key_Reply, + XF86XK_Reload, Qt::Key_Reload, + XF86XK_RotateWindows, Qt::Key_RotateWindows, + XF86XK_RotationPB, Qt::Key_RotationPB, + XF86XK_RotationKB, Qt::Key_RotationKB, + XF86XK_Save, Qt::Key_Save, + XF86XK_Send, Qt::Key_Send, + XF86XK_Spell, Qt::Key_Spell, + XF86XK_SplitScreen, Qt::Key_SplitScreen, + XF86XK_Support, Qt::Key_Support, + XF86XK_TaskPane, Qt::Key_TaskPane, + XF86XK_Terminal, Qt::Key_Terminal, + XF86XK_Tools, Qt::Key_Tools, + XF86XK_Travel, Qt::Key_Travel, + XF86XK_Video, Qt::Key_Video, + XF86XK_Word, Qt::Key_Word, + XF86XK_Xfer, Qt::Key_Xfer, + XF86XK_ZoomIn, Qt::Key_ZoomIn, + XF86XK_ZoomOut, Qt::Key_ZoomOut, + XF86XK_Away, Qt::Key_Away, + XF86XK_Messenger, Qt::Key_Messenger, + XF86XK_WebCam, Qt::Key_WebCam, + XF86XK_MailForward, Qt::Key_MailForward, + XF86XK_Pictures, Qt::Key_Pictures, + XF86XK_Music, Qt::Key_Music, + XF86XK_Battery, Qt::Key_Battery, + XF86XK_Bluetooth, Qt::Key_Bluetooth, + XF86XK_WLAN, Qt::Key_WLAN, + XF86XK_UWB, Qt::Key_UWB, + XF86XK_AudioForward, Qt::Key_AudioForward, + XF86XK_AudioRepeat, Qt::Key_AudioRepeat, + XF86XK_AudioRandomPlay, Qt::Key_AudioRandomPlay, + XF86XK_Subtitle, Qt::Key_Subtitle, + XF86XK_AudioCycleTrack, Qt::Key_AudioCycleTrack, + XF86XK_Time, Qt::Key_Time, + XF86XK_Select, Qt::Key_Select, + XF86XK_View, Qt::Key_View, + XF86XK_TopMenu, Qt::Key_TopMenu, + XF86XK_Bluetooth, Qt::Key_Bluetooth, + XF86XK_Suspend, Qt::Key_Suspend, + XF86XK_Hibernate, Qt::Key_Hibernate, + XF86XK_Launch0, Qt::Key_Launch2, // ### Qt 5: remap properly + XF86XK_Launch1, Qt::Key_Launch3, + XF86XK_Launch2, Qt::Key_Launch4, + XF86XK_Launch3, Qt::Key_Launch5, + XF86XK_Launch4, Qt::Key_Launch6, + XF86XK_Launch5, Qt::Key_Launch7, + XF86XK_Launch6, Qt::Key_Launch8, + XF86XK_Launch7, Qt::Key_Launch9, + XF86XK_Launch8, Qt::Key_LaunchA, + XF86XK_Launch9, Qt::Key_LaunchB, + XF86XK_LaunchA, Qt::Key_LaunchC, + XF86XK_LaunchB, Qt::Key_LaunchD, + XF86XK_LaunchC, Qt::Key_LaunchE, + XF86XK_LaunchD, Qt::Key_LaunchF, + XF86XK_LaunchE, Qt::Key_LaunchG, + XF86XK_LaunchF, Qt::Key_LaunchH, + + // Qtopia keys + QTOPIAXK_Select, Qt::Key_Select, + QTOPIAXK_Yes, Qt::Key_Yes, + QTOPIAXK_No, Qt::Key_No, + QTOPIAXK_Cancel, Qt::Key_Cancel, + QTOPIAXK_Printer, Qt::Key_Printer, + QTOPIAXK_Execute, Qt::Key_Execute, + QTOPIAXK_Sleep, Qt::Key_Sleep, + QTOPIAXK_Play, Qt::Key_Play, + QTOPIAXK_Zoom, Qt::Key_Zoom, + QTOPIAXK_Context1, Qt::Key_Context1, + QTOPIAXK_Context2, Qt::Key_Context2, + QTOPIAXK_Context3, Qt::Key_Context3, + QTOPIAXK_Context4, Qt::Key_Context4, + QTOPIAXK_Call, Qt::Key_Call, + QTOPIAXK_Hangup, Qt::Key_Hangup, + QTOPIAXK_Flip, Qt::Key_Flip, + + 0, 0 +}; + +static const unsigned short katakanaKeysymsToUnicode[] = { + 0x0000, 0x3002, 0x300C, 0x300D, 0x3001, 0x30FB, 0x30F2, 0x30A1, + 0x30A3, 0x30A5, 0x30A7, 0x30A9, 0x30E3, 0x30E5, 0x30E7, 0x30C3, + 0x30FC, 0x30A2, 0x30A4, 0x30A6, 0x30A8, 0x30AA, 0x30AB, 0x30AD, + 0x30AF, 0x30B1, 0x30B3, 0x30B5, 0x30B7, 0x30B9, 0x30BB, 0x30BD, + 0x30BF, 0x30C1, 0x30C4, 0x30C6, 0x30C8, 0x30CA, 0x30CB, 0x30CC, + 0x30CD, 0x30CE, 0x30CF, 0x30D2, 0x30D5, 0x30D8, 0x30DB, 0x30DE, + 0x30DF, 0x30E0, 0x30E1, 0x30E2, 0x30E4, 0x30E6, 0x30E8, 0x30E9, + 0x30EA, 0x30EB, 0x30EC, 0x30ED, 0x30EF, 0x30F3, 0x309B, 0x309C +}; + +static const unsigned short cyrillicKeysymsToUnicode[] = { + 0x0000, 0x0452, 0x0453, 0x0451, 0x0454, 0x0455, 0x0456, 0x0457, + 0x0458, 0x0459, 0x045a, 0x045b, 0x045c, 0x0000, 0x045e, 0x045f, + 0x2116, 0x0402, 0x0403, 0x0401, 0x0404, 0x0405, 0x0406, 0x0407, + 0x0408, 0x0409, 0x040a, 0x040b, 0x040c, 0x0000, 0x040e, 0x040f, + 0x044e, 0x0430, 0x0431, 0x0446, 0x0434, 0x0435, 0x0444, 0x0433, + 0x0445, 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, + 0x043f, 0x044f, 0x0440, 0x0441, 0x0442, 0x0443, 0x0436, 0x0432, + 0x044c, 0x044b, 0x0437, 0x0448, 0x044d, 0x0449, 0x0447, 0x044a, + 0x042e, 0x0410, 0x0411, 0x0426, 0x0414, 0x0415, 0x0424, 0x0413, + 0x0425, 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, + 0x041f, 0x042f, 0x0420, 0x0421, 0x0422, 0x0423, 0x0416, 0x0412, + 0x042c, 0x042b, 0x0417, 0x0428, 0x042d, 0x0429, 0x0427, 0x042a +}; + +static const unsigned short greekKeysymsToUnicode[] = { + 0x0000, 0x0386, 0x0388, 0x0389, 0x038a, 0x03aa, 0x0000, 0x038c, + 0x038e, 0x03ab, 0x0000, 0x038f, 0x0000, 0x0000, 0x0385, 0x2015, + 0x0000, 0x03ac, 0x03ad, 0x03ae, 0x03af, 0x03ca, 0x0390, 0x03cc, + 0x03cd, 0x03cb, 0x03b0, 0x03ce, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, + 0x0398, 0x0399, 0x039a, 0x039b, 0x039c, 0x039d, 0x039e, 0x039f, + 0x03a0, 0x03a1, 0x03a3, 0x0000, 0x03a4, 0x03a5, 0x03a6, 0x03a7, + 0x03a8, 0x03a9, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x03b1, 0x03b2, 0x03b3, 0x03b4, 0x03b5, 0x03b6, 0x03b7, + 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bc, 0x03bd, 0x03be, 0x03bf, + 0x03c0, 0x03c1, 0x03c3, 0x03c2, 0x03c4, 0x03c5, 0x03c6, 0x03c7, + 0x03c8, 0x03c9, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 +}; + +static const unsigned short technicalKeysymsToUnicode[] = { + 0x0000, 0x23B7, 0x250C, 0x2500, 0x2320, 0x2321, 0x2502, 0x23A1, + 0x23A3, 0x23A4, 0x23A6, 0x239B, 0x239D, 0x239E, 0x23A0, 0x23A8, + 0x23AC, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x2264, 0x2260, 0x2265, 0x222B, + 0x2234, 0x221D, 0x221E, 0x0000, 0x0000, 0x2207, 0x0000, 0x0000, + 0x223C, 0x2243, 0x0000, 0x0000, 0x0000, 0x21D4, 0x21D2, 0x2261, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x221A, 0x0000, + 0x0000, 0x0000, 0x2282, 0x2283, 0x2229, 0x222A, 0x2227, 0x2228, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2202, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0192, 0x0000, + 0x0000, 0x0000, 0x0000, 0x2190, 0x2191, 0x2192, 0x2193, 0x0000 +}; + +static const unsigned short specialKeysymsToUnicode[] = { + 0x25C6, 0x2592, 0x2409, 0x240C, 0x240D, 0x240A, 0x0000, 0x0000, + 0x2424, 0x240B, 0x2518, 0x2510, 0x250C, 0x2514, 0x253C, 0x23BA, + 0x23BB, 0x2500, 0x23BC, 0x23BD, 0x251C, 0x2524, 0x2534, 0x252C, + 0x2502, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 +}; + +static const unsigned short publishingKeysymsToUnicode[] = { + 0x0000, 0x2003, 0x2002, 0x2004, 0x2005, 0x2007, 0x2008, 0x2009, + 0x200a, 0x2014, 0x2013, 0x0000, 0x0000, 0x0000, 0x2026, 0x2025, + 0x2153, 0x2154, 0x2155, 0x2156, 0x2157, 0x2158, 0x2159, 0x215a, + 0x2105, 0x0000, 0x0000, 0x2012, 0x2329, 0x0000, 0x232a, 0x0000, + 0x0000, 0x0000, 0x0000, 0x215b, 0x215c, 0x215d, 0x215e, 0x0000, + 0x0000, 0x2122, 0x2613, 0x0000, 0x25c1, 0x25b7, 0x25cb, 0x25af, + 0x2018, 0x2019, 0x201c, 0x201d, 0x211e, 0x0000, 0x2032, 0x2033, + 0x0000, 0x271d, 0x0000, 0x25ac, 0x25c0, 0x25b6, 0x25cf, 0x25ae, + 0x25e6, 0x25ab, 0x25ad, 0x25b3, 0x25bd, 0x2606, 0x2022, 0x25aa, + 0x25b2, 0x25bc, 0x261c, 0x261e, 0x2663, 0x2666, 0x2665, 0x0000, + 0x2720, 0x2020, 0x2021, 0x2713, 0x2717, 0x266f, 0x266d, 0x2642, + 0x2640, 0x260e, 0x2315, 0x2117, 0x2038, 0x201a, 0x201e, 0x0000 +}; + +static const unsigned short aplKeysymsToUnicode[] = { + 0x0000, 0x0000, 0x0000, 0x003c, 0x0000, 0x0000, 0x003e, 0x0000, + 0x2228, 0x2227, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x00af, 0x0000, 0x22a5, 0x2229, 0x230a, 0x0000, 0x005f, 0x0000, + 0x0000, 0x0000, 0x2218, 0x0000, 0x2395, 0x0000, 0x22a4, 0x25cb, + 0x0000, 0x0000, 0x0000, 0x2308, 0x0000, 0x0000, 0x222a, 0x0000, + 0x2283, 0x0000, 0x2282, 0x0000, 0x22a2, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x22a3, 0x0000, 0x0000, 0x0000 +}; + +static const unsigned short koreanKeysymsToUnicode[] = { + 0x0000, 0x3131, 0x3132, 0x3133, 0x3134, 0x3135, 0x3136, 0x3137, + 0x3138, 0x3139, 0x313a, 0x313b, 0x313c, 0x313d, 0x313e, 0x313f, + 0x3140, 0x3141, 0x3142, 0x3143, 0x3144, 0x3145, 0x3146, 0x3147, + 0x3148, 0x3149, 0x314a, 0x314b, 0x314c, 0x314d, 0x314e, 0x314f, + 0x3150, 0x3151, 0x3152, 0x3153, 0x3154, 0x3155, 0x3156, 0x3157, + 0x3158, 0x3159, 0x315a, 0x315b, 0x315c, 0x315d, 0x315e, 0x315f, + 0x3160, 0x3161, 0x3162, 0x3163, 0x11a8, 0x11a9, 0x11aa, 0x11ab, + 0x11ac, 0x11ad, 0x11ae, 0x11af, 0x11b0, 0x11b1, 0x11b2, 0x11b3, + 0x11b4, 0x11b5, 0x11b6, 0x11b7, 0x11b8, 0x11b9, 0x11ba, 0x11bb, + 0x11bc, 0x11bd, 0x11be, 0x11bf, 0x11c0, 0x11c1, 0x11c2, 0x316d, + 0x3171, 0x3178, 0x317f, 0x3181, 0x3184, 0x3186, 0x318d, 0x318e, + 0x11eb, 0x11f0, 0x11f9, 0x0000, 0x0000, 0x0000, 0x0000, 0x20a9 +}; + +static QChar keysymToUnicode(unsigned char byte3, unsigned char byte4) +{ + switch (byte3) { + case 0x04: + // katakana + if (byte4 > 0xa0 && byte4 < 0xe0) + return QChar(katakanaKeysymsToUnicode[byte4 - 0xa0]); + else if (byte4 == 0x7e) + return QChar(0x203e); // Overline + break; + case 0x06: + // russian, use lookup table + if (byte4 > 0xa0) + return QChar(cyrillicKeysymsToUnicode[byte4 - 0xa0]); + break; + case 0x07: + // greek + if (byte4 > 0xa0) + return QChar(greekKeysymsToUnicode[byte4 - 0xa0]); + break; + case 0x08: + // technical + if (byte4 > 0xa0) + return QChar(technicalKeysymsToUnicode[byte4 - 0xa0]); + break; + case 0x09: + // special + if (byte4 >= 0xe0) + return QChar(specialKeysymsToUnicode[byte4 - 0xe0]); + break; + case 0x0a: + // publishing + if (byte4 > 0xa0) + return QChar(publishingKeysymsToUnicode[byte4 - 0xa0]); + break; + case 0x0b: + // APL + if (byte4 > 0xa0) + return QChar(aplKeysymsToUnicode[byte4 - 0xa0]); + break; + case 0x0e: + // Korean + if (byte4 > 0xa0) + return QChar(koreanKeysymsToUnicode[byte4 - 0xa0]); + break; + default: + break; + } + return QChar(0x0); +} + +Qt::KeyboardModifiers QXcbKeyboard::translateModifiers(int s) +{ + Qt::KeyboardModifiers ret = 0; + if (s & XCB_MOD_MASK_SHIFT) + ret |= Qt::ShiftModifier; + if (s & XCB_MOD_MASK_CONTROL) + ret |= Qt::ControlModifier; + if (s & m_alt_mask) + ret |= Qt::AltModifier; + if (s & m_meta_mask) + ret |= Qt::MetaModifier; + return ret; +} + +int QXcbKeyboard::translateKeySym(uint key) const +{ + int code = -1; + int i = 0; // any other keys + while (KeyTbl[i]) { + if (key == KeyTbl[i]) { + code = (int)KeyTbl[i+1]; + break; + } + i += 2; + } + if (m_meta_mask) { + // translate Super/Hyper keys to Meta if we're using them as the MetaModifier + if (m_meta_mask == m_super_mask && (code == Qt::Key_Super_L || code == Qt::Key_Super_R)) { + code = Qt::Key_Meta; + } else if (m_meta_mask == m_hyper_mask && (code == Qt::Key_Hyper_L || code == Qt::Key_Hyper_R)) { + code = Qt::Key_Meta; + } + } + return code; +} + +QString QXcbKeyboard::translateKeySym(xcb_keysym_t keysym, uint xmodifiers, + int &code, Qt::KeyboardModifiers &modifiers, + QByteArray &chars, int &count) +{ + // all keysyms smaller than 0xff00 are actally keys that can be mapped to unicode chars + + QTextCodec *mapper = QTextCodec::codecForLocale(); + QChar converted; + + if (/*count == 0 &&*/ keysym < 0xff00) { + unsigned char byte3 = (unsigned char)(keysym >> 8); + int mib = -1; + switch(byte3) { + case 0: // Latin 1 + case 1: // Latin 2 + case 2: //latin 3 + case 3: // latin4 + mib = byte3 + 4; break; + case 5: // arabic + mib = 82; break; + case 12: // Hebrew + mib = 85; break; + case 13: // Thai + mib = 2259; break; + case 4: // kana + case 6: // cyrillic + case 7: // greek + case 8: // technical, no mapping here at the moment + case 9: // Special + case 10: // Publishing + case 11: // APL + case 14: // Korean, no mapping + mib = -1; // manual conversion + mapper= 0; +#if !defined(QT_NO_XIM) + converted = keysymToUnicode(byte3, keysym & 0xff); +#endif + case 0x20: + // currency symbols + if (keysym >= 0x20a0 && keysym <= 0x20ac) { + mib = -1; // manual conversion + mapper = 0; + converted = (uint)keysym; + } + break; + default: + break; + } + if (mib != -1) { + mapper = QTextCodec::codecForMib(mib); + if (chars.isEmpty()) + chars.resize(1); + chars[0] = (unsigned char) (keysym & 0xff); // get only the fourth bit for conversion later + count = 1; + } + } else if (keysym >= 0x1000000 && keysym <= 0x100ffff) { + converted = (ushort) (keysym - 0x1000000); + mapper = 0; + } + if (count < (int)chars.size()-1) + chars[count] = '\0'; + + QString text; + if (!mapper && converted.unicode() != 0x0) { + text = converted; + } else if (!chars.isEmpty()) { + // convert chars (8bit) to text (unicode). + if (mapper) + text = mapper->toUnicode(chars.data(), count, 0); + if (text.isEmpty()) { + // no mapper, or codec couldn't convert to unicode (this + // can happen when running in the C locale or with no LANG + // set). try converting from latin-1 + text = QString::fromLatin1(chars); + } + } + + modifiers = translateModifiers(xmodifiers); + + // Commentary in X11/keysymdef says that X codes match ASCII, so it + // is safe to use the locale functions to process X codes in ISO8859-1. + // + // This is mainly for compatibility - applications should not use the + // Qt keycodes between 128 and 255, but should rather use the + // QKeyEvent::text(). + // + if (keysym < 128 || (keysym < 256 && (!mapper || mapper->mibEnum()==4))) { + // upper-case key, if known + code = isprint((int)keysym) ? toupper((int)keysym) : 0; + } else if (keysym >= XK_F1 && keysym <= XK_F35) { + // function keys + code = Qt::Key_F1 + ((int)keysym - XK_F1); + } else if (keysym >= XK_KP_Space && keysym <= XK_KP_9) { + if (keysym >= XK_KP_0) { + // numeric keypad keys + code = Qt::Key_0 + ((int)keysym - XK_KP_0); + } else { + code = translateKeySym(keysym); + } + modifiers |= Qt::KeypadModifier; + } else if (text.length() == 1 && text.unicode()->unicode() > 0x1f && text.unicode()->unicode() != 0x7f && !(keysym >= XK_dead_grave && keysym <= XK_dead_horn)) { + code = text.unicode()->toUpper().unicode(); + } else { + // any other keys + code = translateKeySym(keysym); + + if (code == Qt::Key_Tab && (modifiers & Qt::ShiftModifier)) { + // map shift+tab to shift+backtab, QShortcutMap knows about it + // and will handle it. + code = Qt::Key_Backtab; + text = QString(); + } + } + + return text; +} + +QXcbKeyboard::QXcbKeyboard(QXcbConnection *connection) + : QXcbObject(connection) + , m_alt_mask(0) + , m_super_mask(0) + , m_hyper_mask(0) + , m_meta_mask(0) +{ + m_key_symbols = xcb_key_symbols_alloc(xcb_connection()); +} + +QXcbKeyboard::~QXcbKeyboard() +{ + xcb_key_symbols_free(m_key_symbols); +} + +void QXcbKeyboard::handleKeyPressEvent(QWidget *widget, const xcb_key_press_event_t *event) +{ + xcb_keysym_t sym = xcb_key_press_lookup_keysym(m_key_symbols, const_cast(event), 0); + + QByteArray chars; + chars.resize(513); + + Qt::KeyboardModifiers modifiers; + int qtcode = 0; + int count = 0; + + QString string = translateKeySym(sym, event->state, qtcode, modifiers, chars, count); + + QWindowSystemInterface::handleKeyEvent(widget, event->time, QEvent::KeyPress, qtcode, modifiers, string.left(count)); +} + +void QXcbKeyboard::handleKeyReleaseEvent(QWidget *widget, const xcb_key_release_event_t *event) +{ + xcb_keysym_t sym = xcb_key_release_lookup_keysym(m_key_symbols, const_cast(event), 0); + + QByteArray chars; + chars.resize(513); + + Qt::KeyboardModifiers modifiers; + int qtcode = 0; + int count = 0; + + QString string = translateKeySym(sym, event->state, qtcode, modifiers, chars, count); + + QWindowSystemInterface::handleKeyEvent(widget, event->time, QEvent::KeyRelease, qtcode, modifiers, string.left(count)); +} + +void QXcbKeyboard::handleMappingNotifyEvent(const xcb_mapping_notify_event_t *event) +{ + xcb_refresh_keyboard_mapping(m_key_symbols, const_cast(event)); +} diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.h b/src/plugins/platforms/xcb/qxcbkeyboard.h new file mode 100644 index 0000000..dc4175a --- /dev/null +++ b/src/plugins/platforms/xcb/qxcbkeyboard.h @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QXCBKEYBOARD_H +#define QXCBKEYBOARD_H + +#include "qxcbobject.h" + +#include "xcb/xcb_keysyms.h" + +class QXcbKeyboard : public QXcbObject +{ +public: + QXcbKeyboard(QXcbConnection *connection); + ~QXcbKeyboard(); + + void handleKeyPressEvent(QWidget *widget, const xcb_key_press_event_t *event); + void handleKeyReleaseEvent(QWidget *widget, const xcb_key_release_event_t *event); + + void handleMappingNotifyEvent(const xcb_mapping_notify_event_t *event); + + Qt::KeyboardModifiers translateModifiers(int s); + +private: + + int translateKeySym(uint key) const; + QString translateKeySym(xcb_keysym_t keysym, uint xmodifiers, + int &code, Qt::KeyboardModifiers &modifiers, + QByteArray &chars, int &count); + + uint m_alt_mask; + uint m_super_mask; + uint m_hyper_mask; + uint m_meta_mask; + uint m_mode_switch_mask; + uint m_num_lock_mask; + + xcb_key_symbols_t *m_key_symbols; +}; + +#endif diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp index a9a24dd..4faa617 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.cpp +++ b/src/plugins/platforms/xcb/qxcbscreen.cpp @@ -55,6 +55,17 @@ QXcbScreen::QXcbScreen(QXcbConnection *connection, xcb_screen_t *screen) printf (" white pixel...: %x\n", screen->white_pixel); printf (" black pixel...: %x\n", screen->black_pixel); printf ("\n"); + + const quint32 mask = XCB_CW_EVENT_MASK; + const quint32 values[] = { + // XCB_CW_EVENT_MASK + XCB_EVENT_MASK_KEYMAP_STATE + | XCB_EVENT_MASK_ENTER_WINDOW + | XCB_EVENT_MASK_LEAVE_WINDOW + | XCB_EVENT_MASK_PROPERTY_CHANGE + }; + + xcb_configure_window(xcb_connection(), screen->root, mask, values); } QXcbScreen::~QXcbScreen() diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 6dfccba..bdb5fc1 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -64,9 +64,15 @@ QXcbWindow::QXcbWindow(QWidget *tlw) // XCB_CW_EVENT_MASK XCB_EVENT_MASK_EXPOSURE | XCB_EVENT_MASK_STRUCTURE_NOTIFY + | XCB_EVENT_MASK_KEY_PRESS + | XCB_EVENT_MASK_KEY_RELEASE | XCB_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE | XCB_EVENT_MASK_BUTTON_MOTION + | XCB_EVENT_MASK_ENTER_WINDOW + | XCB_EVENT_MASK_LEAVE_WINDOW + | XCB_EVENT_MASK_PROPERTY_CHANGE + | XCB_EVENT_MASK_FOCUS_CHANGE }; m_window = xcb_generate_id(xcb_connection()); @@ -160,7 +166,7 @@ void QXcbWindow::requestActivateWindow() { } -void QXcbWindow::handleExposeEvent(xcb_expose_event_t *event) +void QXcbWindow::handleExposeEvent(const xcb_expose_event_t *event) { QWindowSurface *surface = widget()->windowSurface(); if (surface) { @@ -170,7 +176,7 @@ void QXcbWindow::handleExposeEvent(xcb_expose_event_t *event) } } -void QXcbWindow::handleClientMessageEvent(xcb_client_message_event_t *event) +void QXcbWindow::handleClientMessageEvent(const xcb_client_message_event_t *event) { if (event->format == 32 && event->type == atom(QXcbAtom::WM_PROTOCOLS)) { if (event->data.data32[0] == atom(QXcbAtom::WM_DELETE_WINDOW)) { @@ -179,7 +185,7 @@ void QXcbWindow::handleClientMessageEvent(xcb_client_message_event_t *event) } } -void QXcbWindow::handleConfigureNotifyEvent(xcb_configure_notify_event_t *event) +void QXcbWindow::handleConfigureNotifyEvent(const xcb_configure_notify_event_t *event) { int xpos = geometry().x(); int ypos = geometry().y(); @@ -218,7 +224,7 @@ static Qt::MouseButton translateMouseButton(xcb_button_t s) } } -void QXcbWindow::handleButtonPressEvent(xcb_button_press_event_t *event) +void QXcbWindow::handleButtonPressEvent(const xcb_button_press_event_t *event) { QPoint local(event->event_x, event->event_y); QPoint global(event->root_x, event->root_y); @@ -240,7 +246,7 @@ void QXcbWindow::handleButtonPressEvent(xcb_button_press_event_t *event) handleMouseEvent(event->detail, event->state, event->time, local, global); } -void QXcbWindow::handleButtonReleaseEvent(xcb_button_release_event_t *event) +void QXcbWindow::handleButtonReleaseEvent(const xcb_button_release_event_t *event) { QPoint local(event->event_x, event->event_y); QPoint global(event->root_x, event->root_y); @@ -248,7 +254,7 @@ void QXcbWindow::handleButtonReleaseEvent(xcb_button_release_event_t *event) handleMouseEvent(event->detail, event->state, event->time, local, global); } -void QXcbWindow::handleMotionNotifyEvent(xcb_motion_notify_event_t *event) +void QXcbWindow::handleMotionNotifyEvent(const xcb_motion_notify_event_t *event) { QPoint local(event->event_x, event->event_y); QPoint global(event->root_x, event->root_y); @@ -266,3 +272,23 @@ void QXcbWindow::handleMouseEvent(xcb_button_t detail, uint16_t state, xcb_times QWindowSystemInterface::handleMouseEvent(widget(), time, local, global, buttons); } +void QXcbWindow::handleEnterNotifyEvent(const xcb_enter_notify_event_t *) +{ + QWindowSystemInterface::handleEnterEvent(widget()); +} + +void QXcbWindow::handleLeaveNotifyEvent(const xcb_leave_notify_event_t *) +{ + QWindowSystemInterface::handleLeaveEvent(widget()); +} + +void QXcbWindow::handleFocusInEvent(const xcb_focus_in_event_t *) +{ + QWindowSystemInterface::handleWindowActivated(widget()); +} + +void QXcbWindow::handleFocusOutEvent(const xcb_focus_out_event_t *) +{ + QWindowSystemInterface::handleWindowActivated(0); +} + diff --git a/src/plugins/platforms/xcb/qxcbwindow.h b/src/plugins/platforms/xcb/qxcbwindow.h index a772d30..d9ca86c 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.h +++ b/src/plugins/platforms/xcb/qxcbwindow.h @@ -74,12 +74,17 @@ public: xcb_window_t window() const { return m_window; } - void handleExposeEvent(xcb_expose_event_t *event); - void handleClientMessageEvent(xcb_client_message_event_t *event); - void handleConfigureNotifyEvent(xcb_configure_notify_event_t *event); - void handleButtonPressEvent(xcb_button_press_event_t *event); - void handleButtonReleaseEvent(xcb_button_release_event_t *event); - void handleMotionNotifyEvent(xcb_motion_notify_event_t *event); + void handleExposeEvent(const xcb_expose_event_t *event); + void handleClientMessageEvent(const xcb_client_message_event_t *event); + void handleConfigureNotifyEvent(const xcb_configure_notify_event_t *event); + void handleButtonPressEvent(const xcb_button_press_event_t *event); + void handleButtonReleaseEvent(const xcb_button_release_event_t *event); + void handleMotionNotifyEvent(const xcb_motion_notify_event_t *event); + + void handleEnterNotifyEvent(const xcb_enter_notify_event_t *event); + void handleLeaveNotifyEvent(const xcb_leave_notify_event_t *event); + void handleFocusInEvent(const xcb_focus_in_event_t *event); + void handleFocusOutEvent(const xcb_focus_out_event_t *event); void handleMouseEvent(xcb_button_t detail, uint16_t state, xcb_timestamp_t time, const QPoint &local, const QPoint &global); diff --git a/src/plugins/platforms/xcb/xcb.pro b/src/plugins/platforms/xcb/xcb.pro index a4f9246..3aee0a2 100644 --- a/src/plugins/platforms/xcb/xcb.pro +++ b/src/plugins/platforms/xcb/xcb.pro @@ -4,22 +4,24 @@ include(../../qpluginbase.pri) QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforms SOURCES = \ - main.cpp \ - qxcbintegration.cpp \ qxcbconnection.cpp \ + qxcbintegration.cpp \ + qxcbkeyboard.cpp \ qxcbscreen.cpp \ qxcbwindow.cpp \ - qxcbwindowsurface.cpp + qxcbwindowsurface.cpp \ + main.cpp HEADERS = \ - qxcbobject.h \ - qxcbintegration.h \ qxcbconnection.h \ + qxcbintegration.h \ + qxcbkeyboard.h \ + qxcbobject.h \ qxcbscreen.h \ qxcbwindow.h \ qxcbwindowsurface.h -LIBS += -lxcb -lxcb-image +LIBS += -lxcb -lxcb-image -lxcb-keysyms include (../fontdatabases/genericunix/genericunix.pri) -- cgit v0.12 From 6aa7b8ff77a968a2ad11181d21812e3fe675ba23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Tue, 8 Feb 2011 16:22:18 +0100 Subject: Added setGeometry(), raise(), lower() and setParent() in XCB backend. --- src/plugins/platforms/xcb/qxcbwindow.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index bdb5fc1..caeb3fa 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -112,6 +112,11 @@ QXcbWindow::~QXcbWindow() void QXcbWindow::setGeometry(const QRect &rect) { QPlatformWindow::setGeometry(rect); + + const quint32 mask = XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y | XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT; + const quint32 values[] = { rect.x(), rect.y(), rect.width(), rect.height() }; + + xcb_configure_window(xcb_connection(), m_window, mask, values); } void QXcbWindow::setVisible(bool visible) @@ -137,8 +142,10 @@ WId QXcbWindow::winId() const return m_window; } -void QXcbWindow::setParent(const QPlatformWindow *) +void QXcbWindow::setParent(const QPlatformWindow *parent) { + QPoint topLeft = geometry().topLeft(); + xcb_reparent_window(xcb_connection(), window(), static_cast(parent)->window(), topLeft.x(), topLeft.y()); } void QXcbWindow::setWindowTitle(const QString &title) @@ -156,10 +163,16 @@ void QXcbWindow::setWindowTitle(const QString &title) void QXcbWindow::raise() { + const quint32 mask = XCB_CONFIG_WINDOW_STACK_MODE; + const quint32 values[] = { XCB_STACK_MODE_ABOVE }; + xcb_configure_window(xcb_connection(), m_window, mask, values); } void QXcbWindow::lower() { + const quint32 mask = XCB_CONFIG_WINDOW_STACK_MODE; + const quint32 values[] = { XCB_STACK_MODE_BELOW }; + xcb_configure_window(xcb_connection(), m_window, mask, values); } void QXcbWindow::requestActivateWindow() -- cgit v0.12 From a0cc1e923e1d43bbb86d59b829c2d8a23a03bcf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Wed, 9 Feb 2011 11:38:36 +0100 Subject: Added window attribute setting to XCB backend. --- src/plugins/platforms/xcb/qxcbwindow.cpp | 154 +++++++++++++++++++++++++++++-- src/plugins/platforms/xcb/qxcbwindow.h | 1 - 2 files changed, 145 insertions(+), 10 deletions(-) diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index caeb3fa..b54a233 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -90,9 +90,14 @@ QXcbWindow::QXcbWindow(QWidget *tlw) mask, // value mask values); // value list - xcb_atom_t properties[] = { - atom(QXcbAtom::WM_DELETE_WINDOW) - }; + xcb_atom_t properties[4]; + int propertyCount = 0; + properties[propertyCount++] = atom(QXcbAtom::WM_DELETE_WINDOW); + properties[propertyCount++] = atom(QXcbAtom::WM_TAKE_FOCUS); + properties[propertyCount++] = atom(QXcbAtom::_NET_WM_PING); + + if (tlw->windowFlags() & Qt::WindowContextHelpButtonHint) + properties[propertyCount++] = atom(QXcbAtom::_NET_WM_CONTEXT_HELP); xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, @@ -100,7 +105,7 @@ QXcbWindow::QXcbWindow(QWidget *tlw) atom(QXcbAtom::WM_PROTOCOLS), 4, 32, - sizeof(properties) / sizeof(xcb_atom_t), + propertyCount, properties); } @@ -127,14 +132,144 @@ void QXcbWindow::setVisible(bool visible) xcb_unmap_window(xcb_connection(), m_window); } +struct QtMWMHints { + quint32 flags, functions, decorations; + qint32 input_mode; + quint32 status; +}; + +enum { + MWM_HINTS_FUNCTIONS = (1L << 0), + + MWM_FUNC_ALL = (1L << 0), + MWM_FUNC_RESIZE = (1L << 1), + MWM_FUNC_MOVE = (1L << 2), + MWM_FUNC_MINIMIZE = (1L << 3), + MWM_FUNC_MAXIMIZE = (1L << 4), + MWM_FUNC_CLOSE = (1L << 5), + + MWM_HINTS_DECORATIONS = (1L << 1), + + MWM_DECOR_ALL = (1L << 0), + MWM_DECOR_BORDER = (1L << 1), + MWM_DECOR_RESIZEH = (1L << 2), + MWM_DECOR_TITLE = (1L << 3), + MWM_DECOR_MENU = (1L << 4), + MWM_DECOR_MINIMIZE = (1L << 5), + MWM_DECOR_MAXIMIZE = (1L << 6), + + MWM_HINTS_INPUT_MODE = (1L << 2), + + MWM_INPUT_MODELESS = 0L, + MWM_INPUT_PRIMARY_APPLICATION_MODAL = 1L, + MWM_INPUT_FULL_APPLICATION_MODAL = 3L +}; + Qt::WindowFlags QXcbWindow::setWindowFlags(Qt::WindowFlags flags) { - return flags; -} + Qt::WindowType type = static_cast(int(flags & Qt::WindowType_Mask)); + + if (type == Qt::ToolTip) + flags |= Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint; + if (type == Qt::Popup) + flags |= Qt::X11BypassWindowManagerHint; + + bool topLevel = (flags & Qt::Window); + bool popup = (type == Qt::Popup); + bool dialog = (type == Qt::Dialog + || type == Qt::Sheet); + bool desktop = (type == Qt::Desktop); + bool tool = (type == Qt::Tool || type == Qt::SplashScreen + || type == Qt::ToolTip || type == Qt::Drawer); + + Q_UNUSED(topLevel); + Q_UNUSED(dialog); + Q_UNUSED(desktop); + Q_UNUSED(tool); + + bool tooltip = (type == Qt::ToolTip); + + QtMWMHints mwmhints; + mwmhints.flags = 0L; + mwmhints.functions = 0L; + mwmhints.decorations = 0; + mwmhints.input_mode = 0L; + mwmhints.status = 0L; + + if (type != Qt::SplashScreen) { + mwmhints.flags |= MWM_HINTS_DECORATIONS; + + bool customize = flags & Qt::CustomizeWindowHint; + if (!(flags & Qt::FramelessWindowHint) && !(customize && !(flags & Qt::WindowTitleHint))) { + mwmhints.decorations |= MWM_DECOR_BORDER; + mwmhints.decorations |= MWM_DECOR_RESIZEH; + + if (flags & Qt::WindowTitleHint) + mwmhints.decorations |= MWM_DECOR_TITLE; + + if (flags & Qt::WindowSystemMenuHint) + mwmhints.decorations |= MWM_DECOR_MENU; + + if (flags & Qt::WindowMinimizeButtonHint) { + mwmhints.decorations |= MWM_DECOR_MINIMIZE; + mwmhints.functions |= MWM_FUNC_MINIMIZE; + } + + if (flags & Qt::WindowMaximizeButtonHint) { + mwmhints.decorations |= MWM_DECOR_MAXIMIZE; + mwmhints.functions |= MWM_FUNC_MAXIMIZE; + } + + if (flags & Qt::WindowCloseButtonHint) + mwmhints.functions |= MWM_FUNC_CLOSE; + } + } else { + // if type == Qt::SplashScreen + mwmhints.decorations = MWM_DECOR_ALL; + } -Qt::WindowFlags QXcbWindow::windowFlags() const -{ - return 0; + if (mwmhints.functions != 0) { + mwmhints.flags |= MWM_HINTS_FUNCTIONS; + mwmhints.functions |= MWM_FUNC_MOVE | MWM_FUNC_RESIZE; + } else { + mwmhints.functions = MWM_FUNC_ALL; + } + + if (!(flags & Qt::FramelessWindowHint) + && flags & Qt::CustomizeWindowHint + && flags & Qt::WindowTitleHint + && !(flags & + (Qt::WindowMinimizeButtonHint + | Qt::WindowMaximizeButtonHint + | Qt::WindowCloseButtonHint))) + { + // a special case - only the titlebar without any button + mwmhints.flags = MWM_HINTS_FUNCTIONS; + mwmhints.functions = MWM_FUNC_MOVE | MWM_FUNC_RESIZE; + mwmhints.decorations = 0; + } + + if (mwmhints.flags != 0l) { + xcb_change_property(xcb_connection(), + XCB_PROP_MODE_REPLACE, + m_window, + atom(QXcbAtom::_MOTIF_WM_HINTS), + atom(QXcbAtom::_MOTIF_WM_HINTS), + 32, + 5, + &mwmhints); + } else { + xcb_delete_property(xcb_connection(), m_window, atom(QXcbAtom::_MOTIF_WM_HINTS)); + } + + if (popup || tooltip) { + const quint32 mask = XCB_CW_OVERRIDE_REDIRECT | XCB_CW_SAVE_UNDER; + const quint32 values[] = { true, true }; + + xcb_change_window_attributes(xcb_connection(), m_window, mask, values); + } + + return QPlatformWindow::setWindowFlags(flags); } WId QXcbWindow::winId() const @@ -177,6 +312,7 @@ void QXcbWindow::lower() void QXcbWindow::requestActivateWindow() { + xcb_set_input_focus(xcb_connection(), m_window, XCB_INPUT_FOCUS_PARENT, XCB_TIME_CURRENT_TIME); } void QXcbWindow::handleExposeEvent(const xcb_expose_event_t *event) diff --git a/src/plugins/platforms/xcb/qxcbwindow.h b/src/plugins/platforms/xcb/qxcbwindow.h index d9ca86c..17e1742 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.h +++ b/src/plugins/platforms/xcb/qxcbwindow.h @@ -60,7 +60,6 @@ public: void setVisible(bool visible); Qt::WindowFlags setWindowFlags(Qt::WindowFlags flags); - Qt::WindowFlags windowFlags() const; WId winId() const; void setParent(const QPlatformWindow *window); -- cgit v0.12 From bb0480a03bba6b23dd1e35ea1a8cc62e4f4a0219 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Wed, 9 Feb 2011 12:05:54 +0100 Subject: Added workaround to make XCB key event handling detect upper case. --- src/plugins/platforms/xcb/qxcbkeyboard.cpp | 29 ++++++++++++++--------------- src/plugins/platforms/xcb/qxcbkeyboard.h | 3 +++ 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.cpp b/src/plugins/platforms/xcb/qxcbkeyboard.cpp index b226e3e..83f053a 100644 --- a/src/plugins/platforms/xcb/qxcbkeyboard.cpp +++ b/src/plugins/platforms/xcb/qxcbkeyboard.cpp @@ -911,10 +911,8 @@ QXcbKeyboard::~QXcbKeyboard() xcb_key_symbols_free(m_key_symbols); } -void QXcbKeyboard::handleKeyPressEvent(QWidget *widget, const xcb_key_press_event_t *event) +void QXcbKeyboard::handleKeyEvent(QWidget *widget, QEvent::Type type, xcb_keysym_t sym, quint16 state, xcb_timestamp_t time) { - xcb_keysym_t sym = xcb_key_press_lookup_keysym(m_key_symbols, const_cast(event), 0); - QByteArray chars; chars.resize(513); @@ -922,25 +920,26 @@ void QXcbKeyboard::handleKeyPressEvent(QWidget *widget, const xcb_key_press_even int qtcode = 0; int count = 0; - QString string = translateKeySym(sym, event->state, qtcode, modifiers, chars, count); + if (state & XCB_MOD_MASK_SHIFT && sym <= 0x7f && isalpha(sym)) + sym = toupper(sym); - QWindowSystemInterface::handleKeyEvent(widget, event->time, QEvent::KeyPress, qtcode, modifiers, string.left(count)); + QString string = translateKeySym(sym, state, qtcode, modifiers, chars, count); + + QWindowSystemInterface::handleKeyEvent(widget, time, type, qtcode, modifiers, string.left(count)); } -void QXcbKeyboard::handleKeyReleaseEvent(QWidget *widget, const xcb_key_release_event_t *event) +void QXcbKeyboard::handleKeyPressEvent(QWidget *widget, const xcb_key_press_event_t *event) { - xcb_keysym_t sym = xcb_key_release_lookup_keysym(m_key_symbols, const_cast(event), 0); - - QByteArray chars; - chars.resize(513); + xcb_keysym_t sym = xcb_key_press_lookup_keysym(m_key_symbols, const_cast(event), 0); - Qt::KeyboardModifiers modifiers; - int qtcode = 0; - int count = 0; + handleKeyEvent(widget, QEvent::KeyPress, sym, event->state, event->time); +} - QString string = translateKeySym(sym, event->state, qtcode, modifiers, chars, count); +void QXcbKeyboard::handleKeyReleaseEvent(QWidget *widget, const xcb_key_release_event_t *event) +{ + xcb_keysym_t sym = xcb_key_release_lookup_keysym(m_key_symbols, const_cast(event), 0); - QWindowSystemInterface::handleKeyEvent(widget, event->time, QEvent::KeyRelease, qtcode, modifiers, string.left(count)); + handleKeyEvent(widget, QEvent::KeyRelease, sym, event->state, event->time); } void QXcbKeyboard::handleMappingNotifyEvent(const xcb_mapping_notify_event_t *event) diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.h b/src/plugins/platforms/xcb/qxcbkeyboard.h index dc4175a..89c7418 100644 --- a/src/plugins/platforms/xcb/qxcbkeyboard.h +++ b/src/plugins/platforms/xcb/qxcbkeyboard.h @@ -46,6 +46,8 @@ #include "xcb/xcb_keysyms.h" +#include + class QXcbKeyboard : public QXcbObject { public: @@ -60,6 +62,7 @@ public: Qt::KeyboardModifiers translateModifiers(int s); private: + void handleKeyEvent(QWidget *widget, QEvent::Type type, xcb_keysym_t sym, quint16 state, xcb_timestamp_t time); int translateKeySym(uint key) const; QString translateKeySym(xcb_keysym_t keysym, uint xmodifiers, -- cgit v0.12 From 69a0d3bdbfecdbf559aa6d0132281ad64b88fac8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Wed, 9 Feb 2011 12:36:16 +0100 Subject: Better handling of key codes in XCB backend. Using xcb_key_symbols_get_keysym seems to give better results compared to xcb_key_press_lookup_keysym xcb_key_release_lookup_keysym. --- src/plugins/platforms/xcb/qxcbkeyboard.cpp | 29 ++++++++++++++++++----------- src/plugins/platforms/xcb/qxcbkeyboard.h | 2 +- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.cpp b/src/plugins/platforms/xcb/qxcbkeyboard.cpp index 83f053a..67039a7 100644 --- a/src/plugins/platforms/xcb/qxcbkeyboard.cpp +++ b/src/plugins/platforms/xcb/qxcbkeyboard.cpp @@ -911,18 +911,29 @@ QXcbKeyboard::~QXcbKeyboard() xcb_key_symbols_free(m_key_symbols); } -void QXcbKeyboard::handleKeyEvent(QWidget *widget, QEvent::Type type, xcb_keysym_t sym, quint16 state, xcb_timestamp_t time) +void QXcbKeyboard::handleKeyEvent(QWidget *widget, QEvent::Type type, xcb_keycode_t code, quint16 state, xcb_timestamp_t time) { + int col = state & XCB_MOD_MASK_SHIFT ? 1 : 0; + + const int altGrOffset = 4; + if (state & 128) + col += altGrOffset; + + xcb_keysym_t sym = xcb_key_symbols_get_keysym(m_key_symbols, code, col); + + if (state & XCB_MOD_MASK_LOCK && sym <= 0x7f && isprint(sym)) { + if (isupper(sym)) + sym = tolower(sym); + else + sym = toupper(sym); + } + QByteArray chars; - chars.resize(513); Qt::KeyboardModifiers modifiers; int qtcode = 0; int count = 0; - if (state & XCB_MOD_MASK_SHIFT && sym <= 0x7f && isalpha(sym)) - sym = toupper(sym); - QString string = translateKeySym(sym, state, qtcode, modifiers, chars, count); QWindowSystemInterface::handleKeyEvent(widget, time, type, qtcode, modifiers, string.left(count)); @@ -930,16 +941,12 @@ void QXcbKeyboard::handleKeyEvent(QWidget *widget, QEvent::Type type, xcb_keysym void QXcbKeyboard::handleKeyPressEvent(QWidget *widget, const xcb_key_press_event_t *event) { - xcb_keysym_t sym = xcb_key_press_lookup_keysym(m_key_symbols, const_cast(event), 0); - - handleKeyEvent(widget, QEvent::KeyPress, sym, event->state, event->time); + handleKeyEvent(widget, QEvent::KeyPress, event->detail, event->state, event->time); } void QXcbKeyboard::handleKeyReleaseEvent(QWidget *widget, const xcb_key_release_event_t *event) { - xcb_keysym_t sym = xcb_key_release_lookup_keysym(m_key_symbols, const_cast(event), 0); - - handleKeyEvent(widget, QEvent::KeyRelease, sym, event->state, event->time); + handleKeyEvent(widget, QEvent::KeyRelease, event->detail, event->state, event->time); } void QXcbKeyboard::handleMappingNotifyEvent(const xcb_mapping_notify_event_t *event) diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.h b/src/plugins/platforms/xcb/qxcbkeyboard.h index 89c7418..2a17e48 100644 --- a/src/plugins/platforms/xcb/qxcbkeyboard.h +++ b/src/plugins/platforms/xcb/qxcbkeyboard.h @@ -62,7 +62,7 @@ public: Qt::KeyboardModifiers translateModifiers(int s); private: - void handleKeyEvent(QWidget *widget, QEvent::Type type, xcb_keysym_t sym, quint16 state, xcb_timestamp_t time); + void handleKeyEvent(QWidget *widget, QEvent::Type type, xcb_keycode_t code, quint16 state, xcb_timestamp_t time); int translateKeySym(uint key) const; QString translateKeySym(xcb_keysym_t keysym, uint xmodifiers, -- cgit v0.12 From cb742e70f0d2fb992d27045f6d3d9624bd10ced5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Wed, 9 Feb 2011 14:55:24 +0100 Subject: Dont include EGL header when compiling with QT_NO_EGL --- src/opengl/qgl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 9f31c62..ffde515 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -97,7 +97,7 @@ #include "qlibrary.h" #include -#ifdef QT_OPENGL_ES +#if defined(QT_OPENGL_ES) && !defined(QT_NO_EGL) #include #endif -- cgit v0.12 From 5112afc9eeb546f27e2fa5d655418ee7c544b109 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Wed, 9 Feb 2011 15:00:16 +0100 Subject: Add highest pixel format option to q_configFromQPlatformWindowFormat The default is still the old behavior --- .../platforms/eglconvenience/qeglconvenience.cpp | 18 +++++++++--------- src/plugins/platforms/eglconvenience/qeglconvenience.h | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/plugins/platforms/eglconvenience/qeglconvenience.cpp b/src/plugins/platforms/eglconvenience/qeglconvenience.cpp index 1612f79..acdbf24 100644 --- a/src/plugins/platforms/eglconvenience/qeglconvenience.cpp +++ b/src/plugins/platforms/eglconvenience/qeglconvenience.cpp @@ -206,7 +206,7 @@ bool q_reduceConfigAttributes(QVector *configAttributes) return false; } -EGLConfig q_configFromQPlatformWindowFormat(EGLDisplay display, const QPlatformWindowFormat &format) +EGLConfig q_configFromQPlatformWindowFormat(EGLDisplay display, const QPlatformWindowFormat &format, bool highestPixelFormat) { EGLConfig cfg = 0; QVector configureAttributes = q_createConfigAttributesFromFormat(format); @@ -227,14 +227,14 @@ EGLConfig q_configFromQPlatformWindowFormat(EGLDisplay display, const QPlatformW if (!eglChooseConfig(display, configureAttributes.constData(), 0, 0, &matching) || !matching) continue; -// // If we want the best pixel format, then return the first -// // matching configuration. -// if (match == QEgl::BestPixelFormat) { -// eglChooseConfig(display, props.properties(), &cfg, 1, &matching); -// if (matching < 1) -// continue; -// return cfg; -// } + // If we want the best pixel format, then return the first + // matching configuration. + if (highestPixelFormat) { + eglChooseConfig(display, configureAttributes.constData(), &cfg, 1, &matching); + if (matching < 1) + continue; + return cfg; + } // Fetch all of the matching configurations and find the // first that matches the pixel format we wanted. diff --git a/src/plugins/platforms/eglconvenience/qeglconvenience.h b/src/plugins/platforms/eglconvenience/qeglconvenience.h index 98c30b8..a1df3cc 100644 --- a/src/plugins/platforms/eglconvenience/qeglconvenience.h +++ b/src/plugins/platforms/eglconvenience/qeglconvenience.h @@ -51,7 +51,7 @@ QT_BEGIN_NAMESPACE QVector q_createConfigAttributesFromFormat(const QPlatformWindowFormat &format); bool q_reduceConfigAttributes(QVector *configAttributes); -EGLConfig q_configFromQPlatformWindowFormat(EGLDisplay display, const QPlatformWindowFormat &format); +EGLConfig q_configFromQPlatformWindowFormat(EGLDisplay display, const QPlatformWindowFormat &format, bool highestPixelFormat = false); QPlatformWindowFormat qt_qPlatformWindowFormatFromConfig(EGLDisplay display, const EGLConfig config); bool q_hasEglExtension(EGLDisplay display,const char* extensionName); -- cgit v0.12 From f45102d9e53dc1ac8bde83fc27d83834c79cae93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Wed, 9 Feb 2011 15:03:36 +0100 Subject: Export QGLEngineSharedShaders --- src/opengl/gl2paintengineex/qglengineshadermanager_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/opengl/gl2paintengineex/qglengineshadermanager_p.h b/src/opengl/gl2paintengineex/qglengineshadermanager_p.h index 16a7d66..7cc9dc3 100644 --- a/src/opengl/gl2paintengineex/qglengineshadermanager_p.h +++ b/src/opengl/gl2paintengineex/qglengineshadermanager_p.h @@ -259,7 +259,7 @@ static const GLuint QT_PMV_MATRIX_3_ATTR = 5; class QGLEngineShaderProg; -class QGLEngineSharedShaders +class Q_OPENGL_EXPORT QGLEngineSharedShaders { Q_GADGET public: -- cgit v0.12 From c902dcc8943a2bfcb6432d46303ace46def6fe86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Wed, 9 Feb 2011 15:16:14 +0100 Subject: Lighthouse: Wayland: Use EGLSurface --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 4 +- src/plugins/platforms/wayland/qwaylanddisplay.h | 11 +- .../platforms/wayland/qwaylanddrmsurface.cpp | 245 +++++++-------------- src/plugins/platforms/wayland/qwaylanddrmsurface.h | 71 +----- .../platforms/wayland/qwaylandeglwindow.cpp | 115 ++++++++++ src/plugins/platforms/wayland/qwaylandeglwindow.h | 68 ++++++ .../platforms/wayland/qwaylandglcontext.cpp | 64 +++--- src/plugins/platforms/wayland/qwaylandglcontext.h | 17 +- src/plugins/platforms/wayland/qwaylandinclude.h | 72 ++++++ .../platforms/wayland/qwaylandintegration.cpp | 14 +- src/plugins/platforms/wayland/qwaylandscreen.cpp | 19 ++ src/plugins/platforms/wayland/qwaylandscreen.h | 3 + .../platforms/wayland/qwaylandshmsurface.cpp | 23 +- .../platforms/wayland/qwaylandshmwindow.cpp | 89 ++++++++ src/plugins/platforms/wayland/qwaylandshmwindow.h | 63 ++++++ src/plugins/platforms/wayland/qwaylandwindow.cpp | 35 +-- src/plugins/platforms/wayland/qwaylandwindow.h | 25 ++- src/plugins/platforms/wayland/wayland.pro | 31 ++- 18 files changed, 628 insertions(+), 341 deletions(-) create mode 100644 src/plugins/platforms/wayland/qwaylandeglwindow.cpp create mode 100644 src/plugins/platforms/wayland/qwaylandeglwindow.h create mode 100644 src/plugins/platforms/wayland/qwaylandinclude.h create mode 100644 src/plugins/platforms/wayland/qwaylandshmwindow.cpp create mode 100644 src/plugins/platforms/wayland/qwaylandshmwindow.h diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 0747afd..ca23165 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -50,8 +50,6 @@ #include #include -#include - struct wl_surface *QWaylandDisplay::createSurface() { return wl_compositor_create_surface(mCompositor); @@ -186,7 +184,7 @@ QWaylandDisplay::QWaylandDisplay(void) mNativeEglDisplay = wl_egl_display_create(mDisplay); - mEglDisplay = eglGetDisplay(mNativeEglDisplay); + mEglDisplay = eglGetDisplay((EGLNativeDisplayType)mNativeEglDisplay); if (mEglDisplay == NULL) { qWarning("EGL not available"); } else { diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.h b/src/plugins/platforms/wayland/qwaylanddisplay.h index 375a9c1..ca31756 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay.h @@ -44,13 +44,12 @@ #include #include +#include +#include +#include +#include -#include - -#define MESA_EGL_NO_X11_HEADERS -#define EGL_EGLEXT_PROTOTYPES -#include -#include +#include "qwaylandinclude.h" class QWaylandInputDevice; class QSocketNotifier; diff --git a/src/plugins/platforms/wayland/qwaylanddrmsurface.cpp b/src/plugins/platforms/wayland/qwaylanddrmsurface.cpp index aaf4a5c..38bbc59 100644 --- a/src/plugins/platforms/wayland/qwaylanddrmsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylanddrmsurface.cpp @@ -38,183 +38,104 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ + #include "qwaylanddrmsurface.h" #include "qwaylanddisplay.h" #include "qwaylandwindow.h" #include "qwaylandscreen.h" -#include -#include -#include -#include +#include +#include -#include -#include +#include QT_BEGIN_NAMESPACE -/* - * Shared DRM surface for GL based drawing - */ -QWaylandDrmBuffer::QWaylandDrmBuffer(QWaylandDisplay *display, - const QSize &size, QImage::Format format) - : mDisplay(display) - , mSize(size) -{ - struct wl_visual *visual; - - switch (format) { - case QImage::Format_ARGB32: - visual = display->argbVisual(); - break; - case QImage::Format_ARGB32_Premultiplied: - visual = display->argbPremultipliedVisual(); - break; - default: - qDebug("unsupported buffer format %d requested\n", format); - visual = display->argbVisual(); - break; - } - - mPixmap = wl_egl_pixmap_create(display->nativeDisplay(), - size.width(), size.height(), - visual, 0); - - mImage = eglCreateImageKHR(display->eglDisplay(), - NULL, EGL_NATIVE_PIXMAP_KHR, - (EGLClientBuffer) mPixmap, NULL); - glGenTextures(1, &mTexture); - qDebug() << "generating mTexture" << mTexture; - glBindTexture(GL_TEXTURE_2D, mTexture); - glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, mImage); - mBuffer = wl_egl_pixmap_create_buffer(display->nativeDisplay(), mPixmap); -} - -QWaylandDrmBuffer::~QWaylandDrmBuffer(void) +static void drawTexture(const QRectF &rect, GLuint tex_id, const QSize &texSize, const QRectF &br) { - glDeleteTextures(1, &mTexture); - eglDestroyImageKHR(mDisplay->eglDisplay(), mImage); - wl_egl_pixmap_destroy(mPixmap); - wl_buffer_destroy(mBuffer); -} + const GLenum target = GL_TEXTURE_2D; + QRectF src = br.isEmpty() + ? QRectF(QPointF(), texSize) + : QRectF(QPointF(br.x(), texSize.height() - br.bottom()), br.size()); -void QWaylandDrmBuffer::bindToCurrentFbo() -{ - Q_ASSERT(QPlatformGLContext::currentContext()); - glFramebufferTexture2D(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0, - GL_TEXTURE_2D, mTexture, 0); - QT_CHECK_GLERROR(); -} + if (target == GL_TEXTURE_2D) { + qreal width = texSize.width(); + qreal height = texSize.height(); -QWaylandPaintDevice::QWaylandPaintDevice(QWaylandDisplay *display, QWindowSurface *windowSurface, QPlatformGLContext *context) - : QGLPaintDevice() - , mDisplay(display) - , mPlatformGLContext(context) - , mWindowSurface(windowSurface) - , mBufferList(1) - , mCurrentPaintBuffer(0) - , mDepthStencil(0) -{ - for (int i = 0; i < mBufferList.size(); i++) { - mBufferList[i] = 0; + src.setLeft(src.left() / width); + src.setRight(src.right() / width); + src.setTop(src.top() / height); + src.setBottom(src.bottom() / height); } - mPlatformGLContext->makeCurrent(); - glGenFramebuffers(1, &m_thisFBO); - glBindFramebuffer(GL_FRAMEBUFFER_EXT, m_thisFBO); + const GLfloat tx1 = src.left(); + const GLfloat tx2 = src.right(); + const GLfloat ty1 = src.top(); + const GLfloat ty2 = src.bottom(); - glGenRenderbuffers(1, &mDepthStencil); - glBindRenderbuffer(GL_RENDERBUFFER_EXT, mDepthStencil); - glFramebufferRenderbuffer(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, - GL_RENDERBUFFER_EXT, mDepthStencil); - glFramebufferRenderbuffer(GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT_EXT, - GL_RENDERBUFFER_EXT, mDepthStencil); + GLfloat texCoordArray[4*2] = { + tx1, ty2, tx2, ty2, tx2, ty1, tx1, ty1 + }; - if (windowSurface->size().isValid()) - resize(windowSurface->size()); -} + GLfloat vertexArray[4*2]; + vertexArray[0] = rect.left(); vertexArray[1] = rect.top(); + vertexArray[2] = rect.right(); vertexArray[3] = rect.top(); + vertexArray[4] = rect.right(); vertexArray[5] = rect.bottom(); + vertexArray[6] = rect.left(); vertexArray[7] = rect.bottom(); -QWaylandPaintDevice::~QWaylandPaintDevice() -{ - for(int i = 0; i < mBufferList.size(); i++) { - delete mBufferList[i]; - } - glDeleteRenderbuffers(1,&mDepthStencil); - glDeleteFramebuffers(1,&m_thisFBO); -} + glVertexAttribPointer(QT_VERTEX_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, vertexArray); + glVertexAttribPointer(QT_TEXTURE_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, texCoordArray); -QSize QWaylandPaintDevice::size() const -{ - return mSize; -} -QGLContext *QWaylandPaintDevice::context() const -{ - return QGLContext::fromPlatformGLContext(mPlatformGLContext); -} -QPaintEngine *QWaylandPaintDevice::paintEngine() const -{ - return qt_qgl_paint_engine(); -} + glBindTexture(target, tex_id); -void QWaylandPaintDevice::beginPaint() -{ - QGLPaintDevice::beginPaint(); - currentDrmBuffer()->bindToCurrentFbo(); -} + glEnableVertexAttribArray(QT_VERTEX_COORDS_ATTR); + glEnableVertexAttribArray(QT_TEXTURE_COORDS_ATTR); + glDrawArrays(GL_TRIANGLE_FAN, 0, 4); + glDisableVertexAttribArray(QT_VERTEX_COORDS_ATTR); + glDisableVertexAttribArray(QT_TEXTURE_COORDS_ATTR); -bool QWaylandPaintDevice::isFlipped()const -{ - return true; + glBindTexture(target, 0); } -void QWaylandPaintDevice::resize(const QSize &size) +static void blitTexture(QGLContext *ctx, GLuint texture, const QSize &viewport, const QSize &texSize, const QRect &targetRect, const QRect &sourceRect) { - QImage::Format format = QPlatformScreen::platformScreenForWidget(mWindowSurface->window())->format(); - mPlatformGLContext->makeCurrent(); - mSize = size; - for (int i = 0; i < mBufferList.size(); i++) { - if (!mBufferList.at(i) || mBufferList.at(i)->size() != size) { - delete mBufferList[i]; - mBufferList[i] = new QWaylandDrmBuffer(mDisplay, size, format); - } - } + glDisable(GL_DEPTH_TEST); + glDisable(GL_SCISSOR_TEST); + glDisable(GL_BLEND); + glViewport(0, 0, viewport.width(), viewport.height()); - glBindRenderbuffer(GL_RENDERBUFFER_EXT,mDepthStencil); - glRenderbufferStorage(GL_RENDERBUFFER_EXT, - GL_DEPTH24_STENCIL8_EXT, size.width(), size.height()); + QGLShaderProgram *blitProgram = + QGLEngineSharedShaders::shadersForContext(ctx)->blitProgram(); + blitProgram->bind(); + blitProgram->setUniformValue("imageTexture", 0 /*QT_IMAGE_TEXTURE_UNIT*/); - GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER_EXT); + // The shader manager's blit program does not multiply the + // vertices by the pmv matrix, so we need to do the effect + // of the orthographic projection here ourselves. + QRectF r; + qreal w = viewport.width(); + qreal h = viewport.height(); + r.setLeft((targetRect.left() / w) * 2.0f - 1.0f); + if (targetRect.right() == (viewport.width() - 1)) + r.setRight(1.0f); + else + r.setRight((targetRect.right() / w) * 2.0f - 1.0f); + r.setBottom((targetRect.top() / h) * 2.0f - 1.0f); + if (targetRect.bottom() == (viewport.height() - 1)) + r.setTop(1.0f); + else + r.setTop((targetRect.bottom() / w) * 2.0f - 1.0f); - switch(status) { - case GL_NO_ERROR: - case GL_FRAMEBUFFER_COMPLETE_EXT: - qDebug() << "fbo ok"; - break; - default: - qDebug() <<"QWaylandDrmBuffer error: "<< status; - break; - } - QT_CHECK_GLERROR(); -} - -QWaylandDrmBuffer *QWaylandPaintDevice::currentDrmBuffer() const -{ - return mBufferList[mCurrentPaintBuffer]; -} -QWaylandDrmBuffer *QWaylandPaintDevice::currentDrmBufferAndSwap() -{ - QWaylandDrmBuffer *currentDrmBuffer = mBufferList[mCurrentPaintBuffer]; - mCurrentPaintBuffer = (mCurrentPaintBuffer +1) % mBufferList.size(); - return currentDrmBuffer; + drawTexture(r, texture, texSize, sourceRect); } QWaylandDrmWindowSurface::QWaylandDrmWindowSurface(QWidget *window) : QWindowSurface(window) , mDisplay(QWaylandScreen::waylandScreenFromWidget(window)->display()) - , mPaintDevice(new QWaylandPaintDevice(mDisplay, this,window->platformWindow()->glContext())) + , mPaintDevice(0) { } @@ -224,41 +145,39 @@ QWaylandDrmWindowSurface::~QWaylandDrmWindowSurface() delete mPaintDevice; } -void QWaylandDrmWindowSurface::beginPaint(const QRegion &) +QPaintDevice *QWaylandDrmWindowSurface::paintDevice() { - window()->platformWindow()->glContext()->makeCurrent(); + return mPaintDevice; } -QPaintDevice *QWaylandDrmWindowSurface::paintDevice() +void QWaylandDrmWindowSurface::beginPaint(const QRegion &) { - return mPaintDevice; + window()->platformWindow()->glContext()->makeCurrent(); + glClearColor(0,0,0,0xff); + glClear(GL_COLOR_BUFFER_BIT); } void QWaylandDrmWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) { Q_UNUSED(offset); + Q_UNUSED(region); QWaylandWindow *ww = (QWaylandWindow *) widget->platformWindow(); - glFlush(); - ww->attach(mPaintDevice->currentDrmBufferAndSwap()); + if (mPaintDevice->isBound()) + mPaintDevice->release(); - QVector rects = region.rects(); - for (int i = 0; i < rects.size(); i++) { - QRect r = rects.at(i); - wl_surface_damage(ww->surface(), - r.x(), r.y(), r.width(), r.height()); - } + QRect rect(0,0,size().width(),size().height()); + QGLContext *ctx = QGLContext::fromPlatformGLContext(ww->glContext()); + blitTexture(ctx,mPaintDevice->texture(),size(),mPaintDevice->size(),rect,rect); + ww->glContext()->swapBuffers(); } -void QWaylandDrmWindowSurface::resize(const QSize &requestedSize) +void QWaylandDrmWindowSurface::resize(const QSize &size) { - QWindowSurface::resize(requestedSize); - QWaylandWindow *ww = (QWaylandWindow *) window()->platformWindow(); - - ww->glContext()->makeCurrent(); - - mPaintDevice->resize(requestedSize); - ww->attach(mPaintDevice->currentDrmBuffer()); + QWindowSurface::resize(size); + window()->platformWindow()->glContext()->makeCurrent(); + delete mPaintDevice; + mPaintDevice = new QGLFramebufferObject(size,QGLFramebufferObject::CombinedDepthStencil,GL_TEXTURE_2D,GL_RGBA); } QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylanddrmsurface.h b/src/plugins/platforms/wayland/qwaylanddrmsurface.h index f49263b..78418ee 100644 --- a/src/plugins/platforms/wayland/qwaylanddrmsurface.h +++ b/src/plugins/platforms/wayland/qwaylanddrmsurface.h @@ -43,76 +43,10 @@ #define QWAYLANDDRMSURFACE_H #include "qwaylanddisplay.h" -#include "qwaylandbuffer.h" #include -#include -#include -#define GL_GLEXT_PROTOTYPES -#include -#include - -#define QT_RESET_GLERROR() \ -{ \ - while (glGetError() != GL_NO_ERROR) {} \ -} -#define QT_CHECK_GLERROR() \ -{ \ - GLenum err = glGetError(); \ - if (err != GL_NO_ERROR) { \ - qDebug("[%s line %d] GL Error: 0x%x", \ - __FILE__, __LINE__, (int)err); \ - } \ -} - -class QWaylandDrmBuffer : public QWaylandBuffer { -public: - QWaylandDrmBuffer(QWaylandDisplay *display, - const QSize &size, QImage::Format format); - ~QWaylandDrmBuffer(); - - void bindToCurrentFbo(); - QSize size() const { return mSize; } - -private: - struct wl_egl_pixmap *mPixmap; - EGLImageKHR mImage; - QWaylandDisplay *mDisplay; - QSize mSize; - GLuint mTexture; - -}; - -class QWaylandPaintDevice : public QGLPaintDevice -{ -public: - QWaylandPaintDevice(QWaylandDisplay *display, QWindowSurface *windowSurface, QPlatformGLContext *context); - ~QWaylandPaintDevice(); - - QSize size() const; - QGLContext *context() const; - QPaintEngine *paintEngine() const; - - void beginPaint(); - - bool isFlipped()const; - - void resize(const QSize &size); - - QWaylandDrmBuffer *currentDrmBuffer() const; - QWaylandDrmBuffer *currentDrmBufferAndSwap(); - -private: - QWaylandDisplay *mDisplay; - QPlatformGLContext *mPlatformGLContext; - QWindowSurface *mWindowSurface; - QVarLengthArray mBufferList; - int mCurrentPaintBuffer; - GLuint mDepthStencil; - QSize mSize; - -}; +class QGLFramebufferObject; class QWaylandDrmWindowSurface : public QWindowSurface { @@ -124,12 +58,13 @@ public: QPaintDevice *paintDevice(); void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); + void resize(const QSize &size); private: QWaylandDisplay *mDisplay; - QWaylandPaintDevice *mPaintDevice; + QGLFramebufferObject *mPaintDevice; }; #endif // QWAYLANDDRMSURFACE_H diff --git a/src/plugins/platforms/wayland/qwaylandeglwindow.cpp b/src/plugins/platforms/wayland/qwaylandeglwindow.cpp new file mode 100644 index 0000000..6e5e5bb --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandeglwindow.cpp @@ -0,0 +1,115 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the config.tests of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylandeglwindow.h" + +#include "qwaylandscreen.h" +#include "qwaylandglcontext.h" + +#include + + +QWaylandEglWindow::QWaylandEglWindow(QWidget *window) + : QWaylandWindow(window) + , mGLContext(0) + , mWaylandEglWindow(0) +{ + //super creates a new surface + newSurfaceCreated(); +} + +QWaylandEglWindow::~QWaylandEglWindow() +{ + if (mGLContext) + delete mGLContext; +} + +QWaylandWindow::WindowType QWaylandEglWindow::windowType() const +{ + return QWaylandWindow::Egl; +} + +void QWaylandEglWindow::setGeometry(const QRect &rect) +{ + QWaylandWindow::setGeometry(rect); + if (mWaylandEglWindow) { + wl_egl_window_resize(mWaylandEglWindow,rect.width(),rect.height(),0,0); + } +} + +void QWaylandEglWindow::setParent(const QPlatformWindow *parent) +{ + const QWaylandWindow *wParent = static_cast(parent); + + mParentWindow = wParent; +} + +QPlatformGLContext * QWaylandEglWindow::glContext() const +{ + if (!mGLContext) { + QWaylandEglWindow *that = const_cast(this); + that->mGLContext = new QWaylandGLContext(that->mDisplay,widget()->platformWindowFormat()); + + EGLNativeWindowType window(reinterpret_cast(mWaylandEglWindow)); + EGLSurface surface = eglCreateWindowSurface(mDisplay->eglDisplay(),mGLContext->eglConfig(),window,NULL); + that->mGLContext->setEglSurface(surface); + } + + return mGLContext; +} + +void QWaylandEglWindow::newSurfaceCreated() +{ + if (mWaylandEglWindow) { + wl_egl_window_destroy(mWaylandEglWindow); + } + wl_visual *visual = QWaylandScreen::waylandScreenFromWidget(widget())->visual(); + QSize size = geometry().size(); + if (!size.isValid()) + size = QSize(0,0); + + mWaylandEglWindow = wl_egl_window_create(mSurface,size.width(),size.height(),visual); + if (mGLContext) { + EGLNativeWindowType window(reinterpret_cast(mWaylandEglWindow)); + EGLSurface surface = eglCreateWindowSurface(mDisplay->eglDisplay(),mGLContext->eglConfig(),window,NULL); + mGLContext->setEglSurface(surface); + } +} diff --git a/src/plugins/platforms/wayland/qwaylandeglwindow.h b/src/plugins/platforms/wayland/qwaylandeglwindow.h new file mode 100644 index 0000000..4b3bb5b --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandeglwindow.h @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the config.tests of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDEGLWINDOW_H +#define QWAYLANDEGLWINDOW_H + +#include "qwaylandwindow.h" + +class QWaylandGLContext; + +class QWaylandEglWindow : public QWaylandWindow +{ +public: + QWaylandEglWindow(QWidget *window); + ~QWaylandEglWindow(); + WindowType windowType() const; + void setGeometry(const QRect &rect); + void setParent(const QPlatformWindow *parent); + QPlatformGLContext *glContext() const; +protected: + void newSurfaceCreated(); +private: + QWaylandGLContext *mGLContext; + struct wl_egl_window *mWaylandEglWindow; + EGLConfig mConfig; + + const QWaylandWindow *mParentWindow; +}; + +#endif // QWAYLANDEGLWINDOW_H diff --git a/src/plugins/platforms/wayland/qwaylandglcontext.cpp b/src/plugins/platforms/wayland/qwaylandglcontext.cpp index 23631d9..3720567 100644 --- a/src/plugins/platforms/wayland/qwaylandglcontext.cpp +++ b/src/plugins/platforms/wayland/qwaylandglcontext.cpp @@ -45,25 +45,21 @@ #include "qwaylandwindow.h" #include "qwaylanddrmsurface.h" +#include "../eglconvenience/qeglconvenience.h" + #include #include -#include -#include - Q_GLOBAL_STATIC(QMutex,qt_defaultSharedContextMutex) -EGLint QWaylandGLContext::contextAttibutes[] = { - EGL_CONTEXT_CLIENT_VERSION, 2, - EGL_NONE -}; - QWaylandGLContext::QWaylandGLContext(QWaylandDisplay *wd, const QPlatformWindowFormat &format) : QPlatformGLContext() - , mFormat(format) , mDisplay(wd) + , mSurface(EGL_NO_SURFACE) + , mConfig(q_configFromQPlatformWindowFormat(mDisplay->eglDisplay(),format,true)) + , mFormat(qt_qPlatformWindowFormatFromConfig(mDisplay->eglDisplay(),mConfig)) { - QPlatformGLContext *sharePlatformContext; + QPlatformGLContext *sharePlatformContext = 0; if (format.useDefaultSharedContext()) { if (!QPlatformGLContext::defaultSharedContext()) { if (qt_defaultSharedContextMutex()->tryLock()){ @@ -84,26 +80,22 @@ QWaylandGLContext::QWaylandGLContext(QWaylandDisplay *wd, const QPlatformWindowF shareEGLContext = static_cast(sharePlatformContext)->mContext; eglBindAPI(EGL_OPENGL_ES_API); - mContext = eglCreateContext(mDisplay->eglDisplay(), NULL, - shareEGLContext, contextAttibutes); - - mFormat.setAccum(false); - mFormat.setAlphaBufferSize(8); - mFormat.setRedBufferSize(8); - mFormat.setGreenBufferSize(8); - mFormat.setBlueBufferSize(8); - mFormat.setDepth(false); -// mFormat.setDepthBufferSize(8); - mFormat.setStencil(false); -// mFormat.setStencilBufferSize(24); -// mFormat.setSampleBuffers(false); + QVector eglContextAttrs; + eglContextAttrs.append(EGL_CONTEXT_CLIENT_VERSION); + eglContextAttrs.append(2); + eglContextAttrs.append(EGL_NONE); + + mContext = eglCreateContext(mDisplay->eglDisplay(), mConfig, + shareEGLContext, eglContextAttrs.constData()); } QWaylandGLContext::QWaylandGLContext() : QPlatformGLContext() , mDisplay(0) , mContext(EGL_NO_CONTEXT) + , mSurface(EGL_NO_SURFACE) + , mConfig(0) { } QWaylandGLContext::~QWaylandGLContext() @@ -114,7 +106,10 @@ QWaylandGLContext::~QWaylandGLContext() void QWaylandGLContext::makeCurrent() { QPlatformGLContext::makeCurrent(); - eglMakeCurrent(mDisplay->eglDisplay(), EGL_NO_SURFACE, EGL_NO_SURFACE, mContext); + if (mSurface == EGL_NO_SURFACE) { + qWarning("makeCurrent with EGL_NO_SURFACE"); + } + eglMakeCurrent(mDisplay->eglDisplay(), mSurface, mSurface, mContext); } void QWaylandGLContext::doneCurrent() @@ -125,6 +120,7 @@ void QWaylandGLContext::doneCurrent() void QWaylandGLContext::swapBuffers() { + eglSwapBuffers(mDisplay->eglDisplay(),mSurface); } void *QWaylandGLContext::getProcAddress(const QString &string) @@ -134,10 +130,26 @@ void *QWaylandGLContext::getProcAddress(const QString &string) void QWaylandGLContext::createDefaultSharedContex(QWaylandDisplay *display) { + QVector eglContextAttrs; + eglContextAttrs.append(EGL_CONTEXT_CLIENT_VERSION); + eglContextAttrs.append(2); + eglContextAttrs.append(EGL_NONE); + QWaylandGLContext *defaultSharedContext = new QWaylandGLContext; defaultSharedContext->mDisplay = display; - defaultSharedContext->mContext = eglCreateContext(mDisplay->eglDisplay(), NULL, - EGL_NO_CONTEXT, contextAttibutes); + defaultSharedContext->mContext = eglCreateContext(mDisplay->eglDisplay(),mConfig, + EGL_NO_CONTEXT, eglContextAttrs.constData()); QPlatformGLContext::setDefaultSharedContext(defaultSharedContext); } +void QWaylandGLContext::setEglSurface(EGLSurface surface) +{ + doneCurrent(); + mSurface = surface; +} + +EGLConfig QWaylandGLContext::eglConfig() const +{ + return mConfig; +} + diff --git a/src/plugins/platforms/wayland/qwaylandglcontext.h b/src/plugins/platforms/wayland/qwaylandglcontext.h index d9ba323..dd319fd 100644 --- a/src/plugins/platforms/wayland/qwaylandglcontext.h +++ b/src/plugins/platforms/wayland/qwaylandglcontext.h @@ -42,17 +42,14 @@ #ifndef QWAYLANDGLCONTEXT_H #define QWAYLANDGLCONTEXT_H +#include "qwaylanddisplay.h" + #include -#include -class QWaylandDisplay; class QWaylandWindow; class QWaylandDrmWindowSurface; -#define MESA_EGL_NO_X11_HEADERS -#define EGL_EGLEXT_PROTOTYPES -#include -#include +#include "qwaylandinclude.h" class QWaylandGLContext : public QPlatformGLContext { public: @@ -62,14 +59,18 @@ public: void doneCurrent(); void swapBuffers(); void* getProcAddress(const QString&); + QPlatformWindowFormat platformWindowFormat() const { return mFormat; } + void setEglSurface(EGLSurface surface); + EGLConfig eglConfig() const; private: - QPlatformWindowFormat mFormat; QWaylandDisplay *mDisplay; - static EGLint contextAttibutes[]; EGLContext mContext; + EGLSurface mSurface; + EGLConfig mConfig; + QPlatformWindowFormat mFormat; void createDefaultSharedContex(QWaylandDisplay *display); QWaylandGLContext(); diff --git a/src/plugins/platforms/wayland/qwaylandinclude.h b/src/plugins/platforms/wayland/qwaylandinclude.h new file mode 100644 index 0000000..d1f7e39 --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandinclude.h @@ -0,0 +1,72 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the config.tests of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDINCLUDE_H +#define QWAYLANDINCLUDE_H + +#include + +#include + +#define GL_GLEXT_PROTOTYPES +#include +#include + +//#define MESA_EGL_NO_X11_HEADERS +#define EGL_EGLEXT_PROTOTYPES + #include + #include + +#undef FocusOut +#undef FocusIn +#undef KeyPress +#undef KeyRelease +#undef None +#undef RevertToParent +#undef GrayScale +#undef CursorShape + +#ifdef FontChange +#undef FontChange +#endif + + +#endif // QWAYLANDINCLUDE_H diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 02bc680..9483a47 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -44,7 +44,8 @@ #include "qwaylanddisplay.h" #include "qwaylandshmsurface.h" #include "qwaylanddrmsurface.h" -#include "qwaylandwindow.h" +#include "qwaylandshmwindow.h" +#include "qwaylandeglwindow.h" #include "qfontconfigdatabase.h" @@ -80,16 +81,21 @@ QPixmapData *QWaylandIntegration::createPixmapData(QPixmapData::PixelType type) QPlatformWindow *QWaylandIntegration::createPlatformWindow(QWidget *widget, WId winId) const { Q_UNUSED(winId); - return new QWaylandWindow(widget); + bool useOpenGL = mUseOpenGL || (widget->platformWindowFormat().windowApi() == QPlatformWindowFormat::OpenGL); + if (useOpenGL) + return new QWaylandEglWindow(widget); + + return new QWaylandShmWindow(widget); } QWindowSurface *QWaylandIntegration::createWindowSurface(QWidget *widget, WId winId) const { Q_UNUSED(winId); Q_UNUSED(winId); - - if (mUseOpenGL) + bool useOpenGL = mUseOpenGL || (widget->platformWindowFormat().windowApi() == QPlatformWindowFormat::OpenGL); + if (useOpenGL) return new QWaylandDrmWindowSurface(widget); + return new QWaylandShmWindowSurface(widget); } diff --git a/src/plugins/platforms/wayland/qwaylandscreen.cpp b/src/plugins/platforms/wayland/qwaylandscreen.cpp index aa1083f..35e2532 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen.cpp +++ b/src/plugins/platforms/wayland/qwaylandscreen.cpp @@ -85,3 +85,22 @@ QWaylandScreen * QWaylandScreen::waylandScreenFromWidget(QWidget *widget) QPlatformScreen *platformScreen = QPlatformScreen::platformScreenForWidget(widget); return static_cast(platformScreen); } + +wl_visual * QWaylandScreen::visual() const +{ + struct wl_visual *visual; + + switch (format()) { + case QImage::Format_ARGB32: + visual = mWaylandDisplay->argbVisual(); + break; + case QImage::Format_ARGB32_Premultiplied: + visual = mWaylandDisplay->argbPremultipliedVisual(); + break; + default: + qDebug("unsupported buffer format %d requested\n", format()); + visual = mWaylandDisplay->argbVisual(); + break; + } + return visual; +} diff --git a/src/plugins/platforms/wayland/qwaylandscreen.h b/src/plugins/platforms/wayland/qwaylandscreen.h index 368859f..7784646 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen.h +++ b/src/plugins/platforms/wayland/qwaylandscreen.h @@ -46,6 +46,7 @@ class QWaylandDisplay; class QWaylandCursor; +struct wl_visual; class QWaylandScreen : public QPlatformScreen { @@ -59,6 +60,8 @@ public: int depth() const; QImage::Format format() const; + wl_visual *visual() const; + static QWaylandScreen *waylandScreenFromWidget(QWidget *widget); private: diff --git a/src/plugins/platforms/wayland/qwaylandshmsurface.cpp b/src/plugins/platforms/wayland/qwaylandshmsurface.cpp index 83bb993..9bcae26 100644 --- a/src/plugins/platforms/wayland/qwaylandshmsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmsurface.cpp @@ -44,7 +44,7 @@ #include #include "qwaylanddisplay.h" -#include "qwaylandwindow.h" +#include "qwaylandshmwindow.h" #include "qwaylandscreen.h" #include @@ -111,23 +111,22 @@ void QWaylandShmWindowSurface::flush(QWidget *widget, const QRegion ®ion, con { Q_UNUSED(widget); Q_UNUSED(offset); - QWaylandWindow *ww = (QWaylandWindow *) window()->platformWindow(); - QVector rects = region.rects(); - const QRect *r; - int i; + QWaylandShmWindow *waylandWindow = static_cast(window()->platformWindow()); + Q_ASSERT(waylandWindow->windowType() == QWaylandWindow::Shm); - for (i = 0; i < rects.size(); i++) { - r = &rects.at(i); - wl_surface_damage(ww->surface(), - r->x(), r->y(), r->width(), r->height()); + QVector rects = region.rects(); + for (int i = 0; i < rects.size(); i++) { + waylandWindow->damage(rects.at(i)); } } void QWaylandShmWindowSurface::resize(const QSize &size) { - QWaylandWindow *ww = (QWaylandWindow *) window()->platformWindow(); + QWaylandShmWindow *waylandWindow = static_cast(window()->platformWindow()); + Q_ASSERT(waylandWindow->windowType() == QWaylandWindow::Shm); + QWindowSurface::resize(size); - QImage::Format format = QApplicationPrivate::platformIntegration()->screens().first()->format(); + QImage::Format format = QPlatformScreen::platformScreenForWidget(window())->format(); if (mBuffer != NULL && mBuffer->size() == size) return; @@ -137,7 +136,7 @@ void QWaylandShmWindowSurface::resize(const QSize &size) mBuffer = new QWaylandShmBuffer(mDisplay, size, format); - ww->attach(mBuffer); + waylandWindow->attach(mBuffer); } QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandshmwindow.cpp b/src/plugins/platforms/wayland/qwaylandshmwindow.cpp new file mode 100644 index 0000000..cafd2d0 --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandshmwindow.cpp @@ -0,0 +1,89 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the config.tests of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylandshmwindow.h" + +#include "qwaylandbuffer.h" + +QWaylandShmWindow::QWaylandShmWindow(QWidget *widget) + : QWaylandWindow(widget) + , mBuffer(0) +{ + newSurfaceCreated(); +} + +QWaylandShmWindow::~QWaylandShmWindow() +{ + +} + +QWaylandWindow::WindowType QWaylandShmWindow::windowType() const +{ + return QWaylandWindow::Shm; +} + +QPlatformGLContext * QWaylandShmWindow::glContext() const +{ + qWarning("Trying to retrieve a glContext from a Raster window surface!"); + return 0; +} + +void QWaylandShmWindow::attach(QWaylandBuffer *buffer) +{ + mBuffer = buffer; + if (mSurface) { + wl_surface_attach(mSurface, buffer->buffer(),0,0); + } +} + + +void QWaylandShmWindow::damage(const QRect &rect) +{ + wl_surface_damage(mSurface, + rect.x(), rect.y(), rect.width(), rect.height()); +} + +void QWaylandShmWindow::newSurfaceCreated() +{ + if (mBuffer) { + wl_surface_attach(mSurface,mBuffer->buffer(),0,0); + } +} diff --git a/src/plugins/platforms/wayland/qwaylandshmwindow.h b/src/plugins/platforms/wayland/qwaylandshmwindow.h new file mode 100644 index 0000000..14a29d2 --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandshmwindow.h @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the config.tests of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDSHMWINDOW_H +#define QWAYLANDSHMWINDOW_H + +#include "qwaylandwindow.h" + +class QWaylandShmWindow : public QWaylandWindow +{ +public: + QWaylandShmWindow(QWidget *widget); + ~QWaylandShmWindow(); + + WindowType windowType() const; + QPlatformGLContext *glContext() const; + void attach(QWaylandBuffer *buffer); + void damage(const QRect &rect); +protected: + void newSurfaceCreated(); +private: + QWaylandBuffer *mBuffer; +}; + +#endif // QWAYLANDSHMWINDOW_H diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index a28bdfe..934bbff 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -43,10 +43,6 @@ #include "qwaylanddisplay.h" #include "qwaylandscreen.h" -#include "qwaylandglcontext.h" -#include "qwaylandbuffer.h" - -#include "qwaylanddrmsurface.h" #include #include @@ -56,8 +52,6 @@ QWaylandWindow::QWaylandWindow(QWidget *window) : QPlatformWindow(window) , mDisplay(QWaylandScreen::waylandScreenFromWidget(window)->display()) - , mGLContext(0) - , mBuffer(0) { static WId id = 1; mWindowId = id++; @@ -67,8 +61,6 @@ QWaylandWindow::QWaylandWindow(QWidget *window) QWaylandWindow::~QWaylandWindow() { - if (mGLContext) - delete mGLContext; } WId QWaylandWindow::winId() const @@ -78,13 +70,17 @@ WId QWaylandWindow::winId() const void QWaylandWindow::setParent(const QPlatformWindow *parent) { - QWaylandWindow *wParent = (QWaylandWindow *)parent; - - mParentWindow = wParent; + Q_UNUSED(parent); + qWarning("Trying to add a raster window as a sub-window"); } void QWaylandWindow::setVisible(bool visible) { + if (!mSurface) { + mSurface = mDisplay->createSurface(); + newSurfaceCreated(); + } + if (visible) { wl_surface_set_user_data(mSurface, this); wl_surface_map_toplevel(mSurface); @@ -94,13 +90,6 @@ void QWaylandWindow::setVisible(bool visible) } } -void QWaylandWindow::attach(QWaylandBuffer *buffer) -{ - if (mSurface) { - wl_surface_attach(mSurface, buffer->buffer(),0,0); - } -} - void QWaylandWindow::configure(uint32_t time, uint32_t edges, int32_t x, int32_t y, int32_t width, int32_t height) @@ -111,13 +100,3 @@ void QWaylandWindow::configure(uint32_t time, uint32_t edges, QWindowSystemInterface::handleGeometryChange(widget(), geometry); } - -QPlatformGLContext *QWaylandWindow::glContext() const -{ - if (!mGLContext) { - QWaylandWindow *that = const_cast(this); - that->mGLContext = new QWaylandGLContext(mDisplay, widget()->platformWindowFormat()); - } - - return mGLContext; -} diff --git a/src/plugins/platforms/wayland/qwaylandwindow.h b/src/plugins/platforms/wayland/qwaylandwindow.h index 8b047d7..3b51ee7 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.h +++ b/src/plugins/platforms/wayland/qwaylandwindow.h @@ -45,35 +45,38 @@ #include #include +#include "qwaylanddisplay.h" class QWaylandDisplay; class QWaylandBuffer; +struct wl_egl_window; class QWaylandWindow : public QPlatformWindow { public: + enum WindowType { + Shm, + Egl + }; + QWaylandWindow(QWidget *window); ~QWaylandWindow(); - struct wl_surface *surface() { return mSurface; } + virtual WindowType windowType() const = 0; + WId winId() const; void setVisible(bool visible); + void setParent(const QPlatformWindow *parent); + void configure(uint32_t time, uint32_t edges, int32_t x, int32_t y, int32_t width, int32_t height); - WId winId() const; - void setParent(const QPlatformWindow *parent); - QPlatformGLContext *glContext() const; - void attach(QWaylandBuffer *buffer); - QWaylandBuffer *getBuffer(void) { return mBuffer; } - QWaylandWindow *getParentWindow(void) { return mParentWindow; } -private: +protected: struct wl_surface *mSurface; + virtual void newSurfaceCreated() = 0; QWaylandDisplay *mDisplay; - QPlatformGLContext *mGLContext; WId mWindowId; - QWaylandBuffer *mBuffer; - QWaylandWindow *mParentWindow; + }; diff --git a/src/plugins/platforms/wayland/wayland.pro b/src/plugins/platforms/wayland/wayland.pro index 803a8e9..7e8a1fa 100644 --- a/src/plugins/platforms/wayland/wayland.pro +++ b/src/plugins/platforms/wayland/wayland.pro @@ -9,20 +9,27 @@ SOURCES = main.cpp \ qwaylanddrmsurface.cpp \ qwaylandinputdevice.cpp \ qwaylandglcontext.cpp \ - qwaylandcursor.cpp \ - qwaylanddisplay.cpp \ - qwaylandwindow.cpp \ - qwaylandscreen.cpp + qwaylandcursor.cpp \ + qwaylanddisplay.cpp \ + qwaylandwindow.cpp \ + qwaylandscreen.cpp \ + ../eglconvenience/qeglconvenience.cpp \ + qwaylandeglwindow.cpp \ + qwaylandshmwindow.cpp HEADERS = qwaylandintegration.h \ - qwaylandcursor.h \ - qwaylanddisplay.h \ - qwaylandwindow.h \ - qwaylandscreen.h \ - qwaylandglcontext.h \ - qwaylandshmsurface.h \ - qwaylanddrmsurface.h \ - qwaylandbuffer.h + qwaylandcursor.h \ + qwaylanddisplay.h \ + qwaylandwindow.h \ + qwaylandscreen.h \ + qwaylandglcontext.h \ + qwaylandshmsurface.h \ + qwaylanddrmsurface.h \ + qwaylandbuffer.h \ + ../eglconvenience/qeglconvenience.h \ + qwaylandinclude.h \ + qwaylandeglwindow.h \ + qwaylandshmwindow.h contains(QT_CONFIG, opengl) { QT += opengl -- cgit v0.12 From ea20564a32336c40adb7e3f8e7c5ae13497883c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Wed, 9 Feb 2011 15:40:06 +0100 Subject: Remove warning msg in Lighthouse QGLWidget code --- src/opengl/qgl_qpa.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/opengl/qgl_qpa.cpp b/src/opengl/qgl_qpa.cpp index b865086..d2c0166 100644 --- a/src/opengl/qgl_qpa.cpp +++ b/src/opengl/qgl_qpa.cpp @@ -324,7 +324,6 @@ void QGLWidget::setMouseTracking(bool enable) bool QGLWidget::event(QEvent *e) { - Q_D(QGLWidget); return QWidget::event(e); } -- cgit v0.12 From 909674fce854cd7f761891b918cdf3342e81a0ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Thu, 10 Feb 2011 10:08:56 +0100 Subject: Lighthouse: Wayland: Fix include --- src/plugins/platforms/wayland/qwaylandeglwindow.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandeglwindow.cpp b/src/plugins/platforms/wayland/qwaylandeglwindow.cpp index 6e5e5bb..0bdf44d 100644 --- a/src/plugins/platforms/wayland/qwaylandeglwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandeglwindow.cpp @@ -43,9 +43,7 @@ #include "qwaylandscreen.h" #include "qwaylandglcontext.h" - -#include - +#include "qwaylandinclude.h" QWaylandEglWindow::QWaylandEglWindow(QWidget *window) : QWaylandWindow(window) -- cgit v0.12 From ae873c93125df1c6afe03fe30f70878a8d47414a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Thu, 10 Feb 2011 10:09:18 +0100 Subject: Lighthouse: Wayland compile-fix for egl interface change --- src/plugins/platforms/wayland/qwaylandeglwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandeglwindow.cpp b/src/plugins/platforms/wayland/qwaylandeglwindow.cpp index 0bdf44d..ed54bb9 100644 --- a/src/plugins/platforms/wayland/qwaylandeglwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandeglwindow.cpp @@ -104,7 +104,7 @@ void QWaylandEglWindow::newSurfaceCreated() if (!size.isValid()) size = QSize(0,0); - mWaylandEglWindow = wl_egl_window_create(mSurface,size.width(),size.height(),visual); + mWaylandEglWindow = wl_egl_window_create(mDisplay->nativeDisplay(),mSurface,size.width(),size.height(),visual); if (mGLContext) { EGLNativeWindowType window(reinterpret_cast(mWaylandEglWindow)); EGLSurface surface = eglCreateWindowSurface(mDisplay->eglDisplay(),mGLContext->eglConfig(),window,NULL); -- cgit v0.12 From b6e74de57f6f7504148987394c311c215ec7b375 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Thu, 10 Feb 2011 10:11:55 +0100 Subject: Small improvement to XCB key input handling. If xcb_key_symbols_get_keysym returns XCB_NO_SYMBOL, try the other column. --- src/plugins/platforms/xcb/qxcbkeyboard.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.cpp b/src/plugins/platforms/xcb/qxcbkeyboard.cpp index 67039a7..dcb35fd 100644 --- a/src/plugins/platforms/xcb/qxcbkeyboard.cpp +++ b/src/plugins/platforms/xcb/qxcbkeyboard.cpp @@ -911,6 +911,8 @@ QXcbKeyboard::~QXcbKeyboard() xcb_key_symbols_free(m_key_symbols); } +// #define XCB_KEYBOARD_DEBUG + void QXcbKeyboard::handleKeyEvent(QWidget *widget, QEvent::Type type, xcb_keycode_t code, quint16 state, xcb_timestamp_t time) { int col = state & XCB_MOD_MASK_SHIFT ? 1 : 0; @@ -919,7 +921,17 @@ void QXcbKeyboard::handleKeyEvent(QWidget *widget, QEvent::Type type, xcb_keycod if (state & 128) col += altGrOffset; +#ifdef XCB_KEYBOARD_DEBUG + printf("key code: %d, state: %d, syms: ", code, state); + for (int i = 0; i <= 5; ++i) { + printf("%d ", xcb_key_symbols_get_keysym(m_key_symbols, code, i)); + } + printf("\n"); +#endif + xcb_keysym_t sym = xcb_key_symbols_get_keysym(m_key_symbols, code, col); + if (sym == XCB_NO_SYMBOL) + sym = xcb_key_symbols_get_keysym(m_key_symbols, code, col ^ 0x1); if (state & XCB_MOD_MASK_LOCK && sym <= 0x7f && isprint(sym)) { if (isupper(sym)) -- cgit v0.12 From e279d2ae598c7b05dff843e021fc8a08199c36de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Thu, 10 Feb 2011 10:15:49 +0100 Subject: Fixed 'lingering' dialog bug in XCB backend. We need to flush the XCB command stream after unmapping a window, to ensure it doesn't get delayed. --- src/plugins/platforms/xcb/qxcbwindow.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index b54a233..95110e6 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -130,6 +130,8 @@ void QXcbWindow::setVisible(bool visible) xcb_map_window(xcb_connection(), m_window); else xcb_unmap_window(xcb_connection(), m_window); + + xcb_flush(xcb_connection()); } struct QtMWMHints { -- cgit v0.12 From 51b657a032cb0b9b3c4c7dbfab52c148cf9253af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Thu, 10 Feb 2011 15:28:35 +0100 Subject: Added GL support to XCB backend. We need to use a Xlib / XCB hybrid approach, as GLX depends on Xlib, and there's no replacement for XCB. --- src/plugins/platforms/xcb/README | 2 + src/plugins/platforms/xcb/qglxintegration.cpp | 360 ++++++++++++++++++++++++++ src/plugins/platforms/xcb/qglxintegration.h | 87 +++++++ src/plugins/platforms/xcb/qxcbconnection.cpp | 24 +- src/plugins/platforms/xcb/qxcbconnection.h | 10 + src/plugins/platforms/xcb/qxcbintegration.cpp | 10 + src/plugins/platforms/xcb/qxcbintegration.h | 1 + src/plugins/platforms/xcb/qxcbscreen.cpp | 8 +- src/plugins/platforms/xcb/qxcbscreen.h | 5 +- src/plugins/platforms/xcb/qxcbwindow.cpp | 89 +++++-- src/plugins/platforms/xcb/qxcbwindow.h | 6 +- src/plugins/platforms/xcb/xcb.pro | 10 + 12 files changed, 588 insertions(+), 24 deletions(-) create mode 100644 src/plugins/platforms/xcb/README create mode 100644 src/plugins/platforms/xcb/qglxintegration.cpp create mode 100644 src/plugins/platforms/xcb/qglxintegration.h diff --git a/src/plugins/platforms/xcb/README b/src/plugins/platforms/xcb/README new file mode 100644 index 0000000..d250ad0 --- /dev/null +++ b/src/plugins/platforms/xcb/README @@ -0,0 +1,2 @@ +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 diff --git a/src/plugins/platforms/xcb/qglxintegration.cpp b/src/plugins/platforms/xcb/qglxintegration.cpp new file mode 100644 index 0000000..0cb6b1d --- /dev/null +++ b/src/plugins/platforms/xcb/qglxintegration.cpp @@ -0,0 +1,360 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include + +#include "qxcbwindow.h" +#include "qxcbscreen.h" + +#include +#include +#include + +#include "qglxintegration.h" + +#if defined(Q_OS_LINUX) || defined(Q_OS_BSD4) +#include +#endif + +QMutex QGLXContext::m_defaultSharedContextMutex(QMutex::Recursive); + +QVector QGLXContext::buildSpec(const QPlatformWindowFormat &format) +{ + QVector spec(48); + int i = 0; + + spec[i++] = GLX_LEVEL; + spec[i++] = 0; + spec[i++] = GLX_DRAWABLE_TYPE; spec[i++] = GLX_WINDOW_BIT; + + if (format.rgba()) { + spec[i++] = GLX_RENDER_TYPE; spec[i++] = GLX_RGBA_BIT; + spec[i++] = GLX_RED_SIZE; spec[i++] = (format.redBufferSize() == -1) ? 1 : format.redBufferSize(); + spec[i++] = GLX_GREEN_SIZE; spec[i++] = (format.greenBufferSize() == -1) ? 1 : format.greenBufferSize(); + spec[i++] = GLX_BLUE_SIZE; spec[i++] = (format.blueBufferSize() == -1) ? 1 : format.blueBufferSize(); + if (format.alpha()) { + spec[i++] = GLX_ALPHA_SIZE; spec[i++] = (format.alphaBufferSize() == -1) ? 1 : format.alphaBufferSize(); + } + + spec[i++] = GLX_ACCUM_RED_SIZE; spec[i++] = (format.accumBufferSize() == -1) ? 1 : format.accumBufferSize(); + spec[i++] = GLX_ACCUM_GREEN_SIZE; spec[i++] = (format.accumBufferSize() == -1) ? 1 : format.accumBufferSize(); + spec[i++] = GLX_ACCUM_BLUE_SIZE; spec[i++] = (format.accumBufferSize() == -1) ? 1 : format.accumBufferSize(); + + if (format.alpha()) { + spec[i++] = GLX_ACCUM_ALPHA_SIZE; spec[i++] = (format.accumBufferSize() == -1) ? 1 : format.accumBufferSize(); + } + + } else { + spec[i++] = GLX_RENDER_TYPE; spec[i++] = GLX_COLOR_INDEX_BIT; //I'm really not sure if this works.... + spec[i++] = GLX_BUFFER_SIZE; spec[i++] = 8; + } + + spec[i++] = GLX_DOUBLEBUFFER; spec[i++] = format.doubleBuffer() ? True : False; + spec[i++] = GLX_STEREO; spec[i++] = format.stereo() ? True : False; + + if (format.depth()) { + spec[i++] = GLX_DEPTH_SIZE; spec[i++] = (format.depthBufferSize() == -1) ? 1 : format.depthBufferSize(); + } + + if (format.stencil()) { + spec[i++] = GLX_STENCIL_SIZE; spec[i++] = (format.stencilBufferSize() == -1) ? 1 : format.stencilBufferSize(); + } + if (format.sampleBuffers()) { + spec[i++] = GLX_SAMPLE_BUFFERS_ARB; + spec[i++] = 1; + spec[i++] = GLX_SAMPLES_ARB; + spec[i++] = format.samples() == -1 ? 4 : format.samples(); + } + + spec[i++] = None; + return spec; +} + +GLXFBConfig QGLXContext::findConfig(const QXcbScreen *screen, const QPlatformWindowFormat &format) +{ + bool reduced = true; + GLXFBConfig chosenConfig = 0; + QPlatformWindowFormat reducedFormat = format; + while (!chosenConfig && reduced) { + QVector spec = buildSpec(reducedFormat); + int confcount = 0; + GLXFBConfig *configs; + configs = glXChooseFBConfig(DISPLAY_FROM_XCB(screen), screen->screenNumber(), spec.constData(), &confcount); + if (confcount) + { + for (int i = 0; i < confcount; i++) { + chosenConfig = configs[i]; + // Make sure we try to get an ARGB visual if the format asked for an alpha: + if (reducedFormat.alpha()) { + int alphaSize; + glXGetFBConfigAttrib(DISPLAY_FROM_XCB(screen), configs[i], GLX_ALPHA_SIZE, &alphaSize); + if (alphaSize > 0) + break; + } else { + break; // Just choose the first in the list if there's no alpha requested + } + } + + XFree(configs); + } + reducedFormat = reducePlatformWindowFormat(reducedFormat,&reduced); + } + + if (!chosenConfig) + qWarning("Warning no context created"); + + return chosenConfig; +} + +XVisualInfo *QGLXContext::findVisualInfo(const QXcbScreen *screen, const QPlatformWindowFormat &format) +{ + GLXFBConfig config = QGLXContext::findConfig(screen,format); + XVisualInfo *visualInfo = glXGetVisualFromFBConfig(DISPLAY_FROM_XCB(screen), config); + return visualInfo; +} + +QPlatformWindowFormat QGLXContext::platformWindowFromGLXFBConfig(Display *display, GLXFBConfig config, GLXContext ctx) +{ + QPlatformWindowFormat format; + int redSize = 0; + int greenSize = 0; + int blueSize = 0; + int alphaSize = 0; + int depthSize = 0; + int stencilSize = 0; + int sampleBuffers = 0; + int sampleCount = 0; + int level = 0; + int rgba = 0; + int stereo = 0; + int accumSizeA = 0; + int accumSizeR = 0; + int accumSizeG = 0; + int accumSizeB = 0; + + XVisualInfo *vi = glXGetVisualFromFBConfig(display,config); + glXGetConfig(display,vi,GLX_RGBA,&rgba); + XFree(vi); + glXGetFBConfigAttrib(display, config, GLX_RED_SIZE, &redSize); + glXGetFBConfigAttrib(display, config, GLX_GREEN_SIZE, &greenSize); + glXGetFBConfigAttrib(display, config, GLX_BLUE_SIZE, &blueSize); + glXGetFBConfigAttrib(display, config, GLX_ALPHA_SIZE, &alphaSize); + glXGetFBConfigAttrib(display, config, GLX_DEPTH_SIZE, &depthSize); + glXGetFBConfigAttrib(display, config, GLX_STENCIL_SIZE, &stencilSize); + glXGetFBConfigAttrib(display, config, GLX_SAMPLES, &sampleBuffers); + glXGetFBConfigAttrib(display, config, GLX_LEVEL, &level); + glXGetFBConfigAttrib(display, config, GLX_STEREO, &stereo); + glXGetFBConfigAttrib(display, config, GLX_ACCUM_ALPHA_SIZE, &accumSizeA); + glXGetFBConfigAttrib(display, config, GLX_ACCUM_RED_SIZE, &accumSizeR); + glXGetFBConfigAttrib(display, config, GLX_ACCUM_GREEN_SIZE, &accumSizeG); + glXGetFBConfigAttrib(display, config, GLX_ACCUM_BLUE_SIZE, &accumSizeB); + + format.setRedBufferSize(redSize); + format.setGreenBufferSize(greenSize); + format.setBlueBufferSize(blueSize); + format.setAlphaBufferSize(alphaSize); + format.setDepthBufferSize(depthSize); + format.setStencilBufferSize(stencilSize); + format.setSampleBuffers(sampleBuffers); + if (format.sampleBuffers()) { + glXGetFBConfigAttrib(display, config, GLX_SAMPLES_ARB, &sampleCount); + format.setSamples(sampleCount); + } + + format.setDirectRendering(glXIsDirect(display, ctx)); + format.setRgba(rgba); + format.setStereo(stereo); + format.setAccumBufferSize(accumSizeB); + + return format; +} + +QPlatformWindowFormat QGLXContext::reducePlatformWindowFormat(const QPlatformWindowFormat &format, bool *reduced) +{ + QPlatformWindowFormat retFormat = format; + *reduced = true; + + if (retFormat.sampleBuffers()) { + retFormat.setSampleBuffers(false); + } else if (retFormat.stereo()) { + retFormat.setStereo(false); + } else if (retFormat.accum()) { + retFormat.setAccum(false); + }else if (retFormat.stencil()) { + retFormat.setStencil(false); + }else if (retFormat.alpha()) { + retFormat.setAlpha(false); + }else if (retFormat.depth()) { + retFormat.setDepth(false); + }else if (retFormat.doubleBuffer()) { + retFormat.setDoubleBuffer(false); + }else{ + *reduced = false; + } + return retFormat; +} + +QGLXContext::QGLXContext(Window window, QXcbScreen *screen, const QPlatformWindowFormat &format) + : QPlatformGLContext() + , m_screen(screen) + , m_drawable((Drawable)window) + , m_context(0) +{ + + const QPlatformGLContext *sharePlatformContext; + if (format.useDefaultSharedContext()) { + if (!QPlatformGLContext::defaultSharedContext()) { + if (m_defaultSharedContextMutex.tryLock()){ + createDefaultSharedContex(screen); + m_defaultSharedContextMutex.unlock(); + } else { + m_defaultSharedContextMutex.lock(); //wait to the the shared context is created + m_defaultSharedContextMutex.unlock(); + } + } + sharePlatformContext = QPlatformGLContext::defaultSharedContext(); + } else { + sharePlatformContext = format.sharedGLContext(); + } + GLXContext shareGlxContext = 0; + if (sharePlatformContext) + shareGlxContext = static_cast(sharePlatformContext)->glxContext(); + + GLXFBConfig config = findConfig(screen,format); + m_context = glXCreateNewContext(DISPLAY_FROM_XCB(screen), config, GLX_RGBA_TYPE, shareGlxContext, TRUE); + m_windowFormat = QGLXContext::platformWindowFromGLXFBConfig(DISPLAY_FROM_XCB(screen), config, m_context); +} + +QGLXContext::QGLXContext(QXcbScreen *screen, Drawable drawable, GLXContext context) + : QPlatformGLContext(), m_screen(screen), m_drawable(drawable), m_context(context) +{ + +} + +QGLXContext::~QGLXContext() +{ + if (m_context) + glXDestroyContext(DISPLAY_FROM_XCB(m_screen), m_context); +} + +void QGLXContext::createDefaultSharedContex(QXcbScreen *screen) +{ + int x = 0; + int y = 0; + int w = 3; + int h = 3; + + QPlatformWindowFormat format = QPlatformWindowFormat::defaultFormat(); + GLXContext context; + GLXFBConfig config = findConfig(screen,format); + if (config) { + XVisualInfo *visualInfo = glXGetVisualFromFBConfig(DISPLAY_FROM_XCB(screen), config); + Colormap cmap = XCreateColormap(DISPLAY_FROM_XCB(screen), screen->root(), visualInfo->visual, AllocNone); + XSetWindowAttributes a; + a.colormap = cmap; + Window sharedWindow = XCreateWindow(DISPLAY_FROM_XCB(screen), screen->root(), x, y, w, h, + 0, visualInfo->depth, InputOutput, visualInfo->visual, + CWColormap, &a); + + context = glXCreateNewContext(DISPLAY_FROM_XCB(screen), config, GLX_RGBA_TYPE, 0, TRUE); + QPlatformGLContext *sharedContext = new QGLXContext(screen, sharedWindow, context); + QPlatformGLContext::setDefaultSharedContext(sharedContext); + } else { + qWarning("Warning no shared context created"); + } +} + +void QGLXContext::makeCurrent() +{ + QPlatformGLContext::makeCurrent(); + glXMakeCurrent(DISPLAY_FROM_XCB(m_screen), m_drawable, m_context); +} + +void QGLXContext::doneCurrent() +{ + QPlatformGLContext::doneCurrent(); + glXMakeCurrent(DISPLAY_FROM_XCB(m_screen), 0, 0); +} + +void QGLXContext::swapBuffers() +{ + glXSwapBuffers(DISPLAY_FROM_XCB(m_screen), m_drawable); +} + +void* QGLXContext::getProcAddress(const QString& procName) +{ + typedef void *(*qt_glXGetProcAddressARB)(const GLubyte *); + static qt_glXGetProcAddressARB glXGetProcAddressARB = 0; + static bool resolved = false; + + if (resolved && !glXGetProcAddressARB) + return 0; + if (!glXGetProcAddressARB) { + QList glxExt = QByteArray(glXGetClientString(DISPLAY_FROM_XCB(m_screen), GLX_EXTENSIONS)).split(' '); + if (glxExt.contains("GLX_ARB_get_proc_address")) { +#if defined(Q_OS_LINUX) || defined(Q_OS_BSD4) + void *handle = dlopen(NULL, RTLD_LAZY); + if (handle) { + glXGetProcAddressARB = (qt_glXGetProcAddressARB) dlsym(handle, "glXGetProcAddressARB"); + dlclose(handle); + } + if (!glXGetProcAddressARB) +#endif + { + extern const QString qt_gl_library_name(); +// QLibrary lib(qt_gl_library_name()); + QLibrary lib(QLatin1String("GL")); + glXGetProcAddressARB = (qt_glXGetProcAddressARB) lib.resolve("glXGetProcAddressARB"); + } + } + resolved = true; + } + if (!glXGetProcAddressARB) + return 0; + return glXGetProcAddressARB(reinterpret_cast(procName.toLatin1().data())); +} + +QPlatformWindowFormat QGLXContext::platformWindowFormat() const +{ + return m_windowFormat; +} diff --git a/src/plugins/platforms/xcb/qglxintegration.h b/src/plugins/platforms/xcb/qglxintegration.h new file mode 100644 index 0000000..0006363 --- /dev/null +++ b/src/plugins/platforms/xcb/qglxintegration.h @@ -0,0 +1,87 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QGLXINTEGRATION_H +#define QGLXINTEGRATION_H + +#include "qxcbwindow.h" + +#include +#include + +#include + +#include + +class QGLXContext : public QPlatformGLContext +{ +public: + QGLXContext(Window window, QXcbScreen *xd, const QPlatformWindowFormat &format); + ~QGLXContext(); + + virtual void makeCurrent(); + virtual void doneCurrent(); + virtual void swapBuffers(); + virtual void* getProcAddress(const QString& procName); + + GLXContext glxContext() const { return m_context; } + + QPlatformWindowFormat platformWindowFormat() const; + + static XVisualInfo *findVisualInfo(const QXcbScreen *xd, const QPlatformWindowFormat &format); + +private: + static GLXFBConfig findConfig(const QXcbScreen *xd,const QPlatformWindowFormat &format); + static QVector buildSpec(const QPlatformWindowFormat &format); + static QPlatformWindowFormat platformWindowFromGLXFBConfig(Display *display, GLXFBConfig config, GLXContext context); + static QPlatformWindowFormat reducePlatformWindowFormat(const QPlatformWindowFormat &format, bool *reduced); + + QXcbScreen *m_screen; + Drawable m_drawable; + GLXContext m_context; + QPlatformWindowFormat m_windowFormat; + + QGLXContext (QXcbScreen *screen, Drawable drawable, GLXContext context); + static QMutex m_defaultSharedContextMutex; + static void createDefaultSharedContex(QXcbScreen *xd); +}; + +#endif diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index 2977d76..eafd83a 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -49,19 +49,33 @@ #include +#ifdef XCB_USE_XLIB_FOR_GLX +#include +#include +#endif + QXcbConnection::QXcbConnection(const char *displayName) : m_displayName(displayName ? QByteArray(displayName) : qgetenv("DISPLAY")) { - int primaryScreen; - + int primaryScreen = 0; + +#ifdef XCB_USE_XLIB_FOR_GLX + Display *dpy = XOpenDisplay(m_displayName.constData()); + primaryScreen = DefaultScreen(dpy); + m_connection = XGetXCBConnection(dpy); + XSetEventQueueOwner(dpy, XCBOwnsEventQueue); + m_xlib_display = dpy; +#else m_connection = xcb_connect(m_displayName.constData(), &primaryScreen); +#endif m_setup = xcb_get_setup(xcb_connection()); xcb_screen_iterator_t it = xcb_setup_roots_iterator(m_setup); + int screenNumber = 0; while (it.rem) { - m_screens << new QXcbScreen(this, it.data); + m_screens << new QXcbScreen(this, it.data, screenNumber++); xcb_screen_next(&it); } @@ -77,7 +91,11 @@ QXcbConnection::~QXcbConnection() { qDeleteAll(m_screens); +#ifdef XCB_USE_XLIB_FOR_GLX + XCloseDisplay((Display *)m_xlib_display); +#else xcb_disconnect(xcb_connection()); +#endif delete m_keyboard; } diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index 97f9ba5..8a225c2 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -232,6 +232,10 @@ public: QXcbKeyboard *keyboard() const { return m_keyboard; } +#ifdef XCB_USE_XLIB_FOR_GLX + void *xlib_display() const { return m_xlib_display; } +#endif + private slots: void eventDispatcher(); @@ -249,6 +253,12 @@ private: QByteArray m_displayName; QXcbKeyboard *m_keyboard; + +#ifdef XCB_USE_XLIB_FOR_GLX + void *m_xlib_display; +#endif }; +#define DISPLAY_FROM_XCB(object) ((Display *)(object->connection()->xlib_display())) + #endif diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp index 5da86010..89a6154 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.cpp +++ b/src/plugins/platforms/xcb/qxcbintegration.cpp @@ -114,3 +114,13 @@ QPixmap QXcbIntegration::grabWindow(WId window, int x, int y, int width, int hei Q_UNUSED(height); return QPixmap(); } + + +bool QXcbIntegration::hasOpenGL() const +{ +#ifdef XCB_USE_XLIB_FOR_GLX + return true; +#else + return false; +#endif +} diff --git a/src/plugins/platforms/xcb/qxcbintegration.h b/src/plugins/platforms/xcb/qxcbintegration.h index 8b599b3..80f70fb 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.h +++ b/src/plugins/platforms/xcb/qxcbintegration.h @@ -65,6 +65,7 @@ public: QPixmap grabWindow(WId window, int x, int y, int width, int height) const; QPlatformFontDatabase *fontDatabase() const; + bool hasOpenGL() const; private: QList m_screens; diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp index 4faa617..519db63 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.cpp +++ b/src/plugins/platforms/xcb/qxcbscreen.cpp @@ -43,9 +43,10 @@ #include -QXcbScreen::QXcbScreen(QXcbConnection *connection, xcb_screen_t *screen) +QXcbScreen::QXcbScreen(QXcbConnection *connection, xcb_screen_t *screen, int number) : QXcbObject(connection) , m_screen(screen) + , m_number(number) { printf ("\n"); printf ("Informations of screen %d:\n", screen->root); @@ -91,3 +92,8 @@ QSize QXcbScreen::physicalSize() const { return QSize(m_screen->width_in_millimeters, m_screen->height_in_millimeters); } + +int QXcbScreen::screenNumber() const +{ + return m_number; +} diff --git a/src/plugins/platforms/xcb/qxcbscreen.h b/src/plugins/platforms/xcb/qxcbscreen.h index abebcd9..77ee46f 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.h +++ b/src/plugins/platforms/xcb/qxcbscreen.h @@ -53,7 +53,7 @@ class QXcbConnection; class QXcbScreen : public QXcbObject, public QPlatformScreen { public: - QXcbScreen(QXcbConnection *connection, xcb_screen_t *screen); + QXcbScreen(QXcbConnection *connection, xcb_screen_t *screen, int number); ~QXcbScreen(); QRect geometry() const; @@ -61,11 +61,14 @@ public: QImage::Format format() const; QSize physicalSize() const; + int screenNumber() const; + xcb_screen_t *screen() const { return m_screen; } xcb_window_t root() const { return m_screen->root; } private: xcb_screen_t *m_screen; + int m_number; }; #endif diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 95110e6..e9ff5df 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -44,14 +44,24 @@ #include "qxcbconnection.h" #include "qxcbscreen.h" +#include #include #include #include +#ifdef XCB_USE_XLIB_FOR_GLX +#include +#include +#include "qglxintegration.h" +#endif + QXcbWindow::QXcbWindow(QWidget *tlw) : QPlatformWindow(tlw) +#ifdef XCB_USE_XLIB_FOR_GLX + , m_glx_context(0) +#endif { m_screen = static_cast(QPlatformScreen::platformScreenForWidget(tlw)); @@ -75,20 +85,44 @@ QXcbWindow::QXcbWindow(QWidget *tlw) | XCB_EVENT_MASK_FOCUS_CHANGE }; - m_window = xcb_generate_id(xcb_connection()); - xcb_create_window(xcb_connection(), - XCB_COPY_FROM_PARENT, // depth -- same as root - m_window, // window id - m_screen->root(), // parent window id - tlw->x(), - tlw->y(), - tlw->width(), - tlw->height(), - 0, // border width - XCB_WINDOW_CLASS_INPUT_OUTPUT, // window class - m_screen->screen()->root_visual, // visual - mask, // value mask - values); // value list +#ifdef XCB_USE_XLIB_FOR_GLX + if (tlw->platformWindowFormat().windowApi() == QPlatformWindowFormat::OpenGL + && QApplicationPrivate::platformIntegration()->hasOpenGL() ) { + XVisualInfo *visualInfo = QGLXContext::findVisualInfo(m_screen, tlw->platformWindowFormat()); + if (visualInfo) { + Colormap cmap = XCreateColormap(DISPLAY_FROM_XCB(this), m_screen->root(), visualInfo->visual, AllocNone); + + XSetWindowAttributes a; + a.colormap = cmap; + m_window = XCreateWindow(DISPLAY_FROM_XCB(this), m_screen->root(), tlw->x(), tlw->y(), tlw->width(), tlw->height(), + 0, visualInfo->depth, InputOutput, visualInfo->visual, + CWColormap, &a); + + printf("created GL window: %d\n", m_window); + } else { + qFatal("no window!"); + } + } else +#endif + { + m_window = xcb_generate_id(xcb_connection()); + + xcb_create_window(xcb_connection(), + XCB_COPY_FROM_PARENT, // depth -- same as root + m_window, // window id + m_screen->root(), // parent window id + tlw->x(), + tlw->y(), + tlw->width(), + tlw->height(), + 0, // border width + XCB_WINDOW_CLASS_INPUT_OUTPUT, // window class + m_screen->screen()->root_visual, // visual + mask, // value mask + values); // value list + + printf("created regular window: %d\n", m_window); + } xcb_atom_t properties[4]; int propertyCount = 0; @@ -126,12 +160,12 @@ void QXcbWindow::setGeometry(const QRect &rect) void QXcbWindow::setVisible(bool visible) { - if (visible) + if (visible) { xcb_map_window(xcb_connection(), m_window); - else + } else { xcb_unmap_window(xcb_connection(), m_window); - - xcb_flush(xcb_connection()); + xcb_flush(xcb_connection()); + } } struct QtMWMHints { @@ -317,6 +351,25 @@ void QXcbWindow::requestActivateWindow() xcb_set_input_focus(xcb_connection(), m_window, XCB_INPUT_FOCUS_PARENT, XCB_TIME_CURRENT_TIME); } +QPlatformGLContext *QXcbWindow::glContext() const +{ +#ifdef XCB_USE_XLIB_FOR_GLX + if (!QApplicationPrivate::platformIntegration()->hasOpenGL()) { + printf("no opengl\n"); + return 0; + } + + if (!m_glx_context) { + QXcbWindow *that = const_cast(this); + that->m_glx_context = new QGLXContext(m_window, m_screen, widget()->platformWindowFormat()); + } + + return m_glx_context; +#else + return 0; +#endif +} + void QXcbWindow::handleExposeEvent(const xcb_expose_event_t *event) { QWindowSurface *surface = widget()->windowSurface(); diff --git a/src/plugins/platforms/xcb/qxcbwindow.h b/src/plugins/platforms/xcb/qxcbwindow.h index 17e1742..8db1a1e 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.h +++ b/src/plugins/platforms/xcb/qxcbwindow.h @@ -48,6 +48,7 @@ #include "qxcbobject.h" +class QGLXContext; class QXcbScreen; class QXcbWindow : public QXcbObject, public QPlatformWindow @@ -69,7 +70,7 @@ public: void requestActivateWindow(); - QPlatformGLContext *glContext() const { return 0; } + QPlatformGLContext *glContext() const; xcb_window_t window() const { return m_window; } @@ -91,6 +92,9 @@ private: QXcbScreen *m_screen; xcb_window_t m_window; +#ifdef XCB_USE_XLIB_FOR_GLX + QGLXContext *m_glx_context; +#endif }; #endif diff --git a/src/plugins/platforms/xcb/xcb.pro b/src/plugins/platforms/xcb/xcb.pro index 3aee0a2..58382c0 100644 --- a/src/plugins/platforms/xcb/xcb.pro +++ b/src/plugins/platforms/xcb/xcb.pro @@ -21,6 +21,16 @@ HEADERS = \ qxcbwindow.h \ qxcbwindowsurface.h +contains(QT_CONFIG, opengl):DEFINES += XCB_USE_XLIB_FOR_GLX + +contains(DEFINES, XCB_USE_XLIB_FOR_GLX) { + QT += opengl + + HEADERS += qglxintegration.h + SOURCES += qglxintegration.cpp + LIBS += -lX11 -lX11-xcb +} + LIBS += -lxcb -lxcb-image -lxcb-keysyms include (../fontdatabases/genericunix/genericunix.pri) -- cgit v0.12 From 03b79ca3fda15df214c68ee945ac56000a404d99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Thu, 10 Feb 2011 18:30:51 +0100 Subject: Added warnings for unhandled XCB events. --- src/plugins/platforms/xcb/qxcbconnection.cpp | 46 ++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index eafd83a..3018f56 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -124,6 +124,51 @@ break; } \ break; +void unhandledXcbEventError(xcb_generic_event_t *event) +{ +#define UNHANDLED_XCB_EVENT(event) \ + case event: \ + printf("Unhandled XCB event: %d - %s\n", event, #event); \ + break; + + switch (event->response_type & ~0x80) { + UNHANDLED_XCB_EVENT(XCB_KEY_PRESS); + UNHANDLED_XCB_EVENT(XCB_KEY_RELEASE); + UNHANDLED_XCB_EVENT(XCB_BUTTON_PRESS); + UNHANDLED_XCB_EVENT(XCB_BUTTON_RELEASE); + UNHANDLED_XCB_EVENT(XCB_MOTION_NOTIFY); + UNHANDLED_XCB_EVENT(XCB_ENTER_NOTIFY); + UNHANDLED_XCB_EVENT(XCB_LEAVE_NOTIFY); + UNHANDLED_XCB_EVENT(XCB_FOCUS_IN); + UNHANDLED_XCB_EVENT(XCB_FOCUS_OUT); + UNHANDLED_XCB_EVENT(XCB_KEYMAP_NOTIFY); + UNHANDLED_XCB_EVENT(XCB_EXPOSE); + UNHANDLED_XCB_EVENT(XCB_GRAPHICS_EXPOSURE); + UNHANDLED_XCB_EVENT(XCB_VISIBILITY_NOTIFY); + UNHANDLED_XCB_EVENT(XCB_CREATE_NOTIFY); + UNHANDLED_XCB_EVENT(XCB_DESTROY_NOTIFY); + UNHANDLED_XCB_EVENT(XCB_UNMAP_NOTIFY); + UNHANDLED_XCB_EVENT(XCB_MAP_NOTIFY); + UNHANDLED_XCB_EVENT(XCB_MAP_REQUEST); + UNHANDLED_XCB_EVENT(XCB_REPARENT_NOTIFY); + UNHANDLED_XCB_EVENT(XCB_CONFIGURE_NOTIFY); + UNHANDLED_XCB_EVENT(XCB_CONFIGURE_REQUEST); + UNHANDLED_XCB_EVENT(XCB_GRAVITY_NOTIFY); + UNHANDLED_XCB_EVENT(XCB_RESIZE_REQUEST); + UNHANDLED_XCB_EVENT(XCB_CIRCULATE_NOTIFY); + UNHANDLED_XCB_EVENT(XCB_CIRCULATE_REQUEST); + UNHANDLED_XCB_EVENT(XCB_PROPERTY_NOTIFY); + UNHANDLED_XCB_EVENT(XCB_SELECTION_CLEAR); + UNHANDLED_XCB_EVENT(XCB_SELECTION_REQUEST); + UNHANDLED_XCB_EVENT(XCB_SELECTION_NOTIFY); + UNHANDLED_XCB_EVENT(XCB_COLORMAP_NOTIFY); + UNHANDLED_XCB_EVENT(XCB_CLIENT_MESSAGE); + UNHANDLED_XCB_EVENT(XCB_MAPPING_NOTIFY); + default: + printf("Unhandled XCB event: %d - %s\n", event->response_type, "unknown"); + } +} + void QXcbConnection::eventDispatcher() { while (xcb_generic_event_t *event = xcb_poll_for_event(xcb_connection())) { @@ -156,6 +201,7 @@ void QXcbConnection::eventDispatcher() m_keyboard->handleMappingNotifyEvent((xcb_mapping_notify_event_t *)event); break; default: + unhandledXcbEventError(event); break; } } -- cgit v0.12 From 6257adcdd693ac5c4c258fd81b0e6b2dcfbf8750 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Thu, 10 Feb 2011 18:42:51 +0100 Subject: Added WM_TRANSIENT_FOR property to XCB backend. --- src/plugins/platforms/xcb/qxcbwindow.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index e9ff5df..824a967 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -57,6 +57,19 @@ #include "qglxintegration.h" #endif +// Returns true if we should set WM_TRANSIENT_FOR on \a w +static inline bool isTransient(const QWidget *w) +{ + return ((w->windowType() == Qt::Dialog + || w->windowType() == Qt::Sheet + || w->windowType() == Qt::Tool + || w->windowType() == Qt::SplashScreen + || w->windowType() == Qt::ToolTip + || w->windowType() == Qt::Drawer + || w->windowType() == Qt::Popup) + && !w->testAttribute(Qt::WA_X11BypassTransientForHint)); +} + QXcbWindow::QXcbWindow(QWidget *tlw) : QPlatformWindow(tlw) #ifdef XCB_USE_XLIB_FOR_GLX @@ -141,6 +154,16 @@ QXcbWindow::QXcbWindow(QWidget *tlw) 32, propertyCount, properties); + + if (isTransient(tlw) && tlw->parentWidget()) { + // ICCCM 4.1.2.6 + QWidget *p = tlw->parentWidget()->window(); + xcb_window_t parentWindow = p->winId(); + xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, m_window, + XCB_ATOM_WM_TRANSIENT_FOR, XCB_ATOM_WINDOW, 32, + 1, &parentWindow); + + } } QXcbWindow::~QXcbWindow() -- cgit v0.12 From 80b387b77863230e6edbc03695a971bcd0bcb5d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Thu, 10 Feb 2011 19:22:35 +0100 Subject: Conform to ICCCM when mapping / unmapping windows in XCB backend. --- src/plugins/platforms/xcb/README | 2 +- src/plugins/platforms/xcb/qxcbwindow.cpp | 19 +++++++++++++++++++ src/plugins/platforms/xcb/xcb.pro | 2 +- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/xcb/README b/src/plugins/platforms/xcb/README index d250ad0..e88596b 100644 --- a/src/plugins/platforms/xcb/README +++ b/src/plugins/platforms/xcb/README @@ -1,2 +1,2 @@ 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 +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 diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 824a967..7fb4cc4 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -44,6 +44,8 @@ #include "qxcbconnection.h" #include "qxcbscreen.h" +#include + #include #include @@ -183,10 +185,27 @@ void QXcbWindow::setGeometry(const QRect &rect) void QXcbWindow::setVisible(bool visible) { + xcb_wm_hints_t hints; if (visible) { + if (widget()->isMinimized()) + xcb_wm_hints_set_iconic(&hints); + else + xcb_wm_hints_set_normal(&hints); + xcb_set_wm_hints(xcb_connection(), m_window, &hints); xcb_map_window(xcb_connection(), m_window); } else { xcb_unmap_window(xcb_connection(), m_window); + + // send synthetic UnmapNotify event according to icccm 4.1.4 + xcb_unmap_notify_event_t event; + event.response_type = XCB_UNMAP_NOTIFY; + event.sequence = 0; // does this matter? + event.event = m_screen->root(); + event.window = m_window; + event.from_configure = false; + xcb_send_event(xcb_connection(), false, m_screen->root(), + XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY | XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT, (const char *)&event); + xcb_flush(xcb_connection()); } } diff --git a/src/plugins/platforms/xcb/xcb.pro b/src/plugins/platforms/xcb/xcb.pro index 58382c0..a6e92ef 100644 --- a/src/plugins/platforms/xcb/xcb.pro +++ b/src/plugins/platforms/xcb/xcb.pro @@ -31,7 +31,7 @@ contains(DEFINES, XCB_USE_XLIB_FOR_GLX) { LIBS += -lX11 -lX11-xcb } -LIBS += -lxcb -lxcb-image -lxcb-keysyms +LIBS += -lxcb -lxcb-image -lxcb-keysyms -lxcb-icccm include (../fontdatabases/genericunix/genericunix.pri) -- cgit v0.12 From 27ba43fe5302158cdb54bc0e3fd055b3008ec7ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Fri, 11 Feb 2011 07:55:12 +0100 Subject: Lighthouse: Wayland: Sort out egl includes in plugin We used to include the X part of the eglplatform.h, but now the mesa version of the header file has a WL_EGL_PLATFORM part. This define is defined in wayland-egl.h which thus needs to be included before any egl header file. --- src/plugins/platforms/eglconvenience/qeglconvenience.h | 4 ++++ src/plugins/platforms/wayland/qwaylandinclude.h | 15 --------------- src/plugins/platforms/wayland/wayland.pro | 2 ++ 3 files changed, 6 insertions(+), 15 deletions(-) diff --git a/src/plugins/platforms/eglconvenience/qeglconvenience.h b/src/plugins/platforms/eglconvenience/qeglconvenience.h index a1df3cc..681e9db 100644 --- a/src/plugins/platforms/eglconvenience/qeglconvenience.h +++ b/src/plugins/platforms/eglconvenience/qeglconvenience.h @@ -46,7 +46,11 @@ #include #include +#ifdef Q_PLATFORM_WAYLAND +#include "qwaylandinclude.h" +#else #include +#endif QT_BEGIN_NAMESPACE QVector q_createConfigAttributesFromFormat(const QPlatformWindowFormat &format); diff --git a/src/plugins/platforms/wayland/qwaylandinclude.h b/src/plugins/platforms/wayland/qwaylandinclude.h index d1f7e39..afaa885 100644 --- a/src/plugins/platforms/wayland/qwaylandinclude.h +++ b/src/plugins/platforms/wayland/qwaylandinclude.h @@ -50,23 +50,8 @@ #include #include -//#define MESA_EGL_NO_X11_HEADERS #define EGL_EGLEXT_PROTOTYPES #include #include -#undef FocusOut -#undef FocusIn -#undef KeyPress -#undef KeyRelease -#undef None -#undef RevertToParent -#undef GrayScale -#undef CursorShape - -#ifdef FontChange -#undef FontChange -#endif - - #endif // QWAYLANDINCLUDE_H diff --git a/src/plugins/platforms/wayland/wayland.pro b/src/plugins/platforms/wayland/wayland.pro index 7e8a1fa..e40e423 100644 --- a/src/plugins/platforms/wayland/wayland.pro +++ b/src/plugins/platforms/wayland/wayland.pro @@ -3,6 +3,8 @@ include(../../qpluginbase.pri) QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforms +DEFINES += Q_PLATFORM_WAYLAND + SOURCES = main.cpp \ qwaylandintegration.cpp \ qwaylandshmsurface.cpp \ -- cgit v0.12 From 0ade22781b4f8d291e0b096160f2db5a3caec9dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Fri, 11 Feb 2011 15:12:59 +0100 Subject: Lighthouse:Propogate the configure event to the QWaylandWindow --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 934bbff..a912a83 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -98,5 +98,7 @@ void QWaylandWindow::configure(uint32_t time, uint32_t edges, Q_UNUSED(edges); QRect geometry = QRect(x, y, width, height); + setGeometry(geometry); + QWindowSystemInterface::handleGeometryChange(widget(), geometry); } -- cgit v0.12 From 6027b734714aadf22d34f4e99663b4117cdb4a28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Mon, 14 Feb 2011 10:44:44 +0100 Subject: Properly update the geometry variable of QPlatformWindow when resized. --- src/plugins/platforms/xcb/qxcbwindow.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 7fb4cc4..78cba1c 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -441,7 +441,10 @@ void QXcbWindow::handleConfigureNotifyEvent(const xcb_configure_notify_event_t * ypos = event->y; } - QWindowSystemInterface::handleGeometryChange(widget(), QRect(xpos, ypos, event->width, event->height)); + QRect rect(xpos, ypos, event->width, event->height); + QPlatformWindow::setGeometry(rect); + + QWindowSystemInterface::handleGeometryChange(widget(), rect); } static Qt::MouseButtons translateMouseButtons(int s) -- cgit v0.12 From b46f72e62a5cb781ec94d7cd0317f5cf58c26693 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Mon, 14 Feb 2011 10:54:35 +0100 Subject: More debugging of XCB events. --- src/plugins/platforms/xcb/qxcbconnection.cpp | 84 +++++++++++++++------------- 1 file changed, 46 insertions(+), 38 deletions(-) diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index 3018f56..0696ed3 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -124,49 +124,56 @@ break; } \ break; -void unhandledXcbEventError(xcb_generic_event_t *event) +#define XCB_EVENT_DEBUG + +void printXcbEvent(const char *message, xcb_generic_event_t *event) { -#define UNHANDLED_XCB_EVENT(event) \ +#ifdef XCB_EVENT_DEBUG +#define PRINT_XCB_EVENT(event) \ case event: \ - printf("Unhandled XCB event: %d - %s\n", event, #event); \ + printf("%s: %d - %s\n", message, event, #event); \ break; switch (event->response_type & ~0x80) { - UNHANDLED_XCB_EVENT(XCB_KEY_PRESS); - UNHANDLED_XCB_EVENT(XCB_KEY_RELEASE); - UNHANDLED_XCB_EVENT(XCB_BUTTON_PRESS); - UNHANDLED_XCB_EVENT(XCB_BUTTON_RELEASE); - UNHANDLED_XCB_EVENT(XCB_MOTION_NOTIFY); - UNHANDLED_XCB_EVENT(XCB_ENTER_NOTIFY); - UNHANDLED_XCB_EVENT(XCB_LEAVE_NOTIFY); - UNHANDLED_XCB_EVENT(XCB_FOCUS_IN); - UNHANDLED_XCB_EVENT(XCB_FOCUS_OUT); - UNHANDLED_XCB_EVENT(XCB_KEYMAP_NOTIFY); - UNHANDLED_XCB_EVENT(XCB_EXPOSE); - UNHANDLED_XCB_EVENT(XCB_GRAPHICS_EXPOSURE); - UNHANDLED_XCB_EVENT(XCB_VISIBILITY_NOTIFY); - UNHANDLED_XCB_EVENT(XCB_CREATE_NOTIFY); - UNHANDLED_XCB_EVENT(XCB_DESTROY_NOTIFY); - UNHANDLED_XCB_EVENT(XCB_UNMAP_NOTIFY); - UNHANDLED_XCB_EVENT(XCB_MAP_NOTIFY); - UNHANDLED_XCB_EVENT(XCB_MAP_REQUEST); - UNHANDLED_XCB_EVENT(XCB_REPARENT_NOTIFY); - UNHANDLED_XCB_EVENT(XCB_CONFIGURE_NOTIFY); - UNHANDLED_XCB_EVENT(XCB_CONFIGURE_REQUEST); - UNHANDLED_XCB_EVENT(XCB_GRAVITY_NOTIFY); - UNHANDLED_XCB_EVENT(XCB_RESIZE_REQUEST); - UNHANDLED_XCB_EVENT(XCB_CIRCULATE_NOTIFY); - UNHANDLED_XCB_EVENT(XCB_CIRCULATE_REQUEST); - UNHANDLED_XCB_EVENT(XCB_PROPERTY_NOTIFY); - UNHANDLED_XCB_EVENT(XCB_SELECTION_CLEAR); - UNHANDLED_XCB_EVENT(XCB_SELECTION_REQUEST); - UNHANDLED_XCB_EVENT(XCB_SELECTION_NOTIFY); - UNHANDLED_XCB_EVENT(XCB_COLORMAP_NOTIFY); - UNHANDLED_XCB_EVENT(XCB_CLIENT_MESSAGE); - UNHANDLED_XCB_EVENT(XCB_MAPPING_NOTIFY); + PRINT_XCB_EVENT(XCB_KEY_PRESS); + PRINT_XCB_EVENT(XCB_KEY_RELEASE); + PRINT_XCB_EVENT(XCB_BUTTON_PRESS); + PRINT_XCB_EVENT(XCB_BUTTON_RELEASE); + PRINT_XCB_EVENT(XCB_MOTION_NOTIFY); + PRINT_XCB_EVENT(XCB_ENTER_NOTIFY); + PRINT_XCB_EVENT(XCB_LEAVE_NOTIFY); + PRINT_XCB_EVENT(XCB_FOCUS_IN); + PRINT_XCB_EVENT(XCB_FOCUS_OUT); + PRINT_XCB_EVENT(XCB_KEYMAP_NOTIFY); + PRINT_XCB_EVENT(XCB_EXPOSE); + PRINT_XCB_EVENT(XCB_GRAPHICS_EXPOSURE); + PRINT_XCB_EVENT(XCB_VISIBILITY_NOTIFY); + PRINT_XCB_EVENT(XCB_CREATE_NOTIFY); + PRINT_XCB_EVENT(XCB_DESTROY_NOTIFY); + PRINT_XCB_EVENT(XCB_UNMAP_NOTIFY); + PRINT_XCB_EVENT(XCB_MAP_NOTIFY); + PRINT_XCB_EVENT(XCB_MAP_REQUEST); + PRINT_XCB_EVENT(XCB_REPARENT_NOTIFY); + PRINT_XCB_EVENT(XCB_CONFIGURE_NOTIFY); + PRINT_XCB_EVENT(XCB_CONFIGURE_REQUEST); + PRINT_XCB_EVENT(XCB_GRAVITY_NOTIFY); + PRINT_XCB_EVENT(XCB_RESIZE_REQUEST); + PRINT_XCB_EVENT(XCB_CIRCULATE_NOTIFY); + PRINT_XCB_EVENT(XCB_CIRCULATE_REQUEST); + PRINT_XCB_EVENT(XCB_PROPERTY_NOTIFY); + PRINT_XCB_EVENT(XCB_SELECTION_CLEAR); + PRINT_XCB_EVENT(XCB_SELECTION_REQUEST); + PRINT_XCB_EVENT(XCB_SELECTION_NOTIFY); + PRINT_XCB_EVENT(XCB_COLORMAP_NOTIFY); + PRINT_XCB_EVENT(XCB_CLIENT_MESSAGE); + PRINT_XCB_EVENT(XCB_MAPPING_NOTIFY); default: - printf("Unhandled XCB event: %d - %s\n", event->response_type, "unknown"); + printf("%s: %d - %s\n", message, event->response_type, "unknown"); } +#else + Q_UNUSED(message); + Q_UNUSED(event); +#endif } void QXcbConnection::eventDispatcher() @@ -201,9 +208,10 @@ void QXcbConnection::eventDispatcher() m_keyboard->handleMappingNotifyEvent((xcb_mapping_notify_event_t *)event); break; default: - unhandledXcbEventError(event); - break; + printXcbEvent("Unhandled XCB event", event); + return; } + printXcbEvent("Handled XCB event", event); } } -- cgit v0.12 From 5582311143115dc16281d8ee258bde92e00d55b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Mon, 14 Feb 2011 13:12:16 +0100 Subject: Lighthouse: Testlite: Added modallity for dialogs Also fixed some identing in qtestlitewindow --- src/plugins/platforms/testlite/qtestlitewindow.cpp | 154 ++++++++++++++++----- src/plugins/platforms/testlite/qtestlitewindow.h | 3 +- 2 files changed, 124 insertions(+), 33 deletions(-) diff --git a/src/plugins/platforms/testlite/qtestlitewindow.cpp b/src/plugins/platforms/testlite/qtestlitewindow.cpp index d9c69e3..b7c5e99 100644 --- a/src/plugins/platforms/testlite/qtestlitewindow.cpp +++ b/src/plugins/platforms/testlite/qtestlitewindow.cpp @@ -78,46 +78,46 @@ QTestLiteWindow::QTestLiteWindow(QWidget *window) int w = window->width(); int h = window->height(); - if(window->platformWindowFormat().windowApi() == QPlatformWindowFormat::OpenGL - && QApplicationPrivate::platformIntegration()->hasOpenGL() ) { - #if !defined(QT_NO_OPENGL) + if(window->platformWindowFormat().windowApi() == QPlatformWindowFormat::OpenGL + && QApplicationPrivate::platformIntegration()->hasOpenGL() ) { +#if !defined(QT_NO_OPENGL) #if !defined(QT_OPENGL_ES_2) - XVisualInfo *visualInfo = QGLXContext::findVisualInfo(mScreen,window->platformWindowFormat()); + XVisualInfo *visualInfo = QGLXContext::findVisualInfo(mScreen,window->platformWindowFormat()); #else - QPlatformWindowFormat windowFormat = correctColorBuffers(window->platformWindowFormat()); + QPlatformWindowFormat windowFormat = correctColorBuffers(window->platformWindowFormat()); - EGLDisplay eglDisplay = eglGetDisplay(mScreen->display()); - EGLConfig eglConfig = q_configFromQPlatformWindowFormat(eglDisplay,windowFormat); - VisualID id = QTestLiteEglIntegration::getCompatibleVisualId(mScreen->display(),eglConfig); + EGLDisplay eglDisplay = eglGetDisplay(mScreen->display()); + EGLConfig eglConfig = q_configFromQPlatformWindowFormat(eglDisplay,windowFormat); + VisualID id = QTestLiteEglIntegration::getCompatibleVisualId(mScreen->display(),eglConfig); - XVisualInfo visualInfoTemplate; - memset(&visualInfoTemplate, 0, sizeof(XVisualInfo)); - visualInfoTemplate.visualid = id; + XVisualInfo visualInfoTemplate; + memset(&visualInfoTemplate, 0, sizeof(XVisualInfo)); + visualInfoTemplate.visualid = id; - XVisualInfo *visualInfo; - int matchingCount = 0; - visualInfo = XGetVisualInfo(mScreen->display(), VisualIDMask, &visualInfoTemplate, &matchingCount); + XVisualInfo *visualInfo; + int matchingCount = 0; + visualInfo = XGetVisualInfo(mScreen->display(), VisualIDMask, &visualInfoTemplate, &matchingCount); #endif //!defined(QT_OPENGL_ES_2) - if (visualInfo) { - Colormap cmap = XCreateColormap(mScreen->display(),mScreen->rootWindow(),visualInfo->visual,AllocNone); - - XSetWindowAttributes a; - a.colormap = cmap; - x_window = XCreateWindow(mScreen->display(), mScreen->rootWindow(),x, y, w, h, - 0, visualInfo->depth, InputOutput, visualInfo->visual, - CWColormap, &a); - } else { - qFatal("no window!"); - } -#endif //!defined(QT_NO_OPENGL) + if (visualInfo) { + Colormap cmap = XCreateColormap(mScreen->display(),mScreen->rootWindow(),visualInfo->visual,AllocNone); + + XSetWindowAttributes a; + a.colormap = cmap; + x_window = XCreateWindow(mScreen->display(), mScreen->rootWindow(),x, y, w, h, + 0, visualInfo->depth, InputOutput, visualInfo->visual, + CWColormap, &a); } else { - x_window = XCreateSimpleWindow(mScreen->display(), mScreen->rootWindow(), - x, y, w, h, 0 /*border_width*/, - mScreen->blackPixel(), mScreen->whitePixel()); + qFatal("no window!"); } +#endif //!defined(QT_NO_OPENGL) + } else { + x_window = XCreateSimpleWindow(mScreen->display(), mScreen->rootWindow(), + x, y, w, h, 0 /*border_width*/, + mScreen->blackPixel(), mScreen->whitePixel()); + } #ifdef MYX11_DEBUG - qDebug() << "QTestLiteWindow::QTestLiteWindow creating" << hex << x_window << window; + qDebug() << "QTestLiteWindow::QTestLiteWindow creating" << hex << x_window << window; #endif XSetWindowBackgroundPixmap(mScreen->display(), x_window, XNone); @@ -252,7 +252,7 @@ void QTestLiteWindow::setGeometry(const QRect &rect) Qt::WindowFlags QTestLiteWindow::windowFlags() const { - return window_flags; + return mWindowFlags; } WId QTestLiteWindow::winId() const @@ -411,10 +411,46 @@ static inline bool isTransient(const QWidget *w) && !w->testAttribute(Qt::WA_X11BypassTransientForHint)); } +QVector QTestLiteWindow::getNetWmState() const +{ + QVector returnValue; + + // Don't read anything, just get the size of the property data + Atom actualType; + int actualFormat; + ulong propertyLength; + ulong bytesLeft; + uchar *propertyData = 0; + if (XGetWindowProperty(mScreen->display(), x_window, QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE), 0, 0, + False, XA_ATOM, &actualType, &actualFormat, + &propertyLength, &bytesLeft, &propertyData) == Success + && actualType == XA_ATOM && actualFormat == 32) { + returnValue.resize(bytesLeft / 4); + XFree((char*) propertyData); + + // fetch all data + if (XGetWindowProperty(mScreen->display(), x_window, QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE), 0, + returnValue.size(), False, XA_ATOM, &actualType, &actualFormat, + &propertyLength, &bytesLeft, &propertyData) != Success) { + returnValue.clear(); + } else if (propertyLength != (ulong)returnValue.size()) { + returnValue.resize(propertyLength); + } + + // put it into netWmState + if (!returnValue.isEmpty()) { + memcpy(returnValue.data(), propertyData, returnValue.size() * sizeof(Atom)); + } + XFree((char*) propertyData); + } + + return returnValue; +} + Qt::WindowFlags QTestLiteWindow::setWindowFlags(Qt::WindowFlags flags) { // Q_ASSERT(flags & Qt::Window); - window_flags = flags; + mWindowFlags = flags; #ifdef MYX11_DEBUG qDebug() << "QTestLiteWindow::setWindowFlags" << hex << x_window << "flags" << flags; @@ -518,8 +554,50 @@ Qt::WindowFlags QTestLiteWindow::setWindowFlags(Qt::WindowFlags flags) mwmhints.decorations = 0; } + if (widget()->windowModality() == Qt::WindowModal) { + mwmhints.input_mode = MWM_INPUT_PRIMARY_APPLICATION_MODAL; + } else if (widget()->windowModality() == Qt::ApplicationModal) { + mwmhints.input_mode = MWM_INPUT_FULL_APPLICATION_MODAL; + } + setMWMHints(mwmhints); + QVector netWmState = getNetWmState(); + + if (flags & Qt::WindowStaysOnTopHint) { + if (flags & Qt::WindowStaysOnBottomHint) + qWarning() << "QWidget: Incompatible window flags: the window can't be on top and on bottom at the same time"; + if (!netWmState.contains(QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE_ABOVE))) + netWmState.append(QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE_ABOVE)); + if (!netWmState.contains(QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE_STAYS_ON_TOP))) + netWmState.append(QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE_STAYS_ON_TOP)); + } else if (flags & Qt::WindowStaysOnBottomHint) { + if (!netWmState.contains(QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE_BELOW))) + netWmState.append(QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE_BELOW)); + } + if (widget()->isFullScreen()) { + if (!netWmState.contains(QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE_FULLSCREEN))) + netWmState.append(QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE_FULLSCREEN)); + } + if (widget()->isMaximized()) { + if (!netWmState.contains(QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE_MAXIMIZED_HORZ))) + netWmState.append(QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE_MAXIMIZED_HORZ)); + if (!netWmState.contains(QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE_MAXIMIZED_VERT))) + netWmState.append(QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE_MAXIMIZED_VERT)); + } + if (widget()->windowModality() != Qt::NonModal) { + if (!netWmState.contains(QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE_MODAL))) + netWmState.append(QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE_MODAL)); + } + + if (!netWmState.isEmpty()) { + XChangeProperty(mScreen->display(), x_window, + QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE), XA_ATOM, 32, PropModeReplace, + (unsigned char *) netWmState.data(), netWmState.size()); + } else { + XDeleteProperty(mScreen->display(), x_window, QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE)); + } + //##### only if initializeWindow??? if (popup || tooltip) { // popup widget @@ -547,6 +625,18 @@ void QTestLiteWindow::setVisible(bool visible) #ifdef MYX11_DEBUG qDebug() << "QTestLiteWindow::setVisible" << visible << hex << x_window; #endif + if (isTransient(widget())) { + Window parentXWindow = x_window; + if (widget()->parentWidget()) { + QWidget *widgetParent = widget()->parentWidget()->window(); + if (widgetParent && widgetParent->platformWindow()) { + QTestLiteWindow *parentWidnow = static_cast(widgetParent->platformWindow()); + parentXWindow = parentWidnow->x_window; + } + } + XSetTransientForHint(mScreen->display(),x_window,parentXWindow); + } + if (visible) { //ensure that the window is viewed in correct position. doSizeHints(); diff --git a/src/plugins/platforms/testlite/qtestlitewindow.h b/src/plugins/platforms/testlite/qtestlitewindow.h index e45c3fd..2ca7e10 100644 --- a/src/plugins/platforms/testlite/qtestlitewindow.h +++ b/src/plugins/platforms/testlite/qtestlitewindow.h @@ -123,6 +123,7 @@ public: GC graphicsContext() const; protected: + QVector getNetWmState() const; void setMWMHints(const QtMWMHints &mwmhints); QtMWMHints getMWMHints() const; @@ -138,7 +139,7 @@ private: QPlatformGLContext *mGLContext; QTestLiteScreen *mScreen; - Qt::WindowFlags window_flags; + Qt::WindowFlags mWindowFlags; }; #endif -- cgit v0.12 From 7be3f2585676cb18821b51427527275fb441fa46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Mon, 14 Feb 2011 13:36:13 +0100 Subject: Lighthouse: renaming testlite to xlib --- src/plugins/platforms/testlite/main.cpp | 20 ++-- src/plugins/platforms/testlite/qglxintegration.cpp | 10 +- src/plugins/platforms/testlite/qglxintegration.h | 12 +- .../platforms/testlite/qtestliteclipboard.cpp | 100 ++++++++-------- .../platforms/testlite/qtestliteclipboard.h | 10 +- src/plugins/platforms/testlite/qtestlitecursor.cpp | 16 +-- src/plugins/platforms/testlite/qtestlitecursor.h | 6 +- .../platforms/testlite/qtestliteeglintegration.cpp | 2 +- .../platforms/testlite/qtestliteeglintegration.h | 2 +- .../platforms/testlite/qtestliteintegration.cpp | 34 +++--- .../platforms/testlite/qtestliteintegration.h | 8 +- .../platforms/testlite/qtestlitekeyboard.cpp | 14 +-- src/plugins/platforms/testlite/qtestlitekeyboard.h | 6 +- src/plugins/platforms/testlite/qtestlitemime.cpp | 66 +++++------ src/plugins/platforms/testlite/qtestlitemime.h | 6 +- src/plugins/platforms/testlite/qtestlitescreen.cpp | 40 +++---- src/plugins/platforms/testlite/qtestlitescreen.h | 18 +-- .../platforms/testlite/qtestlitestaticinfo.cpp | 36 +++--- .../platforms/testlite/qtestlitestaticinfo.h | 2 +- src/plugins/platforms/testlite/qtestlitewindow.cpp | 126 ++++++++++----------- src/plugins/platforms/testlite/qtestlitewindow.h | 14 +-- .../platforms/testlite/qtestlitewindowsurface.cpp | 36 +++--- .../platforms/testlite/qtestlitewindowsurface.h | 20 ++-- 23 files changed, 301 insertions(+), 303 deletions(-) diff --git a/src/plugins/platforms/testlite/main.cpp b/src/plugins/platforms/testlite/main.cpp index 2f6aa8b..131d399 100644 --- a/src/plugins/platforms/testlite/main.cpp +++ b/src/plugins/platforms/testlite/main.cpp @@ -44,36 +44,36 @@ QT_BEGIN_NAMESPACE -class QTestLiteIntegrationPlugin : public QPlatformIntegrationPlugin +class QXlibIntegrationPlugin : public QPlatformIntegrationPlugin { public: QStringList keys() const; QPlatformIntegration *create(const QString&, const QStringList&); }; -QStringList QTestLiteIntegrationPlugin::keys() const +QStringList QXlibIntegrationPlugin::keys() const { QStringList list; - list << "TestLite"; + list << "Xlib"; #ifndef QT_NO_OPENGL - list << "TestLiteGL"; + list << "XlibGL"; #endif return list; } -QPlatformIntegration* QTestLiteIntegrationPlugin::create(const QString& system, const QStringList& paramList) +QPlatformIntegration* QXlibIntegrationPlugin::create(const QString& system, const QStringList& paramList) { Q_UNUSED(paramList); - if (system.toLower() == "testlite") - return new QTestLiteIntegration; + if (system.toLower() == "xlib") + return new QXlibIntegration; #ifndef QT_NO_OPENGL - if (system.toLower() == "testlitegl") - return new QTestLiteIntegration(true); + if (system.toLower() == "xlibgl") + return new QXlibIntegration(true); #endif return 0; } -Q_EXPORT_PLUGIN2(testlite, QTestLiteIntegrationPlugin) +Q_EXPORT_PLUGIN2(xlib, QXlibIntegrationPlugin) QT_END_NAMESPACE diff --git a/src/plugins/platforms/testlite/qglxintegration.cpp b/src/plugins/platforms/testlite/qglxintegration.cpp index 8023014..46dfef9 100644 --- a/src/plugins/platforms/testlite/qglxintegration.cpp +++ b/src/plugins/platforms/testlite/qglxintegration.cpp @@ -113,7 +113,7 @@ QVector QGLXContext::buildSpec(const QPlatformWindowFormat &format) return spec; } -GLXFBConfig QGLXContext::findConfig(const QTestLiteScreen *screen, const QPlatformWindowFormat &format) +GLXFBConfig QGLXContext::findConfig(const QXlibScreen *screen, const QPlatformWindowFormat &format) { bool reduced = true; GLXFBConfig chosenConfig = 0; @@ -149,7 +149,7 @@ GLXFBConfig QGLXContext::findConfig(const QTestLiteScreen *screen, const QPlatfo return chosenConfig; } -XVisualInfo *QGLXContext::findVisualInfo(const QTestLiteScreen *screen, const QPlatformWindowFormat &format) +XVisualInfo *QGLXContext::findVisualInfo(const QXlibScreen *screen, const QPlatformWindowFormat &format) { GLXFBConfig config = QGLXContext::findConfig(screen,format); XVisualInfo *visualInfo = glXGetVisualFromFBConfig(screen->display(),config); @@ -237,7 +237,7 @@ QPlatformWindowFormat QGLXContext::reducePlatformWindowFormat(const QPlatformWin return retFormat; } -QGLXContext::QGLXContext(Window window, QTestLiteScreen *screen, const QPlatformWindowFormat &format) +QGLXContext::QGLXContext(Window window, QXlibScreen *screen, const QPlatformWindowFormat &format) : QPlatformGLContext() , m_screen(screen) , m_drawable((Drawable)window) @@ -272,7 +272,7 @@ QGLXContext::QGLXContext(Window window, QTestLiteScreen *screen, const QPlatform #endif } -QGLXContext::QGLXContext(QTestLiteScreen *screen, Drawable drawable, GLXContext context) +QGLXContext::QGLXContext(QXlibScreen *screen, Drawable drawable, GLXContext context) : QPlatformGLContext(), m_screen(screen), m_drawable(drawable), m_context(context) { @@ -286,7 +286,7 @@ QGLXContext::~QGLXContext() } } -void QGLXContext::createDefaultSharedContex(QTestLiteScreen *screen) +void QGLXContext::createDefaultSharedContex(QXlibScreen *screen) { int x = 0; int y = 0; diff --git a/src/plugins/platforms/testlite/qglxintegration.h b/src/plugins/platforms/testlite/qglxintegration.h index abece45..f982708 100644 --- a/src/plugins/platforms/testlite/qglxintegration.h +++ b/src/plugins/platforms/testlite/qglxintegration.h @@ -57,7 +57,7 @@ QT_BEGIN_NAMESPACE class QGLXContext : public QPlatformGLContext { public: - QGLXContext(Window window, QTestLiteScreen *xd, const QPlatformWindowFormat &format); + QGLXContext(Window window, QXlibScreen *xd, const QPlatformWindowFormat &format); ~QGLXContext(); virtual void makeCurrent(); @@ -69,22 +69,22 @@ public: QPlatformWindowFormat platformWindowFormat() const; - static XVisualInfo *findVisualInfo(const QTestLiteScreen *xd, const QPlatformWindowFormat &format); + static XVisualInfo *findVisualInfo(const QXlibScreen *xd, const QPlatformWindowFormat &format); private: - static GLXFBConfig findConfig(const QTestLiteScreen *xd,const QPlatformWindowFormat &format); + static GLXFBConfig findConfig(const QXlibScreen *xd,const QPlatformWindowFormat &format); static QVector buildSpec(const QPlatformWindowFormat &format); static QPlatformWindowFormat platformWindowFromGLXFBConfig(Display *display, GLXFBConfig config, GLXContext context); static QPlatformWindowFormat reducePlatformWindowFormat(const QPlatformWindowFormat &format, bool *reduced); - QTestLiteScreen *m_screen; + QXlibScreen *m_screen; Drawable m_drawable; GLXContext m_context; QPlatformWindowFormat m_windowFormat; - QGLXContext (QTestLiteScreen *screen, Drawable drawable, GLXContext context); + QGLXContext (QXlibScreen *screen, Drawable drawable, GLXContext context); static QMutex m_defaultSharedContextMutex; - static void createDefaultSharedContex(QTestLiteScreen *xd); + static void createDefaultSharedContex(QXlibScreen *xd); }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/testlite/qtestliteclipboard.cpp b/src/plugins/platforms/testlite/qtestliteclipboard.cpp index 9bab7f9..1264b5a 100644 --- a/src/plugins/platforms/testlite/qtestliteclipboard.cpp +++ b/src/plugins/platforms/testlite/qtestliteclipboard.cpp @@ -48,12 +48,12 @@ #include -class QTestLiteClipboardMime : public QTestLiteMime +class QXlibClipboardMime : public QXlibMime { Q_OBJECT public: - QTestLiteClipboardMime(QClipboard::Mode mode, QTestLiteClipboard *clipboard) - : QTestLiteMime() + QXlibClipboardMime(QClipboard::Mode mode, QXlibClipboard *clipboard) + : QXlibMime() , m_clipboard(clipboard) { switch (mode) { @@ -62,7 +62,7 @@ public: break; case QClipboard::Clipboard: - modeAtom = QTestLiteStatic::atom(QTestLiteStatic::CLIPBOARD); + modeAtom = QXlibStatic::atom(QXlibStatic::CLIPBOARD); break; default: @@ -78,11 +78,11 @@ protected: return QStringList(); if (!formatList.count()) { - QTestLiteClipboardMime *that = const_cast(this); + QXlibClipboardMime *that = const_cast(this); // get the list of targets from the current clipboard owner - we do this // once so that multiple calls to this function don't require multiple // server round trips... - that->format_atoms = m_clipboard->getDataInFormat(modeAtom,QTestLiteStatic::atom(QTestLiteStatic::TARGETS)); + that->format_atoms = m_clipboard->getDataInFormat(modeAtom,QXlibStatic::atom(QXlibStatic::TARGETS)); if (format_atoms.size() > 0) { Atom *targets = (Atom *) format_atoms.data(); @@ -141,14 +141,14 @@ private: Atom modeAtom; - QTestLiteClipboard *m_clipboard; + QXlibClipboard *m_clipboard; QStringList formatList; QByteArray format_atoms; }; -const int QTestLiteClipboard::clipboard_timeout = 5000; +const int QXlibClipboard::clipboard_timeout = 5000; -QTestLiteClipboard::QTestLiteClipboard(QTestLiteScreen *screen) +QXlibClipboard::QXlibClipboard(QXlibScreen *screen) : QPlatformClipboard() , m_screen(screen) , m_xClipboard(0) @@ -160,14 +160,14 @@ QTestLiteClipboard::QTestLiteClipboard(QTestLiteScreen *screen) { } -const QMimeData * QTestLiteClipboard::mimeData(QClipboard::Mode mode) const +const QMimeData * QXlibClipboard::mimeData(QClipboard::Mode mode) const { if (mode == QClipboard::Clipboard) { if (!m_xClipboard) { - QTestLiteClipboard *that = const_cast(this); - that->m_xClipboard = new QTestLiteClipboardMime(mode,that); + QXlibClipboard *that = const_cast(this); + that->m_xClipboard = new QXlibClipboardMime(mode,that); } - Window clipboardOwner = XGetSelectionOwner(screen()->display(),QTestLiteStatic::atom(QTestLiteStatic::CLIPBOARD)); + Window clipboardOwner = XGetSelectionOwner(screen()->display(),QXlibStatic::atom(QXlibStatic::CLIPBOARD)); if (clipboardOwner == owner()) { return m_clientClipboard; } else { @@ -175,8 +175,8 @@ const QMimeData * QTestLiteClipboard::mimeData(QClipboard::Mode mode) const } } else if (mode == QClipboard::Selection) { if (!m_xSelection) { - QTestLiteClipboard *that = const_cast(this); - that->m_xSelection = new QTestLiteClipboardMime(mode,that); + QXlibClipboard *that = const_cast(this); + that->m_xSelection = new QXlibClipboardMime(mode,that); } Window clipboardOwner = XGetSelectionOwner(screen()->display(),XA_PRIMARY); if (clipboardOwner == owner()) { @@ -188,7 +188,7 @@ const QMimeData * QTestLiteClipboard::mimeData(QClipboard::Mode mode) const return 0; } -void QTestLiteClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode) +void QXlibClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode) { Atom modeAtom; QMimeData **d; @@ -199,7 +199,7 @@ void QTestLiteClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode) break; case QClipboard::Clipboard: - modeAtom = QTestLiteStatic::atom(QTestLiteStatic::CLIPBOARD); + modeAtom = QXlibStatic::atom(QXlibStatic::CLIPBOARD); d = &m_clientClipboard; break; @@ -226,7 +226,7 @@ void QTestLiteClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode) } -bool QTestLiteClipboard::supportsMode(QClipboard::Mode mode) const +bool QXlibClipboard::supportsMode(QClipboard::Mode mode) const { if (mode == QClipboard::Clipboard || mode == QClipboard::Selection) return true; @@ -234,16 +234,16 @@ bool QTestLiteClipboard::supportsMode(QClipboard::Mode mode) const } -QTestLiteScreen * QTestLiteClipboard::screen() const +QXlibScreen * QXlibClipboard::screen() const { return m_screen; } -Window QTestLiteClipboard::requestor() const +Window QXlibClipboard::requestor() const { if (!m_requestor) { int x = 0, y = 0, w = 3, h = 3; - QTestLiteClipboard *that = const_cast(this); + QXlibClipboard *that = const_cast(this); Window window = XCreateSimpleWindow(m_screen->display(), m_screen->rootWindow(), x, y, w, h, 0 /*border_width*/, m_screen->blackPixel(), m_screen->whitePixel()); @@ -252,7 +252,7 @@ Window QTestLiteClipboard::requestor() const return m_requestor; } -void QTestLiteClipboard::setRequestor(Window window) +void QXlibClipboard::setRequestor(Window window) { if (m_requestor != XNone) { XDestroyWindow(m_screen->display(),m_requestor); @@ -260,11 +260,11 @@ void QTestLiteClipboard::setRequestor(Window window) m_requestor = window; } -Window QTestLiteClipboard::owner() const +Window QXlibClipboard::owner() const { if (!m_owner) { int x = 0, y = 0, w = 3, h = 3; - QTestLiteClipboard *that = const_cast(this); + QXlibClipboard *that = const_cast(this); Window window = XCreateSimpleWindow(m_screen->display(), m_screen->rootWindow(), x, y, w, h, 0 /*border_width*/, m_screen->blackPixel(), m_screen->whitePixel()); @@ -273,7 +273,7 @@ Window QTestLiteClipboard::owner() const return m_owner; } -void QTestLiteClipboard::setOwner(Window window) +void QXlibClipboard::setOwner(Window window) { if (m_owner != XNone){ XDestroyWindow(m_screen->display(),m_owner); @@ -281,45 +281,45 @@ void QTestLiteClipboard::setOwner(Window window) m_owner = window; } -Atom QTestLiteClipboard::sendTargetsSelection(QMimeData *d, Window window, Atom property) +Atom QXlibClipboard::sendTargetsSelection(QMimeData *d, Window window, Atom property) { QVector types; QStringList formats = QInternalMimeData::formatsHelper(d); for (int i = 0; i < formats.size(); ++i) { - QList atoms = QTestLiteMime::mimeAtomsForFormat(screen()->display(),formats.at(i)); + QList atoms = QXlibMime::mimeAtomsForFormat(screen()->display(),formats.at(i)); for (int j = 0; j < atoms.size(); ++j) { if (!types.contains(atoms.at(j))) types.append(atoms.at(j)); } } - types.append(QTestLiteStatic::atom(QTestLiteStatic::TARGETS)); - types.append(QTestLiteStatic::atom(QTestLiteStatic::MULTIPLE)); - types.append(QTestLiteStatic::atom(QTestLiteStatic::TIMESTAMP)); - types.append(QTestLiteStatic::atom(QTestLiteStatic::SAVE_TARGETS)); + types.append(QXlibStatic::atom(QXlibStatic::TARGETS)); + types.append(QXlibStatic::atom(QXlibStatic::MULTIPLE)); + types.append(QXlibStatic::atom(QXlibStatic::TIMESTAMP)); + types.append(QXlibStatic::atom(QXlibStatic::SAVE_TARGETS)); XChangeProperty(screen()->display(), window, property, XA_ATOM, 32, PropModeReplace, (uchar *) types.data(), types.size()); return property; } -Atom QTestLiteClipboard::sendSelection(QMimeData *d, Atom target, Window window, Atom property) +Atom QXlibClipboard::sendSelection(QMimeData *d, Atom target, Window window, Atom property) { Atom atomFormat = target; int dataFormat = 0; QByteArray data; - QString fmt = QTestLiteMime::mimeAtomToString(screen()->display(), target); + QString fmt = QXlibMime::mimeAtomToString(screen()->display(), target); if (fmt.isEmpty()) { // Not a MIME type we have qDebug() << "QClipboard: send_selection(): converting to type '%s' is not supported" << fmt.data(); return XNone; } qDebug() << "QClipboard: send_selection(): converting to type '%s'" << fmt.data(); - if (QTestLiteMime::mimeDataForAtom(screen()->display(),target, d, &data, &atomFormat, &dataFormat)) { + if (QXlibMime::mimeDataForAtom(screen()->display(),target, d, &data, &atomFormat, &dataFormat)) { // don't allow INCR transfers when using MULTIPLE or to // Motif clients (since Motif doesn't support INCR) - static Atom motif_clip_temporary = QTestLiteStatic::atom(QTestLiteStatic::CLIP_TEMPORARY); + static Atom motif_clip_temporary = QXlibStatic::atom(QXlibStatic::CLIP_TEMPORARY); bool allow_incr = property != motif_clip_temporary; // X_ChangeProperty protocol request is 24 bytes @@ -327,7 +327,7 @@ Atom QTestLiteClipboard::sendSelection(QMimeData *d, Atom target, Window window, if (data.size() > increment && allow_incr) { long bytes = data.size(); XChangeProperty(screen()->display(), window, property, - QTestLiteStatic::atom(QTestLiteStatic::INCR), 32, PropModeReplace, (uchar *) &bytes, 1); + QXlibStatic::atom(QXlibStatic::INCR), 32, PropModeReplace, (uchar *) &bytes, 1); // (void)new QClipboardINCRTransaction(window, property, atomFormat, dataFormat, data, increment); qDebug() << "not implemented INCRT just YET!"; @@ -346,7 +346,7 @@ Atom QTestLiteClipboard::sendSelection(QMimeData *d, Atom target, Window window, return property; } -void QTestLiteClipboard::handleSelectionRequest(XEvent *xevent) +void QXlibClipboard::handleSelectionRequest(XEvent *xevent) { XSelectionRequestEvent *req = &xevent->xselectionrequest; @@ -367,7 +367,7 @@ void QTestLiteClipboard::handleSelectionRequest(XEvent *xevent) QMimeData *d; if (req->selection == XA_PRIMARY) { d = m_clientSelection; - } else if (req->selection == QTestLiteStatic::atom(QTestLiteStatic::CLIPBOARD)) { + } else if (req->selection == QXlibStatic::atom(QXlibStatic::CLIPBOARD)) { d = m_clientClipboard; } else { qWarning("QClipboard: Unknown selection '%lx'", req->selection); @@ -381,9 +381,9 @@ void QTestLiteClipboard::handleSelectionRequest(XEvent *xevent) return; } - Atom xa_targets = QTestLiteStatic::atom(QTestLiteStatic::TARGETS); - Atom xa_multiple = QTestLiteStatic::atom(QTestLiteStatic::MULTIPLE); - Atom xa_timestamp = QTestLiteStatic::atom(QTestLiteStatic::TIMESTAMP); + Atom xa_targets = QXlibStatic::atom(QXlibStatic::TARGETS); + Atom xa_multiple = QXlibStatic::atom(QXlibStatic::MULTIPLE); + Atom xa_timestamp = QXlibStatic::atom(QXlibStatic::TIMESTAMP); struct AtomPair { Atom target; Atom property; } *multi = 0; Atom multi_type = XNone; @@ -469,7 +469,7 @@ void QTestLiteClipboard::handleSelectionRequest(XEvent *xevent) static inline int maxSelectionIncr(Display *dpy) { return XMaxRequestSize(dpy) > 65536 ? 65536*4 : XMaxRequestSize(dpy)*4 - 100; } -bool QTestLiteClipboard::clipboardReadProperty(Window win, Atom property, bool deleteProperty, QByteArray *buffer, int *size, Atom *type, int *format) const +bool QXlibClipboard::clipboardReadProperty(Window win, Atom property, bool deleteProperty, QByteArray *buffer, int *size, Atom *type, int *format) const { int maxsize = maxSelectionIncr(screen()->display()); ulong bytes_left; // bytes_after @@ -549,7 +549,7 @@ bool QTestLiteClipboard::clipboardReadProperty(Window win, Atom property, bool d XFree((char*)data); } - if (*format == 8 && *type == QTestLiteStatic::atom(QTestLiteStatic::COMPOUND_TEXT)) { + if (*format == 8 && *type == QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT)) { // convert COMPOUND_TEXT to a multibyte string XTextProperty textprop; textprop.encoding = *type; @@ -581,7 +581,7 @@ bool QTestLiteClipboard::clipboardReadProperty(Window win, Atom property, bool d return ok; } -QByteArray QTestLiteClipboard::clipboardReadIncrementalProperty(Window win, Atom property, int nbytes, bool nullterm) +QByteArray QXlibClipboard::clipboardReadIncrementalProperty(Window win, Atom property, int nbytes, bool nullterm) { XEvent event; @@ -639,7 +639,7 @@ QByteArray QTestLiteClipboard::clipboardReadIncrementalProperty(Window win, Atom return QByteArray(); } -QByteArray QTestLiteClipboard::getDataInFormat(Atom modeAtom, Atom fmtatom) +QByteArray QXlibClipboard::getDataInFormat(Atom modeAtom, Atom fmtatom) { QByteArray buf; @@ -647,8 +647,8 @@ QByteArray QTestLiteClipboard::getDataInFormat(Atom modeAtom, Atom fmtatom) XSelectInput(screen()->display(), win, NoEventMask); // don't listen for any events - XDeleteProperty(screen()->display(), win, QTestLiteStatic::atom(QTestLiteStatic::_QT_SELECTION)); - XConvertSelection(screen()->display(), modeAtom, fmtatom, QTestLiteStatic::atom(QTestLiteStatic::_QT_SELECTION), win, CurrentTime); + XDeleteProperty(screen()->display(), win, QXlibStatic::atom(QXlibStatic::_QT_SELECTION)); + XConvertSelection(screen()->display(), modeAtom, fmtatom, QXlibStatic::atom(QXlibStatic::_QT_SELECTION), win, CurrentTime); XSync(screen()->display(), false); XEvent xevent; @@ -660,10 +660,10 @@ QByteArray QTestLiteClipboard::getDataInFormat(Atom modeAtom, Atom fmtatom) Atom type; XSelectInput(screen()->display(), win, PropertyChangeMask); - if (clipboardReadProperty(win, QTestLiteStatic::atom(QTestLiteStatic::_QT_SELECTION), true, &buf, 0, &type, 0)) { - if (type == QTestLiteStatic::atom(QTestLiteStatic::INCR)) { + if (clipboardReadProperty(win, QXlibStatic::atom(QXlibStatic::_QT_SELECTION), true, &buf, 0, &type, 0)) { + if (type == QXlibStatic::atom(QXlibStatic::INCR)) { int nbytes = buf.size() >= 4 ? *((int*)buf.data()) : 0; - buf = clipboardReadIncrementalProperty(win, QTestLiteStatic::atom(QTestLiteStatic::_QT_SELECTION), nbytes, false); + buf = clipboardReadIncrementalProperty(win, QXlibStatic::atom(QXlibStatic::_QT_SELECTION), nbytes, false); } } diff --git a/src/plugins/platforms/testlite/qtestliteclipboard.h b/src/plugins/platforms/testlite/qtestliteclipboard.h index 76065a2..109714c 100644 --- a/src/plugins/platforms/testlite/qtestliteclipboard.h +++ b/src/plugins/platforms/testlite/qtestliteclipboard.h @@ -45,18 +45,18 @@ #include #include "qtestlitestaticinfo.h" -class QTestLiteScreen; -class QTestLiteClipboard : public QPlatformClipboard +class QXlibScreen; +class QXlibClipboard : public QPlatformClipboard { public: - QTestLiteClipboard(QTestLiteScreen *screen); + QXlibClipboard(QXlibScreen *screen); const QMimeData *mimeData(QClipboard::Mode mode) const; void setMimeData(QMimeData *data, QClipboard::Mode mode); bool supportsMode(QClipboard::Mode mode) const; - QTestLiteScreen *screen() const; + QXlibScreen *screen() const; Window requestor() const; void setRequestor(Window window); @@ -76,7 +76,7 @@ private: Atom sendTargetsSelection(QMimeData *d, Window window, Atom property); Atom sendSelection(QMimeData *d, Atom target, Window window, Atom property); - QTestLiteScreen *m_screen; + QXlibScreen *m_screen; QMimeData *m_xClipboard; QMimeData *m_clientClipboard; diff --git a/src/plugins/platforms/testlite/qtestlitecursor.cpp b/src/plugins/platforms/testlite/qtestlitecursor.cpp index e7ef673..2f7cfbf 100644 --- a/src/plugins/platforms/testlite/qtestlitecursor.cpp +++ b/src/plugins/platforms/testlite/qtestlitecursor.cpp @@ -51,17 +51,17 @@ QT_BEGIN_NAMESPACE -QTestLiteCursor::QTestLiteCursor(QTestLiteScreen *screen) +QXlibCursor::QXlibCursor(QXlibScreen *screen) : QPlatformCursor(screen) { } -void QTestLiteCursor::changeCursor(QCursor *cursor, QWidget *widget) +void QXlibCursor::changeCursor(QCursor *cursor, QWidget *widget) { - QTestLiteWindow *w = 0; + QXlibWindow *w = 0; if (widget) { QWidget *window = widget->window(); - w = static_cast(window->platformWindow()); + w = static_cast(window->platformWindow()); } else { // No X11 cursor control when there is no widget under the cursor return; @@ -89,7 +89,7 @@ void QTestLiteCursor::changeCursor(QCursor *cursor, QWidget *widget) w->setCursor(c); } -Cursor QTestLiteCursor::createCursorBitmap(QCursor * cursor) +Cursor QXlibCursor::createCursorBitmap(QCursor * cursor) { XColor bg, fg; bg.red = 255 << 8; @@ -132,7 +132,7 @@ Cursor QTestLiteCursor::createCursorBitmap(QCursor * cursor) return c; } -Cursor QTestLiteCursor::createCursorShape(int cshape) +Cursor QXlibCursor::createCursorShape(int cshape) { Cursor cursor = 0; @@ -191,9 +191,9 @@ Cursor QTestLiteCursor::createCursorShape(int cshape) return cursor; } -QTestLiteScreen * QTestLiteCursor::testLiteScreen() const +QXlibScreen * QXlibCursor::testLiteScreen() const { - return static_cast(screen); + return static_cast(screen); } QT_END_NAMESPACE diff --git a/src/plugins/platforms/testlite/qtestlitecursor.h b/src/plugins/platforms/testlite/qtestlitecursor.h index bb3549e..db9f9e2 100644 --- a/src/plugins/platforms/testlite/qtestlitecursor.h +++ b/src/plugins/platforms/testlite/qtestlitecursor.h @@ -48,10 +48,10 @@ QT_BEGIN_NAMESPACE -class QTestLiteCursor : QPlatformCursor +class QXlibCursor : QPlatformCursor { public: - QTestLiteCursor(QTestLiteScreen *screen); + QXlibCursor(QXlibScreen *screen); void changeCursor(QCursor * cursor, QWidget * widget); private: @@ -59,7 +59,7 @@ private: Cursor createCursorBitmap(QCursor * cursor); Cursor createCursorShape(int cshape); - QTestLiteScreen *testLiteScreen() const; + QXlibScreen *testLiteScreen() const; QMap cursorMap; }; diff --git a/src/plugins/platforms/testlite/qtestliteeglintegration.cpp b/src/plugins/platforms/testlite/qtestliteeglintegration.cpp index 532c63d..9bbe0ca 100644 --- a/src/plugins/platforms/testlite/qtestliteeglintegration.cpp +++ b/src/plugins/platforms/testlite/qtestliteeglintegration.cpp @@ -52,7 +52,7 @@ static int countBits(unsigned long mask) return count; } -VisualID QTestLiteEglIntegration::getCompatibleVisualId(Display *display, EGLConfig config) +VisualID QXlibEglIntegration::getCompatibleVisualId(Display *display, EGLConfig config) { VisualID visualId = 0; EGLint eglValue = 0; diff --git a/src/plugins/platforms/testlite/qtestliteeglintegration.h b/src/plugins/platforms/testlite/qtestliteeglintegration.h index 99e9018..4c2e50d 100644 --- a/src/plugins/platforms/testlite/qtestliteeglintegration.h +++ b/src/plugins/platforms/testlite/qtestliteeglintegration.h @@ -45,7 +45,7 @@ #include "qtestlitestaticinfo.h" #include "../eglconvenience/qeglconvenience.h" -class QTestLiteEglIntegration +class QXlibEglIntegration { public: static VisualID getCompatibleVisualId(Display *display, EGLConfig config); diff --git a/src/plugins/platforms/testlite/qtestliteintegration.cpp b/src/plugins/platforms/testlite/qtestliteintegration.cpp index dc8a6d7..cdc5c29 100644 --- a/src/plugins/platforms/testlite/qtestliteintegration.cpp +++ b/src/plugins/platforms/testlite/qtestliteintegration.cpp @@ -61,16 +61,16 @@ QT_BEGIN_NAMESPACE -QTestLiteIntegration::QTestLiteIntegration(bool useOpenGL) +QXlibIntegration::QXlibIntegration(bool useOpenGL) : mUseOpenGL(useOpenGL) , mFontDb(new QGenericUnixFontDatabase()) , mClipboard(0) { - mPrimaryScreen = new QTestLiteScreen(); + mPrimaryScreen = new QXlibScreen(); mScreens.append(mPrimaryScreen); } -QPixmapData *QTestLiteIntegration::createPixmapData(QPixmapData::PixelType type) const +QPixmapData *QXlibIntegration::createPixmapData(QPixmapData::PixelType type) const { #ifndef QT_NO_OPENGL if (mUseOpenGL) @@ -79,33 +79,33 @@ QPixmapData *QTestLiteIntegration::createPixmapData(QPixmapData::PixelType type) return new QRasterPixmapData(type); } -QWindowSurface *QTestLiteIntegration::createWindowSurface(QWidget *widget, WId) const +QWindowSurface *QXlibIntegration::createWindowSurface(QWidget *widget, WId) const { #ifndef QT_NO_OPENGL if (mUseOpenGL) return new QGLWindowSurface(widget); #endif - return new QTestLiteWindowSurface(widget); + return new QXlibWindowSurface(widget); } -QPlatformWindow *QTestLiteIntegration::createPlatformWindow(QWidget *widget, WId /*winId*/) const +QPlatformWindow *QXlibIntegration::createPlatformWindow(QWidget *widget, WId /*winId*/) const { - return new QTestLiteWindow(widget); + return new QXlibWindow(widget); } -QPixmap QTestLiteIntegration::grabWindow(WId window, int x, int y, int width, int height) const +QPixmap QXlibIntegration::grabWindow(WId window, int x, int y, int width, int height) const { QImage image; QWidget *widget = QWidget::find(window); if (widget) { - QTestLiteScreen *screen = QTestLiteScreen::testLiteScreenForWidget(widget); + QXlibScreen *screen = QXlibScreen::testLiteScreenForWidget(widget); image = screen->grabWindow(window,x,y,width,height); } else { for (int i = 0; i < mScreens.size(); i++) { - QTestLiteScreen *screen = static_cast(mScreens[i]); + QXlibScreen *screen = static_cast(mScreens[i]); if (screen->rootWindow() == window) { image = screen->grabWindow(window,x,y,width,height); } @@ -114,33 +114,33 @@ QPixmap QTestLiteIntegration::grabWindow(WId window, int x, int y, int width, in return QPixmap::fromImage(image); } -QPlatformFontDatabase *QTestLiteIntegration::fontDatabase() const +QPlatformFontDatabase *QXlibIntegration::fontDatabase() const { return mFontDb; } -QPlatformClipboard * QTestLiteIntegration::clipboard() const +QPlatformClipboard * QXlibIntegration::clipboard() const { //Use lazy init since clipboard needs QTestliteScreen if (!mClipboard) { - QTestLiteIntegration *that = const_cast(this); - that->mClipboard = new QTestLiteClipboard(mPrimaryScreen); + QXlibIntegration *that = const_cast(this); + that->mClipboard = new QXlibClipboard(mPrimaryScreen); } return mClipboard; } -bool QTestLiteIntegration::hasOpenGL() const +bool QXlibIntegration::hasOpenGL() const { #if !defined(QT_NO_OPENGL) #if !defined(QT_OPENGL_ES_2) - QTestLiteScreen *screen = static_cast(mScreens.at(0)); + QXlibScreen *screen = static_cast(mScreens.at(0)); return glXQueryExtension(screen->display(), 0, 0) != 0; #else static bool eglHasbeenInitialized = false; static bool wasEglInitialized = false; if (!eglHasbeenInitialized) { eglHasbeenInitialized = true; - const QTestLiteScreen *screen = static_cast(mScreens.at(0)); + const QXlibScreen *screen = static_cast(mScreens.at(0)); EGLint major, minor; eglBindAPI(EGL_OPENGL_ES_API); EGLDisplay disp = eglGetDisplay(screen->display()); diff --git a/src/plugins/platforms/testlite/qtestliteintegration.h b/src/plugins/platforms/testlite/qtestliteintegration.h index 320cf00..c3125b8 100644 --- a/src/plugins/platforms/testlite/qtestliteintegration.h +++ b/src/plugins/platforms/testlite/qtestliteintegration.h @@ -52,12 +52,12 @@ QT_BEGIN_NAMESPACE -class QTestLiteScreen; +class QXlibScreen; -class QTestLiteIntegration : public QPlatformIntegration +class QXlibIntegration : public QPlatformIntegration { public: - QTestLiteIntegration(bool useOpenGL = false); + QXlibIntegration(bool useOpenGL = false); QPixmapData *createPixmapData(QPixmapData::PixelType type) const; QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId) const; @@ -74,7 +74,7 @@ public: private: bool mUseOpenGL; - QTestLiteScreen *mPrimaryScreen; + QXlibScreen *mPrimaryScreen; QList mScreens; QPlatformFontDatabase *mFontDb; QPlatformClipboard *mClipboard; diff --git a/src/plugins/platforms/testlite/qtestlitekeyboard.cpp b/src/plugins/platforms/testlite/qtestlitekeyboard.cpp index 5b4ebd7..fb0cf2e 100644 --- a/src/plugins/platforms/testlite/qtestlitekeyboard.cpp +++ b/src/plugins/platforms/testlite/qtestlitekeyboard.cpp @@ -740,7 +740,7 @@ static QChar keysymToUnicode(unsigned char byte3, unsigned char byte4) return QChar(0x0); } -Qt::KeyboardModifiers QTestLiteKeyboard::translateModifiers(int s) +Qt::KeyboardModifiers QXlibKeyboard::translateModifiers(int s) { Qt::KeyboardModifiers ret = 0; if (s & ShiftMask) @@ -756,7 +756,7 @@ Qt::KeyboardModifiers QTestLiteKeyboard::translateModifiers(int s) return ret; } -void QTestLiteKeyboard::setMask(KeySym sym, uint mask) +void QXlibKeyboard::setMask(KeySym sym, uint mask) { if (m_alt_mask == 0 && m_meta_mask != mask @@ -800,7 +800,7 @@ void QTestLiteKeyboard::setMask(KeySym sym, uint mask) } } -int QTestLiteKeyboard::translateKeySym(uint key) const +int QXlibKeyboard::translateKeySym(uint key) const { int code = -1; int i = 0; // any other keys @@ -822,7 +822,7 @@ int QTestLiteKeyboard::translateKeySym(uint key) const return code; } -QString QTestLiteKeyboard::translateKeySym(KeySym keysym, uint xmodifiers, +QString QXlibKeyboard::translateKeySym(KeySym keysym, uint xmodifiers, int &code, Qt::KeyboardModifiers &modifiers, QByteArray &chars, int &count) { @@ -939,7 +939,7 @@ QString QTestLiteKeyboard::translateKeySym(KeySym keysym, uint xmodifiers, return text; } -QTestLiteKeyboard::QTestLiteKeyboard(QTestLiteScreen *screen) +QXlibKeyboard::QXlibKeyboard(QXlibScreen *screen) : m_screen(screen) , m_alt_mask(0) , m_super_mask(0) @@ -949,7 +949,7 @@ QTestLiteKeyboard::QTestLiteKeyboard(QTestLiteScreen *screen) changeLayout(); } -void QTestLiteKeyboard::changeLayout() +void QXlibKeyboard::changeLayout() { XkbDescPtr xkbDesc = XkbGetMap(m_screen->display(), XkbAllClientInfoMask, XkbUseCoreKbd); for (int i = xkbDesc->min_key_code; i < xkbDesc->max_key_code; ++i) { @@ -986,7 +986,7 @@ static Qt::KeyboardModifiers modifierFromKeyCode(int qtcode) } } -void QTestLiteKeyboard::handleKeyEvent(QWidget *widget, QEvent::Type type, XKeyEvent *ev) +void QXlibKeyboard::handleKeyEvent(QWidget *widget, QEvent::Type type, XKeyEvent *ev) { int qtcode = 0; Qt::KeyboardModifiers modifiers = translateModifiers(ev->state); diff --git a/src/plugins/platforms/testlite/qtestlitekeyboard.h b/src/plugins/platforms/testlite/qtestlitekeyboard.h index 6873a09..98df4e1 100644 --- a/src/plugins/platforms/testlite/qtestlitekeyboard.h +++ b/src/plugins/platforms/testlite/qtestlitekeyboard.h @@ -44,10 +44,10 @@ #include "qtestliteintegration.h" -class QTestLiteKeyboard +class QXlibKeyboard { public: - QTestLiteKeyboard(QTestLiteScreen *screen); + QXlibKeyboard(QXlibScreen *screen); void changeLayout(); @@ -63,7 +63,7 @@ private: int &code, Qt::KeyboardModifiers &modifiers, QByteArray &chars, int &count); - QTestLiteScreen *m_screen; + QXlibScreen *m_screen; uint m_alt_mask; uint m_super_mask; diff --git a/src/plugins/platforms/testlite/qtestlitemime.cpp b/src/plugins/platforms/testlite/qtestlitemime.cpp index c509991..5335ae9 100644 --- a/src/plugins/platforms/testlite/qtestlitemime.cpp +++ b/src/plugins/platforms/testlite/qtestlitemime.cpp @@ -48,22 +48,22 @@ #include #include -QTestLiteMime::QTestLiteMime() +QXlibMime::QXlibMime() : QInternalMimeData() { } -QTestLiteMime::~QTestLiteMime() +QXlibMime::~QXlibMime() {} -QString QTestLiteMime::mimeAtomToString(Display *display, Atom a) +QString QXlibMime::mimeAtomToString(Display *display, Atom a) { if (!a) return 0; - if (a == XA_STRING || a == QTestLiteStatic::atom(QTestLiteStatic::UTF8_STRING)) { + if (a == XA_STRING || a == QXlibStatic::atom(QXlibStatic::UTF8_STRING)) { return "text/plain"; // some Xdnd clients are dumb } char *atom = XGetAtomName(display, a); @@ -72,14 +72,14 @@ QString QTestLiteMime::mimeAtomToString(Display *display, Atom a) return result; } -Atom QTestLiteMime::mimeStringToAtom(Display *display, const QString &mimeType) +Atom QXlibMime::mimeStringToAtom(Display *display, const QString &mimeType) { if (mimeType.isEmpty()) return 0; return XInternAtom(display, mimeType.toLatin1().constData(), False); } -QStringList QTestLiteMime::mimeFormatsForAtom(Display *display, Atom a) +QStringList QXlibMime::mimeFormatsForAtom(Display *display, Atom a) { QStringList formats; if (a) { @@ -87,10 +87,10 @@ QStringList QTestLiteMime::mimeFormatsForAtom(Display *display, Atom a) formats.append(atomName); // special cases for string type - if (a == QTestLiteStatic::atom(QTestLiteStatic::UTF8_STRING) + if (a == QXlibStatic::atom(QXlibStatic::UTF8_STRING) || a == XA_STRING - || a == QTestLiteStatic::atom(QTestLiteStatic::TEXT) - || a == QTestLiteStatic::atom(QTestLiteStatic::COMPOUND_TEXT)) + || a == QXlibStatic::atom(QXlibStatic::TEXT) + || a == QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT)) formats.append(QLatin1String("text/plain")); // special cases for uris @@ -104,7 +104,7 @@ QStringList QTestLiteMime::mimeFormatsForAtom(Display *display, Atom a) return formats; } -bool QTestLiteMime::mimeDataForAtom(Display *display, Atom a, QMimeData *mimeData, QByteArray *data, Atom *atomFormat, int *dataFormat) +bool QXlibMime::mimeDataForAtom(Display *display, Atom a, QMimeData *mimeData, QByteArray *data, Atom *atomFormat, int *dataFormat) { bool ret = false; *atomFormat = a; @@ -116,27 +116,27 @@ bool QTestLiteMime::mimeDataForAtom(Display *display, Atom a, QMimeData *mimeDat *dataFormat = 16; ret = true; } else { - if ((a == QTestLiteStatic::atom(QTestLiteStatic::UTF8_STRING) + if ((a == QXlibStatic::atom(QXlibStatic::UTF8_STRING) || a == XA_STRING - || a == QTestLiteStatic::atom(QTestLiteStatic::TEXT) - || a == QTestLiteStatic::atom(QTestLiteStatic::COMPOUND_TEXT)) + || a == QXlibStatic::atom(QXlibStatic::TEXT) + || a == QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT)) && QInternalMimeData::hasFormatHelper(QLatin1String("text/plain"), mimeData)) { - if (a == QTestLiteStatic::atom(QTestLiteStatic::UTF8_STRING)){ + if (a == QXlibStatic::atom(QXlibStatic::UTF8_STRING)){ *data = QInternalMimeData::renderDataHelper(QLatin1String("text/plain"), mimeData); ret = true; } else if (a == XA_STRING) { *data = QString::fromUtf8(QInternalMimeData::renderDataHelper( QLatin1String("text/plain"), mimeData)).toLocal8Bit(); ret = true; - } else if (a == QTestLiteStatic::atom(QTestLiteStatic::TEXT) - || a == QTestLiteStatic::atom(QTestLiteStatic::COMPOUND_TEXT)) { + } else if (a == QXlibStatic::atom(QXlibStatic::TEXT) + || a == QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT)) { // the ICCCM states that TEXT and COMPOUND_TEXT are in the // encoding of choice, so we choose the encoding of the locale QByteArray strData = QString::fromUtf8(QInternalMimeData::renderDataHelper( QLatin1String("text/plain"), mimeData)).toLocal8Bit(); char *list[] = { strData.data(), NULL }; - XICCEncodingStyle style = (a == QTestLiteStatic::atom(QTestLiteStatic::COMPOUND_TEXT)) + XICCEncodingStyle style = (a == QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT)) ? XCompoundTextStyle : XStdICCTextStyle; XTextProperty textprop; if (list[0] != NULL @@ -165,17 +165,17 @@ bool QTestLiteMime::mimeDataForAtom(Display *display, Atom a, QMimeData *mimeDat return ret && data != 0; } -QList QTestLiteMime::mimeAtomsForFormat(Display *display, const QString &format) +QList QXlibMime::mimeAtomsForFormat(Display *display, const QString &format) { QList atoms; atoms.append(mimeStringToAtom(display, format)); // special cases for strings if (format == QLatin1String("text/plain")) { - atoms.append(QTestLiteStatic::atom(QTestLiteStatic::UTF8_STRING)); + atoms.append(QXlibStatic::atom(QXlibStatic::UTF8_STRING)); atoms.append(XA_STRING); - atoms.append(QTestLiteStatic::atom(QTestLiteStatic::TEXT)); - atoms.append(QTestLiteStatic::atom(QTestLiteStatic::COMPOUND_TEXT)); + atoms.append(QXlibStatic::atom(QXlibStatic::TEXT)); + atoms.append(QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT)); } // special cases for uris @@ -192,7 +192,7 @@ QList QTestLiteMime::mimeAtomsForFormat(Display *display, const QString &f return atoms; } -QVariant QTestLiteMime::mimeConvertToFormat(Display *display, Atom a, const QByteArray &data, const QString &format, QVariant::Type requestedType, const QByteArray &encoding) +QVariant QXlibMime::mimeConvertToFormat(Display *display, Atom a, const QByteArray &data, const QString &format, QVariant::Type requestedType, const QByteArray &encoding) { QString atomName = mimeAtomToString(display,a); if (atomName == format) @@ -212,12 +212,12 @@ QVariant QTestLiteMime::mimeConvertToFormat(Display *display, Atom a, const QByt // special cases for string types if (format == QLatin1String("text/plain")) { - if (a == QTestLiteStatic::atom(QTestLiteStatic::UTF8_STRING)) + if (a == QXlibStatic::atom(QXlibStatic::UTF8_STRING)) return QString::fromUtf8(data); if (a == XA_STRING) return QString::fromLatin1(data); - if (a == QTestLiteStatic::atom(QTestLiteStatic::TEXT) - || a == QTestLiteStatic::atom(QTestLiteStatic::COMPOUND_TEXT)) + if (a == QXlibStatic::atom(QXlibStatic::TEXT) + || a == QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT)) // #### might be wrong for COMPUND_TEXT return QString::fromLocal8Bit(data, data.size()); } @@ -251,7 +251,7 @@ QVariant QTestLiteMime::mimeConvertToFormat(Display *display, Atom a, const QByt XGetGeometry(display, xpm, &root, &x, &y, &width, &height, &border_width, &depth); XImage *ximg = XGetImage(display,xpm,x,y,width,height,AllPlanes,depth==1 ? XYPixmap : ZPixmap); - QImage qimg = QTestLiteStatic::qimageFromXImage(ximg); + QImage qimg = QXlibStatic::qimageFromXImage(ximg); XDestroyImage(ximg); QImageWriter imageWriter; @@ -266,18 +266,18 @@ QVariant QTestLiteMime::mimeConvertToFormat(Display *display, Atom a, const QByt return QVariant(); } -Atom QTestLiteMime::mimeAtomForFormat(Display *display, const QString &format, QVariant::Type requestedType, const QList &atoms, QByteArray *requestedEncoding) +Atom QXlibMime::mimeAtomForFormat(Display *display, const QString &format, QVariant::Type requestedType, const QList &atoms, QByteArray *requestedEncoding) { requestedEncoding->clear(); // find matches for string types if (format == QLatin1String("text/plain")) { - if (atoms.contains(QTestLiteStatic::atom(QTestLiteStatic::UTF8_STRING))) - return QTestLiteStatic::atom(QTestLiteStatic::UTF8_STRING); - if (atoms.contains(QTestLiteStatic::atom(QTestLiteStatic::COMPOUND_TEXT))) - return QTestLiteStatic::atom(QTestLiteStatic::COMPOUND_TEXT); - if (atoms.contains(QTestLiteStatic::atom(QTestLiteStatic::TEXT))) - return QTestLiteStatic::atom(QTestLiteStatic::TEXT); + if (atoms.contains(QXlibStatic::atom(QXlibStatic::UTF8_STRING))) + return QXlibStatic::atom(QXlibStatic::UTF8_STRING); + if (atoms.contains(QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT))) + return QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT); + if (atoms.contains(QXlibStatic::atom(QXlibStatic::TEXT))) + return QXlibStatic::atom(QXlibStatic::TEXT); if (atoms.contains(XA_STRING)) return XA_STRING; } diff --git a/src/plugins/platforms/testlite/qtestlitemime.h b/src/plugins/platforms/testlite/qtestlitemime.h index f11070f..6a70ea4 100644 --- a/src/plugins/platforms/testlite/qtestlitemime.h +++ b/src/plugins/platforms/testlite/qtestlitemime.h @@ -49,11 +49,11 @@ #include "qtestliteintegration.h" #include "qtestliteclipboard.h" -class QTestLiteMime : public QInternalMimeData { +class QXlibMime : public QInternalMimeData { Q_OBJECT public: - QTestLiteMime(); - ~QTestLiteMime(); + QXlibMime(); + ~QXlibMime(); static QList mimeAtomsForFormat(Display *display, const QString &format); static QString mimeAtomToString(Display *display, Atom a); diff --git a/src/plugins/platforms/testlite/qtestlitescreen.cpp b/src/plugins/platforms/testlite/qtestlitescreen.cpp index c211ee6..714c17b 100644 --- a/src/plugins/platforms/testlite/qtestlitescreen.cpp +++ b/src/plugins/platforms/testlite/qtestlitescreen.cpp @@ -188,7 +188,7 @@ qDebug() << "qt_x_errhandler" << err->error_code; return 0; } -QTestLiteScreen::QTestLiteScreen() +QXlibScreen::QXlibScreen() : mFormat(QImage::Format_RGB32) { char *display_name = getenv("DISPLAY"); @@ -228,11 +228,11 @@ QTestLiteScreen::QTestLiteScreen() QSocketNotifier *sock = new QSocketNotifier(xSocketNumber, QSocketNotifier::Read, this); connect(sock, SIGNAL(activated(int)), this, SLOT(eventDispatcher())); - mCursor = new QTestLiteCursor(this); - mKeyboard = new QTestLiteKeyboard(this); + mCursor = new QXlibCursor(this); + mKeyboard = new QXlibKeyboard(this); } -QTestLiteScreen::~QTestLiteScreen() +QXlibScreen::~QXlibScreen() { delete mCursor; XCloseDisplay(mDisplay); @@ -245,17 +245,17 @@ QTestLiteScreen::~QTestLiteScreen() #undef KeyRelease #endif -bool QTestLiteScreen::handleEvent(XEvent *xe) +bool QXlibScreen::handleEvent(XEvent *xe) { int quit = false; - QTestLiteWindow *platformWindow = 0; + QXlibWindow *platformWindow = 0; QWidget *widget = QWidget::find(xe->xany.window); if (widget) { - platformWindow = static_cast(widget->platformWindow()); + platformWindow = static_cast(widget->platformWindow()); } - Atom wmProtocolsAtom = QTestLiteStatic::atom(QTestLiteStatic::WM_PROTOCOLS); - Atom wmDeleteWindowAtom = QTestLiteStatic::atom(QTestLiteStatic::WM_DELETE_WINDOW); + Atom wmProtocolsAtom = QXlibStatic::atom(QXlibStatic::WM_PROTOCOLS); + Atom wmDeleteWindowAtom = QXlibStatic::atom(QXlibStatic::WM_DELETE_WINDOW); switch (xe->type) { case ClientMessage: @@ -346,14 +346,14 @@ bool QTestLiteScreen::handleEvent(XEvent *xe) static Bool checkForClipboardEvents(Display *, XEvent *e, XPointer) { - Atom clipboard = QTestLiteStatic::atom(QTestLiteStatic::CLIPBOARD); + Atom clipboard = QXlibStatic::atom(QXlibStatic::CLIPBOARD); return ((e->type == SelectionRequest && (e->xselectionrequest.selection == XA_PRIMARY || e->xselectionrequest.selection == clipboard)) || (e->type == SelectionClear && (e->xselectionclear.selection == XA_PRIMARY || e->xselectionclear.selection == clipboard))); } -bool QTestLiteScreen::waitForClipboardEvent(Window win, int type, XEvent *event, int timeout) +bool QXlibScreen::waitForClipboardEvent(Window win, int type, XEvent *event, int timeout) { QElapsedTimer timer; timer.start(); @@ -377,7 +377,7 @@ bool QTestLiteScreen::waitForClipboardEvent(Window win, int type, XEvent *event, return false; } -void QTestLiteScreen::eventDispatcher() +void QXlibScreen::eventDispatcher() { ulong marker = XNextRequest(mDisplay); // int i = 0; @@ -402,7 +402,7 @@ void QTestLiteScreen::eventDispatcher() } } -QImage QTestLiteScreen::grabWindow(Window window, int x, int y, int w, int h) +QImage QXlibScreen::grabWindow(Window window, int x, int y, int w, int h) { if (w == 0 || h ==0) return QImage(); @@ -437,31 +437,31 @@ QImage QTestLiteScreen::grabWindow(Window window, int x, int y, int w, int h) return result; } -QTestLiteScreen * QTestLiteScreen::testLiteScreenForWidget(QWidget *widget) +QXlibScreen * QXlibScreen::testLiteScreenForWidget(QWidget *widget) { QPlatformScreen *platformScreen = platformScreenForWidget(widget); - return static_cast(platformScreen); + return static_cast(platformScreen); } -Display * QTestLiteScreen::display() const +Display * QXlibScreen::display() const { return mDisplay; } -int QTestLiteScreen::xScreenNumber() const +int QXlibScreen::xScreenNumber() const { return mScreen; } -QTestLiteKeyboard * QTestLiteScreen::keyboard() const +QXlibKeyboard * QXlibScreen::keyboard() const { return mKeyboard; } -void QTestLiteScreen::handleSelectionRequest(XEvent *event) +void QXlibScreen::handleSelectionRequest(XEvent *event) { QPlatformIntegration *integration = QApplicationPrivate::platformIntegration(); - QTestLiteClipboard *clipboard = static_cast(integration->clipboard()); + QXlibClipboard *clipboard = static_cast(integration->clipboard()); clipboard->handleSelectionRequest(event); } diff --git a/src/plugins/platforms/testlite/qtestlitescreen.h b/src/plugins/platforms/testlite/qtestlitescreen.h index 860a67c..7e59a59 100644 --- a/src/plugins/platforms/testlite/qtestlitescreen.h +++ b/src/plugins/platforms/testlite/qtestlitescreen.h @@ -47,16 +47,16 @@ QT_BEGIN_NAMESPACE -class QTestLiteCursor; -class QTestLiteKeyboard; +class QXlibCursor; +class QXlibKeyboard; -class QTestLiteScreen : public QPlatformScreen +class QXlibScreen : public QPlatformScreen { Q_OBJECT public: - QTestLiteScreen(); + QXlibScreen(); - ~QTestLiteScreen(); + ~QXlibScreen(); QString displayName() const { return mDisplayName; } @@ -74,12 +74,12 @@ public: QImage grabWindow(Window window, int x, int y, int w, int h); - static QTestLiteScreen *testLiteScreenForWidget(QWidget *widget); + static QXlibScreen *testLiteScreenForWidget(QWidget *widget); Display *display() const; int xScreenNumber() const; - QTestLiteKeyboard *keyboard() const; + QXlibKeyboard *keyboard() const; public slots: void eventDispatcher(); @@ -92,8 +92,8 @@ private: QSize mPhysicalSize; int mDepth; QImage::Format mFormat; - QTestLiteCursor *mCursor; - QTestLiteKeyboard *mKeyboard; + QXlibCursor *mCursor; + QXlibKeyboard *mKeyboard; Display * mDisplay; int mScreen; diff --git a/src/plugins/platforms/testlite/qtestlitestaticinfo.cpp b/src/plugins/platforms/testlite/qtestlitestaticinfo.cpp index 2c6404d..837636c 100644 --- a/src/plugins/platforms/testlite/qtestlitestaticinfo.cpp +++ b/src/plugins/platforms/testlite/qtestlitestaticinfo.cpp @@ -261,7 +261,7 @@ public: , xfixes_eventbase(0) , xfixes_errorbase(0) { - QTestLiteScreen *screen = qobject_cast (QApplicationPrivate::platformIntegration()->screens().at(0)); + QXlibScreen *screen = qobject_cast (QApplicationPrivate::platformIntegration()->screens().at(0)); Q_ASSERT(screen); initializeAllAtoms(screen); @@ -287,7 +287,7 @@ public: return supported; } - Atom atom(QTestLiteStatic::X11Atom atom) + Atom atom(QXlibStatic::X11Atom atom) { return m_allAtoms[atom]; } @@ -351,8 +351,8 @@ public: private: - void initializeAllAtoms(QTestLiteScreen *screen) { - const char *names[QTestLiteStatic::NAtoms]; + void initializeAllAtoms(QXlibScreen *screen) { + const char *names[QXlibStatic::NAtoms]; const char *ptr = x11_atomnames; int i = 0; @@ -363,22 +363,22 @@ private: ++ptr; } - Q_ASSERT(i == QTestLiteStatic::NPredefinedAtoms); + Q_ASSERT(i == QXlibStatic::NPredefinedAtoms); QByteArray settings_atom_name("_QT_SETTINGS_TIMESTAMP_"); settings_atom_name += XDisplayName(qPrintable(screen->displayName())); names[i++] = settings_atom_name; - Q_ASSERT(i == QTestLiteStatic::NAtoms); + Q_ASSERT(i == QXlibStatic::NAtoms); #if 0//defined(XlibSpecificationRelease) && (XlibSpecificationRelease >= 6) XInternAtoms(screen->display(), (char **)names, i, False, m_allAtoms); #else - for (i = 0; i < QTestLiteStatic::NAtoms; ++i) + for (i = 0; i < QXlibStatic::NAtoms; ++i) m_allAtoms[i] = XInternAtom(screen->display(), (char *)names[i], False); #endif } - void initializeSupportedAtoms(QTestLiteScreen *screen) + void initializeSupportedAtoms(QXlibScreen *screen) { Atom type; int format; @@ -387,7 +387,7 @@ private: unsigned char *data = 0; int e = XGetWindowProperty(screen->display(), screen->rootWindow(), - this->atom(QTestLiteStatic::_NET_SUPPORTED), 0, 0, + this->atom(QXlibStatic::_NET_SUPPORTED), 0, 0, False, XA_ATOM, &type, &format, &nitems, &after, &data); if (data) XFree(data); @@ -398,7 +398,7 @@ private: while (after > 0) { XGetWindowProperty(screen->display(), screen->rootWindow(), - this->atom(QTestLiteStatic::_NET_SUPPORTED), offset, 1024, + this->atom(QXlibStatic::_NET_SUPPORTED), offset, 1024, False, XA_ATOM, &type, &format, &nitems, &after, &data); if (type == XA_ATOM && format == 32) { @@ -423,7 +423,7 @@ private: } } - void resolveXFixes(QTestLiteScreen *screen) + void resolveXFixes(QXlibScreen *screen) { #ifndef QT_NO_XFIXES // See if Xfixes is supported on the connected display @@ -456,7 +456,7 @@ private: } Atom *m_supportedAtoms; - Atom m_allAtoms[QTestLiteStatic::NAtoms]; + Atom m_allAtoms[QXlibStatic::NAtoms]; #ifndef QT_NO_XFIXES PtrXFixesQueryExtension ptrXFixesQueryExtension; @@ -474,28 +474,28 @@ private: Q_GLOBAL_STATIC(QTestLiteStaticInfoPrivate, qTestLiteStaticInfoPrivate); -Atom QTestLiteStatic::atom(QTestLiteStatic::X11Atom atom) +Atom QXlibStatic::atom(QXlibStatic::X11Atom atom) { return qTestLiteStaticInfoPrivate()->atom(atom); } -bool QTestLiteStatic::isSupportedByWM(Atom atom) +bool QXlibStatic::isSupportedByWM(Atom atom) { return qTestLiteStaticInfoPrivate()->isSupportedByWM(atom); } -bool QTestLiteStatic::useXFixes() +bool QXlibStatic::useXFixes() { return qTestLiteStaticInfoPrivate()->useXFixes(); } -int QTestLiteStatic::xFixesEventBase() +int QXlibStatic::xFixesEventBase() { return qTestLiteStaticInfoPrivate()->xFixesEventBase(); } #ifndef QT_NO_XFIXES -PtrXFixesSelectSelectionInput QTestLiteStatic::xFixesSelectSelectionInput() +PtrXFixesSelectSelectionInput QXlibStatic::xFixesSelectSelectionInput() { qDebug() << qTestLiteStaticInfoPrivate()->useXFixes(); if (!qTestLiteStaticInfoPrivate()->useXFixes()) @@ -504,7 +504,7 @@ PtrXFixesSelectSelectionInput QTestLiteStatic::xFixesSelectSelectionInput() return qTestLiteStaticInfoPrivate()->xFixesSelectSelectionInput(); } -QImage QTestLiteStatic::qimageFromXImage(XImage *xi) +QImage QXlibStatic::qimageFromXImage(XImage *xi) { return qTestLiteStaticInfoPrivate()->qimageFromXImage(xi); } diff --git a/src/plugins/platforms/testlite/qtestlitestaticinfo.h b/src/plugins/platforms/testlite/qtestlitestaticinfo.h index 0876768..8473ee9 100644 --- a/src/plugins/platforms/testlite/qtestlitestaticinfo.h +++ b/src/plugins/platforms/testlite/qtestlitestaticinfo.h @@ -231,7 +231,7 @@ enum { #endif -class QTestLiteStatic +class QXlibStatic { public: enum X11Atom { diff --git a/src/plugins/platforms/testlite/qtestlitewindow.cpp b/src/plugins/platforms/testlite/qtestlitewindow.cpp index b7c5e99..0f11a81 100644 --- a/src/plugins/platforms/testlite/qtestlitewindow.cpp +++ b/src/plugins/platforms/testlite/qtestlitewindow.cpp @@ -68,10 +68,10 @@ QT_BEGIN_NAMESPACE -QTestLiteWindow::QTestLiteWindow(QWidget *window) +QXlibWindow::QXlibWindow(QWidget *window) : QPlatformWindow(window) , mGLContext(0) - , mScreen(QTestLiteScreen::testLiteScreenForWidget(window)) + , mScreen(QXlibScreen::testLiteScreenForWidget(window)) { int x = window->x(); int y = window->y(); @@ -88,7 +88,7 @@ QTestLiteWindow::QTestLiteWindow(QWidget *window) EGLDisplay eglDisplay = eglGetDisplay(mScreen->display()); EGLConfig eglConfig = q_configFromQPlatformWindowFormat(eglDisplay,windowFormat); - VisualID id = QTestLiteEglIntegration::getCompatibleVisualId(mScreen->display(),eglConfig); + VisualID id = QXlibEglIntegration::getCompatibleVisualId(mScreen->display(),eglConfig); XVisualInfo visualInfoTemplate; memset(&visualInfoTemplate, 0, sizeof(XVisualInfo)); @@ -133,20 +133,20 @@ QTestLiteWindow::QTestLiteWindow(QWidget *window) Atom protocols[5]; int n = 0; - protocols[n++] = QTestLiteStatic::atom(QTestLiteStatic::WM_DELETE_WINDOW); // support del window protocol - protocols[n++] = QTestLiteStatic::atom(QTestLiteStatic::WM_TAKE_FOCUS); // support take focus window protocol - protocols[n++] = QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_PING); // support _NET_WM_PING protocol + protocols[n++] = QXlibStatic::atom(QXlibStatic::WM_DELETE_WINDOW); // support del window protocol + protocols[n++] = QXlibStatic::atom(QXlibStatic::WM_TAKE_FOCUS); // support take focus window protocol + protocols[n++] = QXlibStatic::atom(QXlibStatic::_NET_WM_PING); // support _NET_WM_PING protocol #ifndef QT_NO_XSYNC - protocols[n++] = QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_SYNC_REQUEST); // support _NET_WM_SYNC_REQUEST protocol + protocols[n++] = QXlibStatic::atom(QXlibStatic::_NET_WM_SYNC_REQUEST); // support _NET_WM_SYNC_REQUEST protocol #endif // QT_NO_XSYNC if (window->windowFlags() & Qt::WindowContextHelpButtonHint) - protocols[n++] = QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_CONTEXT_HELP); + protocols[n++] = QXlibStatic::atom(QXlibStatic::_NET_WM_CONTEXT_HELP); XSetWMProtocols(mScreen->display(), x_window, protocols, n); } -QTestLiteWindow::~QTestLiteWindow() +QXlibWindow::~QXlibWindow() { #ifdef MYX11_DEBUG qDebug() << "~QTestLiteWindow" << hex << x_window; @@ -172,7 +172,7 @@ static Qt::MouseButtons translateMouseButtons(int s) -void QTestLiteWindow::handleMouseEvent(QEvent::Type type, XButtonEvent *e) +void QXlibWindow::handleMouseEvent(QEvent::Type type, XButtonEvent *e) { static QPoint mousePoint; @@ -215,68 +215,68 @@ void QTestLiteWindow::handleMouseEvent(QEvent::Type type, XButtonEvent *e) mousePoint = QPoint(e->x_root, e->y_root); } -void QTestLiteWindow::handleCloseEvent() +void QXlibWindow::handleCloseEvent() { QWindowSystemInterface::handleCloseEvent(widget()); } -void QTestLiteWindow::handleEnterEvent() +void QXlibWindow::handleEnterEvent() { QWindowSystemInterface::handleEnterEvent(widget()); } -void QTestLiteWindow::handleLeaveEvent() +void QXlibWindow::handleLeaveEvent() { QWindowSystemInterface::handleLeaveEvent(widget()); } -void QTestLiteWindow::handleFocusInEvent() +void QXlibWindow::handleFocusInEvent() { QWindowSystemInterface::handleWindowActivated(widget()); } -void QTestLiteWindow::handleFocusOutEvent() +void QXlibWindow::handleFocusOutEvent() { QWindowSystemInterface::handleWindowActivated(0); } -void QTestLiteWindow::setGeometry(const QRect &rect) +void QXlibWindow::setGeometry(const QRect &rect) { XMoveResizeWindow(mScreen->display(), x_window, rect.x(), rect.y(), rect.width(), rect.height()); QPlatformWindow::setGeometry(rect); } -Qt::WindowFlags QTestLiteWindow::windowFlags() const +Qt::WindowFlags QXlibWindow::windowFlags() const { return mWindowFlags; } -WId QTestLiteWindow::winId() const +WId QXlibWindow::winId() const { return x_window; } -void QTestLiteWindow::setParent(const QPlatformWindow *window) +void QXlibWindow::setParent(const QPlatformWindow *window) { QPoint topLeft = geometry().topLeft(); XReparentWindow(mScreen->display(),x_window,window->winId(),topLeft.x(),topLeft.y()); } -void QTestLiteWindow::raise() +void QXlibWindow::raise() { XRaiseWindow(mScreen->display(), x_window); } -void QTestLiteWindow::lower() +void QXlibWindow::lower() { XLowerWindow(mScreen->display(), x_window); } -void QTestLiteWindow::setWindowTitle(const QString &title) +void QXlibWindow::setWindowTitle(const QString &title) { QByteArray ba = title.toLatin1(); //We're not making a general solution here... XTextProperty windowName; @@ -288,7 +288,7 @@ void QTestLiteWindow::setWindowTitle(const QString &title) XSetWMName(mScreen->display(), x_window, &windowName); } -GC QTestLiteWindow::createGC() +GC QXlibWindow::createGC() { GC gc; @@ -299,7 +299,7 @@ GC QTestLiteWindow::createGC() return gc; } -void QTestLiteWindow::paintEvent() +void QXlibWindow::paintEvent() { #ifdef MYX11_DEBUG // qDebug() << "QTestLiteWindow::paintEvent" << shm_img.size() << painted; @@ -309,12 +309,12 @@ void QTestLiteWindow::paintEvent() surface->flush(widget(), widget()->geometry(), QPoint()); } -void QTestLiteWindow::requestActivateWindow() +void QXlibWindow::requestActivateWindow() { XSetInputFocus(mScreen->display(), x_window, XRevertToParent, CurrentTime); } -void QTestLiteWindow::resizeEvent(XConfigureEvent *e) +void QXlibWindow::resizeEvent(XConfigureEvent *e) { int xpos = geometry().x(); int ypos = geometry().y(); @@ -333,7 +333,7 @@ void QTestLiteWindow::resizeEvent(XConfigureEvent *e) QWindowSystemInterface::handleGeometryChange(widget(), newRect); } -void QTestLiteWindow::mousePressEvent(XButtonEvent *e) +void QXlibWindow::mousePressEvent(XButtonEvent *e) { static long prevTime = 0; static Window prevWindow; @@ -356,22 +356,22 @@ void QTestLiteWindow::mousePressEvent(XButtonEvent *e) handleMouseEvent(type, e); } -QtMWMHints QTestLiteWindow::getMWMHints() const +QXlibMWMHints QXlibWindow::getMWMHints() const { - QtMWMHints mwmhints; + QXlibMWMHints mwmhints; Atom type; int format; ulong nitems, bytesLeft; uchar *data = 0; - Atom atomForMotifWmHints = QTestLiteStatic::atom(QTestLiteStatic::_MOTIF_WM_HINTS); + Atom atomForMotifWmHints = QXlibStatic::atom(QXlibStatic::_MOTIF_WM_HINTS); if ((XGetWindowProperty(mScreen->display(), x_window, atomForMotifWmHints, 0, 5, false, atomForMotifWmHints, &type, &format, &nitems, &bytesLeft, &data) == Success) && (type == atomForMotifWmHints && format == 32 && nitems >= 5)) { - mwmhints = *(reinterpret_cast(data)); + mwmhints = *(reinterpret_cast(data)); } else { mwmhints.flags = 0L; mwmhints.functions = MWM_FUNC_ALL; @@ -386,9 +386,9 @@ QtMWMHints QTestLiteWindow::getMWMHints() const return mwmhints; } -void QTestLiteWindow::setMWMHints(const QtMWMHints &mwmhints) +void QXlibWindow::setMWMHints(const QXlibMWMHints &mwmhints) { - Atom atomForMotifWmHints = QTestLiteStatic::atom(QTestLiteStatic::_MOTIF_WM_HINTS); + Atom atomForMotifWmHints = QXlibStatic::atom(QXlibStatic::_MOTIF_WM_HINTS); if (mwmhints.flags != 0l) { XChangeProperty(mScreen->display(), x_window, atomForMotifWmHints, atomForMotifWmHints, 32, @@ -411,7 +411,7 @@ static inline bool isTransient(const QWidget *w) && !w->testAttribute(Qt::WA_X11BypassTransientForHint)); } -QVector QTestLiteWindow::getNetWmState() const +QVector QXlibWindow::getNetWmState() const { QVector returnValue; @@ -421,7 +421,7 @@ QVector QTestLiteWindow::getNetWmState() const ulong propertyLength; ulong bytesLeft; uchar *propertyData = 0; - if (XGetWindowProperty(mScreen->display(), x_window, QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE), 0, 0, + if (XGetWindowProperty(mScreen->display(), x_window, QXlibStatic::atom(QXlibStatic::_NET_WM_STATE), 0, 0, False, XA_ATOM, &actualType, &actualFormat, &propertyLength, &bytesLeft, &propertyData) == Success && actualType == XA_ATOM && actualFormat == 32) { @@ -429,7 +429,7 @@ QVector QTestLiteWindow::getNetWmState() const XFree((char*) propertyData); // fetch all data - if (XGetWindowProperty(mScreen->display(), x_window, QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE), 0, + if (XGetWindowProperty(mScreen->display(), x_window, QXlibStatic::atom(QXlibStatic::_NET_WM_STATE), 0, returnValue.size(), False, XA_ATOM, &actualType, &actualFormat, &propertyLength, &bytesLeft, &propertyData) != Success) { returnValue.clear(); @@ -447,7 +447,7 @@ QVector QTestLiteWindow::getNetWmState() const return returnValue; } -Qt::WindowFlags QTestLiteWindow::setWindowFlags(Qt::WindowFlags flags) +Qt::WindowFlags QXlibWindow::setWindowFlags(Qt::WindowFlags flags) { // Q_ASSERT(flags & Qt::Window); mWindowFlags = flags; @@ -478,7 +478,7 @@ Qt::WindowFlags QTestLiteWindow::setWindowFlags(Qt::WindowFlags flags) XSetWindowAttributes wsa; - QtMWMHints mwmhints; + QXlibMWMHints mwmhints; mwmhints.flags = 0L; mwmhints.functions = 0L; mwmhints.decorations = 0; @@ -567,35 +567,35 @@ Qt::WindowFlags QTestLiteWindow::setWindowFlags(Qt::WindowFlags flags) if (flags & Qt::WindowStaysOnTopHint) { if (flags & Qt::WindowStaysOnBottomHint) qWarning() << "QWidget: Incompatible window flags: the window can't be on top and on bottom at the same time"; - if (!netWmState.contains(QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE_ABOVE))) - netWmState.append(QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE_ABOVE)); - if (!netWmState.contains(QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE_STAYS_ON_TOP))) - netWmState.append(QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE_STAYS_ON_TOP)); + if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_ABOVE))) + netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_ABOVE)); + if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_STAYS_ON_TOP))) + netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_STAYS_ON_TOP)); } else if (flags & Qt::WindowStaysOnBottomHint) { - if (!netWmState.contains(QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE_BELOW))) - netWmState.append(QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE_BELOW)); + if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_BELOW))) + netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_BELOW)); } if (widget()->isFullScreen()) { - if (!netWmState.contains(QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE_FULLSCREEN))) - netWmState.append(QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE_FULLSCREEN)); + if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_FULLSCREEN))) + netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_FULLSCREEN)); } if (widget()->isMaximized()) { - if (!netWmState.contains(QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE_MAXIMIZED_HORZ))) - netWmState.append(QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE_MAXIMIZED_HORZ)); - if (!netWmState.contains(QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE_MAXIMIZED_VERT))) - netWmState.append(QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE_MAXIMIZED_VERT)); + if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_MAXIMIZED_HORZ))) + netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_MAXIMIZED_HORZ)); + if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_MAXIMIZED_VERT))) + netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_MAXIMIZED_VERT)); } if (widget()->windowModality() != Qt::NonModal) { - if (!netWmState.contains(QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE_MODAL))) - netWmState.append(QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE_MODAL)); + if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_MODAL))) + netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_MODAL)); } if (!netWmState.isEmpty()) { XChangeProperty(mScreen->display(), x_window, - QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE), XA_ATOM, 32, PropModeReplace, + QXlibStatic::atom(QXlibStatic::_NET_WM_STATE), XA_ATOM, 32, PropModeReplace, (unsigned char *) netWmState.data(), netWmState.size()); } else { - XDeleteProperty(mScreen->display(), x_window, QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE)); + XDeleteProperty(mScreen->display(), x_window, QXlibStatic::atom(QXlibStatic::_NET_WM_STATE)); } //##### only if initializeWindow??? @@ -620,7 +620,7 @@ Qt::WindowFlags QTestLiteWindow::setWindowFlags(Qt::WindowFlags flags) return flags; } -void QTestLiteWindow::setVisible(bool visible) +void QXlibWindow::setVisible(bool visible) { #ifdef MYX11_DEBUG qDebug() << "QTestLiteWindow::setVisible" << visible << hex << x_window; @@ -630,7 +630,7 @@ void QTestLiteWindow::setVisible(bool visible) if (widget()->parentWidget()) { QWidget *widgetParent = widget()->parentWidget()->window(); if (widgetParent && widgetParent->platformWindow()) { - QTestLiteWindow *parentWidnow = static_cast(widgetParent->platformWindow()); + QXlibWindow *parentWidnow = static_cast(widgetParent->platformWindow()); parentXWindow = parentWidnow->x_window; } } @@ -646,18 +646,18 @@ void QTestLiteWindow::setVisible(bool visible) } } -void QTestLiteWindow::setCursor(const Cursor &cursor) +void QXlibWindow::setCursor(const Cursor &cursor) { XDefineCursor(mScreen->display(), x_window, cursor); XFlush(mScreen->display()); } -QPlatformGLContext *QTestLiteWindow::glContext() const +QPlatformGLContext *QXlibWindow::glContext() const { if (!QApplicationPrivate::platformIntegration()->hasOpenGL()) return 0; if (!mGLContext) { - QTestLiteWindow *that = const_cast(this); + QXlibWindow *that = const_cast(this); #if !defined(QT_NO_OPENGL) #if !defined(QT_OPENGL_ES_2) that->mGLContext = new QGLXContext(x_window, mScreen,widget()->platformWindowFormat()); @@ -680,17 +680,17 @@ QPlatformGLContext *QTestLiteWindow::glContext() const return mGLContext; } -Window QTestLiteWindow::xWindow() const +Window QXlibWindow::xWindow() const { return x_window; } -GC QTestLiteWindow::graphicsContext() const +GC QXlibWindow::graphicsContext() const { return gc; } -void QTestLiteWindow::doSizeHints() +void QXlibWindow::doSizeHints() { Q_ASSERT(widget()->testAttribute(Qt::WA_WState_Created)); XSizeHints s; @@ -709,7 +709,7 @@ void QTestLiteWindow::doSizeHints() XSetWMNormalHints(mScreen->display(), x_window, &s); } -QPlatformWindowFormat QTestLiteWindow::correctColorBuffers(const QPlatformWindowFormat &platformWindowFormat) const +QPlatformWindowFormat QXlibWindow::correctColorBuffers(const QPlatformWindowFormat &platformWindowFormat) const { // I have only tested this setup on a dodgy intel setup, where I didn't use standard libs, // so this might be not what we want to do :) diff --git a/src/plugins/platforms/testlite/qtestlitewindow.h b/src/plugins/platforms/testlite/qtestlitewindow.h index 2ca7e10..ccf6867 100644 --- a/src/plugins/platforms/testlite/qtestlitewindow.h +++ b/src/plugins/platforms/testlite/qtestlitewindow.h @@ -50,7 +50,7 @@ #include #include -struct QtMWMHints { +struct QXlibMWMHints { ulong flags, functions, decorations; long input_mode; ulong status; @@ -83,11 +83,11 @@ enum { MWM_INPUT_FULL_APPLICATION_MODAL = 3L }; -class QTestLiteWindow : public QPlatformWindow +class QXlibWindow : public QPlatformWindow { public: - QTestLiteWindow(QWidget *window); - ~QTestLiteWindow(); + QXlibWindow(QWidget *window); + ~QXlibWindow(); void mousePressEvent(XButtonEvent*); @@ -124,8 +124,8 @@ public: protected: QVector getNetWmState() const; - void setMWMHints(const QtMWMHints &mwmhints); - QtMWMHints getMWMHints() const; + void setMWMHints(const QXlibMWMHints &mwmhints); + QXlibMWMHints getMWMHints() const; void doSizeHints(); @@ -138,7 +138,7 @@ private: GC createGC(); QPlatformGLContext *mGLContext; - QTestLiteScreen *mScreen; + QXlibScreen *mScreen; Qt::WindowFlags mWindowFlags; }; diff --git a/src/plugins/platforms/testlite/qtestlitewindowsurface.cpp b/src/plugins/platforms/testlite/qtestlitewindowsurface.cpp index ced964a..088730d 100644 --- a/src/plugins/platforms/testlite/qtestlitewindowsurface.cpp +++ b/src/plugins/platforms/testlite/qtestlitewindowsurface.cpp @@ -55,9 +55,9 @@ QT_BEGIN_NAMESPACE -struct MyShmImageInfo { - MyShmImageInfo(Display *xdisplay) : image(0), display(xdisplay) {} - ~MyShmImageInfo() { destroy(); } +struct QXlibShmImageInfo { + QXlibShmImageInfo(Display *xdisplay) : image(0), display(xdisplay) {} + ~QXlibShmImageInfo() { destroy(); } void destroy(); @@ -68,7 +68,7 @@ struct MyShmImageInfo { #ifndef DONT_USE_MIT_SHM -void MyShmImageInfo::destroy() +void QXlibShmImageInfo::destroy() { XShmDetach (display, &shminfo); XDestroyImage (image); @@ -77,18 +77,18 @@ void MyShmImageInfo::destroy() } #endif -void QTestLiteWindowSurface::resizeShmImage(int width, int height) +void QXlibWindowSurface::resizeShmImage(int width, int height) { #ifdef DONT_USE_MIT_SHM shm_img = QImage(width, height, QImage::Format_RGB32); #else - QTestLiteScreen *screen = QTestLiteScreen::testLiteScreenForWidget(window()); + QXlibScreen *screen = QXlibScreen::testLiteScreenForWidget(window()); if (image_info) image_info->destroy(); else - image_info = new MyShmImageInfo(screen->display()); + image_info = new QXlibShmImageInfo(screen->display()); Visual *visual = DefaultVisual(screen->display(), screen->xScreenNumber()); @@ -115,37 +115,37 @@ void QTestLiteWindowSurface::resizeShmImage(int width, int height) } -void QTestLiteWindowSurface::resizeBuffer(QSize s) +void QXlibWindowSurface::resizeBuffer(QSize s) { if (shm_img.size() != s) resizeShmImage(s.width(), s.height()); } -QSize QTestLiteWindowSurface::bufferSize() const +QSize QXlibWindowSurface::bufferSize() const { return shm_img.size(); } -QTestLiteWindowSurface::QTestLiteWindowSurface (QWidget *window) +QXlibWindowSurface::QXlibWindowSurface (QWidget *window) : QWindowSurface(window), painted(false), image_info(0) { - xw = static_cast(window->platformWindow()); + xw = static_cast(window->platformWindow()); // qDebug() << "QTestLiteWindowSurface::QTestLiteWindowSurface:" << xw->window; } -QTestLiteWindowSurface::~QTestLiteWindowSurface() +QXlibWindowSurface::~QXlibWindowSurface() { delete image_info; } -QPaintDevice *QTestLiteWindowSurface::paintDevice() +QPaintDevice *QXlibWindowSurface::paintDevice() { return &shm_img; } -void QTestLiteWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) +void QXlibWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) { Q_UNUSED(widget); Q_UNUSED(region); @@ -154,7 +154,7 @@ void QTestLiteWindowSurface::flush(QWidget *widget, const QRegion ®ion, const if (!painted) return; - QTestLiteScreen *screen = QTestLiteScreen::testLiteScreenForWidget(widget); + QXlibScreen *screen = QXlibScreen::testLiteScreenForWidget(widget); GC gc = xw->graphicsContext(); Window window = xw->xWindow(); #ifdef DONT_USE_MIT_SHM @@ -197,7 +197,7 @@ void QTestLiteWindowSurface::flush(QWidget *widget, const QRegion ®ion, const // from qwindowsurface.cpp extern void qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &offset); -bool QTestLiteWindowSurface::scroll(const QRegion &area, int dx, int dy) +bool QXlibWindowSurface::scroll(const QRegion &area, int dx, int dy) { if (shm_img.isNull()) return false; @@ -210,13 +210,13 @@ bool QTestLiteWindowSurface::scroll(const QRegion &area, int dx, int dy) } -void QTestLiteWindowSurface::beginPaint(const QRegion ®ion) +void QXlibWindowSurface::beginPaint(const QRegion ®ion) { Q_UNUSED(region); resizeBuffer(size()); } -void QTestLiteWindowSurface::endPaint(const QRegion ®ion) +void QXlibWindowSurface::endPaint(const QRegion ®ion) { Q_UNUSED(region); painted = true; //there is content in the buffer diff --git a/src/plugins/platforms/testlite/qtestlitewindowsurface.h b/src/plugins/platforms/testlite/qtestlitewindowsurface.h index ca900e5..12b4c60 100644 --- a/src/plugins/platforms/testlite/qtestlitewindowsurface.h +++ b/src/plugins/platforms/testlite/qtestlitewindowsurface.h @@ -47,21 +47,19 @@ QT_BEGIN_NAMESPACE -class QTestLiteWindow; -class QTestLiteIntegration; -class QTestLiteScreen; -class MyShmImageInfo; +class QXlibWindow; +class QXlibIntegration; +class QXlibScreen; +class QXlibShmImageInfo; -class QTestLiteWindowSurface : public QWindowSurface +class QXlibWindowSurface : public QWindowSurface { public: - QTestLiteWindowSurface (QWidget *window); - ~QTestLiteWindowSurface(); + QXlibWindowSurface (QWidget *window); + ~QXlibWindowSurface(); QPaintDevice *paintDevice(); -// void flush(); void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); -// void resize(const QSize &size); bool scroll(const QRegion &area, int dx, int dy); void beginPaint(const QRegion ®ion); @@ -76,9 +74,9 @@ private: void resizeShmImage(int width, int height); QImage shm_img; - MyShmImageInfo *image_info; + QXlibShmImageInfo *image_info; - QTestLiteWindow *xw; + QXlibWindow *xw; }; -- cgit v0.12 From 98f2392e7278aea52f46b7e20f93dea1831e5704 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Mon, 14 Feb 2011 13:37:24 +0100 Subject: Lighthouse Moving testlite plugin into xlib --- src/plugins/platforms/testlite/main.cpp | 79 -- src/plugins/platforms/testlite/qglxintegration.cpp | 376 -------- src/plugins/platforms/testlite/qglxintegration.h | 94 -- .../platforms/testlite/qtestliteclipboard.cpp | 676 ------------- .../platforms/testlite/qtestliteclipboard.h | 94 -- src/plugins/platforms/testlite/qtestlitecursor.cpp | 199 ---- src/plugins/platforms/testlite/qtestlitecursor.h | 68 -- .../platforms/testlite/qtestliteeglintegration.cpp | 186 ---- .../platforms/testlite/qtestliteeglintegration.h | 54 -- .../platforms/testlite/qtestliteintegration.cpp | 156 --- .../platforms/testlite/qtestliteintegration.h | 85 -- .../platforms/testlite/qtestlitekeyboard.cpp | 1000 -------------------- src/plugins/platforms/testlite/qtestlitekeyboard.h | 76 -- src/plugins/platforms/testlite/qtestlitemime.cpp | 322 ------- src/plugins/platforms/testlite/qtestlitemime.h | 67 -- src/plugins/platforms/testlite/qtestlitescreen.cpp | 468 --------- src/plugins/platforms/testlite/qtestlitescreen.h | 104 -- .../platforms/testlite/qtestlitestaticinfo.cpp | 511 ---------- .../platforms/testlite/qtestlitestaticinfo.h | 413 -------- src/plugins/platforms/testlite/qtestlitewindow.cpp | 735 -------------- src/plugins/platforms/testlite/qtestlitewindow.h | 145 --- .../platforms/testlite/qtestlitewindowsurface.cpp | 224 ----- .../platforms/testlite/qtestlitewindowsurface.h | 86 -- src/plugins/platforms/testlite/testlite.pro | 57 -- src/plugins/platforms/xlib/main.cpp | 79 ++ src/plugins/platforms/xlib/qglxintegration.cpp | 376 ++++++++ src/plugins/platforms/xlib/qglxintegration.h | 94 ++ src/plugins/platforms/xlib/qtestliteclipboard.cpp | 676 +++++++++++++ src/plugins/platforms/xlib/qtestliteclipboard.h | 94 ++ src/plugins/platforms/xlib/qtestlitecursor.cpp | 199 ++++ src/plugins/platforms/xlib/qtestlitecursor.h | 68 ++ .../platforms/xlib/qtestliteeglintegration.cpp | 186 ++++ .../platforms/xlib/qtestliteeglintegration.h | 54 ++ .../platforms/xlib/qtestliteintegration.cpp | 156 +++ src/plugins/platforms/xlib/qtestliteintegration.h | 85 ++ src/plugins/platforms/xlib/qtestlitekeyboard.cpp | 1000 ++++++++++++++++++++ src/plugins/platforms/xlib/qtestlitekeyboard.h | 76 ++ src/plugins/platforms/xlib/qtestlitemime.cpp | 322 +++++++ src/plugins/platforms/xlib/qtestlitemime.h | 67 ++ src/plugins/platforms/xlib/qtestlitescreen.cpp | 468 +++++++++ src/plugins/platforms/xlib/qtestlitescreen.h | 104 ++ src/plugins/platforms/xlib/qtestlitestaticinfo.cpp | 511 ++++++++++ src/plugins/platforms/xlib/qtestlitestaticinfo.h | 413 ++++++++ src/plugins/platforms/xlib/qtestlitewindow.cpp | 735 ++++++++++++++ src/plugins/platforms/xlib/qtestlitewindow.h | 145 +++ .../platforms/xlib/qtestlitewindowsurface.cpp | 224 +++++ .../platforms/xlib/qtestlitewindowsurface.h | 86 ++ src/plugins/platforms/xlib/testlite.pro | 57 ++ 48 files changed, 6275 insertions(+), 6275 deletions(-) delete mode 100644 src/plugins/platforms/testlite/main.cpp delete mode 100644 src/plugins/platforms/testlite/qglxintegration.cpp delete mode 100644 src/plugins/platforms/testlite/qglxintegration.h delete mode 100644 src/plugins/platforms/testlite/qtestliteclipboard.cpp delete mode 100644 src/plugins/platforms/testlite/qtestliteclipboard.h delete mode 100644 src/plugins/platforms/testlite/qtestlitecursor.cpp delete mode 100644 src/plugins/platforms/testlite/qtestlitecursor.h delete mode 100644 src/plugins/platforms/testlite/qtestliteeglintegration.cpp delete mode 100644 src/plugins/platforms/testlite/qtestliteeglintegration.h delete mode 100644 src/plugins/platforms/testlite/qtestliteintegration.cpp delete mode 100644 src/plugins/platforms/testlite/qtestliteintegration.h delete mode 100644 src/plugins/platforms/testlite/qtestlitekeyboard.cpp delete mode 100644 src/plugins/platforms/testlite/qtestlitekeyboard.h delete mode 100644 src/plugins/platforms/testlite/qtestlitemime.cpp delete mode 100644 src/plugins/platforms/testlite/qtestlitemime.h delete mode 100644 src/plugins/platforms/testlite/qtestlitescreen.cpp delete mode 100644 src/plugins/platforms/testlite/qtestlitescreen.h delete mode 100644 src/plugins/platforms/testlite/qtestlitestaticinfo.cpp delete mode 100644 src/plugins/platforms/testlite/qtestlitestaticinfo.h delete mode 100644 src/plugins/platforms/testlite/qtestlitewindow.cpp delete mode 100644 src/plugins/platforms/testlite/qtestlitewindow.h delete mode 100644 src/plugins/platforms/testlite/qtestlitewindowsurface.cpp delete mode 100644 src/plugins/platforms/testlite/qtestlitewindowsurface.h delete mode 100644 src/plugins/platforms/testlite/testlite.pro create mode 100644 src/plugins/platforms/xlib/main.cpp create mode 100644 src/plugins/platforms/xlib/qglxintegration.cpp create mode 100644 src/plugins/platforms/xlib/qglxintegration.h create mode 100644 src/plugins/platforms/xlib/qtestliteclipboard.cpp create mode 100644 src/plugins/platforms/xlib/qtestliteclipboard.h create mode 100644 src/plugins/platforms/xlib/qtestlitecursor.cpp create mode 100644 src/plugins/platforms/xlib/qtestlitecursor.h create mode 100644 src/plugins/platforms/xlib/qtestliteeglintegration.cpp create mode 100644 src/plugins/platforms/xlib/qtestliteeglintegration.h create mode 100644 src/plugins/platforms/xlib/qtestliteintegration.cpp create mode 100644 src/plugins/platforms/xlib/qtestliteintegration.h create mode 100644 src/plugins/platforms/xlib/qtestlitekeyboard.cpp create mode 100644 src/plugins/platforms/xlib/qtestlitekeyboard.h create mode 100644 src/plugins/platforms/xlib/qtestlitemime.cpp create mode 100644 src/plugins/platforms/xlib/qtestlitemime.h create mode 100644 src/plugins/platforms/xlib/qtestlitescreen.cpp create mode 100644 src/plugins/platforms/xlib/qtestlitescreen.h create mode 100644 src/plugins/platforms/xlib/qtestlitestaticinfo.cpp create mode 100644 src/plugins/platforms/xlib/qtestlitestaticinfo.h create mode 100644 src/plugins/platforms/xlib/qtestlitewindow.cpp create mode 100644 src/plugins/platforms/xlib/qtestlitewindow.h create mode 100644 src/plugins/platforms/xlib/qtestlitewindowsurface.cpp create mode 100644 src/plugins/platforms/xlib/qtestlitewindowsurface.h create mode 100644 src/plugins/platforms/xlib/testlite.pro diff --git a/src/plugins/platforms/testlite/main.cpp b/src/plugins/platforms/testlite/main.cpp deleted file mode 100644 index 131d399..0000000 --- a/src/plugins/platforms/testlite/main.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include "qtestliteintegration.h" - -QT_BEGIN_NAMESPACE - -class QXlibIntegrationPlugin : public QPlatformIntegrationPlugin -{ -public: - QStringList keys() const; - QPlatformIntegration *create(const QString&, const QStringList&); -}; - -QStringList QXlibIntegrationPlugin::keys() const -{ - QStringList list; - list << "Xlib"; -#ifndef QT_NO_OPENGL - list << "XlibGL"; -#endif - return list; -} - -QPlatformIntegration* QXlibIntegrationPlugin::create(const QString& system, const QStringList& paramList) -{ - Q_UNUSED(paramList); - if (system.toLower() == "xlib") - return new QXlibIntegration; -#ifndef QT_NO_OPENGL - if (system.toLower() == "xlibgl") - return new QXlibIntegration(true); -#endif - - return 0; -} - -Q_EXPORT_PLUGIN2(xlib, QXlibIntegrationPlugin) - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/testlite/qglxintegration.cpp b/src/plugins/platforms/testlite/qglxintegration.cpp deleted file mode 100644 index 46dfef9..0000000 --- a/src/plugins/platforms/testlite/qglxintegration.cpp +++ /dev/null @@ -1,376 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include - -#include "qtestlitewindow.h" -#include "qtestlitescreen.h" - -#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2) -#include -#include -#include - -#include "qglxintegration.h" - -#if defined(Q_OS_LINUX) || defined(Q_OS_BSD4) -#include -#endif - -QT_BEGIN_NAMESPACE - -QMutex QGLXContext::m_defaultSharedContextMutex(QMutex::Recursive); - -QVector QGLXContext::buildSpec(const QPlatformWindowFormat &format) -{ - QVector spec(48); - int i = 0; - - spec[i++] = GLX_LEVEL; - spec[i++] = 0; - spec[i++] = GLX_DRAWABLE_TYPE; spec[i++] = GLX_WINDOW_BIT; - - if (format.rgba()) { - spec[i++] = GLX_RENDER_TYPE; spec[i++] = GLX_RGBA_BIT; - spec[i++] = GLX_RED_SIZE; spec[i++] = (format.redBufferSize() == -1) ? 1 : format.redBufferSize(); - spec[i++] = GLX_GREEN_SIZE; spec[i++] = (format.greenBufferSize() == -1) ? 1 : format.greenBufferSize(); - spec[i++] = GLX_BLUE_SIZE; spec[i++] = (format.blueBufferSize() == -1) ? 1 : format.blueBufferSize(); - if (format.alpha()) { - spec[i++] = GLX_ALPHA_SIZE; spec[i++] = (format.alphaBufferSize() == -1) ? 1 : format.alphaBufferSize(); - } - - spec[i++] = GLX_ACCUM_RED_SIZE; spec[i++] = (format.accumBufferSize() == -1) ? 1 : format.accumBufferSize(); - spec[i++] = GLX_ACCUM_GREEN_SIZE; spec[i++] = (format.accumBufferSize() == -1) ? 1 : format.accumBufferSize(); - spec[i++] = GLX_ACCUM_BLUE_SIZE; spec[i++] = (format.accumBufferSize() == -1) ? 1 : format.accumBufferSize(); - - if (format.alpha()) { - spec[i++] = GLX_ACCUM_ALPHA_SIZE; spec[i++] = (format.accumBufferSize() == -1) ? 1 : format.accumBufferSize(); - } - - } else { - spec[i++] = GLX_RENDER_TYPE; spec[i++] = GLX_COLOR_INDEX_BIT; //I'm really not sure if this works.... - spec[i++] = GLX_BUFFER_SIZE; spec[i++] = 8; - } - - spec[i++] = GLX_DOUBLEBUFFER; spec[i++] = format.doubleBuffer() ? True : False; - spec[i++] = GLX_STEREO; spec[i++] = format.stereo() ? True : False; - - if (format.depth()) { - spec[i++] = GLX_DEPTH_SIZE; spec[i++] = (format.depthBufferSize() == -1) ? 1 : format.depthBufferSize(); - } - - if (format.stencil()) { - spec[i++] = GLX_STENCIL_SIZE; spec[i++] = (format.stencilBufferSize() == -1) ? 1 : format.stencilBufferSize(); - } - if (format.sampleBuffers()) { - spec[i++] = GLX_SAMPLE_BUFFERS_ARB; - spec[i++] = 1; - spec[i++] = GLX_SAMPLES_ARB; - spec[i++] = format.samples() == -1 ? 4 : format.samples(); - } - - spec[i++] = XNone; - return spec; -} - -GLXFBConfig QGLXContext::findConfig(const QXlibScreen *screen, const QPlatformWindowFormat &format) -{ - bool reduced = true; - GLXFBConfig chosenConfig = 0; - QPlatformWindowFormat reducedFormat = format; - while (!chosenConfig && reduced) { - QVector spec = buildSpec(reducedFormat); - int confcount = 0; - GLXFBConfig *configs; - configs = glXChooseFBConfig(screen->display(),screen->xScreenNumber(),spec.constData(),&confcount); - if (confcount) - { - for (int i = 0; i < confcount; i++) { - chosenConfig = configs[i]; - // Make sure we try to get an ARGB visual if the format asked for an alpha: - if (reducedFormat.alpha()) { - int alphaSize; - glXGetFBConfigAttrib(screen->display(),configs[i],GLX_ALPHA_SIZE,&alphaSize); - if (alphaSize > 0) - break; - } else { - break; // Just choose the first in the list if there's no alpha requested - } - } - - XFree(configs); - } - reducedFormat = reducePlatformWindowFormat(reducedFormat,&reduced); - } - - if (!chosenConfig) - qWarning("Warning no context created"); - - return chosenConfig; -} - -XVisualInfo *QGLXContext::findVisualInfo(const QXlibScreen *screen, const QPlatformWindowFormat &format) -{ - GLXFBConfig config = QGLXContext::findConfig(screen,format); - XVisualInfo *visualInfo = glXGetVisualFromFBConfig(screen->display(),config); - return visualInfo; -} - -QPlatformWindowFormat QGLXContext::platformWindowFromGLXFBConfig(Display *display, GLXFBConfig config, GLXContext ctx) -{ - QPlatformWindowFormat format; - int redSize = 0; - int greenSize = 0; - int blueSize = 0; - int alphaSize = 0; - int depthSize = 0; - int stencilSize = 0; - int sampleBuffers = 0; - int sampleCount = 0; - int level = 0; - int rgba = 0; - int stereo = 0; - int accumSizeA = 0; - int accumSizeR = 0; - int accumSizeG = 0; - int accumSizeB = 0; - - XVisualInfo *vi = glXGetVisualFromFBConfig(display,config); - glXGetConfig(display,vi,GLX_RGBA,&rgba); - XFree(vi); - glXGetFBConfigAttrib(display, config, GLX_RED_SIZE, &redSize); - glXGetFBConfigAttrib(display, config, GLX_GREEN_SIZE, &greenSize); - glXGetFBConfigAttrib(display, config, GLX_BLUE_SIZE, &blueSize); - glXGetFBConfigAttrib(display, config, GLX_ALPHA_SIZE, &alphaSize); - glXGetFBConfigAttrib(display, config, GLX_DEPTH_SIZE, &depthSize); - glXGetFBConfigAttrib(display, config, GLX_STENCIL_SIZE, &stencilSize); - glXGetFBConfigAttrib(display, config, GLX_SAMPLES, &sampleBuffers); - glXGetFBConfigAttrib(display, config, GLX_LEVEL, &level); - glXGetFBConfigAttrib(display, config, GLX_STEREO, &stereo); - glXGetFBConfigAttrib(display, config, GLX_ACCUM_ALPHA_SIZE, &accumSizeA); - glXGetFBConfigAttrib(display, config, GLX_ACCUM_RED_SIZE, &accumSizeR); - glXGetFBConfigAttrib(display, config, GLX_ACCUM_GREEN_SIZE, &accumSizeG); - glXGetFBConfigAttrib(display, config, GLX_ACCUM_BLUE_SIZE, &accumSizeB); - - format.setRedBufferSize(redSize); - format.setGreenBufferSize(greenSize); - format.setBlueBufferSize(blueSize); - format.setAlphaBufferSize(alphaSize); - format.setDepthBufferSize(depthSize); - format.setStencilBufferSize(stencilSize); - format.setSampleBuffers(sampleBuffers); - if (format.sampleBuffers()) { - glXGetFBConfigAttrib(display, config, GLX_SAMPLES_ARB, &sampleCount); - format.setSamples(sampleCount); - } - - format.setDirectRendering(glXIsDirect(display, ctx)); - format.setRgba(rgba); - format.setStereo(stereo); - format.setAccumBufferSize(accumSizeB); - - return format; -} - -QPlatformWindowFormat QGLXContext::reducePlatformWindowFormat(const QPlatformWindowFormat &format, bool *reduced) -{ - QPlatformWindowFormat retFormat = format; - *reduced = true; - - if (retFormat.sampleBuffers()) { - retFormat.setSampleBuffers(false); - } else if (retFormat.stereo()) { - retFormat.setStereo(false); - } else if (retFormat.accum()) { - retFormat.setAccum(false); - }else if (retFormat.stencil()) { - retFormat.setStencil(false); - }else if (retFormat.alpha()) { - retFormat.setAlpha(false); - }else if (retFormat.depth()) { - retFormat.setDepth(false); - }else if (retFormat.doubleBuffer()) { - retFormat.setDoubleBuffer(false); - }else{ - *reduced = false; - } - return retFormat; -} - -QGLXContext::QGLXContext(Window window, QXlibScreen *screen, const QPlatformWindowFormat &format) - : QPlatformGLContext() - , m_screen(screen) - , m_drawable((Drawable)window) - , m_context(0) -{ - - const QPlatformGLContext *sharePlatformContext; - if (format.useDefaultSharedContext()) { - if (!QPlatformGLContext::defaultSharedContext()) { - if (m_defaultSharedContextMutex.tryLock()){ - createDefaultSharedContex(screen); - m_defaultSharedContextMutex.unlock(); - } else { - m_defaultSharedContextMutex.lock(); //wait to the the shared context is created - m_defaultSharedContextMutex.unlock(); - } - } - sharePlatformContext = QPlatformGLContext::defaultSharedContext(); - } else { - sharePlatformContext = format.sharedGLContext(); - } - GLXContext shareGlxContext = 0; - if (sharePlatformContext) - shareGlxContext = static_cast(sharePlatformContext)->glxContext(); - - GLXFBConfig config = findConfig(screen,format); - m_context = glXCreateNewContext(screen->display(),config,GLX_RGBA_TYPE,shareGlxContext,TRUE); - m_windowFormat = QGLXContext::platformWindowFromGLXFBConfig(screen->display(),config,m_context); - -#ifdef MYX11_DEBUG - qDebug() << "QGLXGLContext::create context" << m_context; -#endif -} - -QGLXContext::QGLXContext(QXlibScreen *screen, Drawable drawable, GLXContext context) - : QPlatformGLContext(), m_screen(screen), m_drawable(drawable), m_context(context) -{ - -} - -QGLXContext::~QGLXContext() -{ - if (m_context) { - qDebug("Destroying GLX context 0x%p", m_context); - glXDestroyContext(m_screen->display(), m_context); - } -} - -void QGLXContext::createDefaultSharedContex(QXlibScreen *screen) -{ - int x = 0; - int y = 0; - int w = 3; - int h = 3; - - QPlatformWindowFormat format = QPlatformWindowFormat::defaultFormat(); - GLXContext context; - GLXFBConfig config = findConfig(screen,format); - if (config) { - XVisualInfo *visualInfo = glXGetVisualFromFBConfig(screen->display(),config); - Colormap cmap = XCreateColormap(screen->display(),screen->rootWindow(),visualInfo->visual,AllocNone); - XSetWindowAttributes a; - a.colormap = cmap; - Window sharedWindow = XCreateWindow(screen->display(), screen->rootWindow(),x, y, w, h, - 0, visualInfo->depth, InputOutput, visualInfo->visual, - CWColormap, &a); - - context = glXCreateNewContext(screen->display(),config,GLX_RGBA_TYPE,0,TRUE); - QPlatformGLContext *sharedContext = new QGLXContext(screen,sharedWindow,context); - QPlatformGLContext::setDefaultSharedContext(sharedContext); - } else { - qWarning("Warning no shared context created"); - } -} - -void QGLXContext::makeCurrent() -{ - QPlatformGLContext::makeCurrent(); -#ifdef MYX11_DEBUG - qDebug("QGLXGLContext::makeCurrent(window=0x%x, ctx=0x%x)", m_drawable, m_context); -#endif - glXMakeCurrent(m_screen->display(), m_drawable, m_context); -} - -void QGLXContext::doneCurrent() -{ - QPlatformGLContext::doneCurrent(); - glXMakeCurrent(m_screen->display(), 0, 0); -} - -void QGLXContext::swapBuffers() -{ - glXSwapBuffers(m_screen->display(), m_drawable); -} - -void* QGLXContext::getProcAddress(const QString& procName) -{ - typedef void *(*qt_glXGetProcAddressARB)(const GLubyte *); - static qt_glXGetProcAddressARB glXGetProcAddressARB = 0; - static bool resolved = false; - - if (resolved && !glXGetProcAddressARB) - return 0; - if (!glXGetProcAddressARB) { - QList glxExt = QByteArray(glXGetClientString(m_screen->display(), GLX_EXTENSIONS)).split(' '); - if (glxExt.contains("GLX_ARB_get_proc_address")) { -#if defined(Q_OS_LINUX) || defined(Q_OS_BSD4) - void *handle = dlopen(NULL, RTLD_LAZY); - if (handle) { - glXGetProcAddressARB = (qt_glXGetProcAddressARB) dlsym(handle, "glXGetProcAddressARB"); - dlclose(handle); - } - if (!glXGetProcAddressARB) -#endif - { - extern const QString qt_gl_library_name(); -// QLibrary lib(qt_gl_library_name()); - QLibrary lib(QLatin1String("GL")); - glXGetProcAddressARB = (qt_glXGetProcAddressARB) lib.resolve("glXGetProcAddressARB"); - } - } - resolved = true; - } - if (!glXGetProcAddressARB) - return 0; - return glXGetProcAddressARB(reinterpret_cast(procName.toLatin1().data())); -} - -QPlatformWindowFormat QGLXContext::platformWindowFormat() const -{ - return m_windowFormat; -} - -QT_END_NAMESPACE - -#endif //!defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2) diff --git a/src/plugins/platforms/testlite/qglxintegration.h b/src/plugins/platforms/testlite/qglxintegration.h deleted file mode 100644 index f982708..0000000 --- a/src/plugins/platforms/testlite/qglxintegration.h +++ /dev/null @@ -1,94 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef Q_GLX_CONTEXT_H -#define Q_GLX_CONTEXT_H - -#include "qtestlitewindow.h" - -#include -#include - -#include - -#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2) -#include - -QT_BEGIN_NAMESPACE - -class QGLXContext : public QPlatformGLContext -{ -public: - QGLXContext(Window window, QXlibScreen *xd, const QPlatformWindowFormat &format); - ~QGLXContext(); - - virtual void makeCurrent(); - virtual void doneCurrent(); - virtual void swapBuffers(); - virtual void* getProcAddress(const QString& procName); - - GLXContext glxContext() const {return m_context;} - - QPlatformWindowFormat platformWindowFormat() const; - - static XVisualInfo *findVisualInfo(const QXlibScreen *xd, const QPlatformWindowFormat &format); -private: - static GLXFBConfig findConfig(const QXlibScreen *xd,const QPlatformWindowFormat &format); - static QVector buildSpec(const QPlatformWindowFormat &format); - static QPlatformWindowFormat platformWindowFromGLXFBConfig(Display *display, GLXFBConfig config, GLXContext context); - static QPlatformWindowFormat reducePlatformWindowFormat(const QPlatformWindowFormat &format, bool *reduced); - - - QXlibScreen *m_screen; - Drawable m_drawable; - GLXContext m_context; - QPlatformWindowFormat m_windowFormat; - - QGLXContext (QXlibScreen *screen, Drawable drawable, GLXContext context); - static QMutex m_defaultSharedContextMutex; - static void createDefaultSharedContex(QXlibScreen *xd); -}; - -QT_END_NAMESPACE - -#endif //!defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2) - -#endif diff --git a/src/plugins/platforms/testlite/qtestliteclipboard.cpp b/src/plugins/platforms/testlite/qtestliteclipboard.cpp deleted file mode 100644 index 1264b5a..0000000 --- a/src/plugins/platforms/testlite/qtestliteclipboard.cpp +++ /dev/null @@ -1,676 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qtestliteclipboard.h" - -#include "qtestlitescreen.h" -#include "qtestlitemime.h" - -#include - -#include - -class QXlibClipboardMime : public QXlibMime -{ - Q_OBJECT -public: - QXlibClipboardMime(QClipboard::Mode mode, QXlibClipboard *clipboard) - : QXlibMime() - , m_clipboard(clipboard) - { - switch (mode) { - case QClipboard::Selection: - modeAtom = XA_PRIMARY; - break; - - case QClipboard::Clipboard: - modeAtom = QXlibStatic::atom(QXlibStatic::CLIPBOARD); - break; - - default: - qWarning("QTestLiteMime: Internal error: Unsupported clipboard mode"); - break; - } - } - -protected: - QStringList formats_sys() const - { - if (empty()) - return QStringList(); - - if (!formatList.count()) { - QXlibClipboardMime *that = const_cast(this); - // get the list of targets from the current clipboard owner - we do this - // once so that multiple calls to this function don't require multiple - // server round trips... - that->format_atoms = m_clipboard->getDataInFormat(modeAtom,QXlibStatic::atom(QXlibStatic::TARGETS)); - - if (format_atoms.size() > 0) { - Atom *targets = (Atom *) format_atoms.data(); - int size = format_atoms.size() / sizeof(Atom); - - for (int i = 0; i < size; ++i) { - if (targets[i] == 0) - continue; - - QStringList formatsForAtom = mimeFormatsForAtom(m_clipboard->screen()->display(),targets[i]); - for (int j = 0; j < formatsForAtom.size(); ++j) { - if (!formatList.contains(formatsForAtom.at(j))) - that->formatList.append(formatsForAtom.at(j)); - } - } - } - } - - return formatList; - } - - bool hasFormat_sys(const QString &format) const - { - QStringList list = formats(); - return list.contains(format); - } - - QVariant retrieveData_sys(const QString &fmt, QVariant::Type requestedType) const - { - if (fmt.isEmpty() || empty()) - return QByteArray(); - - (void)formats(); // trigger update of format list - - QList atoms; - Atom *targets = (Atom *) format_atoms.data(); - int size = format_atoms.size() / sizeof(Atom); - for (int i = 0; i < size; ++i) - atoms.append(targets[i]); - - QByteArray encoding; - Atom fmtatom = mimeAtomForFormat(m_clipboard->screen()->display(),fmt, requestedType, atoms, &encoding); - - if (fmtatom == 0) - return QVariant(); - - return mimeConvertToFormat(m_clipboard->screen()->display(),fmtatom, m_clipboard->getDataInFormat(modeAtom,fmtatom), fmt, requestedType, encoding); - } -private: - bool empty() const - { - Window win = XGetSelectionOwner(m_clipboard->screen()->display(), modeAtom); - - return win == XNone; - } - - - Atom modeAtom; - QXlibClipboard *m_clipboard; - QStringList formatList; - QByteArray format_atoms; -}; - -const int QXlibClipboard::clipboard_timeout = 5000; - -QXlibClipboard::QXlibClipboard(QXlibScreen *screen) - : QPlatformClipboard() - , m_screen(screen) - , m_xClipboard(0) - , m_clientClipboard(0) - , m_xSelection(0) - , m_clientSelection(0) - , m_requestor(XNone) - , m_owner(XNone) -{ -} - -const QMimeData * QXlibClipboard::mimeData(QClipboard::Mode mode) const -{ - if (mode == QClipboard::Clipboard) { - if (!m_xClipboard) { - QXlibClipboard *that = const_cast(this); - that->m_xClipboard = new QXlibClipboardMime(mode,that); - } - Window clipboardOwner = XGetSelectionOwner(screen()->display(),QXlibStatic::atom(QXlibStatic::CLIPBOARD)); - if (clipboardOwner == owner()) { - return m_clientClipboard; - } else { - return m_xClipboard; - } - } else if (mode == QClipboard::Selection) { - if (!m_xSelection) { - QXlibClipboard *that = const_cast(this); - that->m_xSelection = new QXlibClipboardMime(mode,that); - } - Window clipboardOwner = XGetSelectionOwner(screen()->display(),XA_PRIMARY); - if (clipboardOwner == owner()) { - return m_clientSelection; - } else { - return m_xSelection; - } - } - return 0; -} - -void QXlibClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode) -{ - Atom modeAtom; - QMimeData **d; - switch (mode) { - case QClipboard::Selection: - modeAtom = XA_PRIMARY; - d = &m_clientSelection; - break; - - case QClipboard::Clipboard: - modeAtom = QXlibStatic::atom(QXlibStatic::CLIPBOARD); - d = &m_clientClipboard; - break; - - default: - qWarning("QClipboard::setMimeData: unsupported mode '%d'", mode); - return; - } - - Window newOwner; - - if (! data) { // no data, clear clipboard contents - newOwner = XNone; - } else { - newOwner = owner(); - - *d = data; - } - - XSetSelectionOwner(m_screen->display(), modeAtom, newOwner, CurrentTime); - - if (XGetSelectionOwner(m_screen->display(), modeAtom) != newOwner) { - qWarning("QClipboard::setData: Cannot set X11 selection owner"); - } - -} - -bool QXlibClipboard::supportsMode(QClipboard::Mode mode) const -{ - if (mode == QClipboard::Clipboard || mode == QClipboard::Selection) - return true; - return false; -} - - -QXlibScreen * QXlibClipboard::screen() const -{ - return m_screen; -} - -Window QXlibClipboard::requestor() const -{ - if (!m_requestor) { - int x = 0, y = 0, w = 3, h = 3; - QXlibClipboard *that = const_cast(this); - Window window = XCreateSimpleWindow(m_screen->display(), m_screen->rootWindow(), - x, y, w, h, 0 /*border_width*/, - m_screen->blackPixel(), m_screen->whitePixel()); - that->setRequestor(window); - } - return m_requestor; -} - -void QXlibClipboard::setRequestor(Window window) -{ - if (m_requestor != XNone) { - XDestroyWindow(m_screen->display(),m_requestor); - } - m_requestor = window; -} - -Window QXlibClipboard::owner() const -{ - if (!m_owner) { - int x = 0, y = 0, w = 3, h = 3; - QXlibClipboard *that = const_cast(this); - Window window = XCreateSimpleWindow(m_screen->display(), m_screen->rootWindow(), - x, y, w, h, 0 /*border_width*/, - m_screen->blackPixel(), m_screen->whitePixel()); - that->setOwner(window); - } - return m_owner; -} - -void QXlibClipboard::setOwner(Window window) -{ - if (m_owner != XNone){ - XDestroyWindow(m_screen->display(),m_owner); - } - m_owner = window; -} - -Atom QXlibClipboard::sendTargetsSelection(QMimeData *d, Window window, Atom property) -{ - QVector types; - QStringList formats = QInternalMimeData::formatsHelper(d); - for (int i = 0; i < formats.size(); ++i) { - QList atoms = QXlibMime::mimeAtomsForFormat(screen()->display(),formats.at(i)); - for (int j = 0; j < atoms.size(); ++j) { - if (!types.contains(atoms.at(j))) - types.append(atoms.at(j)); - } - } - types.append(QXlibStatic::atom(QXlibStatic::TARGETS)); - types.append(QXlibStatic::atom(QXlibStatic::MULTIPLE)); - types.append(QXlibStatic::atom(QXlibStatic::TIMESTAMP)); - types.append(QXlibStatic::atom(QXlibStatic::SAVE_TARGETS)); - - XChangeProperty(screen()->display(), window, property, XA_ATOM, 32, - PropModeReplace, (uchar *) types.data(), types.size()); - return property; -} - -Atom QXlibClipboard::sendSelection(QMimeData *d, Atom target, Window window, Atom property) -{ - Atom atomFormat = target; - int dataFormat = 0; - QByteArray data; - - QString fmt = QXlibMime::mimeAtomToString(screen()->display(), target); - if (fmt.isEmpty()) { // Not a MIME type we have - qDebug() << "QClipboard: send_selection(): converting to type '%s' is not supported" << fmt.data(); - return XNone; - } - qDebug() << "QClipboard: send_selection(): converting to type '%s'" << fmt.data(); - - if (QXlibMime::mimeDataForAtom(screen()->display(),target, d, &data, &atomFormat, &dataFormat)) { - - // don't allow INCR transfers when using MULTIPLE or to - // Motif clients (since Motif doesn't support INCR) - static Atom motif_clip_temporary = QXlibStatic::atom(QXlibStatic::CLIP_TEMPORARY); - bool allow_incr = property != motif_clip_temporary; - - // X_ChangeProperty protocol request is 24 bytes - const int increment = (XMaxRequestSize(screen()->display()) * 4) - 24; - if (data.size() > increment && allow_incr) { - long bytes = data.size(); - XChangeProperty(screen()->display(), window, property, - QXlibStatic::atom(QXlibStatic::INCR), 32, PropModeReplace, (uchar *) &bytes, 1); - -// (void)new QClipboardINCRTransaction(window, property, atomFormat, dataFormat, data, increment); - qDebug() << "not implemented INCRT just YET!"; - return property; - } - - // make sure we can perform the XChangeProperty in a single request - if (data.size() > increment) - return XNone; // ### perhaps use several XChangeProperty calls w/ PropModeAppend? - int dataSize = data.size() / (dataFormat / 8); - // use a single request to transfer data - XChangeProperty(screen()->display(), window, property, atomFormat, - dataFormat, PropModeReplace, (uchar *) data.data(), - dataSize); - } - return property; -} - -void QXlibClipboard::handleSelectionRequest(XEvent *xevent) -{ - XSelectionRequestEvent *req = &xevent->xselectionrequest; - - if (requestor() && req->requestor == requestor()) { - qDebug() << "This should be caught before"; - return; - } - - XEvent event; - event.xselection.type = SelectionNotify; - event.xselection.display = req->display; - event.xselection.requestor = req->requestor; - event.xselection.selection = req->selection; - event.xselection.target = req->target; - event.xselection.property = XNone; - event.xselection.time = req->time; - - QMimeData *d; - if (req->selection == XA_PRIMARY) { - d = m_clientSelection; - } else if (req->selection == QXlibStatic::atom(QXlibStatic::CLIPBOARD)) { - d = m_clientClipboard; - } else { - qWarning("QClipboard: Unknown selection '%lx'", req->selection); - XSendEvent(screen()->display(), req->requestor, False, NoEventMask, &event); - return; - } - - if (!d) { - qWarning("QClipboard: Cannot transfer data, no data available"); - XSendEvent(screen()->display(), req->requestor, False, NoEventMask, &event); - return; - } - - Atom xa_targets = QXlibStatic::atom(QXlibStatic::TARGETS); - Atom xa_multiple = QXlibStatic::atom(QXlibStatic::MULTIPLE); - Atom xa_timestamp = QXlibStatic::atom(QXlibStatic::TIMESTAMP); - - struct AtomPair { Atom target; Atom property; } *multi = 0; - Atom multi_type = XNone; - int multi_format = 0; - int nmulti = 0; - int imulti = -1; - bool multi_writeback = false; - - if (req->target == xa_multiple) { - QByteArray multi_data; - if (req->property == XNone - || !clipboardReadProperty(req->requestor, req->property, false, &multi_data, - 0, &multi_type, &multi_format) - || multi_format != 32) { - // MULTIPLE property not formatted correctly - XSendEvent(screen()->display(), req->requestor, False, NoEventMask, &event); - return; - } - nmulti = multi_data.size()/sizeof(*multi); - multi = new AtomPair[nmulti]; - memcpy(multi,multi_data.data(),multi_data.size()); - imulti = 0; - } - - for (; imulti < nmulti; ++imulti) { - Atom target; - Atom property; - - if (multi) { - target = multi[imulti].target; - property = multi[imulti].property; - } else { - target = req->target; - property = req->property; - if (property == XNone) // obsolete client - property = target; - } - - Atom ret = XNone; - if (target == XNone || property == XNone) { - ; - } else if (target == xa_timestamp) { -// if (d->timestamp != CurrentTime) { -// XChangeProperty(screen()->display(), req->requestor, property, XA_INTEGER, 32, -// PropModeReplace, CurrentTime, 1); -// ret = property; -// } else { -// qWarning("QClipboard: Invalid data timestamp"); -// } - } else if (target == xa_targets) { - ret = sendTargetsSelection(d, req->requestor, property); - } else { - ret = sendSelection(d, target, req->requestor, property); - } - - if (nmulti > 0) { - if (ret == XNone) { - multi[imulti].property = XNone; - multi_writeback = true; - } - } else { - event.xselection.property = ret; - break; - } - } - - if (nmulti > 0) { - if (multi_writeback) { - // according to ICCCM 2.6.2 says to put None back - // into the original property on the requestor window - XChangeProperty(screen()->display(), req->requestor, req->property, multi_type, 32, - PropModeReplace, (uchar *) multi, nmulti * 2); - } - - delete [] multi; - event.xselection.property = req->property; - } - - // send selection notify to requestor - XSendEvent(screen()->display(), req->requestor, False, NoEventMask, &event); -} - -static inline int maxSelectionIncr(Display *dpy) -{ return XMaxRequestSize(dpy) > 65536 ? 65536*4 : XMaxRequestSize(dpy)*4 - 100; } - -bool QXlibClipboard::clipboardReadProperty(Window win, Atom property, bool deleteProperty, QByteArray *buffer, int *size, Atom *type, int *format) const -{ - int maxsize = maxSelectionIncr(screen()->display()); - ulong bytes_left; // bytes_after - ulong length; // nitems - uchar *data; - Atom dummy_type; - int dummy_format; - int r; - - if (!type) // allow null args - type = &dummy_type; - if (!format) - format = &dummy_format; - - // Don't read anything, just get the size of the property data - r = XGetWindowProperty(screen()->display(), win, property, 0, 0, False, - AnyPropertyType, type, format, - &length, &bytes_left, &data); - if (r != Success || (type && *type == XNone)) { - buffer->resize(0); - return false; - } - XFree((char*)data); - - int offset = 0, buffer_offset = 0, format_inc = 1, proplen = bytes_left; - - switch (*format) { - case 8: - default: - format_inc = sizeof(char) / 1; - break; - - case 16: - format_inc = sizeof(short) / 2; - proplen *= sizeof(short) / 2; - break; - - case 32: - format_inc = sizeof(long) / 4; - proplen *= sizeof(long) / 4; - break; - } - - int newSize = proplen; - buffer->resize(newSize); - - bool ok = (buffer->size() == newSize); - - if (ok && newSize) { - // could allocate buffer - - while (bytes_left) { - // more to read... - - r = XGetWindowProperty(screen()->display(), win, property, offset, maxsize/4, - False, AnyPropertyType, type, format, - &length, &bytes_left, &data); - if (r != Success || (type && *type == XNone)) - break; - - offset += length / (32 / *format); - length *= format_inc * (*format) / 8; - - // Here we check if we get a buffer overflow and tries to - // recover -- this shouldn't normally happen, but it doesn't - // hurt to be defensive - if ((int)(buffer_offset + length) > buffer->size()) { - length = buffer->size() - buffer_offset; - - // escape loop - bytes_left = 0; - } - - memcpy(buffer->data() + buffer_offset, data, length); - buffer_offset += length; - - XFree((char*)data); - } - - if (*format == 8 && *type == QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT)) { - // convert COMPOUND_TEXT to a multibyte string - XTextProperty textprop; - textprop.encoding = *type; - textprop.format = *format; - textprop.nitems = buffer_offset; - textprop.value = (unsigned char *) buffer->data(); - - char **list_ret = 0; - int count; - if (XmbTextPropertyToTextList(screen()->display(), &textprop, &list_ret, - &count) == Success && count && list_ret) { - offset = buffer_offset = strlen(list_ret[0]); - buffer->resize(offset); - memcpy(buffer->data(), list_ret[0], offset); - } - if (list_ret) XFreeStringList(list_ret); - } - } - - // correct size, not 0-term. - if (size) - *size = buffer_offset; - - if (deleteProperty) - XDeleteProperty(screen()->display(), win, property); - - XFlush(screen()->display()); - - return ok; -} - -QByteArray QXlibClipboard::clipboardReadIncrementalProperty(Window win, Atom property, int nbytes, bool nullterm) -{ - XEvent event; - - QByteArray buf; - QByteArray tmp_buf; - bool alloc_error = false; - int length; - int offset = 0; - - if (nbytes > 0) { - // Reserve buffer + zero-terminator (for text data) - // We want to complete the INCR transfer even if we cannot - // allocate more memory - buf.resize(nbytes+1); - alloc_error = buf.size() != nbytes+1; - } - - for (;;) { - XFlush(screen()->display()); - if (!screen()->waitForClipboardEvent(win,PropertyNotify,&event,clipboard_timeout)) - break; - if (event.xproperty.atom != property || - event.xproperty.state != PropertyNewValue) - continue; - if (clipboardReadProperty(win, property, true, &tmp_buf, &length, 0, 0)) { - if (length == 0) { // no more data, we're done - if (nullterm) { - buf.resize(offset+1); - buf[offset] = '\0'; - } else { - buf.resize(offset); - } - return buf; - } else if (!alloc_error) { - if (offset+length > (int)buf.size()) { - buf.resize(offset+length+65535); - if (buf.size() != offset+length+65535) { - alloc_error = true; - length = buf.size() - offset; - } - } - memcpy(buf.data()+offset, tmp_buf.constData(), length); - tmp_buf.resize(0); - offset += length; - } - } else { - break; - } - } - - // timed out ... create a new requestor window, otherwise the requestor - // could consider next request to be still part of this timed out request - setRequestor(0); - - return QByteArray(); -} - -QByteArray QXlibClipboard::getDataInFormat(Atom modeAtom, Atom fmtatom) -{ - QByteArray buf; - - Window win = requestor(); - - XSelectInput(screen()->display(), win, NoEventMask); // don't listen for any events - - XDeleteProperty(screen()->display(), win, QXlibStatic::atom(QXlibStatic::_QT_SELECTION)); - XConvertSelection(screen()->display(), modeAtom, fmtatom, QXlibStatic::atom(QXlibStatic::_QT_SELECTION), win, CurrentTime); - XSync(screen()->display(), false); - - XEvent xevent; - if (!screen()->waitForClipboardEvent(win,SelectionNotify,&xevent,clipboard_timeout) || - xevent.xselection.property == XNone) { - return buf; - } - - Atom type; - XSelectInput(screen()->display(), win, PropertyChangeMask); - - if (clipboardReadProperty(win, QXlibStatic::atom(QXlibStatic::_QT_SELECTION), true, &buf, 0, &type, 0)) { - if (type == QXlibStatic::atom(QXlibStatic::INCR)) { - int nbytes = buf.size() >= 4 ? *((int*)buf.data()) : 0; - buf = clipboardReadIncrementalProperty(win, QXlibStatic::atom(QXlibStatic::_QT_SELECTION), nbytes, false); - } - } - - XSelectInput(screen()->display(), win, NoEventMask); - - - return buf; -} - -#include "qtestliteclipboard.moc" diff --git a/src/plugins/platforms/testlite/qtestliteclipboard.h b/src/plugins/platforms/testlite/qtestliteclipboard.h deleted file mode 100644 index 109714c..0000000 --- a/src/plugins/platforms/testlite/qtestliteclipboard.h +++ /dev/null @@ -1,94 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QTESTLITECLIPBOARD_H -#define QTESTLITECLIPBOARD_H - -#include -#include "qtestlitestaticinfo.h" - -class QXlibScreen; -class QXlibClipboard : public QPlatformClipboard -{ -public: - QXlibClipboard(QXlibScreen *screen); - - const QMimeData *mimeData(QClipboard::Mode mode) const; - void setMimeData(QMimeData *data, QClipboard::Mode mode); - - bool supportsMode(QClipboard::Mode mode) const; - - QXlibScreen *screen() const; - - Window requestor() const; - void setRequestor(Window window); - - Window owner() const; - - void handleSelectionRequest(XEvent *event); - - bool clipboardReadProperty(Window win, Atom property, bool deleteProperty, QByteArray *buffer, int *size, Atom *type, int *format) const; - QByteArray clipboardReadIncrementalProperty(Window win, Atom property, int nbytes, bool nullterm); - - QByteArray getDataInFormat(Atom modeAtom, Atom fmtatom); - -private: - void setOwner(Window window); - - Atom sendTargetsSelection(QMimeData *d, Window window, Atom property); - Atom sendSelection(QMimeData *d, Atom target, Window window, Atom property); - - QXlibScreen *m_screen; - - QMimeData *m_xClipboard; - QMimeData *m_clientClipboard; - - QMimeData *m_xSelection; - QMimeData *m_clientSelection; - - Window m_requestor; - Window m_owner; - - static const int clipboard_timeout; - -}; - -#endif // QTESTLITECLIPBOARD_H diff --git a/src/plugins/platforms/testlite/qtestlitecursor.cpp b/src/plugins/platforms/testlite/qtestlitecursor.cpp deleted file mode 100644 index 2f7cfbf..0000000 --- a/src/plugins/platforms/testlite/qtestlitecursor.cpp +++ /dev/null @@ -1,199 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qtestlitecursor.h" - -#include "qtestliteintegration.h" -#include "qtestlitescreen.h" -#include "qtestlitewindow.h" - -#include - -#include - -QT_BEGIN_NAMESPACE - -QXlibCursor::QXlibCursor(QXlibScreen *screen) - : QPlatformCursor(screen) -{ -} - -void QXlibCursor::changeCursor(QCursor *cursor, QWidget *widget) -{ - QXlibWindow *w = 0; - if (widget) { - QWidget *window = widget->window(); - w = static_cast(window->platformWindow()); - } else { - // No X11 cursor control when there is no widget under the cursor - return; - } - - if (!w) - return; - - int id = cursor->handle(); - - Cursor c; - if (!cursorMap.contains(id)) { - if (cursor->shape() == Qt::BitmapCursor) - c = createCursorBitmap(cursor); - else - c = createCursorShape(cursor->shape()); - if (!c) { - return; - } - cursorMap.insert(id, c); - } else { - c = cursorMap.value(id); - } - - w->setCursor(c); -} - -Cursor QXlibCursor::createCursorBitmap(QCursor * cursor) -{ - XColor bg, fg; - bg.red = 255 << 8; - bg.green = 255 << 8; - bg.blue = 255 << 8; - fg.red = 0; - fg.green = 0; - fg.blue = 0; - QPoint spot = cursor->hotSpot(); - Window rootwin = testLiteScreen()->rootWindow(); - - QImage mapImage = cursor->bitmap()->toImage().convertToFormat(QImage::Format_MonoLSB); - QImage maskImage = cursor->mask()->toImage().convertToFormat(QImage::Format_MonoLSB); - - int width = cursor->bitmap()->width(); - int height = cursor->bitmap()->height(); - int bytesPerLine = mapImage.bytesPerLine(); - int destLineSize = width / 8; - if (width % 8) - destLineSize++; - - const uchar * map = mapImage.bits(); - const uchar * mask = maskImage.bits(); - - char * mapBits = new char[height * destLineSize]; - char * maskBits = new char[height * destLineSize]; - for (int i = 0; i < height; i++) { - memcpy(mapBits + (destLineSize * i),map + (bytesPerLine * i), destLineSize); - memcpy(maskBits + (destLineSize * i),mask + (bytesPerLine * i), destLineSize); - } - - Pixmap cp = XCreateBitmapFromData(testLiteScreen()->display(), rootwin, mapBits, width, height); - Pixmap mp = XCreateBitmapFromData(testLiteScreen()->display(), rootwin, maskBits, width, height); - Cursor c = XCreatePixmapCursor(testLiteScreen()->display(), cp, mp, &fg, &bg, spot.x(), spot.y()); - XFreePixmap(testLiteScreen()->display(), cp); - XFreePixmap(testLiteScreen()->display(), mp); - delete[] mapBits; - delete[] maskBits; - - return c; -} - -Cursor QXlibCursor::createCursorShape(int cshape) -{ - Cursor cursor = 0; - - if (cshape < 0 || cshape > Qt::LastCursor) - return 0; - - switch (cshape) { - case Qt::ArrowCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_left_ptr); - break; - case Qt::UpArrowCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_center_ptr); - break; - case Qt::CrossCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_crosshair); - break; - case Qt::WaitCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_watch); - break; - case Qt::IBeamCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_xterm); - break; - case Qt::SizeAllCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_fleur); - break; - case Qt::PointingHandCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_hand2); - break; - case Qt::SizeBDiagCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_top_right_corner); - break; - case Qt::SizeFDiagCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_bottom_right_corner); - break; - case Qt::SizeVerCursor: - case Qt::SplitVCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_sb_v_double_arrow); - break; - case Qt::SizeHorCursor: - case Qt::SplitHCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_sb_h_double_arrow); - break; - case Qt::WhatsThisCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_question_arrow); - break; - case Qt::ForbiddenCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_circle); - break; - case Qt::BusyCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_watch); - break; - - default: //default cursor for all the rest - break; - } - return cursor; -} - -QXlibScreen * QXlibCursor::testLiteScreen() const -{ - return static_cast(screen); -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/testlite/qtestlitecursor.h b/src/plugins/platforms/testlite/qtestlitecursor.h deleted file mode 100644 index db9f9e2..0000000 --- a/src/plugins/platforms/testlite/qtestlitecursor.h +++ /dev/null @@ -1,68 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QTESTLITECURSOR_H -#define QTESTLITECURSOR_H - -#include - -#include "qtestliteintegration.h" - -QT_BEGIN_NAMESPACE - -class QXlibCursor : QPlatformCursor -{ -public: - QXlibCursor(QXlibScreen *screen); - - void changeCursor(QCursor * cursor, QWidget * widget); -private: - - Cursor createCursorBitmap(QCursor * cursor); - Cursor createCursorShape(int cshape); - - QXlibScreen *testLiteScreen() const; - QMap cursorMap; -}; - -QT_END_NAMESPACE - -#endif // QTESTLITECURSOR_H diff --git a/src/plugins/platforms/testlite/qtestliteeglintegration.cpp b/src/plugins/platforms/testlite/qtestliteeglintegration.cpp deleted file mode 100644 index 9bbe0ca..0000000 --- a/src/plugins/platforms/testlite/qtestliteeglintegration.cpp +++ /dev/null @@ -1,186 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qtestliteeglintegration.h" - -static int countBits(unsigned long mask) -{ - int count = 0; - while (mask != 0) { - if (mask & 1) - ++count; - mask >>= 1; - } - return count; -} - -VisualID QXlibEglIntegration::getCompatibleVisualId(Display *display, EGLConfig config) -{ - VisualID visualId = 0; - EGLint eglValue = 0; - - EGLDisplay eglDisplay = eglGetDisplay(display); - - EGLint configRedSize = 0; - eglGetConfigAttrib(eglDisplay, config, EGL_RED_SIZE, &configRedSize); - - EGLint configGreenSize = 0; - eglGetConfigAttrib(eglDisplay, config, EGL_GREEN_SIZE, &configGreenSize); - - EGLint configBlueSize = 0; - eglGetConfigAttrib(eglDisplay, config, EGL_BLUE_SIZE, &configBlueSize); - - EGLint configAlphaSize = 0; - eglGetConfigAttrib(eglDisplay, config, EGL_ALPHA_SIZE, &configAlphaSize); - - eglGetConfigAttrib(eglDisplay, config, EGL_CONFIG_ID, &eglValue); - int configId = eglValue; - - // See if EGL provided a valid VisualID: - eglGetConfigAttrib(eglDisplay, config, EGL_NATIVE_VISUAL_ID, &eglValue); - visualId = (VisualID)eglValue; - if (visualId) { - // EGL has suggested a visual id, so get the rest of the visual info for that id: - XVisualInfo visualInfoTemplate; - memset(&visualInfoTemplate, 0, sizeof(XVisualInfo)); - visualInfoTemplate.visualid = visualId; - - XVisualInfo *chosenVisualInfo; - int matchingCount = 0; - chosenVisualInfo = XGetVisualInfo(display, VisualIDMask, &visualInfoTemplate, &matchingCount); - if (chosenVisualInfo) { - // Skip size checks if implementation supports non-matching visual - // and config (http://bugreports.qt.nokia.com/browse/QTBUG-9444). - if (q_hasEglExtension(eglDisplay,"EGL_NV_post_convert_rounding")) { - XFree(chosenVisualInfo); - return visualId; - } - - int visualRedSize = countBits(chosenVisualInfo->red_mask); - int visualGreenSize = countBits(chosenVisualInfo->green_mask); - int visualBlueSize = countBits(chosenVisualInfo->blue_mask); - int visualAlphaSize = -1; // Need XRender to tell us the alpha channel size - - bool visualMatchesConfig = false; - if ( visualRedSize == configRedSize && - visualGreenSize == configGreenSize && - visualBlueSize == configBlueSize ) - { - // We need XRender to check the alpha channel size of the visual. If we don't have - // the alpha size, we don't check it against the EGL config's alpha size. - if (visualAlphaSize >= 0) - visualMatchesConfig = visualAlphaSize == configAlphaSize; - else - visualMatchesConfig = true; - } - - if (!visualMatchesConfig) { - if (visualAlphaSize >= 0) { - qWarning("Warning: EGL suggested using X Visual ID %d (ARGB%d%d%d%d) for EGL config %d (ARGB%d%d%d%d), but this is incompatable", - (int)visualId, visualAlphaSize, visualRedSize, visualGreenSize, visualBlueSize, - configId, configAlphaSize, configRedSize, configGreenSize, configBlueSize); - } else { - qWarning("Warning: EGL suggested using X Visual ID %d (RGB%d%d%d) for EGL config %d (RGB%d%d%d), but this is incompatable", - (int)visualId, visualRedSize, visualGreenSize, visualBlueSize, - configId, configRedSize, configGreenSize, configBlueSize); - } - visualId = 0; - } - } else { - qWarning("Warning: EGL suggested using X Visual ID %d for EGL config %d, but that isn't a valid ID", - (int)visualId, configId); - visualId = 0; - } - XFree(chosenVisualInfo); - } -#ifdef QT_DEBUG_X11_VISUAL_SELECTION - else - qDebug("EGL did not suggest a VisualID (EGL_NATIVE_VISUAL_ID was zero) for EGLConfig %d", configId); -#endif - - if (visualId) { -#ifdef QT_DEBUG_X11_VISUAL_SELECTION - if (configAlphaSize > 0) - qDebug("Using ARGB Visual ID %d provided by EGL for config %d", (int)visualId, configId); - else - qDebug("Using Opaque Visual ID %d provided by EGL for config %d", (int)visualId, configId); -#endif - return visualId; - } - - // Finally, try to - // use XGetVisualInfo and only use the bit depths to match on: - if (!visualId) { - XVisualInfo visualInfoTemplate; - memset(&visualInfoTemplate, 0, sizeof(XVisualInfo)); - XVisualInfo *matchingVisuals; - int matchingCount = 0; - - visualInfoTemplate.depth = configRedSize + configGreenSize + configBlueSize + configAlphaSize; - matchingVisuals = XGetVisualInfo(display, - VisualDepthMask, - &visualInfoTemplate, - &matchingCount); - if (!matchingVisuals) { - // Try again without taking the alpha channel into account: - visualInfoTemplate.depth = configRedSize + configGreenSize + configBlueSize; - matchingVisuals = XGetVisualInfo(display, - VisualDepthMask, - &visualInfoTemplate, - &matchingCount); - } - - if (matchingVisuals) { - visualId = matchingVisuals[0].visualid; - XFree(matchingVisuals); - } - } - - if (visualId) { -#ifdef QT_DEBUG_X11_VISUAL_SELECTION - qDebug("Using Visual ID %d provided by XGetVisualInfo for EGL config %d", (int)visualId, configId); -#endif - return visualId; - } - - qWarning("Unable to find an X11 visual which matches EGL config %d", configId); - return (VisualID)0; -} diff --git a/src/plugins/platforms/testlite/qtestliteeglintegration.h b/src/plugins/platforms/testlite/qtestliteeglintegration.h deleted file mode 100644 index 4c2e50d..0000000 --- a/src/plugins/platforms/testlite/qtestliteeglintegration.h +++ /dev/null @@ -1,54 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QTESTLITEEGLINTEGRATION_H -#define QTESTLITEEGLINTEGRATION_H - -#include "qtestlitestaticinfo.h" -#include "../eglconvenience/qeglconvenience.h" - -class QXlibEglIntegration -{ -public: - static VisualID getCompatibleVisualId(Display *display, EGLConfig config); -}; - -#endif // QTESTLITEEGLINTEGRATION_H diff --git a/src/plugins/platforms/testlite/qtestliteintegration.cpp b/src/plugins/platforms/testlite/qtestliteintegration.cpp deleted file mode 100644 index cdc5c29..0000000 --- a/src/plugins/platforms/testlite/qtestliteintegration.cpp +++ /dev/null @@ -1,156 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qtestliteintegration.h" -#include "qtestlitewindowsurface.h" -#include -#include - -#include "qtestlitewindow.h" -#include "qgenericunixfontdatabase.h" -#include "qtestlitescreen.h" -#include "qtestliteclipboard.h" - -#if !defined(QT_NO_OPENGL) -#if !defined(QT_OPENGL_ES_2) -#include -#else -#include -#endif //!defined(QT_OPENGL_ES_2) -#include -#include -#endif //QT_NO_OPENGL - -QT_BEGIN_NAMESPACE - -QXlibIntegration::QXlibIntegration(bool useOpenGL) - : mUseOpenGL(useOpenGL) - , mFontDb(new QGenericUnixFontDatabase()) - , mClipboard(0) -{ - mPrimaryScreen = new QXlibScreen(); - mScreens.append(mPrimaryScreen); -} - -QPixmapData *QXlibIntegration::createPixmapData(QPixmapData::PixelType type) const -{ -#ifndef QT_NO_OPENGL - if (mUseOpenGL) - return new QGLPixmapData(type); -#endif - return new QRasterPixmapData(type); -} - -QWindowSurface *QXlibIntegration::createWindowSurface(QWidget *widget, WId) const -{ -#ifndef QT_NO_OPENGL - if (mUseOpenGL) - return new QGLWindowSurface(widget); -#endif - return new QXlibWindowSurface(widget); -} - - -QPlatformWindow *QXlibIntegration::createPlatformWindow(QWidget *widget, WId /*winId*/) const -{ - return new QXlibWindow(widget); -} - - - -QPixmap QXlibIntegration::grabWindow(WId window, int x, int y, int width, int height) const -{ - QImage image; - QWidget *widget = QWidget::find(window); - if (widget) { - QXlibScreen *screen = QXlibScreen::testLiteScreenForWidget(widget); - image = screen->grabWindow(window,x,y,width,height); - } else { - for (int i = 0; i < mScreens.size(); i++) { - QXlibScreen *screen = static_cast(mScreens[i]); - if (screen->rootWindow() == window) { - image = screen->grabWindow(window,x,y,width,height); - } - } - } - return QPixmap::fromImage(image); -} - -QPlatformFontDatabase *QXlibIntegration::fontDatabase() const -{ - return mFontDb; -} - -QPlatformClipboard * QXlibIntegration::clipboard() const -{ - //Use lazy init since clipboard needs QTestliteScreen - if (!mClipboard) { - QXlibIntegration *that = const_cast(this); - that->mClipboard = new QXlibClipboard(mPrimaryScreen); - } - return mClipboard; -} - -bool QXlibIntegration::hasOpenGL() const -{ -#if !defined(QT_NO_OPENGL) -#if !defined(QT_OPENGL_ES_2) - QXlibScreen *screen = static_cast(mScreens.at(0)); - return glXQueryExtension(screen->display(), 0, 0) != 0; -#else - static bool eglHasbeenInitialized = false; - static bool wasEglInitialized = false; - if (!eglHasbeenInitialized) { - eglHasbeenInitialized = true; - const QXlibScreen *screen = static_cast(mScreens.at(0)); - EGLint major, minor; - eglBindAPI(EGL_OPENGL_ES_API); - EGLDisplay disp = eglGetDisplay(screen->display()); - wasEglInitialized = eglInitialize(disp,&major,&minor); - } - return wasEglInitialized; -#endif -#endif - return false; -} - - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/testlite/qtestliteintegration.h b/src/plugins/platforms/testlite/qtestliteintegration.h deleted file mode 100644 index c3125b8..0000000 --- a/src/plugins/platforms/testlite/qtestliteintegration.h +++ /dev/null @@ -1,85 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QGRAPHICSSYSTEM_TESTLITE_H -#define QGRAPHICSSYSTEM_TESTLITE_H - -//make sure textstream is included before any X11 headers -#include - -#include -#include - -#include "qtestlitestaticinfo.h" - -QT_BEGIN_NAMESPACE - -class QXlibScreen; - -class QXlibIntegration : public QPlatformIntegration -{ -public: - QXlibIntegration(bool useOpenGL = false); - - QPixmapData *createPixmapData(QPixmapData::PixelType type) const; - QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId) const; - QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const; - - QPixmap grabWindow(WId window, int x, int y, int width, int height) const; - - QList screens() const { return mScreens; } - - QPlatformFontDatabase *fontDatabase() const; - QPlatformClipboard *clipboard() const; - - bool hasOpenGL() const; - -private: - bool mUseOpenGL; - QXlibScreen *mPrimaryScreen; - QList mScreens; - QPlatformFontDatabase *mFontDb; - QPlatformClipboard *mClipboard; -}; - -QT_END_NAMESPACE - -#endif diff --git a/src/plugins/platforms/testlite/qtestlitekeyboard.cpp b/src/plugins/platforms/testlite/qtestlitekeyboard.cpp deleted file mode 100644 index fb0cf2e..0000000 --- a/src/plugins/platforms/testlite/qtestlitekeyboard.cpp +++ /dev/null @@ -1,1000 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qtestlitekeyboard.h" - -#include "qtestlitescreen.h" - -#include - -#include - -#ifndef XK_ISO_Left_Tab -#define XK_ISO_Left_Tab 0xFE20 -#endif - -#ifndef XK_dead_hook -#define XK_dead_hook 0xFE61 -#endif - -#ifndef XK_dead_horn -#define XK_dead_horn 0xFE62 -#endif - -#ifndef XK_Codeinput -#define XK_Codeinput 0xFF37 -#endif - -#ifndef XK_Kanji_Bangou -#define XK_Kanji_Bangou 0xFF37 /* same as codeinput */ -#endif - -// Fix old X libraries -#ifndef XK_KP_Home -#define XK_KP_Home 0xFF95 -#endif -#ifndef XK_KP_Left -#define XK_KP_Left 0xFF96 -#endif -#ifndef XK_KP_Up -#define XK_KP_Up 0xFF97 -#endif -#ifndef XK_KP_Right -#define XK_KP_Right 0xFF98 -#endif -#ifndef XK_KP_Down -#define XK_KP_Down 0xFF99 -#endif -#ifndef XK_KP_Prior -#define XK_KP_Prior 0xFF9A -#endif -#ifndef XK_KP_Next -#define XK_KP_Next 0xFF9B -#endif -#ifndef XK_KP_End -#define XK_KP_End 0xFF9C -#endif -#ifndef XK_KP_Insert -#define XK_KP_Insert 0xFF9E -#endif -#ifndef XK_KP_Delete -#define XK_KP_Delete 0xFF9F -#endif - -// the next lines are taken on 10/2009 from X.org (X11/XF86keysym.h), defining some special -// multimedia keys. They are included here as not every system has them. -#define XF86XK_MonBrightnessUp 0x1008FF02 -#define XF86XK_MonBrightnessDown 0x1008FF03 -#define XF86XK_KbdLightOnOff 0x1008FF04 -#define XF86XK_KbdBrightnessUp 0x1008FF05 -#define XF86XK_KbdBrightnessDown 0x1008FF06 -#define XF86XK_Standby 0x1008FF10 -#define XF86XK_AudioLowerVolume 0x1008FF11 -#define XF86XK_AudioMute 0x1008FF12 -#define XF86XK_AudioRaiseVolume 0x1008FF13 -#define XF86XK_AudioPlay 0x1008FF14 -#define XF86XK_AudioStop 0x1008FF15 -#define XF86XK_AudioPrev 0x1008FF16 -#define XF86XK_AudioNext 0x1008FF17 -#define XF86XK_HomePage 0x1008FF18 -#define XF86XK_Mail 0x1008FF19 -#define XF86XK_Start 0x1008FF1A -#define XF86XK_Search 0x1008FF1B -#define XF86XK_AudioRecord 0x1008FF1C -#define XF86XK_Calculator 0x1008FF1D -#define XF86XK_Memo 0x1008FF1E -#define XF86XK_ToDoList 0x1008FF1F -#define XF86XK_Calendar 0x1008FF20 -#define XF86XK_PowerDown 0x1008FF21 -#define XF86XK_ContrastAdjust 0x1008FF22 -#define XF86XK_Back 0x1008FF26 -#define XF86XK_Forward 0x1008FF27 -#define XF86XK_Stop 0x1008FF28 -#define XF86XK_Refresh 0x1008FF29 -#define XF86XK_PowerOff 0x1008FF2A -#define XF86XK_WakeUp 0x1008FF2B -#define XF86XK_Eject 0x1008FF2C -#define XF86XK_ScreenSaver 0x1008FF2D -#define XF86XK_WWW 0x1008FF2E -#define XF86XK_Sleep 0x1008FF2F -#define XF86XK_Favorites 0x1008FF30 -#define XF86XK_AudioPause 0x1008FF31 -#define XF86XK_AudioMedia 0x1008FF32 -#define XF86XK_MyComputer 0x1008FF33 -#define XF86XK_LightBulb 0x1008FF35 -#define XF86XK_Shop 0x1008FF36 -#define XF86XK_History 0x1008FF37 -#define XF86XK_OpenURL 0x1008FF38 -#define XF86XK_AddFavorite 0x1008FF39 -#define XF86XK_HotLinks 0x1008FF3A -#define XF86XK_BrightnessAdjust 0x1008FF3B -#define XF86XK_Finance 0x1008FF3C -#define XF86XK_Community 0x1008FF3D -#define XF86XK_AudioRewind 0x1008FF3E -#define XF86XK_BackForward 0x1008FF3F -#define XF86XK_Launch0 0x1008FF40 -#define XF86XK_Launch1 0x1008FF41 -#define XF86XK_Launch2 0x1008FF42 -#define XF86XK_Launch3 0x1008FF43 -#define XF86XK_Launch4 0x1008FF44 -#define XF86XK_Launch5 0x1008FF45 -#define XF86XK_Launch6 0x1008FF46 -#define XF86XK_Launch7 0x1008FF47 -#define XF86XK_Launch8 0x1008FF48 -#define XF86XK_Launch9 0x1008FF49 -#define XF86XK_LaunchA 0x1008FF4A -#define XF86XK_LaunchB 0x1008FF4B -#define XF86XK_LaunchC 0x1008FF4C -#define XF86XK_LaunchD 0x1008FF4D -#define XF86XK_LaunchE 0x1008FF4E -#define XF86XK_LaunchF 0x1008FF4F -#define XF86XK_ApplicationLeft 0x1008FF50 -#define XF86XK_ApplicationRight 0x1008FF51 -#define XF86XK_Book 0x1008FF52 -#define XF86XK_CD 0x1008FF53 -#define XF86XK_Calculater 0x1008FF54 -#define XF86XK_Clear 0x1008FF55 -#define XF86XK_ClearGrab 0x1008FE21 -#define XF86XK_Close 0x1008FF56 -#define XF86XK_Copy 0x1008FF57 -#define XF86XK_Cut 0x1008FF58 -#define XF86XK_Display 0x1008FF59 -#define XF86XK_DOS 0x1008FF5A -#define XF86XK_Documents 0x1008FF5B -#define XF86XK_Excel 0x1008FF5C -#define XF86XK_Explorer 0x1008FF5D -#define XF86XK_Game 0x1008FF5E -#define XF86XK_Go 0x1008FF5F -#define XF86XK_iTouch 0x1008FF60 -#define XF86XK_LogOff 0x1008FF61 -#define XF86XK_Market 0x1008FF62 -#define XF86XK_Meeting 0x1008FF63 -#define XF86XK_MenuKB 0x1008FF65 -#define XF86XK_MenuPB 0x1008FF66 -#define XF86XK_MySites 0x1008FF67 -#define XF86XK_News 0x1008FF69 -#define XF86XK_OfficeHome 0x1008FF6A -#define XF86XK_Option 0x1008FF6C -#define XF86XK_Paste 0x1008FF6D -#define XF86XK_Phone 0x1008FF6E -#define XF86XK_Reply 0x1008FF72 -#define XF86XK_Reload 0x1008FF73 -#define XF86XK_RotateWindows 0x1008FF74 -#define XF86XK_RotationPB 0x1008FF75 -#define XF86XK_RotationKB 0x1008FF76 -#define XF86XK_Save 0x1008FF77 -#define XF86XK_Send 0x1008FF7B -#define XF86XK_Spell 0x1008FF7C -#define XF86XK_SplitScreen 0x1008FF7D -#define XF86XK_Support 0x1008FF7E -#define XF86XK_TaskPane 0x1008FF7F -#define XF86XK_Terminal 0x1008FF80 -#define XF86XK_Tools 0x1008FF81 -#define XF86XK_Travel 0x1008FF82 -#define XF86XK_Video 0x1008FF87 -#define XF86XK_Word 0x1008FF89 -#define XF86XK_Xfer 0x1008FF8A -#define XF86XK_ZoomIn 0x1008FF8B -#define XF86XK_ZoomOut 0x1008FF8C -#define XF86XK_Away 0x1008FF8D -#define XF86XK_Messenger 0x1008FF8E -#define XF86XK_WebCam 0x1008FF8F -#define XF86XK_MailForward 0x1008FF90 -#define XF86XK_Pictures 0x1008FF91 -#define XF86XK_Music 0x1008FF92 -#define XF86XK_Battery 0x1008FF93 -#define XF86XK_Bluetooth 0x1008FF94 -#define XF86XK_WLAN 0x1008FF95 -#define XF86XK_UWB 0x1008FF96 -#define XF86XK_AudioForward 0x1008FF97 -#define XF86XK_AudioRepeat 0x1008FF98 -#define XF86XK_AudioRandomPlay 0x1008FF99 -#define XF86XK_Subtitle 0x1008FF9A -#define XF86XK_AudioCycleTrack 0x1008FF9B -#define XF86XK_Time 0x1008FF9F -#define XF86XK_Select 0x1008FFA0 -#define XF86XK_View 0x1008FFA1 -#define XF86XK_TopMenu 0x1008FFA2 -#define XF86XK_Suspend 0x1008FFA7 -#define XF86XK_Hibernate 0x1008FFA8 - - -// end of XF86keysyms.h - -// Special keys used by Qtopia, mapped into the X11 private keypad range. -#define QTOPIAXK_Select 0x11000601 -#define QTOPIAXK_Yes 0x11000602 -#define QTOPIAXK_No 0x11000603 -#define QTOPIAXK_Cancel 0x11000604 -#define QTOPIAXK_Printer 0x11000605 -#define QTOPIAXK_Execute 0x11000606 -#define QTOPIAXK_Sleep 0x11000607 -#define QTOPIAXK_Play 0x11000608 -#define QTOPIAXK_Zoom 0x11000609 -#define QTOPIAXK_Context1 0x1100060A -#define QTOPIAXK_Context2 0x1100060B -#define QTOPIAXK_Context3 0x1100060C -#define QTOPIAXK_Context4 0x1100060D -#define QTOPIAXK_Call 0x1100060E -#define QTOPIAXK_Hangup 0x1100060F -#define QTOPIAXK_Flip 0x11000610 - -// keyboard mapping table -static const unsigned int KeyTbl[] = { - - // misc keys - - XK_Escape, Qt::Key_Escape, - XK_Tab, Qt::Key_Tab, - XK_ISO_Left_Tab, Qt::Key_Backtab, - XK_BackSpace, Qt::Key_Backspace, - XK_Return, Qt::Key_Return, - XK_Insert, Qt::Key_Insert, - XK_Delete, Qt::Key_Delete, - XK_Clear, Qt::Key_Delete, - XK_Pause, Qt::Key_Pause, - XK_Print, Qt::Key_Print, - 0x1005FF60, Qt::Key_SysReq, // hardcoded Sun SysReq - 0x1007ff00, Qt::Key_SysReq, // hardcoded X386 SysReq - - // cursor movement - - XK_Home, Qt::Key_Home, - XK_End, Qt::Key_End, - XK_Left, Qt::Key_Left, - XK_Up, Qt::Key_Up, - XK_Right, Qt::Key_Right, - XK_Down, Qt::Key_Down, - XK_Prior, Qt::Key_PageUp, - XK_Next, Qt::Key_PageDown, - - // modifiers - - XK_Shift_L, Qt::Key_Shift, - XK_Shift_R, Qt::Key_Shift, - XK_Shift_Lock, Qt::Key_Shift, - XK_Control_L, Qt::Key_Control, - XK_Control_R, Qt::Key_Control, - XK_Meta_L, Qt::Key_Meta, - XK_Meta_R, Qt::Key_Meta, - XK_Alt_L, Qt::Key_Alt, - XK_Alt_R, Qt::Key_Alt, - XK_Caps_Lock, Qt::Key_CapsLock, - XK_Num_Lock, Qt::Key_NumLock, - XK_Scroll_Lock, Qt::Key_ScrollLock, - XK_Super_L, Qt::Key_Super_L, - XK_Super_R, Qt::Key_Super_R, - XK_Menu, Qt::Key_Menu, - XK_Hyper_L, Qt::Key_Hyper_L, - XK_Hyper_R, Qt::Key_Hyper_R, - XK_Help, Qt::Key_Help, - 0x1000FF74, Qt::Key_Backtab, // hardcoded HP backtab - 0x1005FF10, Qt::Key_F11, // hardcoded Sun F36 (labeled F11) - 0x1005FF11, Qt::Key_F12, // hardcoded Sun F37 (labeled F12) - - // numeric and function keypad keys - - XK_KP_Space, Qt::Key_Space, - XK_KP_Tab, Qt::Key_Tab, - XK_KP_Enter, Qt::Key_Enter, - //XK_KP_F1, Qt::Key_F1, - //XK_KP_F2, Qt::Key_F2, - //XK_KP_F3, Qt::Key_F3, - //XK_KP_F4, Qt::Key_F4, - XK_KP_Home, Qt::Key_Home, - XK_KP_Left, Qt::Key_Left, - XK_KP_Up, Qt::Key_Up, - XK_KP_Right, Qt::Key_Right, - XK_KP_Down, Qt::Key_Down, - XK_KP_Prior, Qt::Key_PageUp, - XK_KP_Next, Qt::Key_PageDown, - XK_KP_End, Qt::Key_End, - XK_KP_Begin, Qt::Key_Clear, - XK_KP_Insert, Qt::Key_Insert, - XK_KP_Delete, Qt::Key_Delete, - XK_KP_Equal, Qt::Key_Equal, - XK_KP_Multiply, Qt::Key_Asterisk, - XK_KP_Add, Qt::Key_Plus, - XK_KP_Separator, Qt::Key_Comma, - XK_KP_Subtract, Qt::Key_Minus, - XK_KP_Decimal, Qt::Key_Period, - XK_KP_Divide, Qt::Key_Slash, - - // International input method support keys - - // International & multi-key character composition - XK_ISO_Level3_Shift, Qt::Key_AltGr, - XK_Multi_key, Qt::Key_Multi_key, - XK_Codeinput, Qt::Key_Codeinput, - XK_SingleCandidate, Qt::Key_SingleCandidate, - XK_MultipleCandidate, Qt::Key_MultipleCandidate, - XK_PreviousCandidate, Qt::Key_PreviousCandidate, - - // Misc Functions - XK_Mode_switch, Qt::Key_Mode_switch, - XK_script_switch, Qt::Key_Mode_switch, - - // Japanese keyboard support - XK_Kanji, Qt::Key_Kanji, - XK_Muhenkan, Qt::Key_Muhenkan, - //XK_Henkan_Mode, Qt::Key_Henkan_Mode, - XK_Henkan_Mode, Qt::Key_Henkan, - XK_Henkan, Qt::Key_Henkan, - XK_Romaji, Qt::Key_Romaji, - XK_Hiragana, Qt::Key_Hiragana, - XK_Katakana, Qt::Key_Katakana, - XK_Hiragana_Katakana, Qt::Key_Hiragana_Katakana, - XK_Zenkaku, Qt::Key_Zenkaku, - XK_Hankaku, Qt::Key_Hankaku, - XK_Zenkaku_Hankaku, Qt::Key_Zenkaku_Hankaku, - XK_Touroku, Qt::Key_Touroku, - XK_Massyo, Qt::Key_Massyo, - XK_Kana_Lock, Qt::Key_Kana_Lock, - XK_Kana_Shift, Qt::Key_Kana_Shift, - XK_Eisu_Shift, Qt::Key_Eisu_Shift, - XK_Eisu_toggle, Qt::Key_Eisu_toggle, - //XK_Kanji_Bangou, Qt::Key_Kanji_Bangou, - //XK_Zen_Koho, Qt::Key_Zen_Koho, - //XK_Mae_Koho, Qt::Key_Mae_Koho, - XK_Kanji_Bangou, Qt::Key_Codeinput, - XK_Zen_Koho, Qt::Key_MultipleCandidate, - XK_Mae_Koho, Qt::Key_PreviousCandidate, - -#ifdef XK_KOREAN - // Korean keyboard support - XK_Hangul, Qt::Key_Hangul, - XK_Hangul_Start, Qt::Key_Hangul_Start, - XK_Hangul_End, Qt::Key_Hangul_End, - XK_Hangul_Hanja, Qt::Key_Hangul_Hanja, - XK_Hangul_Jamo, Qt::Key_Hangul_Jamo, - XK_Hangul_Romaja, Qt::Key_Hangul_Romaja, - //XK_Hangul_Codeinput, Qt::Key_Hangul_Codeinput, - XK_Hangul_Codeinput, Qt::Key_Codeinput, - XK_Hangul_Jeonja, Qt::Key_Hangul_Jeonja, - XK_Hangul_Banja, Qt::Key_Hangul_Banja, - XK_Hangul_PreHanja, Qt::Key_Hangul_PreHanja, - XK_Hangul_PostHanja, Qt::Key_Hangul_PostHanja, - //XK_Hangul_SingleCandidate,Qt::Key_Hangul_SingleCandidate, - //XK_Hangul_MultipleCandidate,Qt::Key_Hangul_MultipleCandidate, - //XK_Hangul_PreviousCandidate,Qt::Key_Hangul_PreviousCandidate, - XK_Hangul_SingleCandidate, Qt::Key_SingleCandidate, - XK_Hangul_MultipleCandidate,Qt::Key_MultipleCandidate, - XK_Hangul_PreviousCandidate,Qt::Key_PreviousCandidate, - XK_Hangul_Special, Qt::Key_Hangul_Special, - //XK_Hangul_switch, Qt::Key_Hangul_switch, - XK_Hangul_switch, Qt::Key_Mode_switch, -#endif // XK_KOREAN - - // dead keys - XK_dead_grave, Qt::Key_Dead_Grave, - XK_dead_acute, Qt::Key_Dead_Acute, - XK_dead_circumflex, Qt::Key_Dead_Circumflex, - XK_dead_tilde, Qt::Key_Dead_Tilde, - XK_dead_macron, Qt::Key_Dead_Macron, - XK_dead_breve, Qt::Key_Dead_Breve, - XK_dead_abovedot, Qt::Key_Dead_Abovedot, - XK_dead_diaeresis, Qt::Key_Dead_Diaeresis, - XK_dead_abovering, Qt::Key_Dead_Abovering, - XK_dead_doubleacute, Qt::Key_Dead_Doubleacute, - XK_dead_caron, Qt::Key_Dead_Caron, - XK_dead_cedilla, Qt::Key_Dead_Cedilla, - XK_dead_ogonek, Qt::Key_Dead_Ogonek, - XK_dead_iota, Qt::Key_Dead_Iota, - XK_dead_voiced_sound, Qt::Key_Dead_Voiced_Sound, - XK_dead_semivoiced_sound, Qt::Key_Dead_Semivoiced_Sound, - XK_dead_belowdot, Qt::Key_Dead_Belowdot, - XK_dead_hook, Qt::Key_Dead_Hook, - XK_dead_horn, Qt::Key_Dead_Horn, - - // Special keys from X.org - This include multimedia keys, - // wireless/bluetooth/uwb keys, special launcher keys, etc. - XF86XK_Back, Qt::Key_Back, - XF86XK_Forward, Qt::Key_Forward, - XF86XK_Stop, Qt::Key_Stop, - XF86XK_Refresh, Qt::Key_Refresh, - XF86XK_Favorites, Qt::Key_Favorites, - XF86XK_AudioMedia, Qt::Key_LaunchMedia, - XF86XK_OpenURL, Qt::Key_OpenUrl, - XF86XK_HomePage, Qt::Key_HomePage, - XF86XK_Search, Qt::Key_Search, - XF86XK_AudioLowerVolume, Qt::Key_VolumeDown, - XF86XK_AudioMute, Qt::Key_VolumeMute, - XF86XK_AudioRaiseVolume, Qt::Key_VolumeUp, - XF86XK_AudioPlay, Qt::Key_MediaPlay, - XF86XK_AudioStop, Qt::Key_MediaStop, - XF86XK_AudioPrev, Qt::Key_MediaPrevious, - XF86XK_AudioNext, Qt::Key_MediaNext, - XF86XK_AudioRecord, Qt::Key_MediaRecord, - XF86XK_Mail, Qt::Key_LaunchMail, - XF86XK_MyComputer, Qt::Key_Launch0, // ### Qt 5: remap properly - XF86XK_Calculator, Qt::Key_Launch1, - XF86XK_Memo, Qt::Key_Memo, - XF86XK_ToDoList, Qt::Key_ToDoList, - XF86XK_Calendar, Qt::Key_Calendar, - XF86XK_PowerDown, Qt::Key_PowerDown, - XF86XK_ContrastAdjust, Qt::Key_ContrastAdjust, - XF86XK_Standby, Qt::Key_Standby, - XF86XK_MonBrightnessUp, Qt::Key_MonBrightnessUp, - XF86XK_MonBrightnessDown, Qt::Key_MonBrightnessDown, - XF86XK_KbdLightOnOff, Qt::Key_KeyboardLightOnOff, - XF86XK_KbdBrightnessUp, Qt::Key_KeyboardBrightnessUp, - XF86XK_KbdBrightnessDown, Qt::Key_KeyboardBrightnessDown, - XF86XK_PowerOff, Qt::Key_PowerOff, - XF86XK_WakeUp, Qt::Key_WakeUp, - XF86XK_Eject, Qt::Key_Eject, - XF86XK_ScreenSaver, Qt::Key_ScreenSaver, - XF86XK_WWW, Qt::Key_WWW, - XF86XK_Sleep, Qt::Key_Sleep, - XF86XK_LightBulb, Qt::Key_LightBulb, - XF86XK_Shop, Qt::Key_Shop, - XF86XK_History, Qt::Key_History, - XF86XK_AddFavorite, Qt::Key_AddFavorite, - XF86XK_HotLinks, Qt::Key_HotLinks, - XF86XK_BrightnessAdjust, Qt::Key_BrightnessAdjust, - XF86XK_Finance, Qt::Key_Finance, - XF86XK_Community, Qt::Key_Community, - XF86XK_AudioRewind, Qt::Key_AudioRewind, - XF86XK_BackForward, Qt::Key_BackForward, - XF86XK_ApplicationLeft, Qt::Key_ApplicationLeft, - XF86XK_ApplicationRight, Qt::Key_ApplicationRight, - XF86XK_Book, Qt::Key_Book, - XF86XK_CD, Qt::Key_CD, - XF86XK_Calculater, Qt::Key_Calculator, - XF86XK_Clear, Qt::Key_Clear, - XF86XK_ClearGrab, Qt::Key_ClearGrab, - XF86XK_Close, Qt::Key_Close, - XF86XK_Copy, Qt::Key_Copy, - XF86XK_Cut, Qt::Key_Cut, - XF86XK_Display, Qt::Key_Display, - XF86XK_DOS, Qt::Key_DOS, - XF86XK_Documents, Qt::Key_Documents, - XF86XK_Excel, Qt::Key_Excel, - XF86XK_Explorer, Qt::Key_Explorer, - XF86XK_Game, Qt::Key_Game, - XF86XK_Go, Qt::Key_Go, - XF86XK_iTouch, Qt::Key_iTouch, - XF86XK_LogOff, Qt::Key_LogOff, - XF86XK_Market, Qt::Key_Market, - XF86XK_Meeting, Qt::Key_Meeting, - XF86XK_MenuKB, Qt::Key_MenuKB, - XF86XK_MenuPB, Qt::Key_MenuPB, - XF86XK_MySites, Qt::Key_MySites, - XF86XK_News, Qt::Key_News, - XF86XK_OfficeHome, Qt::Key_OfficeHome, - XF86XK_Option, Qt::Key_Option, - XF86XK_Paste, Qt::Key_Paste, - XF86XK_Phone, Qt::Key_Phone, - XF86XK_Reply, Qt::Key_Reply, - XF86XK_Reload, Qt::Key_Reload, - XF86XK_RotateWindows, Qt::Key_RotateWindows, - XF86XK_RotationPB, Qt::Key_RotationPB, - XF86XK_RotationKB, Qt::Key_RotationKB, - XF86XK_Save, Qt::Key_Save, - XF86XK_Send, Qt::Key_Send, - XF86XK_Spell, Qt::Key_Spell, - XF86XK_SplitScreen, Qt::Key_SplitScreen, - XF86XK_Support, Qt::Key_Support, - XF86XK_TaskPane, Qt::Key_TaskPane, - XF86XK_Terminal, Qt::Key_Terminal, - XF86XK_Tools, Qt::Key_Tools, - XF86XK_Travel, Qt::Key_Travel, - XF86XK_Video, Qt::Key_Video, - XF86XK_Word, Qt::Key_Word, - XF86XK_Xfer, Qt::Key_Xfer, - XF86XK_ZoomIn, Qt::Key_ZoomIn, - XF86XK_ZoomOut, Qt::Key_ZoomOut, - XF86XK_Away, Qt::Key_Away, - XF86XK_Messenger, Qt::Key_Messenger, - XF86XK_WebCam, Qt::Key_WebCam, - XF86XK_MailForward, Qt::Key_MailForward, - XF86XK_Pictures, Qt::Key_Pictures, - XF86XK_Music, Qt::Key_Music, - XF86XK_Battery, Qt::Key_Battery, - XF86XK_Bluetooth, Qt::Key_Bluetooth, - XF86XK_WLAN, Qt::Key_WLAN, - XF86XK_UWB, Qt::Key_UWB, - XF86XK_AudioForward, Qt::Key_AudioForward, - XF86XK_AudioRepeat, Qt::Key_AudioRepeat, - XF86XK_AudioRandomPlay, Qt::Key_AudioRandomPlay, - XF86XK_Subtitle, Qt::Key_Subtitle, - XF86XK_AudioCycleTrack, Qt::Key_AudioCycleTrack, - XF86XK_Time, Qt::Key_Time, - XF86XK_Select, Qt::Key_Select, - XF86XK_View, Qt::Key_View, - XF86XK_TopMenu, Qt::Key_TopMenu, - XF86XK_Bluetooth, Qt::Key_Bluetooth, - XF86XK_Suspend, Qt::Key_Suspend, - XF86XK_Hibernate, Qt::Key_Hibernate, - XF86XK_Launch0, Qt::Key_Launch2, // ### Qt 5: remap properly - XF86XK_Launch1, Qt::Key_Launch3, - XF86XK_Launch2, Qt::Key_Launch4, - XF86XK_Launch3, Qt::Key_Launch5, - XF86XK_Launch4, Qt::Key_Launch6, - XF86XK_Launch5, Qt::Key_Launch7, - XF86XK_Launch6, Qt::Key_Launch8, - XF86XK_Launch7, Qt::Key_Launch9, - XF86XK_Launch8, Qt::Key_LaunchA, - XF86XK_Launch9, Qt::Key_LaunchB, - XF86XK_LaunchA, Qt::Key_LaunchC, - XF86XK_LaunchB, Qt::Key_LaunchD, - XF86XK_LaunchC, Qt::Key_LaunchE, - XF86XK_LaunchD, Qt::Key_LaunchF, - XF86XK_LaunchE, Qt::Key_LaunchG, - XF86XK_LaunchF, Qt::Key_LaunchH, - - // Qtopia keys - QTOPIAXK_Select, Qt::Key_Select, - QTOPIAXK_Yes, Qt::Key_Yes, - QTOPIAXK_No, Qt::Key_No, - QTOPIAXK_Cancel, Qt::Key_Cancel, - QTOPIAXK_Printer, Qt::Key_Printer, - QTOPIAXK_Execute, Qt::Key_Execute, - QTOPIAXK_Sleep, Qt::Key_Sleep, - QTOPIAXK_Play, Qt::Key_Play, - QTOPIAXK_Zoom, Qt::Key_Zoom, - QTOPIAXK_Context1, Qt::Key_Context1, - QTOPIAXK_Context2, Qt::Key_Context2, - QTOPIAXK_Context3, Qt::Key_Context3, - QTOPIAXK_Context4, Qt::Key_Context4, - QTOPIAXK_Call, Qt::Key_Call, - QTOPIAXK_Hangup, Qt::Key_Hangup, - QTOPIAXK_Flip, Qt::Key_Flip, - - 0, 0 -}; - -static const unsigned short katakanaKeysymsToUnicode[] = { - 0x0000, 0x3002, 0x300C, 0x300D, 0x3001, 0x30FB, 0x30F2, 0x30A1, - 0x30A3, 0x30A5, 0x30A7, 0x30A9, 0x30E3, 0x30E5, 0x30E7, 0x30C3, - 0x30FC, 0x30A2, 0x30A4, 0x30A6, 0x30A8, 0x30AA, 0x30AB, 0x30AD, - 0x30AF, 0x30B1, 0x30B3, 0x30B5, 0x30B7, 0x30B9, 0x30BB, 0x30BD, - 0x30BF, 0x30C1, 0x30C4, 0x30C6, 0x30C8, 0x30CA, 0x30CB, 0x30CC, - 0x30CD, 0x30CE, 0x30CF, 0x30D2, 0x30D5, 0x30D8, 0x30DB, 0x30DE, - 0x30DF, 0x30E0, 0x30E1, 0x30E2, 0x30E4, 0x30E6, 0x30E8, 0x30E9, - 0x30EA, 0x30EB, 0x30EC, 0x30ED, 0x30EF, 0x30F3, 0x309B, 0x309C -}; - -static const unsigned short cyrillicKeysymsToUnicode[] = { - 0x0000, 0x0452, 0x0453, 0x0451, 0x0454, 0x0455, 0x0456, 0x0457, - 0x0458, 0x0459, 0x045a, 0x045b, 0x045c, 0x0000, 0x045e, 0x045f, - 0x2116, 0x0402, 0x0403, 0x0401, 0x0404, 0x0405, 0x0406, 0x0407, - 0x0408, 0x0409, 0x040a, 0x040b, 0x040c, 0x0000, 0x040e, 0x040f, - 0x044e, 0x0430, 0x0431, 0x0446, 0x0434, 0x0435, 0x0444, 0x0433, - 0x0445, 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, - 0x043f, 0x044f, 0x0440, 0x0441, 0x0442, 0x0443, 0x0436, 0x0432, - 0x044c, 0x044b, 0x0437, 0x0448, 0x044d, 0x0449, 0x0447, 0x044a, - 0x042e, 0x0410, 0x0411, 0x0426, 0x0414, 0x0415, 0x0424, 0x0413, - 0x0425, 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, - 0x041f, 0x042f, 0x0420, 0x0421, 0x0422, 0x0423, 0x0416, 0x0412, - 0x042c, 0x042b, 0x0417, 0x0428, 0x042d, 0x0429, 0x0427, 0x042a -}; - -static const unsigned short greekKeysymsToUnicode[] = { - 0x0000, 0x0386, 0x0388, 0x0389, 0x038a, 0x03aa, 0x0000, 0x038c, - 0x038e, 0x03ab, 0x0000, 0x038f, 0x0000, 0x0000, 0x0385, 0x2015, - 0x0000, 0x03ac, 0x03ad, 0x03ae, 0x03af, 0x03ca, 0x0390, 0x03cc, - 0x03cd, 0x03cb, 0x03b0, 0x03ce, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, - 0x0398, 0x0399, 0x039a, 0x039b, 0x039c, 0x039d, 0x039e, 0x039f, - 0x03a0, 0x03a1, 0x03a3, 0x0000, 0x03a4, 0x03a5, 0x03a6, 0x03a7, - 0x03a8, 0x03a9, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x03b1, 0x03b2, 0x03b3, 0x03b4, 0x03b5, 0x03b6, 0x03b7, - 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bc, 0x03bd, 0x03be, 0x03bf, - 0x03c0, 0x03c1, 0x03c3, 0x03c2, 0x03c4, 0x03c5, 0x03c6, 0x03c7, - 0x03c8, 0x03c9, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 -}; - -static const unsigned short technicalKeysymsToUnicode[] = { - 0x0000, 0x23B7, 0x250C, 0x2500, 0x2320, 0x2321, 0x2502, 0x23A1, - 0x23A3, 0x23A4, 0x23A6, 0x239B, 0x239D, 0x239E, 0x23A0, 0x23A8, - 0x23AC, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x2264, 0x2260, 0x2265, 0x222B, - 0x2234, 0x221D, 0x221E, 0x0000, 0x0000, 0x2207, 0x0000, 0x0000, - 0x223C, 0x2243, 0x0000, 0x0000, 0x0000, 0x21D4, 0x21D2, 0x2261, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x221A, 0x0000, - 0x0000, 0x0000, 0x2282, 0x2283, 0x2229, 0x222A, 0x2227, 0x2228, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2202, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0192, 0x0000, - 0x0000, 0x0000, 0x0000, 0x2190, 0x2191, 0x2192, 0x2193, 0x0000 -}; - -static const unsigned short specialKeysymsToUnicode[] = { - 0x25C6, 0x2592, 0x2409, 0x240C, 0x240D, 0x240A, 0x0000, 0x0000, - 0x2424, 0x240B, 0x2518, 0x2510, 0x250C, 0x2514, 0x253C, 0x23BA, - 0x23BB, 0x2500, 0x23BC, 0x23BD, 0x251C, 0x2524, 0x2534, 0x252C, - 0x2502, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 -}; - -static const unsigned short publishingKeysymsToUnicode[] = { - 0x0000, 0x2003, 0x2002, 0x2004, 0x2005, 0x2007, 0x2008, 0x2009, - 0x200a, 0x2014, 0x2013, 0x0000, 0x0000, 0x0000, 0x2026, 0x2025, - 0x2153, 0x2154, 0x2155, 0x2156, 0x2157, 0x2158, 0x2159, 0x215a, - 0x2105, 0x0000, 0x0000, 0x2012, 0x2329, 0x0000, 0x232a, 0x0000, - 0x0000, 0x0000, 0x0000, 0x215b, 0x215c, 0x215d, 0x215e, 0x0000, - 0x0000, 0x2122, 0x2613, 0x0000, 0x25c1, 0x25b7, 0x25cb, 0x25af, - 0x2018, 0x2019, 0x201c, 0x201d, 0x211e, 0x0000, 0x2032, 0x2033, - 0x0000, 0x271d, 0x0000, 0x25ac, 0x25c0, 0x25b6, 0x25cf, 0x25ae, - 0x25e6, 0x25ab, 0x25ad, 0x25b3, 0x25bd, 0x2606, 0x2022, 0x25aa, - 0x25b2, 0x25bc, 0x261c, 0x261e, 0x2663, 0x2666, 0x2665, 0x0000, - 0x2720, 0x2020, 0x2021, 0x2713, 0x2717, 0x266f, 0x266d, 0x2642, - 0x2640, 0x260e, 0x2315, 0x2117, 0x2038, 0x201a, 0x201e, 0x0000 -}; - -static const unsigned short aplKeysymsToUnicode[] = { - 0x0000, 0x0000, 0x0000, 0x003c, 0x0000, 0x0000, 0x003e, 0x0000, - 0x2228, 0x2227, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x00af, 0x0000, 0x22a5, 0x2229, 0x230a, 0x0000, 0x005f, 0x0000, - 0x0000, 0x0000, 0x2218, 0x0000, 0x2395, 0x0000, 0x22a4, 0x25cb, - 0x0000, 0x0000, 0x0000, 0x2308, 0x0000, 0x0000, 0x222a, 0x0000, - 0x2283, 0x0000, 0x2282, 0x0000, 0x22a2, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x22a3, 0x0000, 0x0000, 0x0000 -}; - -static const unsigned short koreanKeysymsToUnicode[] = { - 0x0000, 0x3131, 0x3132, 0x3133, 0x3134, 0x3135, 0x3136, 0x3137, - 0x3138, 0x3139, 0x313a, 0x313b, 0x313c, 0x313d, 0x313e, 0x313f, - 0x3140, 0x3141, 0x3142, 0x3143, 0x3144, 0x3145, 0x3146, 0x3147, - 0x3148, 0x3149, 0x314a, 0x314b, 0x314c, 0x314d, 0x314e, 0x314f, - 0x3150, 0x3151, 0x3152, 0x3153, 0x3154, 0x3155, 0x3156, 0x3157, - 0x3158, 0x3159, 0x315a, 0x315b, 0x315c, 0x315d, 0x315e, 0x315f, - 0x3160, 0x3161, 0x3162, 0x3163, 0x11a8, 0x11a9, 0x11aa, 0x11ab, - 0x11ac, 0x11ad, 0x11ae, 0x11af, 0x11b0, 0x11b1, 0x11b2, 0x11b3, - 0x11b4, 0x11b5, 0x11b6, 0x11b7, 0x11b8, 0x11b9, 0x11ba, 0x11bb, - 0x11bc, 0x11bd, 0x11be, 0x11bf, 0x11c0, 0x11c1, 0x11c2, 0x316d, - 0x3171, 0x3178, 0x317f, 0x3181, 0x3184, 0x3186, 0x318d, 0x318e, - 0x11eb, 0x11f0, 0x11f9, 0x0000, 0x0000, 0x0000, 0x0000, 0x20a9 -}; - -static QChar keysymToUnicode(unsigned char byte3, unsigned char byte4) -{ - switch (byte3) { - case 0x04: - // katakana - if (byte4 > 0xa0 && byte4 < 0xe0) - return QChar(katakanaKeysymsToUnicode[byte4 - 0xa0]); - else if (byte4 == 0x7e) - return QChar(0x203e); // Overline - break; - case 0x06: - // russian, use lookup table - if (byte4 > 0xa0) - return QChar(cyrillicKeysymsToUnicode[byte4 - 0xa0]); - break; - case 0x07: - // greek - if (byte4 > 0xa0) - return QChar(greekKeysymsToUnicode[byte4 - 0xa0]); - break; - case 0x08: - // technical - if (byte4 > 0xa0) - return QChar(technicalKeysymsToUnicode[byte4 - 0xa0]); - break; - case 0x09: - // special - if (byte4 >= 0xe0) - return QChar(specialKeysymsToUnicode[byte4 - 0xe0]); - break; - case 0x0a: - // publishing - if (byte4 > 0xa0) - return QChar(publishingKeysymsToUnicode[byte4 - 0xa0]); - break; - case 0x0b: - // APL - if (byte4 > 0xa0) - return QChar(aplKeysymsToUnicode[byte4 - 0xa0]); - break; - case 0x0e: - // Korean - if (byte4 > 0xa0) - return QChar(koreanKeysymsToUnicode[byte4 - 0xa0]); - break; - default: - break; - } - return QChar(0x0); -} - -Qt::KeyboardModifiers QXlibKeyboard::translateModifiers(int s) -{ - Qt::KeyboardModifiers ret = 0; - if (s & ShiftMask) - ret |= Qt::ShiftModifier; - if (s & ControlMask) - ret |= Qt::ControlModifier; - if (s & m_alt_mask) - ret |= Qt::AltModifier; - if (s & m_meta_mask) - ret |= Qt::MetaModifier; -// if (s & m_mode_switch_mask) //doesn't seem to work correctly -// ret |= Qt::GroupSwitchModifier; - return ret; -} - -void QXlibKeyboard::setMask(KeySym sym, uint mask) -{ - if (m_alt_mask == 0 - && m_meta_mask != mask - && m_super_mask != mask - && m_hyper_mask != mask - && (sym == XK_Alt_L || sym == XK_Alt_R)) { - m_alt_mask = mask; - } - if (m_meta_mask == 0 - && m_alt_mask != mask - && m_super_mask != mask - && m_hyper_mask != mask - && (sym == XK_Meta_L || sym == XK_Meta_R)) { - m_meta_mask = mask; - } - if (m_super_mask == 0 - && m_alt_mask != mask - && m_meta_mask != mask - && m_hyper_mask != mask - && (sym == XK_Super_L || sym == XK_Super_R)) { - m_super_mask = mask; - } - if (m_hyper_mask == 0 - && m_alt_mask != mask - && m_meta_mask != mask - && m_super_mask != mask - && (sym == XK_Hyper_L || sym == XK_Hyper_R)) { - m_hyper_mask = mask; - } - if (m_mode_switch_mask == 0 - && m_alt_mask != mask - && m_meta_mask != mask - && m_super_mask != mask - && m_hyper_mask != mask - && sym == XK_Mode_switch) { - m_mode_switch_mask = mask; - } - if (m_num_lock_mask == 0 - && sym == XK_Num_Lock) { - m_num_lock_mask = mask; - } -} - -int QXlibKeyboard::translateKeySym(uint key) const -{ - int code = -1; - int i = 0; // any other keys - while (KeyTbl[i]) { - if (key == KeyTbl[i]) { - code = (int)KeyTbl[i+1]; - break; - } - i += 2; - } - if (m_meta_mask) { - // translate Super/Hyper keys to Meta if we're using them as the MetaModifier - if (m_meta_mask == m_super_mask && (code == Qt::Key_Super_L || code == Qt::Key_Super_R)) { - code = Qt::Key_Meta; - } else if (m_meta_mask == m_hyper_mask && (code == Qt::Key_Hyper_L || code == Qt::Key_Hyper_R)) { - code = Qt::Key_Meta; - } - } - return code; -} - -QString QXlibKeyboard::translateKeySym(KeySym keysym, uint xmodifiers, - int &code, Qt::KeyboardModifiers &modifiers, - QByteArray &chars, int &count) -{ - // all keysyms smaller than 0xff00 are actally keys that can be mapped to unicode chars - - QTextCodec *mapper = QTextCodec::codecForLocale(); - QChar converted; - - if (/*count == 0 &&*/ keysym < 0xff00) { - unsigned char byte3 = (unsigned char)(keysym >> 8); - int mib = -1; - switch(byte3) { - case 0: // Latin 1 - case 1: // Latin 2 - case 2: //latin 3 - case 3: // latin4 - mib = byte3 + 4; break; - case 5: // arabic - mib = 82; break; - case 12: // Hebrew - mib = 85; break; - case 13: // Thai - mib = 2259; break; - case 4: // kana - case 6: // cyrillic - case 7: // greek - case 8: // technical, no mapping here at the moment - case 9: // Special - case 10: // Publishing - case 11: // APL - case 14: // Korean, no mapping - mib = -1; // manual conversion - mapper= 0; -#if !defined(QT_NO_XIM) - converted = keysymToUnicode(byte3, keysym & 0xff); -#endif - case 0x20: - // currency symbols - if (keysym >= 0x20a0 && keysym <= 0x20ac) { - mib = -1; // manual conversion - mapper = 0; - converted = (uint)keysym; - } - break; - default: - break; - } - if (mib != -1) { - mapper = QTextCodec::codecForMib(mib); - if (chars.isEmpty()) - chars.resize(1); - chars[0] = (unsigned char) (keysym & 0xff); // get only the fourth bit for conversion later - count = 1; - } - } else if (keysym >= 0x1000000 && keysym <= 0x100ffff) { - converted = (ushort) (keysym - 0x1000000); - mapper = 0; - } - if (count < (int)chars.size()-1) - chars[count] = '\0'; - - QString text; - if (!mapper && converted.unicode() != 0x0) { - text = converted; - } else if (!chars.isEmpty()) { - // convert chars (8bit) to text (unicode). - if (mapper) - text = mapper->toUnicode(chars.data(), count, 0); - if (text.isEmpty()) { - // no mapper, or codec couldn't convert to unicode (this - // can happen when running in the C locale or with no LANG - // set). try converting from latin-1 - text = QString::fromLatin1(chars); - } - } - - modifiers = translateModifiers(xmodifiers); - - // Commentary in X11/keysymdef says that X codes match ASCII, so it - // is safe to use the locale functions to process X codes in ISO8859-1. - // - // This is mainly for compatibility - applications should not use the - // Qt keycodes between 128 and 255, but should rather use the - // QKeyEvent::text(). - // - if (keysym < 128 || (keysym < 256 && (!mapper || mapper->mibEnum()==4))) { - // upper-case key, if known - code = isprint((int)keysym) ? toupper((int)keysym) : 0; - } else if (keysym >= XK_F1 && keysym <= XK_F35) { - // function keys - code = Qt::Key_F1 + ((int)keysym - XK_F1); - } else if (keysym >= XK_KP_Space && keysym <= XK_KP_9) { - if (keysym >= XK_KP_0) { - // numeric keypad keys - code = Qt::Key_0 + ((int)keysym - XK_KP_0); - } else { - code = translateKeySym(keysym); - } - modifiers |= Qt::KeypadModifier; - } else if (text.length() == 1 && text.unicode()->unicode() > 0x1f && text.unicode()->unicode() != 0x7f && !(keysym >= XK_dead_grave && keysym <= XK_dead_horn)) { - code = text.unicode()->toUpper().unicode(); - } else { - // any other keys - code = translateKeySym(keysym); - - if (code == Qt::Key_Tab && (modifiers & Qt::ShiftModifier)) { - // map shift+tab to shift+backtab, QShortcutMap knows about it - // and will handle it. - code = Qt::Key_Backtab; - text = QString(); - } - } - - return text; -} - -QXlibKeyboard::QXlibKeyboard(QXlibScreen *screen) - : m_screen(screen) - , m_alt_mask(0) - , m_super_mask(0) - , m_hyper_mask(0) - , m_meta_mask(0) -{ - changeLayout(); -} - -void QXlibKeyboard::changeLayout() -{ - XkbDescPtr xkbDesc = XkbGetMap(m_screen->display(), XkbAllClientInfoMask, XkbUseCoreKbd); - for (int i = xkbDesc->min_key_code; i < xkbDesc->max_key_code; ++i) { - const uint mask = xkbDesc->map->modmap ? xkbDesc->map->modmap[i] : 0; - if (mask == 0) { - // key is not bound to a modifier - continue; - } - - for (int j = 0; j < XkbKeyGroupsWidth(xkbDesc, i); ++j) { - KeySym keySym = XkbKeySym(xkbDesc, i, j); - if (keySym == NoSymbol) - continue; - setMask(keySym, mask); - } - } - XkbFreeKeyboard(xkbDesc, XkbAllComponentsMask, true); - -} - -static Qt::KeyboardModifiers modifierFromKeyCode(int qtcode) -{ - switch (qtcode) { - case Qt::Key_Control: - return Qt::ControlModifier; - case Qt::Key_Alt: - return Qt::AltModifier; - case Qt::Key_Shift: - return Qt::ShiftModifier; - case Qt::Key_Meta: - return Qt::MetaModifier; - default: - return Qt::NoModifier; - } -} - -void QXlibKeyboard::handleKeyEvent(QWidget *widget, QEvent::Type type, XKeyEvent *ev) -{ - int qtcode = 0; - Qt::KeyboardModifiers modifiers = translateModifiers(ev->state); - QByteArray chars; - chars.resize(513); - int count = 0; - KeySym keySym; - count = XLookupString(ev,chars.data(),chars.size(),&keySym,0); - QString text = translateKeySym(keySym,ev->state,qtcode,modifiers,chars,count); - QWindowSystemInterface::handleKeyEvent(widget,ev->time,type,qtcode,modifiers,text.left(count)); -} diff --git a/src/plugins/platforms/testlite/qtestlitekeyboard.h b/src/plugins/platforms/testlite/qtestlitekeyboard.h deleted file mode 100644 index 98df4e1..0000000 --- a/src/plugins/platforms/testlite/qtestlitekeyboard.h +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QTESTLITEKEYBOARD_H -#define QTESTLITEKEYBOARD_H - -#include "qtestliteintegration.h" - -class QXlibKeyboard -{ -public: - QXlibKeyboard(QXlibScreen *screen); - - void changeLayout(); - - void handleKeyEvent(QWidget *widget, QEvent::Type type, XKeyEvent *ev); - - Qt::KeyboardModifiers translateModifiers(int s); - -private: - - void setMask(KeySym sym, uint mask); - int translateKeySym(uint key) const; - QString translateKeySym(KeySym keysym, uint xmodifiers, - int &code, Qt::KeyboardModifiers &modifiers, - QByteArray &chars, int &count); - - QXlibScreen *m_screen; - - uint m_alt_mask; - uint m_super_mask; - uint m_hyper_mask; - uint m_meta_mask; - uint m_mode_switch_mask; - uint m_num_lock_mask; -}; - -#endif // QTESTLITEKEYBOARD_H diff --git a/src/plugins/platforms/testlite/qtestlitemime.cpp b/src/plugins/platforms/testlite/qtestlitemime.cpp deleted file mode 100644 index 5335ae9..0000000 --- a/src/plugins/platforms/testlite/qtestlitemime.cpp +++ /dev/null @@ -1,322 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qtestlitemime.h" - -#include "qtestlitestaticinfo.h" -#include "qtestlitescreen.h" - -#include -#include -#include - -QXlibMime::QXlibMime() - : QInternalMimeData() -{ } - -QXlibMime::~QXlibMime() -{} - - - - - -QString QXlibMime::mimeAtomToString(Display *display, Atom a) -{ - if (!a) return 0; - - if (a == XA_STRING || a == QXlibStatic::atom(QXlibStatic::UTF8_STRING)) { - return "text/plain"; // some Xdnd clients are dumb - } - char *atom = XGetAtomName(display, a); - QString result = QString::fromLatin1(atom); - XFree(atom); - return result; -} - -Atom QXlibMime::mimeStringToAtom(Display *display, const QString &mimeType) -{ - if (mimeType.isEmpty()) - return 0; - return XInternAtom(display, mimeType.toLatin1().constData(), False); -} - -QStringList QXlibMime::mimeFormatsForAtom(Display *display, Atom a) -{ - QStringList formats; - if (a) { - QString atomName = mimeAtomToString(display, a); - formats.append(atomName); - - // special cases for string type - if (a == QXlibStatic::atom(QXlibStatic::UTF8_STRING) - || a == XA_STRING - || a == QXlibStatic::atom(QXlibStatic::TEXT) - || a == QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT)) - formats.append(QLatin1String("text/plain")); - - // special cases for uris - if (atomName == QLatin1String("text/x-moz-url")) - formats.append(QLatin1String("text/uri-list")); - - // special case for images - if (a == XA_PIXMAP) - formats.append(QLatin1String("image/ppm")); - } - return formats; -} - -bool QXlibMime::mimeDataForAtom(Display *display, Atom a, QMimeData *mimeData, QByteArray *data, Atom *atomFormat, int *dataFormat) -{ - bool ret = false; - *atomFormat = a; - *dataFormat = 8; - QString atomName = mimeAtomToString(display, a); - if (QInternalMimeData::hasFormatHelper(atomName, mimeData)) { - *data = QInternalMimeData::renderDataHelper(atomName, mimeData); - if (atomName == QLatin1String("application/x-color")) - *dataFormat = 16; - ret = true; - } else { - if ((a == QXlibStatic::atom(QXlibStatic::UTF8_STRING) - || a == XA_STRING - || a == QXlibStatic::atom(QXlibStatic::TEXT) - || a == QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT)) - && QInternalMimeData::hasFormatHelper(QLatin1String("text/plain"), mimeData)) { - if (a == QXlibStatic::atom(QXlibStatic::UTF8_STRING)){ - *data = QInternalMimeData::renderDataHelper(QLatin1String("text/plain"), mimeData); - ret = true; - } else if (a == XA_STRING) { - *data = QString::fromUtf8(QInternalMimeData::renderDataHelper( - QLatin1String("text/plain"), mimeData)).toLocal8Bit(); - ret = true; - } else if (a == QXlibStatic::atom(QXlibStatic::TEXT) - || a == QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT)) { - // the ICCCM states that TEXT and COMPOUND_TEXT are in the - // encoding of choice, so we choose the encoding of the locale - QByteArray strData = QString::fromUtf8(QInternalMimeData::renderDataHelper( - QLatin1String("text/plain"), mimeData)).toLocal8Bit(); - char *list[] = { strData.data(), NULL }; - - XICCEncodingStyle style = (a == QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT)) - ? XCompoundTextStyle : XStdICCTextStyle; - XTextProperty textprop; - if (list[0] != NULL - && XmbTextListToTextProperty(display, list, 1, style, - &textprop) == Success) { - *atomFormat = textprop.encoding; - *dataFormat = textprop.format; - *data = QByteArray((const char *) textprop.value, textprop.nitems * textprop.format / 8); - ret = true; - - XFree(textprop.value); - } - } - } else if (atomName == QLatin1String("text/x-moz-url") && - QInternalMimeData::hasFormatHelper(QLatin1String("text/uri-list"), mimeData)) { - QByteArray uri = QInternalMimeData::renderDataHelper( - QLatin1String("text/uri-list"), mimeData).split('\n').first(); - QString mozUri = QString::fromLatin1(uri, uri.size()); - mozUri += QLatin1Char('\n'); - *data = QByteArray(reinterpret_cast(mozUri.utf16()), mozUri.length() * 2); - ret = true; - } else if ((a == XA_PIXMAP || a == XA_BITMAP) && mimeData->hasImage()) { - ret = true; - } - } - return ret && data != 0; -} - -QList QXlibMime::mimeAtomsForFormat(Display *display, const QString &format) -{ - QList atoms; - atoms.append(mimeStringToAtom(display, format)); - - // special cases for strings - if (format == QLatin1String("text/plain")) { - atoms.append(QXlibStatic::atom(QXlibStatic::UTF8_STRING)); - atoms.append(XA_STRING); - atoms.append(QXlibStatic::atom(QXlibStatic::TEXT)); - atoms.append(QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT)); - } - - // special cases for uris - if (format == QLatin1String("text/uri-list")) { - atoms.append(mimeStringToAtom(display,QLatin1String("text/x-moz-url"))); - } - - //special cases for images - if (format == QLatin1String("image/ppm")) - atoms.append(XA_PIXMAP); - if (format == QLatin1String("image/pbm")) - atoms.append(XA_BITMAP); - - return atoms; -} - -QVariant QXlibMime::mimeConvertToFormat(Display *display, Atom a, const QByteArray &data, const QString &format, QVariant::Type requestedType, const QByteArray &encoding) -{ - QString atomName = mimeAtomToString(display,a); - if (atomName == format) - return data; - - if (!encoding.isEmpty() - && atomName == format + QLatin1String(";charset=") + QString::fromLatin1(encoding)) { - - if (requestedType == QVariant::String) { - QTextCodec *codec = QTextCodec::codecForName(encoding); - if (codec) - return codec->toUnicode(data); - } - - return data; - } - - // special cases for string types - if (format == QLatin1String("text/plain")) { - if (a == QXlibStatic::atom(QXlibStatic::UTF8_STRING)) - return QString::fromUtf8(data); - if (a == XA_STRING) - return QString::fromLatin1(data); - if (a == QXlibStatic::atom(QXlibStatic::TEXT) - || a == QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT)) - // #### might be wrong for COMPUND_TEXT - return QString::fromLocal8Bit(data, data.size()); - } - - // special case for uri types - if (format == QLatin1String("text/uri-list")) { - if (atomName == QLatin1String("text/x-moz-url")) { - // we expect this as utf16 - // the first part is a url that should only contain ascci char - // so it should be safe to check that the second char is 0 - // to verify that it is utf16 - if (data.size() > 1 && data.at(1) == 0) - return QString::fromRawData((const QChar *)data.constData(), - data.size() / 2).split(QLatin1Char('\n')).first().toLatin1(); - } - } - - // special cas for images - if (format == QLatin1String("image/ppm")) { - if (a == XA_PIXMAP && data.size() == sizeof(Pixmap)) { - Pixmap xpm = *((Pixmap*)data.data()); - if (!xpm) - return QByteArray(); - Window root; - int x; - int y; - uint width; - uint height; - uint border_width; - uint depth; - - XGetGeometry(display, xpm, &root, &x, &y, &width, &height, &border_width, &depth); - XImage *ximg = XGetImage(display,xpm,x,y,width,height,AllPlanes,depth==1 ? XYPixmap : ZPixmap); - QImage qimg = QXlibStatic::qimageFromXImage(ximg); - XDestroyImage(ximg); - - QImageWriter imageWriter; - imageWriter.setFormat("PPMRAW"); - QBuffer buf; - buf.open(QIODevice::WriteOnly); - imageWriter.setDevice(&buf); - imageWriter.write(qimg); - return buf.buffer(); - } - } - return QVariant(); -} - -Atom QXlibMime::mimeAtomForFormat(Display *display, const QString &format, QVariant::Type requestedType, const QList<Atom> &atoms, QByteArray *requestedEncoding) -{ - requestedEncoding->clear(); - - // find matches for string types - if (format == QLatin1String("text/plain")) { - if (atoms.contains(QXlibStatic::atom(QXlibStatic::UTF8_STRING))) - return QXlibStatic::atom(QXlibStatic::UTF8_STRING); - if (atoms.contains(QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT))) - return QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT); - if (atoms.contains(QXlibStatic::atom(QXlibStatic::TEXT))) - return QXlibStatic::atom(QXlibStatic::TEXT); - if (atoms.contains(XA_STRING)) - return XA_STRING; - } - - // find matches for uri types - if (format == QLatin1String("text/uri-list")) { - Atom a = mimeStringToAtom(display,format); - if (a && atoms.contains(a)) - return a; - a = mimeStringToAtom(display,QLatin1String("text/x-moz-url")); - if (a && atoms.contains(a)) - return a; - } - - // find match for image - if (format == QLatin1String("image/ppm")) { - if (atoms.contains(XA_PIXMAP)) - return XA_PIXMAP; - } - - // for string/text requests try to use a format with a well-defined charset - // first to avoid encoding problems - if (requestedType == QVariant::String - && format.startsWith(QLatin1String("text/")) - && !format.contains(QLatin1String("charset="))) { - - QString formatWithCharset = format; - formatWithCharset.append(QLatin1String(";charset=utf-8")); - - Atom a = mimeStringToAtom(display,formatWithCharset); - if (a && atoms.contains(a)) { - *requestedEncoding = "utf-8"; - return a; - } - } - - Atom a = mimeStringToAtom(display,format); - if (a && atoms.contains(a)) - return a; - - return 0; -} diff --git a/src/plugins/platforms/testlite/qtestlitemime.h b/src/plugins/platforms/testlite/qtestlitemime.h deleted file mode 100644 index 6a70ea4..0000000 --- a/src/plugins/platforms/testlite/qtestlitemime.h +++ /dev/null @@ -1,67 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QTESTLITEMIME_H -#define QTESTLITEMIME_H - -#include <private/qdnd_p.h> - -#include <QtGui/QClipboard> - -#include "qtestliteintegration.h" -#include "qtestliteclipboard.h" - -class QXlibMime : public QInternalMimeData { - Q_OBJECT -public: - QXlibMime(); - ~QXlibMime(); - - static QList<Atom> mimeAtomsForFormat(Display *display, const QString &format); - static QString mimeAtomToString(Display *display, Atom a); - static bool mimeDataForAtom(Display *display, Atom a, QMimeData *mimeData, QByteArray *data, Atom *atomFormat, int *dataFormat); - static QStringList mimeFormatsForAtom(Display *display, Atom a); - static Atom mimeStringToAtom(Display *display, const QString &mimeType); - static QVariant mimeConvertToFormat(Display *display, Atom a, const QByteArray &data, const QString &format, QVariant::Type requestedType, const QByteArray &encoding); - static Atom mimeAtomForFormat(Display *display, const QString &format, QVariant::Type requestedType, const QList<Atom> &atoms, QByteArray *requestedEncoding); -}; - -#endif // QTESTLITEMIME_H diff --git a/src/plugins/platforms/testlite/qtestlitescreen.cpp b/src/plugins/platforms/testlite/qtestlitescreen.cpp deleted file mode 100644 index 714c17b..0000000 --- a/src/plugins/platforms/testlite/qtestlitescreen.cpp +++ /dev/null @@ -1,468 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qtestlitescreen.h" - -#include "qtestlitecursor.h" -#include "qtestlitewindow.h" -#include "qtestlitekeyboard.h" -#include "qtestlitestaticinfo.h" -#include "qtestliteclipboard.h" - -#include <QtCore/QDebug> -#include <QtCore/QSocketNotifier> -#include <QtCore/QElapsedTimer> - -#include <private/qapplication_p.h> - -#include <X11/extensions/Xfixes.h> - -QT_BEGIN_NAMESPACE - -static int (*original_x_errhandler)(Display *dpy, XErrorEvent *); -static bool seen_badwindow; - -static int qt_x_errhandler(Display *dpy, XErrorEvent *err) -{ - -qDebug() << "qt_x_errhandler" << err->error_code; - - switch (err->error_code) { - case BadAtom: -#if 0 - if (err->request_code == 20 /* X_GetProperty */ - && (err->resourceid == XA_RESOURCE_MANAGER - || err->resourceid == XA_RGB_DEFAULT_MAP - || err->resourceid == ATOM(_NET_SUPPORTED) - || err->resourceid == ATOM(_NET_SUPPORTING_WM_CHECK) - || err->resourceid == ATOM(KDE_FULL_SESSION) - || err->resourceid == ATOM(KWIN_RUNNING) - || err->resourceid == ATOM(XdndProxy) - || err->resourceid == ATOM(XdndAware)) - - - ) { - // Perhaps we're running under SECURITY reduction? :/ - return 0; - } -#endif - qDebug() << "BadAtom"; - break; - - case BadWindow: - if (err->request_code == 2 /* X_ChangeWindowAttributes */ - || err->request_code == 38 /* X_QueryPointer */) { - for (int i = 0; i < ScreenCount(dpy); ++i) { - if (err->resourceid == RootWindow(dpy, i)) { - // Perhaps we're running under SECURITY reduction? :/ - return 0; - } - } - } - seen_badwindow = true; - if (err->request_code == 25 /* X_SendEvent */) { - for (int i = 0; i < ScreenCount(dpy); ++i) { - if (err->resourceid == RootWindow(dpy, i)) { - // Perhaps we're running under SECURITY reduction? :/ - return 0; - } - } -#if 0 - if (X11->xdndHandleBadwindow()) { - qDebug("xdndHandleBadwindow returned true"); - return 0; - } -#endif - } -#if 0 - if (X11->ignore_badwindow) - return 0; -#endif - break; - - case BadMatch: - if (err->request_code == 42 /* X_SetInputFocus */) - return 0; - break; - - default: -#if 0 //!defined(QT_NO_XINPUT) - if (err->request_code == X11->xinput_major - && err->error_code == (X11->xinput_errorbase + XI_BadDevice) - && err->minor_code == 3 /* X_OpenDevice */) { - return 0; - } -#endif - break; - } - - char errstr[256]; - XGetErrorText( dpy, err->error_code, errstr, 256 ); - char buffer[256]; - char request_str[256]; - qsnprintf(buffer, 256, "%d", err->request_code); - XGetErrorDatabaseText(dpy, "XRequest", buffer, "", request_str, 256); - if (err->request_code < 128) { - // X error for a normal protocol request - qWarning( "X Error: %s %d\n" - " Major opcode: %d (%s)\n" - " Resource id: 0x%lx", - errstr, err->error_code, - err->request_code, - request_str, - err->resourceid ); - } else { - // X error for an extension request - const char *extensionName = 0; -#if 0 - if (err->request_code == X11->xrender_major) - extensionName = "RENDER"; - else if (err->request_code == X11->xrandr_major) - extensionName = "RANDR"; - else if (err->request_code == X11->xinput_major) - extensionName = "XInputExtension"; - else if (err->request_code == X11->mitshm_major) - extensionName = "MIT-SHM"; -#endif - char minor_str[256]; - if (extensionName) { - qsnprintf(buffer, 256, "%s.%d", extensionName, err->minor_code); - XGetErrorDatabaseText(dpy, "XRequest", buffer, "", minor_str, 256); - } else { - extensionName = "Uknown extension"; - qsnprintf(minor_str, 256, "Unknown request"); - } - qWarning( "X Error: %s %d\n" - " Extension: %d (%s)\n" - " Minor opcode: %d (%s)\n" - " Resource id: 0x%lx", - errstr, err->error_code, - err->request_code, - extensionName, - err->minor_code, - minor_str, - err->resourceid ); - } - - // ### we really should distinguish between severe, non-severe and - // ### application specific errors - - return 0; -} - -QXlibScreen::QXlibScreen() - : mFormat(QImage::Format_RGB32) -{ - char *display_name = getenv("DISPLAY"); - mDisplay = XOpenDisplay(display_name); - mDisplayName = QString::fromLocal8Bit(display_name); - if (!mDisplay) { - fprintf(stderr, "Cannot connect to X server: %s\n", - display_name); - exit(1); - } - -#ifndef DONT_USE_MIT_SHM - Status MIT_SHM_extension_supported = XShmQueryExtension (mDisplay); - Q_ASSERT(MIT_SHM_extension_supported == True); -#endif - original_x_errhandler = XSetErrorHandler(qt_x_errhandler); - - if (qgetenv("DO_X_SYNCHRONIZE").toInt()) - XSynchronize(mDisplay, true); - - mScreen = DefaultScreen(mDisplay); - XSelectInput(mDisplay,rootWindow(), KeymapStateMask | EnterWindowMask | LeaveWindowMask | PropertyChangeMask); - int width = DisplayWidth(mDisplay, mScreen); - int height = DisplayHeight(mDisplay, mScreen); - mGeometry = QRect(0,0,width,height); - - int physicalWidth = DisplayWidthMM(mDisplay, mScreen); - int physicalHeight = DisplayHeightMM(mDisplay, mScreen); - mPhysicalSize = QSize(physicalWidth,physicalHeight); - - int xSocketNumber = XConnectionNumber(mDisplay); - - mDepth = DefaultDepth(mDisplay,mScreen); -#ifdef MYX11_DEBUG - qDebug() << "X socket:"<< xSocketNumber; -#endif - QSocketNotifier *sock = new QSocketNotifier(xSocketNumber, QSocketNotifier::Read, this); - connect(sock, SIGNAL(activated(int)), this, SLOT(eventDispatcher())); - - mCursor = new QXlibCursor(this); - mKeyboard = new QXlibKeyboard(this); -} - -QXlibScreen::~QXlibScreen() -{ - delete mCursor; - XCloseDisplay(mDisplay); -} - -#ifdef KeyPress -#undef KeyPress -#endif -#ifdef KeyRelease -#undef KeyRelease -#endif - -bool QXlibScreen::handleEvent(XEvent *xe) -{ - int quit = false; - QXlibWindow *platformWindow = 0; - QWidget *widget = QWidget::find(xe->xany.window); - if (widget) { - platformWindow = static_cast<QXlibWindow *>(widget->platformWindow()); - } - - Atom wmProtocolsAtom = QXlibStatic::atom(QXlibStatic::WM_PROTOCOLS); - Atom wmDeleteWindowAtom = QXlibStatic::atom(QXlibStatic::WM_DELETE_WINDOW); - switch (xe->type) { - - case ClientMessage: - if (xe->xclient.format == 32 && xe->xclient.message_type == wmProtocolsAtom) { - Atom a = xe->xclient.data.l[0]; - if (a == wmDeleteWindowAtom) - platformWindow->handleCloseEvent(); - } - break; - - case Expose: - if (platformWindow) - if (xe->xexpose.count == 0) - platformWindow->paintEvent(); - break; - case ConfigureNotify: - if (platformWindow) - platformWindow->resizeEvent(&xe->xconfigure); - break; - - case ButtonPress: - if (platformWindow) - platformWindow->mousePressEvent(&xe->xbutton); - break; - - case ButtonRelease: - if (platformWindow) - platformWindow->handleMouseEvent(QEvent::MouseButtonRelease, &xe->xbutton); - break; - - case MotionNotify: - if (platformWindow) - platformWindow->handleMouseEvent(QEvent::MouseMove, &xe->xbutton); - break; - - case XKeyPress: - mKeyboard->handleKeyEvent(widget,QEvent::KeyPress, &xe->xkey); - break; - - case XKeyRelease: - mKeyboard->handleKeyEvent(widget,QEvent::KeyRelease, &xe->xkey); - break; - - case EnterNotify: - if (platformWindow) - platformWindow->handleEnterEvent(); - break; - - case LeaveNotify: - if (platformWindow) - platformWindow->handleLeaveEvent(); - break; - - case XFocusIn: - if (platformWindow) - platformWindow->handleFocusInEvent(); - break; - - case XFocusOut: - if (platformWindow) - platformWindow->handleFocusOutEvent(); - break; - - case PropertyNotify: - break; - - case SelectionClear: - qDebug() << "Selection Clear!!!"; - break; - case SelectionRequest: - handleSelectionRequest(xe); - break; - case SelectionNotify: - qDebug() << "Selection Notify!!!!"; - - break; - - - default: -#ifdef MYX11_DEBUG - qDebug() << hex << xe->xany.window << "Other X event" << xe->type; -#endif - break; - } - - return quit; -} - -static Bool checkForClipboardEvents(Display *, XEvent *e, XPointer) -{ - Atom clipboard = QXlibStatic::atom(QXlibStatic::CLIPBOARD); - return ((e->type == SelectionRequest && (e->xselectionrequest.selection == XA_PRIMARY - || e->xselectionrequest.selection == clipboard)) - || (e->type == SelectionClear && (e->xselectionclear.selection == XA_PRIMARY - || e->xselectionclear.selection == clipboard))); -} - -bool QXlibScreen::waitForClipboardEvent(Window win, int type, XEvent *event, int timeout) -{ - QElapsedTimer timer; - timer.start(); - do { - if (XCheckTypedWindowEvent(mDisplay,win,type,event)) - return true; - - // process other clipboard events, since someone is probably requesting data from us - XEvent e; - if (XCheckIfEvent(mDisplay, &e, checkForClipboardEvents, 0)) - handleEvent(&e); - - XFlush(mDisplay); - - // sleep 50 ms, so we don't use up CPU cycles all the time. - struct timeval usleep_tv; - usleep_tv.tv_sec = 0; - usleep_tv.tv_usec = 50000; - select(0, 0, 0, 0, &usleep_tv); - } while (timer.elapsed() < timeout); - return false; -} - -void QXlibScreen::eventDispatcher() -{ - ulong marker = XNextRequest(mDisplay); - // int i = 0; - while (XPending(mDisplay)) { - XEvent event; - XNextEvent(mDisplay, &event); - /* done = */ - handleEvent(&event); - - if (event.xany.serial >= marker) { - #ifdef MYX11_DEBUG - qDebug() << "potential livelock averted"; - #endif - #if 0 - if (XEventsQueued(mDisplay, QueuedAfterFlush)) { - qDebug() << " with events queued"; - QTimer::singleShot(0, this, SLOT(eventDispatcher())); - } - #endif - break; - } - } -} - -QImage QXlibScreen::grabWindow(Window window, int x, int y, int w, int h) -{ - if (w == 0 || h ==0) - return QImage(); - - //WinId 0 means the desktop widget - if (!window) - window = rootWindow(); - - XWindowAttributes window_attr; - if (!XGetWindowAttributes(mDisplay, window, &window_attr)) - return QImage(); - - if (w < 0) - w = window_attr.width - x; - if (h < 0) - h = window_attr.height - y; - - // Ideally, we should also limit ourselves to the screen area, but the Qt docs say - // that it's "unsafe" to go outside the screen, so we can ignore that problem. - - //We're definitely not optimizing for speed... - XImage *xi = XGetImage(mDisplay, window, x, y, w, h, AllPlanes, ZPixmap); - - if (!xi) - return QImage(); - - //taking a copy to make sure we have ownership -- not fast - QImage result = QImage( (uchar*) xi->data, xi->width, xi->height, xi->bytes_per_line, QImage::Format_RGB32 ).copy(); - - XDestroyImage(xi); - - return result; -} - -QXlibScreen * QXlibScreen::testLiteScreenForWidget(QWidget *widget) -{ - QPlatformScreen *platformScreen = platformScreenForWidget(widget); - return static_cast<QXlibScreen *>(platformScreen); -} - -Display * QXlibScreen::display() const -{ - return mDisplay; -} - -int QXlibScreen::xScreenNumber() const -{ - return mScreen; -} - -QXlibKeyboard * QXlibScreen::keyboard() const -{ - return mKeyboard; -} - -void QXlibScreen::handleSelectionRequest(XEvent *event) -{ - QPlatformIntegration *integration = QApplicationPrivate::platformIntegration(); - QXlibClipboard *clipboard = static_cast<QXlibClipboard *>(integration->clipboard()); - clipboard->handleSelectionRequest(event); -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/testlite/qtestlitescreen.h b/src/plugins/platforms/testlite/qtestlitescreen.h deleted file mode 100644 index 7e59a59..0000000 --- a/src/plugins/platforms/testlite/qtestlitescreen.h +++ /dev/null @@ -1,104 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QTESTLITESCREEN_H -#define QTESTLITESCREEN_H - -#include <QtGui/QPlatformScreen> -#include "qtestliteintegration.h" - -QT_BEGIN_NAMESPACE - -class QXlibCursor; -class QXlibKeyboard; - -class QXlibScreen : public QPlatformScreen -{ - Q_OBJECT -public: - QXlibScreen(); - - ~QXlibScreen(); - - QString displayName() const { return mDisplayName; } - - QRect geometry() const { return mGeometry; } - int depth() const { return mDepth; } - QImage::Format format() const { return mFormat; } - QSize physicalSize() const { return mPhysicalSize; } - - Window rootWindow() { return RootWindow(mDisplay, mScreen); } - unsigned long blackPixel() { return BlackPixel(mDisplay, mScreen); } - unsigned long whitePixel() { return WhitePixel(mDisplay, mScreen); } - - bool handleEvent(XEvent *xe); - bool waitForClipboardEvent(Window win, int type, XEvent *event, int timeout); - - QImage grabWindow(Window window, int x, int y, int w, int h); - - static QXlibScreen *testLiteScreenForWidget(QWidget *widget); - - Display *display() const; - int xScreenNumber() const; - - QXlibKeyboard *keyboard() const; - -public slots: - void eventDispatcher(); - -private: - - void handleSelectionRequest(XEvent *event); - QString mDisplayName; - QRect mGeometry; - QSize mPhysicalSize; - int mDepth; - QImage::Format mFormat; - QXlibCursor *mCursor; - QXlibKeyboard *mKeyboard; - - Display * mDisplay; - int mScreen; -}; - -QT_END_NAMESPACE - -#endif // QTESTLITESCREEN_H diff --git a/src/plugins/platforms/testlite/qtestlitestaticinfo.cpp b/src/plugins/platforms/testlite/qtestlitestaticinfo.cpp deleted file mode 100644 index 837636c..0000000 --- a/src/plugins/platforms/testlite/qtestlitestaticinfo.cpp +++ /dev/null @@ -1,511 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qtestlitestaticinfo.h" -#include "qtestlitescreen.h" - -#include <qplatformdefs.h> - -#include <QtGui/private/qapplication_p.h> -#include <QtCore/QBuffer> -#include <QtCore/QLibrary> - -#include <QDebug> - -#ifndef QT_NO_XFIXES -#include <X11/extensions/Xfixes.h> -#endif // QT_NO_XFIXES - -static const char * x11_atomnames = { - // window-manager <-> client protocols - "WM_PROTOCOLS\0" - "WM_DELETE_WINDOW\0" - "WM_TAKE_FOCUS\0" - "_NET_WM_PING\0" - "_NET_WM_CONTEXT_HELP\0" - "_NET_WM_SYNC_REQUEST\0" - "_NET_WM_SYNC_REQUEST_COUNTER\0" - - // ICCCM window state - "WM_STATE\0" - "WM_CHANGE_STATE\0" - - // Session management - "WM_CLIENT_LEADER\0" - "WM_WINDOW_ROLE\0" - "SM_CLIENT_ID\0" - - // Clipboard - "CLIPBOARD\0" - "INCR\0" - "TARGETS\0" - "MULTIPLE\0" - "TIMESTAMP\0" - "SAVE_TARGETS\0" - "CLIP_TEMPORARY\0" - "_QT_SELECTION\0" - "_QT_CLIPBOARD_SENTINEL\0" - "_QT_SELECTION_SENTINEL\0" - "CLIPBOARD_MANAGER\0" - - "RESOURCE_MANAGER\0" - - "_XSETROOT_ID\0" - - "_QT_SCROLL_DONE\0" - "_QT_INPUT_ENCODING\0" - - "_MOTIF_WM_HINTS\0" - - "DTWM_IS_RUNNING\0" - "ENLIGHTENMENT_DESKTOP\0" - "_DT_SAVE_MODE\0" - "_SGI_DESKS_MANAGER\0" - - // EWMH (aka NETWM) - "_NET_SUPPORTED\0" - "_NET_VIRTUAL_ROOTS\0" - "_NET_WORKAREA\0" - - "_NET_MOVERESIZE_WINDOW\0" - "_NET_WM_MOVERESIZE\0" - - "_NET_WM_NAME\0" - "_NET_WM_ICON_NAME\0" - "_NET_WM_ICON\0" - - "_NET_WM_PID\0" - - "_NET_WM_WINDOW_OPACITY\0" - - "_NET_WM_STATE\0" - "_NET_WM_STATE_ABOVE\0" - "_NET_WM_STATE_BELOW\0" - "_NET_WM_STATE_FULLSCREEN\0" - "_NET_WM_STATE_MAXIMIZED_HORZ\0" - "_NET_WM_STATE_MAXIMIZED_VERT\0" - "_NET_WM_STATE_MODAL\0" - "_NET_WM_STATE_STAYS_ON_TOP\0" - "_NET_WM_STATE_DEMANDS_ATTENTION\0" - - "_NET_WM_USER_TIME\0" - "_NET_WM_USER_TIME_WINDOW\0" - "_NET_WM_FULL_PLACEMENT\0" - - "_NET_WM_WINDOW_TYPE\0" - "_NET_WM_WINDOW_TYPE_DESKTOP\0" - "_NET_WM_WINDOW_TYPE_DOCK\0" - "_NET_WM_WINDOW_TYPE_TOOLBAR\0" - "_NET_WM_WINDOW_TYPE_MENU\0" - "_NET_WM_WINDOW_TYPE_UTILITY\0" - "_NET_WM_WINDOW_TYPE_SPLASH\0" - "_NET_WM_WINDOW_TYPE_DIALOG\0" - "_NET_WM_WINDOW_TYPE_DROPDOWN_MENU\0" - "_NET_WM_WINDOW_TYPE_POPUP_MENU\0" - "_NET_WM_WINDOW_TYPE_TOOLTIP\0" - "_NET_WM_WINDOW_TYPE_NOTIFICATION\0" - "_NET_WM_WINDOW_TYPE_COMBO\0" - "_NET_WM_WINDOW_TYPE_DND\0" - "_NET_WM_WINDOW_TYPE_NORMAL\0" - "_KDE_NET_WM_WINDOW_TYPE_OVERRIDE\0" - - "_KDE_NET_WM_FRAME_STRUT\0" - - "_NET_STARTUP_INFO\0" - "_NET_STARTUP_INFO_BEGIN\0" - - "_NET_SUPPORTING_WM_CHECK\0" - - "_NET_WM_CM_S0\0" - - "_NET_SYSTEM_TRAY_VISUAL\0" - - "_NET_ACTIVE_WINDOW\0" - - // Property formats - "COMPOUND_TEXT\0" - "TEXT\0" - "UTF8_STRING\0" - - // xdnd - "XdndEnter\0" - "XdndPosition\0" - "XdndStatus\0" - "XdndLeave\0" - "XdndDrop\0" - "XdndFinished\0" - "XdndTypeList\0" - "XdndActionList\0" - - "XdndSelection\0" - - "XdndAware\0" - "XdndProxy\0" - - "XdndActionCopy\0" - "XdndActionLink\0" - "XdndActionMove\0" - "XdndActionPrivate\0" - - // Motif DND - "_MOTIF_DRAG_AND_DROP_MESSAGE\0" - "_MOTIF_DRAG_INITIATOR_INFO\0" - "_MOTIF_DRAG_RECEIVER_INFO\0" - "_MOTIF_DRAG_WINDOW\0" - "_MOTIF_DRAG_TARGETS\0" - - "XmTRANSFER_SUCCESS\0" - "XmTRANSFER_FAILURE\0" - - // Xkb - "_XKB_RULES_NAMES\0" - - // XEMBED - "_XEMBED\0" - "_XEMBED_INFO\0" - - // Wacom old. (before version 0.10) - "Wacom Stylus\0" - "Wacom Cursor\0" - "Wacom Eraser\0" - - // Tablet - "STYLUS\0" - "ERASER\0" -}; - -/*! - \internal - Try to resolve a \a symbol from \a library with the version specified - by \a vernum. - - Note that, in the case of the Xfixes library, \a vernum is not the same as - \c XFIXES_MAJOR - it is a part of soname and may differ from the Xfixes - version. -*/ -static void* qt_load_library_runtime(const char *library, int vernum, - int highestVernum, const char *symbol) -{ - QList<int> versions; - // we try to load in the following order: - // explicit version -> the default one -> (from the highest (highestVernum) to the lowest (vernum) ) - if (vernum != -1) - versions << vernum; - versions << -1; - if (vernum != -1) { - for(int i = highestVernum; i > vernum; --i) - versions << i; - } - Q_FOREACH(int version, versions) { - QLatin1String libName(library); - QLibrary xfixesLib(libName, version); - void *ptr = xfixesLib.resolve(symbol); - if (ptr) - return ptr; - } - return 0; -} - -# define XFIXES_LOAD_RUNTIME(vernum, symbol, symbol_type) \ - (symbol_type)qt_load_library_runtime("libXfixes", vernum, 4, #symbol); -# define XFIXES_LOAD_V1(symbol) \ - XFIXES_LOAD_RUNTIME(1, symbol, Ptr##symbol) -# define XFIXES_LOAD_V2(symbol) \ - XFIXES_LOAD_RUNTIME(2, symbol, Ptr##symbol) - - -class QTestLiteStaticInfoPrivate -{ -public: - QTestLiteStaticInfoPrivate() - : use_xfixes(false) - , xfixes_major(0) - , xfixes_eventbase(0) - , xfixes_errorbase(0) - { - QXlibScreen *screen = qobject_cast<QXlibScreen *> (QApplicationPrivate::platformIntegration()->screens().at(0)); - Q_ASSERT(screen); - - initializeAllAtoms(screen); - initializeSupportedAtoms(screen); - - resolveXFixes(screen); - } - - bool isSupportedByWM(Atom atom) - { - if (!m_supportedAtoms) - return false; - - bool supported = false; - int i = 0; - while (m_supportedAtoms[i] != 0) { - if (m_supportedAtoms[i++] == atom) { - supported = true; - break; - } - } - - return supported; - } - - Atom atom(QXlibStatic::X11Atom atom) - { - return m_allAtoms[atom]; - } - - bool useXFixes() const { return use_xfixes; } - - int xFixesEventBase() const {return xfixes_eventbase; } - - PtrXFixesSelectSelectionInput xFixesSelectSelectionInput() const - { - return ptrXFixesSelectSelectionInput; - } - - QImage qimageFromXImage(XImage *xi) - { - QImage::Format format = QImage::Format_ARGB32_Premultiplied; - if (xi->depth == 24) - format = QImage::Format_RGB32; - else if (xi->depth == 16) - format = QImage::Format_RGB16; - - QImage image = QImage((uchar *)xi->data, xi->width, xi->height, xi->bytes_per_line, format).copy(); - - // we may have to swap the byte order - if ((QSysInfo::ByteOrder == QSysInfo::LittleEndian && xi->byte_order == MSBFirst) - || (QSysInfo::ByteOrder == QSysInfo::BigEndian && xi->byte_order == LSBFirst)) - { - for (int i=0; i < image.height(); i++) { - if (xi->depth == 16) { - ushort *p = (ushort*)image.scanLine(i); - ushort *end = p + image.width(); - while (p < end) { - *p = ((*p << 8) & 0xff00) | ((*p >> 8) & 0x00ff); - p++; - } - } else { - uint *p = (uint*)image.scanLine(i); - uint *end = p + image.width(); - while (p < end) { - *p = ((*p << 24) & 0xff000000) | ((*p << 8) & 0x00ff0000) - | ((*p >> 8) & 0x0000ff00) | ((*p >> 24) & 0x000000ff); - p++; - } - } - } - } - - // fix-up alpha channel - if (format == QImage::Format_RGB32) { - QRgb *p = (QRgb *)image.bits(); - for (int y = 0; y < xi->height; ++y) { - for (int x = 0; x < xi->width; ++x) - p[x] |= 0xff000000; - p += xi->bytes_per_line / 4; - } - } - - return image; - } - - -private: - - void initializeAllAtoms(QXlibScreen *screen) { - const char *names[QXlibStatic::NAtoms]; - const char *ptr = x11_atomnames; - - int i = 0; - while (*ptr) { - names[i++] = ptr; - while (*ptr) - ++ptr; - ++ptr; - } - - Q_ASSERT(i == QXlibStatic::NPredefinedAtoms); - - QByteArray settings_atom_name("_QT_SETTINGS_TIMESTAMP_"); - settings_atom_name += XDisplayName(qPrintable(screen->displayName())); - names[i++] = settings_atom_name; - - Q_ASSERT(i == QXlibStatic::NAtoms); - #if 0//defined(XlibSpecificationRelease) && (XlibSpecificationRelease >= 6) - XInternAtoms(screen->display(), (char **)names, i, False, m_allAtoms); - #else - for (i = 0; i < QXlibStatic::NAtoms; ++i) - m_allAtoms[i] = XInternAtom(screen->display(), (char *)names[i], False); - #endif - } - - void initializeSupportedAtoms(QXlibScreen *screen) - { - Atom type; - int format; - long offset = 0; - unsigned long nitems, after; - unsigned char *data = 0; - - int e = XGetWindowProperty(screen->display(), screen->rootWindow(), - this->atom(QXlibStatic::_NET_SUPPORTED), 0, 0, - False, XA_ATOM, &type, &format, &nitems, &after, &data); - if (data) - XFree(data); - - if (e == Success && type == XA_ATOM && format == 32) { - QBuffer ts; - ts.open(QIODevice::WriteOnly); - - while (after > 0) { - XGetWindowProperty(screen->display(), screen->rootWindow(), - this->atom(QXlibStatic::_NET_SUPPORTED), offset, 1024, - False, XA_ATOM, &type, &format, &nitems, &after, &data); - - if (type == XA_ATOM && format == 32) { - ts.write(reinterpret_cast<char *>(data), nitems * sizeof(long)); - offset += nitems; - } else - after = 0; - if (data) - XFree(data); - } - - // compute nitems - QByteArray buffer(ts.buffer()); - nitems = buffer.size() / sizeof(Atom); - m_supportedAtoms = new Atom[nitems + 1]; - Atom *a = (Atom *) buffer.data(); - uint i; - for (i = 0; i < nitems; i++) - m_supportedAtoms[i] = a[i]; - m_supportedAtoms[nitems] = 0; - - } - } - - void resolveXFixes(QXlibScreen *screen) - { -#ifndef QT_NO_XFIXES - // See if Xfixes is supported on the connected display - if (XQueryExtension(screen->display(), "XFIXES", &xfixes_major, - &xfixes_eventbase, &xfixes_errorbase)) { - ptrXFixesQueryExtension = XFIXES_LOAD_V1(XFixesQueryExtension); - ptrXFixesQueryVersion = XFIXES_LOAD_V1(XFixesQueryVersion); - ptrXFixesSetCursorName = XFIXES_LOAD_V2(XFixesSetCursorName); - ptrXFixesSelectSelectionInput = XFIXES_LOAD_V2(XFixesSelectSelectionInput); - - if(ptrXFixesQueryExtension && ptrXFixesQueryVersion - && ptrXFixesQueryExtension(screen->display(), &xfixes_eventbase, - &xfixes_errorbase)) { - // Xfixes is supported. - // Note: the XFixes protocol version is negotiated using QueryVersion. - // We supply the highest version we support, the X server replies with - // the highest version it supports, but no higher than the version we - // asked for. The version sent back is the protocol version the X server - // will use to talk us. If this call is removed, the behavior of the - // X server when it receives an XFixes request is undefined. - int major = 3; - int minor = 0; - ptrXFixesQueryVersion(screen->display(), &major, &minor); - use_xfixes = (major >= 1); - xfixes_major = major; - } - } -#endif // QT_NO_XFIXES - - } - - Atom *m_supportedAtoms; - Atom m_allAtoms[QXlibStatic::NAtoms]; - -#ifndef QT_NO_XFIXES - PtrXFixesQueryExtension ptrXFixesQueryExtension; - PtrXFixesQueryVersion ptrXFixesQueryVersion; - PtrXFixesSetCursorName ptrXFixesSetCursorName; - PtrXFixesSelectSelectionInput ptrXFixesSelectSelectionInput; -#endif - - bool use_xfixes; - int xfixes_major; - int xfixes_eventbase; - int xfixes_errorbase; - -}; -Q_GLOBAL_STATIC(QTestLiteStaticInfoPrivate, qTestLiteStaticInfoPrivate); - - -Atom QXlibStatic::atom(QXlibStatic::X11Atom atom) -{ - return qTestLiteStaticInfoPrivate()->atom(atom); -} - -bool QXlibStatic::isSupportedByWM(Atom atom) -{ - return qTestLiteStaticInfoPrivate()->isSupportedByWM(atom); -} - -bool QXlibStatic::useXFixes() -{ - return qTestLiteStaticInfoPrivate()->useXFixes(); -} - -int QXlibStatic::xFixesEventBase() -{ - return qTestLiteStaticInfoPrivate()->xFixesEventBase(); -} - -#ifndef QT_NO_XFIXES -PtrXFixesSelectSelectionInput QXlibStatic::xFixesSelectSelectionInput() -{ - qDebug() << qTestLiteStaticInfoPrivate()->useXFixes(); - if (!qTestLiteStaticInfoPrivate()->useXFixes()) - return 0; - - return qTestLiteStaticInfoPrivate()->xFixesSelectSelectionInput(); -} - -QImage QXlibStatic::qimageFromXImage(XImage *xi) -{ - return qTestLiteStaticInfoPrivate()->qimageFromXImage(xi); -} -#endif //QT_NO_XFIXES diff --git a/src/plugins/platforms/testlite/qtestlitestaticinfo.h b/src/plugins/platforms/testlite/qtestlitestaticinfo.h deleted file mode 100644 index 8473ee9..0000000 --- a/src/plugins/platforms/testlite/qtestlitestaticinfo.h +++ /dev/null @@ -1,413 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QTESTLITESTATICINFO_H -#define QTESTLITESTATICINFO_H - -#include <QtCore/QTextStream> -#include <QtCore/QDataStream> -#include <QtCore/QMetaType> -#include <QtCore/QVariant> - -#if defined(_XLIB_H_) // crude hack, but... -#error "cannot include <X11/Xlib.h> before this file" -#endif -#define XRegisterIMInstantiateCallback qt_XRegisterIMInstantiateCallback -#define XUnregisterIMInstantiateCallback qt_XUnregisterIMInstantiateCallback -#define XSetIMValues qt_XSetIMValues -#include <X11/Xlib.h> -#undef XRegisterIMInstantiateCallback -#undef XUnregisterIMInstantiateCallback -#undef XSetIMValues - -#include <X11/Xutil.h> -#include <X11/Xos.h> -#ifdef index -# undef index -#endif -#ifdef rindex -# undef rindex -#endif -#ifdef Q_OS_VXWORS -# ifdef open -# undef open -# endif -# ifdef getpid -# undef getpid -# endif -#endif // Q_OS_VXWORKS -#include <X11/Xatom.h> - -//#define QT_NO_SHAPE -#ifdef QT_NO_SHAPE -# define XShapeCombineRegion(a,b,c,d,e,f,g) -# define XShapeCombineMask(a,b,c,d,e,f,g) -#else -# include <X11/extensions/shape.h> -#endif // QT_NO_SHAPE - - -#if !defined (QT_NO_TABLET) -# include <X11/extensions/XInput.h> -#if defined (Q_OS_IRIX) -# include <X11/extensions/SGIMisc.h> -# include <wacom.h> -#endif -#endif // QT_NO_TABLET - - -// #define QT_NO_XINERAMA -#ifndef QT_NO_XINERAMA -// XFree86 does not C++ify Xinerama (at least up to XFree86 4.0.3). -extern "C" { -# include <X11/extensions/Xinerama.h> -} -#endif // QT_NO_XINERAMA - -// #define QT_NO_XRANDR -#ifndef QT_NO_XRANDR -# include <X11/extensions/Xrandr.h> -#endif // QT_NO_XRANDR - -// #define QT_NO_XRENDER -#ifndef QT_NO_XRENDER -# include <X11/extensions/Xrender.h> -#endif // QT_NO_XRENDER - -#ifndef QT_NO_XSYNC -extern "C" { -# include "X11/extensions/sync.h" -} -#endif - -// #define QT_NO_XKB -#ifndef QT_NO_XKB -# include <X11/XKBlib.h> -#endif // QT_NO_XKB - - -#if !defined(XlibSpecificationRelease) -# define X11R4 -typedef char *XPointer; -#else -# undef X11R4 -#endif - -#ifndef QT_NO_XFIXES -typedef Bool (*PtrXFixesQueryExtension)(Display *, int *, int *); -typedef Status (*PtrXFixesQueryVersion)(Display *, int *, int *); -typedef void (*PtrXFixesSetCursorName)(Display *dpy, Cursor cursor, const char *name); -typedef void (*PtrXFixesSelectSelectionInput)(Display *dpy, Window win, Atom selection, unsigned long eventMask); -#endif // QT_NO_XFIXES - -#ifndef QT_NO_XCURSOR -#include <X11/Xcursor/Xcursor.h> -typedef Cursor (*PtrXcursorLibraryLoadCursor)(Display *, const char *); -#endif // QT_NO_XCURSOR - -#ifndef QT_NO_XINERAMA -typedef Bool (*PtrXineramaQueryExtension)(Display *dpy, int *event_base, int *error_base); -typedef Bool (*PtrXineramaIsActive)(Display *dpy); -typedef XineramaScreenInfo *(*PtrXineramaQueryScreens)(Display *dpy, int *number); -#endif // QT_NO_XINERAMA - -#ifndef QT_NO_XRANDR -typedef void (*PtrXRRSelectInput)(Display *, Window, int); -typedef int (*PtrXRRUpdateConfiguration)(XEvent *); -typedef int (*PtrXRRRootToScreen)(Display *, Window); -typedef Bool (*PtrXRRQueryExtension)(Display *, int *, int *); -#endif // QT_NO_XRANDR - -#ifndef QT_NO_XINPUT -typedef int (*PtrXCloseDevice)(Display *, XDevice *); -typedef XDeviceInfo* (*PtrXListInputDevices)(Display *, int *); -typedef XDevice* (*PtrXOpenDevice)(Display *, XID); -typedef void (*PtrXFreeDeviceList)(XDeviceInfo *); -typedef int (*PtrXSelectExtensionEvent)(Display *, Window, XEventClass *, int); -#endif // QT_NO_XINPUT - -/* - * Solaris patch 108652-47 and higher fixes crases in - * XRegisterIMInstantiateCallback, but the function doesn't seem to - * work. - * - * Instead, we disabled R6 input, and open the input method - * immediately at application start. - */ - -//######### XFree86 has wrong declarations for XRegisterIMInstantiateCallback -//######### and XUnregisterIMInstantiateCallback in at least version 3.3.2. -//######### Many old X11R6 header files lack XSetIMValues. -//######### Therefore, we have to declare these functions ourselves. - -extern "C" Bool XRegisterIMInstantiateCallback( - Display*, - struct _XrmHashBucketRec*, - char*, - char*, - XIMProc, //XFree86 has XIDProc, which has to be wrong - XPointer -); - -extern "C" Bool XUnregisterIMInstantiateCallback( - Display*, - struct _XrmHashBucketRec*, - char*, - char*, - XIMProc, //XFree86 has XIDProc, which has to be wrong - XPointer -); - -#ifndef X11R4 -# include <X11/Xlocale.h> -#endif // X11R4 - - -#ifndef QT_NO_MITSHM -# include <X11/extensions/XShm.h> -#endif // QT_NO_MITSHM - -// rename a couple of X defines to get rid of name clashes -// resolve the conflict between X11's FocusIn and QEvent::FocusIn -enum { - XFocusOut = FocusOut, - XFocusIn = FocusIn, - XKeyPress = KeyPress, - XKeyRelease = KeyRelease, - XNone = None, - XRevertToParent = RevertToParent, - XGrayScale = GrayScale, - XCursorShape = CursorShape -}; -#undef FocusOut -#undef FocusIn -#undef KeyPress -#undef KeyRelease -#undef None -#undef RevertToParent -#undef GrayScale -#undef CursorShape - -#ifdef FontChange -#undef FontChange -#endif - - -class QXlibStatic -{ -public: - enum X11Atom { - // window-manager <-> client protocols - WM_PROTOCOLS, - WM_DELETE_WINDOW, - WM_TAKE_FOCUS, - _NET_WM_PING, - _NET_WM_CONTEXT_HELP, - _NET_WM_SYNC_REQUEST, - _NET_WM_SYNC_REQUEST_COUNTER, - - // ICCCM window state - WM_STATE, - WM_CHANGE_STATE, - - // Session management - WM_CLIENT_LEADER, - WM_WINDOW_ROLE, - SM_CLIENT_ID, - - // Clipboard - CLIPBOARD, - INCR, - TARGETS, - MULTIPLE, - TIMESTAMP, - SAVE_TARGETS, - CLIP_TEMPORARY, - _QT_SELECTION, - _QT_CLIPBOARD_SENTINEL, - _QT_SELECTION_SENTINEL, - CLIPBOARD_MANAGER, - - RESOURCE_MANAGER, - - _XSETROOT_ID, - - _QT_SCROLL_DONE, - _QT_INPUT_ENCODING, - - _MOTIF_WM_HINTS, - - DTWM_IS_RUNNING, - ENLIGHTENMENT_DESKTOP, - _DT_SAVE_MODE, - _SGI_DESKS_MANAGER, - - // EWMH (aka NETWM) - _NET_SUPPORTED, - _NET_VIRTUAL_ROOTS, - _NET_WORKAREA, - - _NET_MOVERESIZE_WINDOW, - _NET_WM_MOVERESIZE, - - _NET_WM_NAME, - _NET_WM_ICON_NAME, - _NET_WM_ICON, - - _NET_WM_PID, - - _NET_WM_WINDOW_OPACITY, - - _NET_WM_STATE, - _NET_WM_STATE_ABOVE, - _NET_WM_STATE_BELOW, - _NET_WM_STATE_FULLSCREEN, - _NET_WM_STATE_MAXIMIZED_HORZ, - _NET_WM_STATE_MAXIMIZED_VERT, - _NET_WM_STATE_MODAL, - _NET_WM_STATE_STAYS_ON_TOP, - _NET_WM_STATE_DEMANDS_ATTENTION, - - _NET_WM_USER_TIME, - _NET_WM_USER_TIME_WINDOW, - _NET_WM_FULL_PLACEMENT, - - _NET_WM_WINDOW_TYPE, - _NET_WM_WINDOW_TYPE_DESKTOP, - _NET_WM_WINDOW_TYPE_DOCK, - _NET_WM_WINDOW_TYPE_TOOLBAR, - _NET_WM_WINDOW_TYPE_MENU, - _NET_WM_WINDOW_TYPE_UTILITY, - _NET_WM_WINDOW_TYPE_SPLASH, - _NET_WM_WINDOW_TYPE_DIALOG, - _NET_WM_WINDOW_TYPE_DROPDOWN_MENU, - _NET_WM_WINDOW_TYPE_POPUP_MENU, - _NET_WM_WINDOW_TYPE_TOOLTIP, - _NET_WM_WINDOW_TYPE_NOTIFICATION, - _NET_WM_WINDOW_TYPE_COMBO, - _NET_WM_WINDOW_TYPE_DND, - _NET_WM_WINDOW_TYPE_NORMAL, - _KDE_NET_WM_WINDOW_TYPE_OVERRIDE, - - _KDE_NET_WM_FRAME_STRUT, - - _NET_STARTUP_INFO, - _NET_STARTUP_INFO_BEGIN, - - _NET_SUPPORTING_WM_CHECK, - - _NET_WM_CM_S0, - - _NET_SYSTEM_TRAY_VISUAL, - - _NET_ACTIVE_WINDOW, - - // Property formats - COMPOUND_TEXT, - TEXT, - UTF8_STRING, - - // Xdnd - XdndEnter, - XdndPosition, - XdndStatus, - XdndLeave, - XdndDrop, - XdndFinished, - XdndTypelist, - XdndActionList, - - XdndSelection, - - XdndAware, - XdndProxy, - - XdndActionCopy, - XdndActionLink, - XdndActionMove, - XdndActionPrivate, - - // Motif DND - _MOTIF_DRAG_AND_DROP_MESSAGE, - _MOTIF_DRAG_INITIATOR_INFO, - _MOTIF_DRAG_RECEIVER_INFO, - _MOTIF_DRAG_WINDOW, - _MOTIF_DRAG_TARGETS, - - XmTRANSFER_SUCCESS, - XmTRANSFER_FAILURE, - - // Xkb - _XKB_RULES_NAMES, - - // XEMBED - _XEMBED, - _XEMBED_INFO, - - XWacomStylus, - XWacomCursor, - XWacomEraser, - - XTabletStylus, - XTabletEraser, - - NPredefinedAtoms, - - _QT_SETTINGS_TIMESTAMP = NPredefinedAtoms, - NAtoms - }; - - static Atom atom(X11Atom atom); - static bool isSupportedByWM(Atom atom); - - static bool useXFixes(); - static int xFixesEventBase(); - - #ifndef QT_NO_XFIXES - static PtrXFixesSelectSelectionInput xFixesSelectSelectionInput(); - #endif //QT_NO_XFIXES - - static QImage qimageFromXImage(XImage *xi); - - -}; - -#endif // QTESTLITESTATICINFO_H diff --git a/src/plugins/platforms/testlite/qtestlitewindow.cpp b/src/plugins/platforms/testlite/qtestlitewindow.cpp deleted file mode 100644 index 0f11a81..0000000 --- a/src/plugins/platforms/testlite/qtestlitewindow.cpp +++ /dev/null @@ -1,735 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qtestlitewindow.h" - -#include "qtestliteintegration.h" -#include "qtestlitescreen.h" -#include "qtestlitekeyboard.h" -#include "qtestlitestaticinfo.h" - -#include <QtGui/QWindowSystemInterface> -#include <QSocketNotifier> -#include <QApplication> -#include <QDebug> - -#include <QtGui/private/qwindowsurface_p.h> -#include <QtGui/private/qapplication_p.h> - -#if !defined(QT_NO_OPENGL) -#if !defined(QT_OPENGL_ES_2) -#include "qglxintegration.h" -#else -#include "../eglconvenience/qeglconvenience.h" -#include "../eglconvenience/qeglplatformcontext.h" -#include "qtestliteeglintegration.h" -#endif //QT_OPENGL_ES_2 -#endif //QT_NO_OPENGL - -//#define MYX11_DEBUG - -QT_BEGIN_NAMESPACE - -QXlibWindow::QXlibWindow(QWidget *window) - : QPlatformWindow(window) - , mGLContext(0) - , mScreen(QXlibScreen::testLiteScreenForWidget(window)) -{ - int x = window->x(); - int y = window->y(); - int w = window->width(); - int h = window->height(); - - if(window->platformWindowFormat().windowApi() == QPlatformWindowFormat::OpenGL - && QApplicationPrivate::platformIntegration()->hasOpenGL() ) { -#if !defined(QT_NO_OPENGL) -#if !defined(QT_OPENGL_ES_2) - XVisualInfo *visualInfo = QGLXContext::findVisualInfo(mScreen,window->platformWindowFormat()); -#else - QPlatformWindowFormat windowFormat = correctColorBuffers(window->platformWindowFormat()); - - EGLDisplay eglDisplay = eglGetDisplay(mScreen->display()); - EGLConfig eglConfig = q_configFromQPlatformWindowFormat(eglDisplay,windowFormat); - VisualID id = QXlibEglIntegration::getCompatibleVisualId(mScreen->display(),eglConfig); - - XVisualInfo visualInfoTemplate; - memset(&visualInfoTemplate, 0, sizeof(XVisualInfo)); - visualInfoTemplate.visualid = id; - - XVisualInfo *visualInfo; - int matchingCount = 0; - visualInfo = XGetVisualInfo(mScreen->display(), VisualIDMask, &visualInfoTemplate, &matchingCount); -#endif //!defined(QT_OPENGL_ES_2) - if (visualInfo) { - Colormap cmap = XCreateColormap(mScreen->display(),mScreen->rootWindow(),visualInfo->visual,AllocNone); - - XSetWindowAttributes a; - a.colormap = cmap; - x_window = XCreateWindow(mScreen->display(), mScreen->rootWindow(),x, y, w, h, - 0, visualInfo->depth, InputOutput, visualInfo->visual, - CWColormap, &a); - } else { - qFatal("no window!"); - } -#endif //!defined(QT_NO_OPENGL) - } else { - x_window = XCreateSimpleWindow(mScreen->display(), mScreen->rootWindow(), - x, y, w, h, 0 /*border_width*/, - mScreen->blackPixel(), mScreen->whitePixel()); - } - -#ifdef MYX11_DEBUG - qDebug() << "QTestLiteWindow::QTestLiteWindow creating" << hex << x_window << window; -#endif - - XSetWindowBackgroundPixmap(mScreen->display(), x_window, XNone); - - XSelectInput(mScreen->display(), x_window, - ExposureMask | KeyPressMask | KeyReleaseMask | - EnterWindowMask | LeaveWindowMask | FocusChangeMask | - PointerMotionMask | ButtonPressMask | ButtonReleaseMask | - ButtonMotionMask | PropertyChangeMask | - StructureNotifyMask); - - gc = createGC(); - - Atom protocols[5]; - int n = 0; - protocols[n++] = QXlibStatic::atom(QXlibStatic::WM_DELETE_WINDOW); // support del window protocol - protocols[n++] = QXlibStatic::atom(QXlibStatic::WM_TAKE_FOCUS); // support take focus window protocol - protocols[n++] = QXlibStatic::atom(QXlibStatic::_NET_WM_PING); // support _NET_WM_PING protocol -#ifndef QT_NO_XSYNC - protocols[n++] = QXlibStatic::atom(QXlibStatic::_NET_WM_SYNC_REQUEST); // support _NET_WM_SYNC_REQUEST protocol -#endif // QT_NO_XSYNC - if (window->windowFlags() & Qt::WindowContextHelpButtonHint) - protocols[n++] = QXlibStatic::atom(QXlibStatic::_NET_WM_CONTEXT_HELP); - XSetWMProtocols(mScreen->display(), x_window, protocols, n); -} - - - -QXlibWindow::~QXlibWindow() -{ -#ifdef MYX11_DEBUG - qDebug() << "~QTestLiteWindow" << hex << x_window; -#endif - delete mGLContext; - XFreeGC(mScreen->display(), gc); - XDestroyWindow(mScreen->display(), x_window); -} - -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// Mouse event stuff -static Qt::MouseButtons translateMouseButtons(int s) -{ - Qt::MouseButtons ret = 0; - if (s & Button1Mask) - ret |= Qt::LeftButton; - if (s & Button2Mask) - ret |= Qt::MidButton; - if (s & Button3Mask) - ret |= Qt::RightButton; - return ret; -} - - - -void QXlibWindow::handleMouseEvent(QEvent::Type type, XButtonEvent *e) -{ - static QPoint mousePoint; - - Qt::MouseButton button = Qt::NoButton; - Qt::MouseButtons buttons = translateMouseButtons(e->state); - Qt::KeyboardModifiers modifiers = mScreen->keyboard()->translateModifiers(e->state); - if (type != QEvent::MouseMove) { - switch (e->button) { - case Button1: button = Qt::LeftButton; break; - case Button2: button = Qt::MidButton; break; - case Button3: button = Qt::RightButton; break; - case Button4: - case Button5: - case 6: - case 7: { - //mouse wheel - if (type == QEvent::MouseButtonPress) { - //logic borrowed from qapplication_x11.cpp - int delta = 120 * ((e->button == Button4 || e->button == 6) ? 1 : -1); - bool hor = (((e->button == Button4 || e->button == Button5) - && (modifiers & Qt::AltModifier)) - || (e->button == 6 || e->button == 7)); - QWindowSystemInterface::handleWheelEvent(widget(), e->time, - QPoint(e->x, e->y), - QPoint(e->x_root, e->y_root), - delta, hor ? Qt::Horizontal : Qt::Vertical); - } - return; - } - default: break; - } - } - - buttons ^= button; // X event uses state *before*, Qt uses state *after* - - QWindowSystemInterface::handleMouseEvent(widget(), e->time, QPoint(e->x, e->y), - QPoint(e->x_root, e->y_root), - buttons); - - mousePoint = QPoint(e->x_root, e->y_root); -} - -void QXlibWindow::handleCloseEvent() -{ - QWindowSystemInterface::handleCloseEvent(widget()); -} - - -void QXlibWindow::handleEnterEvent() -{ - QWindowSystemInterface::handleEnterEvent(widget()); -} - -void QXlibWindow::handleLeaveEvent() -{ - QWindowSystemInterface::handleLeaveEvent(widget()); -} - -void QXlibWindow::handleFocusInEvent() -{ - QWindowSystemInterface::handleWindowActivated(widget()); -} - -void QXlibWindow::handleFocusOutEvent() -{ - QWindowSystemInterface::handleWindowActivated(0); -} - - - -void QXlibWindow::setGeometry(const QRect &rect) -{ - XMoveResizeWindow(mScreen->display(), x_window, rect.x(), rect.y(), rect.width(), rect.height()); - QPlatformWindow::setGeometry(rect); -} - - -Qt::WindowFlags QXlibWindow::windowFlags() const -{ - return mWindowFlags; -} - -WId QXlibWindow::winId() const -{ - return x_window; -} - -void QXlibWindow::setParent(const QPlatformWindow *window) -{ - QPoint topLeft = geometry().topLeft(); - XReparentWindow(mScreen->display(),x_window,window->winId(),topLeft.x(),topLeft.y()); -} - -void QXlibWindow::raise() -{ - XRaiseWindow(mScreen->display(), x_window); -} - -void QXlibWindow::lower() -{ - XLowerWindow(mScreen->display(), x_window); -} - -void QXlibWindow::setWindowTitle(const QString &title) -{ - QByteArray ba = title.toLatin1(); //We're not making a general solution here... - XTextProperty windowName; - windowName.value = (unsigned char *)ba.constData(); - windowName.encoding = XA_STRING; - windowName.format = 8; - windowName.nitems = ba.length(); - - XSetWMName(mScreen->display(), x_window, &windowName); -} - -GC QXlibWindow::createGC() -{ - GC gc; - - gc = XCreateGC(mScreen->display(), x_window, 0, 0); - if (gc < 0) { - qWarning("QTestLiteWindow::createGC() could not create GC"); - } - return gc; -} - -void QXlibWindow::paintEvent() -{ -#ifdef MYX11_DEBUG -// qDebug() << "QTestLiteWindow::paintEvent" << shm_img.size() << painted; -#endif - - if (QWindowSurface *surface = widget()->windowSurface()) - surface->flush(widget(), widget()->geometry(), QPoint()); -} - -void QXlibWindow::requestActivateWindow() -{ - XSetInputFocus(mScreen->display(), x_window, XRevertToParent, CurrentTime); -} - -void QXlibWindow::resizeEvent(XConfigureEvent *e) -{ - int xpos = geometry().x(); - int ypos = geometry().y(); - if ((e->width != geometry().width() || e->height != geometry().height()) && e->x == 0 && e->y == 0) { - //qDebug() << "resize with bogus pos" << e->x << e->y << e->width << e->height << "window"<< hex << window; - } else { - //qDebug() << "geometry change" << e->x << e->y << e->width << e->height << "window"<< hex << window; - xpos = e->x; - ypos = e->y; - } -#ifdef MYX11_DEBUG - qDebug() << hex << x_window << dec << "ConfigureNotify" << e->x << e->y << e->width << e->height << "geometry" << xpos << ypos << width << height; -#endif - - QRect newRect(xpos, ypos, e->width, e->height); - QWindowSystemInterface::handleGeometryChange(widget(), newRect); -} - -void QXlibWindow::mousePressEvent(XButtonEvent *e) -{ - static long prevTime = 0; - static Window prevWindow; - static int prevX = -999; - static int prevY = -999; - - QEvent::Type type = QEvent::MouseButtonPress; - - if (e->window == prevWindow && long(e->time) - prevTime < QApplication::doubleClickInterval() - && qAbs(e->x - prevX) < 5 && qAbs(e->y - prevY) < 5) { - type = QEvent::MouseButtonDblClick; - prevTime = e->time - QApplication::doubleClickInterval(); //no double click next time - } else { - prevTime = e->time; - } - prevWindow = e->window; - prevX = e->x; - prevY = e->y; - - handleMouseEvent(type, e); -} - -QXlibMWMHints QXlibWindow::getMWMHints() const -{ - QXlibMWMHints mwmhints; - - Atom type; - int format; - ulong nitems, bytesLeft; - uchar *data = 0; - Atom atomForMotifWmHints = QXlibStatic::atom(QXlibStatic::_MOTIF_WM_HINTS); - if ((XGetWindowProperty(mScreen->display(), x_window, atomForMotifWmHints, 0, 5, false, - atomForMotifWmHints, &type, &format, &nitems, &bytesLeft, - &data) == Success) - && (type == atomForMotifWmHints - && format == 32 - && nitems >= 5)) { - mwmhints = *(reinterpret_cast<QXlibMWMHints *>(data)); - } else { - mwmhints.flags = 0L; - mwmhints.functions = MWM_FUNC_ALL; - mwmhints.decorations = MWM_DECOR_ALL; - mwmhints.input_mode = 0L; - mwmhints.status = 0L; - } - - if (data) - XFree(data); - - return mwmhints; -} - -void QXlibWindow::setMWMHints(const QXlibMWMHints &mwmhints) -{ - Atom atomForMotifWmHints = QXlibStatic::atom(QXlibStatic::_MOTIF_WM_HINTS); - if (mwmhints.flags != 0l) { - XChangeProperty(mScreen->display(), x_window, - atomForMotifWmHints, atomForMotifWmHints, 32, - PropModeReplace, (unsigned char *) &mwmhints, 5); - } else { - XDeleteProperty(mScreen->display(), x_window, atomForMotifWmHints); - } -} - -// Returns true if we should set WM_TRANSIENT_FOR on \a w -static inline bool isTransient(const QWidget *w) -{ - return ((w->windowType() == Qt::Dialog - || w->windowType() == Qt::Sheet - || w->windowType() == Qt::Tool - || w->windowType() == Qt::SplashScreen - || w->windowType() == Qt::ToolTip - || w->windowType() == Qt::Drawer - || w->windowType() == Qt::Popup) - && !w->testAttribute(Qt::WA_X11BypassTransientForHint)); -} - -QVector<Atom> QXlibWindow::getNetWmState() const -{ - QVector<Atom> returnValue; - - // Don't read anything, just get the size of the property data - Atom actualType; - int actualFormat; - ulong propertyLength; - ulong bytesLeft; - uchar *propertyData = 0; - if (XGetWindowProperty(mScreen->display(), x_window, QXlibStatic::atom(QXlibStatic::_NET_WM_STATE), 0, 0, - False, XA_ATOM, &actualType, &actualFormat, - &propertyLength, &bytesLeft, &propertyData) == Success - && actualType == XA_ATOM && actualFormat == 32) { - returnValue.resize(bytesLeft / 4); - XFree((char*) propertyData); - - // fetch all data - if (XGetWindowProperty(mScreen->display(), x_window, QXlibStatic::atom(QXlibStatic::_NET_WM_STATE), 0, - returnValue.size(), False, XA_ATOM, &actualType, &actualFormat, - &propertyLength, &bytesLeft, &propertyData) != Success) { - returnValue.clear(); - } else if (propertyLength != (ulong)returnValue.size()) { - returnValue.resize(propertyLength); - } - - // put it into netWmState - if (!returnValue.isEmpty()) { - memcpy(returnValue.data(), propertyData, returnValue.size() * sizeof(Atom)); - } - XFree((char*) propertyData); - } - - return returnValue; -} - -Qt::WindowFlags QXlibWindow::setWindowFlags(Qt::WindowFlags flags) -{ -// Q_ASSERT(flags & Qt::Window); - mWindowFlags = flags; - -#ifdef MYX11_DEBUG - qDebug() << "QTestLiteWindow::setWindowFlags" << hex << x_window << "flags" << flags; -#endif - Qt::WindowType type = static_cast<Qt::WindowType>(int(flags & Qt::WindowType_Mask)); - - if (type == Qt::ToolTip) - flags |= Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint; - if (type == Qt::Popup) - flags |= Qt::X11BypassWindowManagerHint; - - bool topLevel = (flags & Qt::Window); - bool popup = (type == Qt::Popup); - bool dialog = (type == Qt::Dialog - || type == Qt::Sheet); - bool desktop = (type == Qt::Desktop); - bool tool = (type == Qt::Tool || type == Qt::SplashScreen - || type == Qt::ToolTip || type == Qt::Drawer); - - Q_UNUSED(topLevel); - Q_UNUSED(dialog); - Q_UNUSED(desktop); - - bool tooltip = (type == Qt::ToolTip); - - XSetWindowAttributes wsa; - - QXlibMWMHints mwmhints; - mwmhints.flags = 0L; - mwmhints.functions = 0L; - mwmhints.decorations = 0; - mwmhints.input_mode = 0L; - mwmhints.status = 0L; - - - ulong wsa_mask = 0; - if (type != Qt::SplashScreen) { // && customize) { - mwmhints.flags |= MWM_HINTS_DECORATIONS; - - bool customize = flags & Qt::CustomizeWindowHint; - if (!(flags & Qt::FramelessWindowHint) && !(customize && !(flags & Qt::WindowTitleHint))) { - mwmhints.decorations |= MWM_DECOR_BORDER; - mwmhints.decorations |= MWM_DECOR_RESIZEH; - - if (flags & Qt::WindowTitleHint) - mwmhints.decorations |= MWM_DECOR_TITLE; - - if (flags & Qt::WindowSystemMenuHint) - mwmhints.decorations |= MWM_DECOR_MENU; - - if (flags & Qt::WindowMinimizeButtonHint) { - mwmhints.decorations |= MWM_DECOR_MINIMIZE; - mwmhints.functions |= MWM_FUNC_MINIMIZE; - } - - if (flags & Qt::WindowMaximizeButtonHint) { - mwmhints.decorations |= MWM_DECOR_MAXIMIZE; - mwmhints.functions |= MWM_FUNC_MAXIMIZE; - } - - if (flags & Qt::WindowCloseButtonHint) - mwmhints.functions |= MWM_FUNC_CLOSE; - } - } else { - // if type == Qt::SplashScreen - mwmhints.decorations = MWM_DECOR_ALL; - } - - if (tool) { - wsa.save_under = True; - wsa_mask |= CWSaveUnder; - } - - if (flags & Qt::X11BypassWindowManagerHint) { - wsa.override_redirect = True; - wsa_mask |= CWOverrideRedirect; - } -#if 0 - if (wsa_mask && initializeWindow) { - Q_ASSERT(id); - XChangeWindowAttributes(dpy, id, wsa_mask, &wsa); - } -#endif - if (mwmhints.functions != 0) { - mwmhints.flags |= MWM_HINTS_FUNCTIONS; - mwmhints.functions |= MWM_FUNC_MOVE | MWM_FUNC_RESIZE; - } else { - mwmhints.functions = MWM_FUNC_ALL; - } - - if (!(flags & Qt::FramelessWindowHint) - && flags & Qt::CustomizeWindowHint - && flags & Qt::WindowTitleHint - && !(flags & - (Qt::WindowMinimizeButtonHint - | Qt::WindowMaximizeButtonHint - | Qt::WindowCloseButtonHint))) { - // a special case - only the titlebar without any button - mwmhints.flags = MWM_HINTS_FUNCTIONS; - mwmhints.functions = MWM_FUNC_MOVE | MWM_FUNC_RESIZE; - mwmhints.decorations = 0; - } - - if (widget()->windowModality() == Qt::WindowModal) { - mwmhints.input_mode = MWM_INPUT_PRIMARY_APPLICATION_MODAL; - } else if (widget()->windowModality() == Qt::ApplicationModal) { - mwmhints.input_mode = MWM_INPUT_FULL_APPLICATION_MODAL; - } - - setMWMHints(mwmhints); - - QVector<Atom> netWmState = getNetWmState(); - - if (flags & Qt::WindowStaysOnTopHint) { - if (flags & Qt::WindowStaysOnBottomHint) - qWarning() << "QWidget: Incompatible window flags: the window can't be on top and on bottom at the same time"; - if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_ABOVE))) - netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_ABOVE)); - if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_STAYS_ON_TOP))) - netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_STAYS_ON_TOP)); - } else if (flags & Qt::WindowStaysOnBottomHint) { - if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_BELOW))) - netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_BELOW)); - } - if (widget()->isFullScreen()) { - if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_FULLSCREEN))) - netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_FULLSCREEN)); - } - if (widget()->isMaximized()) { - if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_MAXIMIZED_HORZ))) - netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_MAXIMIZED_HORZ)); - if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_MAXIMIZED_VERT))) - netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_MAXIMIZED_VERT)); - } - if (widget()->windowModality() != Qt::NonModal) { - if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_MODAL))) - netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_MODAL)); - } - - if (!netWmState.isEmpty()) { - XChangeProperty(mScreen->display(), x_window, - QXlibStatic::atom(QXlibStatic::_NET_WM_STATE), XA_ATOM, 32, PropModeReplace, - (unsigned char *) netWmState.data(), netWmState.size()); - } else { - XDeleteProperty(mScreen->display(), x_window, QXlibStatic::atom(QXlibStatic::_NET_WM_STATE)); - } - -//##### only if initializeWindow??? - - if (popup || tooltip) { // popup widget -#ifdef MYX11_DEBUG - qDebug() << "Doing XChangeWindowAttributes for popup" << wsa.override_redirect; -#endif - // set EWMH window types - // setNetWmWindowTypes(); - - wsa.override_redirect = True; - wsa.save_under = True; - XChangeWindowAttributes(mScreen->display(), x_window, CWOverrideRedirect | CWSaveUnder, - &wsa); - } else { -#ifdef MYX11_DEBUG - qDebug() << "Doing XChangeWindowAttributes for non-popup"; -#endif - } - - return flags; -} - -void QXlibWindow::setVisible(bool visible) -{ -#ifdef MYX11_DEBUG - qDebug() << "QTestLiteWindow::setVisible" << visible << hex << x_window; -#endif - if (isTransient(widget())) { - Window parentXWindow = x_window; - if (widget()->parentWidget()) { - QWidget *widgetParent = widget()->parentWidget()->window(); - if (widgetParent && widgetParent->platformWindow()) { - QXlibWindow *parentWidnow = static_cast<QXlibWindow *>(widgetParent->platformWindow()); - parentXWindow = parentWidnow->x_window; - } - } - XSetTransientForHint(mScreen->display(),x_window,parentXWindow); - } - - if (visible) { - //ensure that the window is viewed in correct position. - doSizeHints(); - XMapWindow(mScreen->display(), x_window); - } else { - XUnmapWindow(mScreen->display(), x_window); - } -} - -void QXlibWindow::setCursor(const Cursor &cursor) -{ - XDefineCursor(mScreen->display(), x_window, cursor); - XFlush(mScreen->display()); -} - -QPlatformGLContext *QXlibWindow::glContext() const -{ - if (!QApplicationPrivate::platformIntegration()->hasOpenGL()) - return 0; - if (!mGLContext) { - QXlibWindow *that = const_cast<QXlibWindow *>(this); -#if !defined(QT_NO_OPENGL) -#if !defined(QT_OPENGL_ES_2) - that->mGLContext = new QGLXContext(x_window, mScreen,widget()->platformWindowFormat()); -#else - EGLDisplay display = eglGetDisplay(mScreen->display()); - - QPlatformWindowFormat windowFormat = correctColorBuffers(widget()->platformWindowFormat()); - - EGLConfig config = q_configFromQPlatformWindowFormat(display,windowFormat); - QVector<EGLint> eglContextAttrs; - eglContextAttrs.append(EGL_CONTEXT_CLIENT_VERSION); - eglContextAttrs.append(2); - eglContextAttrs.append(EGL_NONE); - - EGLSurface eglSurface = eglCreateWindowSurface(display,config,(EGLNativeWindowType)x_window,0); - that->mGLContext = new QEGLPlatformContext(display, config, eglContextAttrs.data(), eglSurface, EGL_OPENGL_ES_API); -#endif -#endif - } - return mGLContext; -} - -Window QXlibWindow::xWindow() const -{ - return x_window; -} - -GC QXlibWindow::graphicsContext() const -{ - return gc; -} - -void QXlibWindow::doSizeHints() -{ - Q_ASSERT(widget()->testAttribute(Qt::WA_WState_Created)); - XSizeHints s; - s.flags = 0; - QRect g = geometry(); - s.x = g.x(); - s.y = g.y(); - s.width = g.width(); - s.height = g.height(); - s.flags |= USPosition; - s.flags |= PPosition; - s.flags |= USSize; - s.flags |= PSize; - s.flags |= PWinGravity; - s.win_gravity = QApplication::isRightToLeft() ? NorthEastGravity : NorthWestGravity; - XSetWMNormalHints(mScreen->display(), x_window, &s); -} - -QPlatformWindowFormat QXlibWindow::correctColorBuffers(const QPlatformWindowFormat &platformWindowFormat) const -{ - // I have only tested this setup on a dodgy intel setup, where I didn't use standard libs, - // so this might be not what we want to do :) - if ( !(platformWindowFormat.redBufferSize() == -1 && - platformWindowFormat.greenBufferSize() == -1 && - platformWindowFormat.blueBufferSize() == -1)) - return platformWindowFormat; - - QPlatformWindowFormat windowFormat = platformWindowFormat; - if (mScreen->depth() == 16) { - windowFormat.setRedBufferSize(5); - windowFormat.setGreenBufferSize(6); - windowFormat.setBlueBufferSize(5); - } else { - windowFormat.setRedBufferSize(8); - windowFormat.setGreenBufferSize(8); - windowFormat.setBlueBufferSize(8); - } - - return windowFormat; -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/testlite/qtestlitewindow.h b/src/plugins/platforms/testlite/qtestlitewindow.h deleted file mode 100644 index ccf6867..0000000 --- a/src/plugins/platforms/testlite/qtestlitewindow.h +++ /dev/null @@ -1,145 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QTESTLITEWINDOW_H -#define QTESTLITEWINDOW_H - -#include "qtestliteintegration.h" - -#include <QPlatformWindow> -#include <QEvent> - -#include <QObject> -#include <QImage> - -struct QXlibMWMHints { - ulong flags, functions, decorations; - long input_mode; - ulong status; -}; - -enum { - MWM_HINTS_FUNCTIONS = (1L << 0), - - MWM_FUNC_ALL = (1L << 0), - MWM_FUNC_RESIZE = (1L << 1), - MWM_FUNC_MOVE = (1L << 2), - MWM_FUNC_MINIMIZE = (1L << 3), - MWM_FUNC_MAXIMIZE = (1L << 4), - MWM_FUNC_CLOSE = (1L << 5), - - MWM_HINTS_DECORATIONS = (1L << 1), - - MWM_DECOR_ALL = (1L << 0), - MWM_DECOR_BORDER = (1L << 1), - MWM_DECOR_RESIZEH = (1L << 2), - MWM_DECOR_TITLE = (1L << 3), - MWM_DECOR_MENU = (1L << 4), - MWM_DECOR_MINIMIZE = (1L << 5), - MWM_DECOR_MAXIMIZE = (1L << 6), - - MWM_HINTS_INPUT_MODE = (1L << 2), - - MWM_INPUT_MODELESS = 0L, - MWM_INPUT_PRIMARY_APPLICATION_MODAL = 1L, - MWM_INPUT_FULL_APPLICATION_MODAL = 3L -}; - -class QXlibWindow : public QPlatformWindow -{ -public: - QXlibWindow(QWidget *window); - ~QXlibWindow(); - - - void mousePressEvent(XButtonEvent*); - void handleMouseEvent(QEvent::Type, XButtonEvent *ev); - - void handleCloseEvent(); - void handleEnterEvent(); - void handleLeaveEvent(); - void handleFocusInEvent(); - void handleFocusOutEvent(); - - void resizeEvent(XConfigureEvent *configure_event); - void paintEvent(); - - void requestActivateWindow(); - - void setGeometry(const QRect &rect); - - Qt::WindowFlags setWindowFlags(Qt::WindowFlags type); - Qt::WindowFlags windowFlags() const; - void setVisible(bool visible); - WId winId() const; - void setParent(const QPlatformWindow *window); - void raise(); - void lower(); - void setWindowTitle(const QString &title); - - void setCursor(const Cursor &cursor); - - QPlatformGLContext *glContext() const; - - Window xWindow() const; - GC graphicsContext() const; - -protected: - QVector<Atom> getNetWmState() const; - void setMWMHints(const QXlibMWMHints &mwmhints); - QXlibMWMHints getMWMHints() const; - - void doSizeHints(); - -private: - QPlatformWindowFormat correctColorBuffers(const QPlatformWindowFormat &windowFormat)const; - - Window x_window; - GC gc; - - GC createGC(); - - QPlatformGLContext *mGLContext; - QXlibScreen *mScreen; - Qt::WindowFlags mWindowFlags; -}; - -#endif diff --git a/src/plugins/platforms/testlite/qtestlitewindowsurface.cpp b/src/plugins/platforms/testlite/qtestlitewindowsurface.cpp deleted file mode 100644 index 088730d..0000000 --- a/src/plugins/platforms/testlite/qtestlitewindowsurface.cpp +++ /dev/null @@ -1,224 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qtestlitewindowsurface.h" -#include "qtestliteintegration.h" - -#include <QtCore/qdebug.h> -#include <QWindowSystemInterface> - -#include "qtestlitewindow.h" -#include "qtestlitescreen.h" - -# include <sys/ipc.h> -# include <sys/shm.h> -# include <X11/extensions/XShm.h> - -QT_BEGIN_NAMESPACE - - -struct QXlibShmImageInfo { - QXlibShmImageInfo(Display *xdisplay) : image(0), display(xdisplay) {} - ~QXlibShmImageInfo() { destroy(); } - - void destroy(); - - XShmSegmentInfo shminfo; - XImage *image; - Display *display; -}; - - -#ifndef DONT_USE_MIT_SHM -void QXlibShmImageInfo::destroy() -{ - XShmDetach (display, &shminfo); - XDestroyImage (image); - shmdt (shminfo.shmaddr); - shmctl (shminfo.shmid, IPC_RMID, 0); -} -#endif - -void QXlibWindowSurface::resizeShmImage(int width, int height) -{ - -#ifdef DONT_USE_MIT_SHM - shm_img = QImage(width, height, QImage::Format_RGB32); -#else - - QXlibScreen *screen = QXlibScreen::testLiteScreenForWidget(window()); - if (image_info) - image_info->destroy(); - else - image_info = new QXlibShmImageInfo(screen->display()); - - Visual *visual = DefaultVisual(screen->display(), screen->xScreenNumber()); - - - XImage *image = XShmCreateImage (screen->display(), visual, 24, ZPixmap, 0, - &image_info->shminfo, width, height); - - - image_info->shminfo.shmid = shmget (IPC_PRIVATE, - image->bytes_per_line * image->height, IPC_CREAT|0777); - - image_info->shminfo.shmaddr = image->data = (char*)shmat (image_info->shminfo.shmid, 0, 0); - image_info->shminfo.readOnly = False; - - image_info->image = image; - - Status shm_attach_status = XShmAttach(screen->display(), &image_info->shminfo); - - Q_ASSERT(shm_attach_status == True); - - shm_img = QImage( (uchar*) image->data, image->width, image->height, image->bytes_per_line, QImage::Format_RGB32 ); -#endif - painted = false; -} - - -void QXlibWindowSurface::resizeBuffer(QSize s) -{ - if (shm_img.size() != s) - resizeShmImage(s.width(), s.height()); -} - -QSize QXlibWindowSurface::bufferSize() const -{ - return shm_img.size(); -} - -QXlibWindowSurface::QXlibWindowSurface (QWidget *window) - : QWindowSurface(window), - painted(false), image_info(0) -{ - xw = static_cast<QXlibWindow*>(window->platformWindow()); -// qDebug() << "QTestLiteWindowSurface::QTestLiteWindowSurface:" << xw->window; -} - -QXlibWindowSurface::~QXlibWindowSurface() -{ - delete image_info; -} - -QPaintDevice *QXlibWindowSurface::paintDevice() -{ - return &shm_img; -} - - -void QXlibWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) -{ - Q_UNUSED(widget); - Q_UNUSED(region); - Q_UNUSED(offset); - - if (!painted) - return; - - QXlibScreen *screen = QXlibScreen::testLiteScreenForWidget(widget); - GC gc = xw->graphicsContext(); - Window window = xw->xWindow(); -#ifdef DONT_USE_MIT_SHM - // just convert the image every time... - if (!shm_img.isNull()) { - Visual *visual = DefaultVisual(screen->display(), screen->xScreenNumber()); - - QImage image = shm_img; - //img.convertToFormat( - XImage *xi = XCreateImage(screen->display(), visual, 24, ZPixmap, - 0, (char *) image.scanLine(0), image.width(), image.height(), - 32, image.bytesPerLine()); - - int x = 0; - int y = 0; - - /*int r =*/ XPutImage(screen->display(), window, gc, xi, 0, 0, x, y, image.width(), image.height()); - - xi->data = 0; // QImage owns these bits - XDestroyImage(xi); - } -#else - // Use MIT_SHM - if (image_info && image_info->image) { - //qDebug() << "Here we go" << image_info->image->width << image_info->image->height; - int x = 0; - int y = 0; - - // We could set send_event to true, and then use the ShmCompletion to synchronize, - // but let's do like Qt/11 and just use XSync - XShmPutImage (screen->display(), window, gc, image_info->image, 0, 0, - x, y, image_info->image->width, image_info->image->height, - /*send_event*/ False); - - XSync(screen->display(), False); - } -#endif -} - -// from qwindowsurface.cpp -extern void qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &offset); - -bool QXlibWindowSurface::scroll(const QRegion &area, int dx, int dy) -{ - if (shm_img.isNull()) - return false; - - const QVector<QRect> rects = area.rects(); - for (int i = 0; i < rects.size(); ++i) - qt_scrollRectInImage(shm_img, rects.at(i), QPoint(dx, dy)); - - return true; -} - - -void QXlibWindowSurface::beginPaint(const QRegion ®ion) -{ - Q_UNUSED(region); - resizeBuffer(size()); -} - -void QXlibWindowSurface::endPaint(const QRegion ®ion) -{ - Q_UNUSED(region); - painted = true; //there is content in the buffer -} -QT_END_NAMESPACE diff --git a/src/plugins/platforms/testlite/qtestlitewindowsurface.h b/src/plugins/platforms/testlite/qtestlitewindowsurface.h deleted file mode 100644 index 12b4c60..0000000 --- a/src/plugins/platforms/testlite/qtestlitewindowsurface.h +++ /dev/null @@ -1,86 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWINDOWSURFACE_TESTLITE_H -#define QWINDOWSURFACE_TESTLITE_H - -#include <QtGui/private/qwindowsurface_p.h> - - -QT_BEGIN_NAMESPACE - -class QXlibWindow; -class QXlibIntegration; -class QXlibScreen; -class QXlibShmImageInfo; - -class QXlibWindowSurface : public QWindowSurface -{ -public: - QXlibWindowSurface (QWidget *window); - ~QXlibWindowSurface(); - - QPaintDevice *paintDevice(); - void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); - bool scroll(const QRegion &area, int dx, int dy); - - void beginPaint(const QRegion ®ion); - void endPaint(const QRegion ®ion); - -private: - bool painted; - void resizeBuffer(QSize); - QSize bufferSize() const; - - - void resizeShmImage(int width, int height); - - QImage shm_img; - QXlibShmImageInfo *image_info; - - QXlibWindow *xw; - -}; - - -QT_END_NAMESPACE - -#endif diff --git a/src/plugins/platforms/testlite/testlite.pro b/src/plugins/platforms/testlite/testlite.pro deleted file mode 100644 index 7fb3304..0000000 --- a/src/plugins/platforms/testlite/testlite.pro +++ /dev/null @@ -1,57 +0,0 @@ -TARGET = qtestlite - -include(../../qpluginbase.pri) -QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforms - -SOURCES = \ - main.cpp \ - qtestliteintegration.cpp \ - qtestlitewindowsurface.cpp \ - qtestlitewindow.cpp \ - qtestlitecursor.cpp \ - qtestlitescreen.cpp \ - qtestlitekeyboard.cpp \ - qtestliteclipboard.cpp \ - qtestlitemime.cpp \ - qtestlitestaticinfo.cpp - -HEADERS = \ - qtestliteintegration.h \ - qtestlitewindowsurface.h \ - qtestlitewindow.h \ - qtestlitecursor.h \ - qtestlitescreen.h \ - qtestlitekeyboard.h \ - qtestliteclipboard.h \ - qtestlitemime.h \ - qtestlitestaticinfo.h - -LIBS += -lX11 -lXext - -mac { - LIBS += -L/usr/X11/lib -lz -framework Carbon -} - -include (../fontdatabases/genericunix/genericunix.pri) - -contains(QT_CONFIG, opengl) { - QT += opengl - !contains(QT_CONFIG, opengles2) { - HEADERS += qglxintegration.h - SOURCES += qglxintegration.cpp - } else { # There is no easy way to detect if we'r suppose to use glx or not - HEADERS += \ - ../eglconvenience/qeglplatformcontext.h \ - ../eglconvenience/qeglconvenience.h \ - qtestliteeglintegration.h - - SOURCES += \ - ../eglconvenience/qeglplatformcontext.cpp \ - ../eglconvenience/qeglconvenience.cpp \ - qtestliteeglintegration.cpp - LIBS += -lEGL - } -} - -target.path += $$[QT_INSTALL_PLUGINS]/platforms -INSTALLS += target diff --git a/src/plugins/platforms/xlib/main.cpp b/src/plugins/platforms/xlib/main.cpp new file mode 100644 index 0000000..131d399 --- /dev/null +++ b/src/plugins/platforms/xlib/main.cpp @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtGui/QPlatformIntegrationPlugin> +#include "qtestliteintegration.h" + +QT_BEGIN_NAMESPACE + +class QXlibIntegrationPlugin : public QPlatformIntegrationPlugin +{ +public: + QStringList keys() const; + QPlatformIntegration *create(const QString&, const QStringList&); +}; + +QStringList QXlibIntegrationPlugin::keys() const +{ + QStringList list; + list << "Xlib"; +#ifndef QT_NO_OPENGL + list << "XlibGL"; +#endif + return list; +} + +QPlatformIntegration* QXlibIntegrationPlugin::create(const QString& system, const QStringList& paramList) +{ + Q_UNUSED(paramList); + if (system.toLower() == "xlib") + return new QXlibIntegration; +#ifndef QT_NO_OPENGL + if (system.toLower() == "xlibgl") + return new QXlibIntegration(true); +#endif + + return 0; +} + +Q_EXPORT_PLUGIN2(xlib, QXlibIntegrationPlugin) + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/xlib/qglxintegration.cpp b/src/plugins/platforms/xlib/qglxintegration.cpp new file mode 100644 index 0000000..46dfef9 --- /dev/null +++ b/src/plugins/platforms/xlib/qglxintegration.cpp @@ -0,0 +1,376 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QDebug> +#include <QLibrary> +#include <QGLFormat> + +#include "qtestlitewindow.h" +#include "qtestlitescreen.h" + +#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2) +#include <X11/Xlib.h> +#include <X11/Xutil.h> +#include <GL/glx.h> + +#include "qglxintegration.h" + +#if defined(Q_OS_LINUX) || defined(Q_OS_BSD4) +#include <dlfcn.h> +#endif + +QT_BEGIN_NAMESPACE + +QMutex QGLXContext::m_defaultSharedContextMutex(QMutex::Recursive); + +QVector<int> QGLXContext::buildSpec(const QPlatformWindowFormat &format) +{ + QVector<int> spec(48); + int i = 0; + + spec[i++] = GLX_LEVEL; + spec[i++] = 0; + spec[i++] = GLX_DRAWABLE_TYPE; spec[i++] = GLX_WINDOW_BIT; + + if (format.rgba()) { + spec[i++] = GLX_RENDER_TYPE; spec[i++] = GLX_RGBA_BIT; + spec[i++] = GLX_RED_SIZE; spec[i++] = (format.redBufferSize() == -1) ? 1 : format.redBufferSize(); + spec[i++] = GLX_GREEN_SIZE; spec[i++] = (format.greenBufferSize() == -1) ? 1 : format.greenBufferSize(); + spec[i++] = GLX_BLUE_SIZE; spec[i++] = (format.blueBufferSize() == -1) ? 1 : format.blueBufferSize(); + if (format.alpha()) { + spec[i++] = GLX_ALPHA_SIZE; spec[i++] = (format.alphaBufferSize() == -1) ? 1 : format.alphaBufferSize(); + } + + spec[i++] = GLX_ACCUM_RED_SIZE; spec[i++] = (format.accumBufferSize() == -1) ? 1 : format.accumBufferSize(); + spec[i++] = GLX_ACCUM_GREEN_SIZE; spec[i++] = (format.accumBufferSize() == -1) ? 1 : format.accumBufferSize(); + spec[i++] = GLX_ACCUM_BLUE_SIZE; spec[i++] = (format.accumBufferSize() == -1) ? 1 : format.accumBufferSize(); + + if (format.alpha()) { + spec[i++] = GLX_ACCUM_ALPHA_SIZE; spec[i++] = (format.accumBufferSize() == -1) ? 1 : format.accumBufferSize(); + } + + } else { + spec[i++] = GLX_RENDER_TYPE; spec[i++] = GLX_COLOR_INDEX_BIT; //I'm really not sure if this works.... + spec[i++] = GLX_BUFFER_SIZE; spec[i++] = 8; + } + + spec[i++] = GLX_DOUBLEBUFFER; spec[i++] = format.doubleBuffer() ? True : False; + spec[i++] = GLX_STEREO; spec[i++] = format.stereo() ? True : False; + + if (format.depth()) { + spec[i++] = GLX_DEPTH_SIZE; spec[i++] = (format.depthBufferSize() == -1) ? 1 : format.depthBufferSize(); + } + + if (format.stencil()) { + spec[i++] = GLX_STENCIL_SIZE; spec[i++] = (format.stencilBufferSize() == -1) ? 1 : format.stencilBufferSize(); + } + if (format.sampleBuffers()) { + spec[i++] = GLX_SAMPLE_BUFFERS_ARB; + spec[i++] = 1; + spec[i++] = GLX_SAMPLES_ARB; + spec[i++] = format.samples() == -1 ? 4 : format.samples(); + } + + spec[i++] = XNone; + return spec; +} + +GLXFBConfig QGLXContext::findConfig(const QXlibScreen *screen, const QPlatformWindowFormat &format) +{ + bool reduced = true; + GLXFBConfig chosenConfig = 0; + QPlatformWindowFormat reducedFormat = format; + while (!chosenConfig && reduced) { + QVector<int> spec = buildSpec(reducedFormat); + int confcount = 0; + GLXFBConfig *configs; + configs = glXChooseFBConfig(screen->display(),screen->xScreenNumber(),spec.constData(),&confcount); + if (confcount) + { + for (int i = 0; i < confcount; i++) { + chosenConfig = configs[i]; + // Make sure we try to get an ARGB visual if the format asked for an alpha: + if (reducedFormat.alpha()) { + int alphaSize; + glXGetFBConfigAttrib(screen->display(),configs[i],GLX_ALPHA_SIZE,&alphaSize); + if (alphaSize > 0) + break; + } else { + break; // Just choose the first in the list if there's no alpha requested + } + } + + XFree(configs); + } + reducedFormat = reducePlatformWindowFormat(reducedFormat,&reduced); + } + + if (!chosenConfig) + qWarning("Warning no context created"); + + return chosenConfig; +} + +XVisualInfo *QGLXContext::findVisualInfo(const QXlibScreen *screen, const QPlatformWindowFormat &format) +{ + GLXFBConfig config = QGLXContext::findConfig(screen,format); + XVisualInfo *visualInfo = glXGetVisualFromFBConfig(screen->display(),config); + return visualInfo; +} + +QPlatformWindowFormat QGLXContext::platformWindowFromGLXFBConfig(Display *display, GLXFBConfig config, GLXContext ctx) +{ + QPlatformWindowFormat format; + int redSize = 0; + int greenSize = 0; + int blueSize = 0; + int alphaSize = 0; + int depthSize = 0; + int stencilSize = 0; + int sampleBuffers = 0; + int sampleCount = 0; + int level = 0; + int rgba = 0; + int stereo = 0; + int accumSizeA = 0; + int accumSizeR = 0; + int accumSizeG = 0; + int accumSizeB = 0; + + XVisualInfo *vi = glXGetVisualFromFBConfig(display,config); + glXGetConfig(display,vi,GLX_RGBA,&rgba); + XFree(vi); + glXGetFBConfigAttrib(display, config, GLX_RED_SIZE, &redSize); + glXGetFBConfigAttrib(display, config, GLX_GREEN_SIZE, &greenSize); + glXGetFBConfigAttrib(display, config, GLX_BLUE_SIZE, &blueSize); + glXGetFBConfigAttrib(display, config, GLX_ALPHA_SIZE, &alphaSize); + glXGetFBConfigAttrib(display, config, GLX_DEPTH_SIZE, &depthSize); + glXGetFBConfigAttrib(display, config, GLX_STENCIL_SIZE, &stencilSize); + glXGetFBConfigAttrib(display, config, GLX_SAMPLES, &sampleBuffers); + glXGetFBConfigAttrib(display, config, GLX_LEVEL, &level); + glXGetFBConfigAttrib(display, config, GLX_STEREO, &stereo); + glXGetFBConfigAttrib(display, config, GLX_ACCUM_ALPHA_SIZE, &accumSizeA); + glXGetFBConfigAttrib(display, config, GLX_ACCUM_RED_SIZE, &accumSizeR); + glXGetFBConfigAttrib(display, config, GLX_ACCUM_GREEN_SIZE, &accumSizeG); + glXGetFBConfigAttrib(display, config, GLX_ACCUM_BLUE_SIZE, &accumSizeB); + + format.setRedBufferSize(redSize); + format.setGreenBufferSize(greenSize); + format.setBlueBufferSize(blueSize); + format.setAlphaBufferSize(alphaSize); + format.setDepthBufferSize(depthSize); + format.setStencilBufferSize(stencilSize); + format.setSampleBuffers(sampleBuffers); + if (format.sampleBuffers()) { + glXGetFBConfigAttrib(display, config, GLX_SAMPLES_ARB, &sampleCount); + format.setSamples(sampleCount); + } + + format.setDirectRendering(glXIsDirect(display, ctx)); + format.setRgba(rgba); + format.setStereo(stereo); + format.setAccumBufferSize(accumSizeB); + + return format; +} + +QPlatformWindowFormat QGLXContext::reducePlatformWindowFormat(const QPlatformWindowFormat &format, bool *reduced) +{ + QPlatformWindowFormat retFormat = format; + *reduced = true; + + if (retFormat.sampleBuffers()) { + retFormat.setSampleBuffers(false); + } else if (retFormat.stereo()) { + retFormat.setStereo(false); + } else if (retFormat.accum()) { + retFormat.setAccum(false); + }else if (retFormat.stencil()) { + retFormat.setStencil(false); + }else if (retFormat.alpha()) { + retFormat.setAlpha(false); + }else if (retFormat.depth()) { + retFormat.setDepth(false); + }else if (retFormat.doubleBuffer()) { + retFormat.setDoubleBuffer(false); + }else{ + *reduced = false; + } + return retFormat; +} + +QGLXContext::QGLXContext(Window window, QXlibScreen *screen, const QPlatformWindowFormat &format) + : QPlatformGLContext() + , m_screen(screen) + , m_drawable((Drawable)window) + , m_context(0) +{ + + const QPlatformGLContext *sharePlatformContext; + if (format.useDefaultSharedContext()) { + if (!QPlatformGLContext::defaultSharedContext()) { + if (m_defaultSharedContextMutex.tryLock()){ + createDefaultSharedContex(screen); + m_defaultSharedContextMutex.unlock(); + } else { + m_defaultSharedContextMutex.lock(); //wait to the the shared context is created + m_defaultSharedContextMutex.unlock(); + } + } + sharePlatformContext = QPlatformGLContext::defaultSharedContext(); + } else { + sharePlatformContext = format.sharedGLContext(); + } + GLXContext shareGlxContext = 0; + if (sharePlatformContext) + shareGlxContext = static_cast<const QGLXContext*>(sharePlatformContext)->glxContext(); + + GLXFBConfig config = findConfig(screen,format); + m_context = glXCreateNewContext(screen->display(),config,GLX_RGBA_TYPE,shareGlxContext,TRUE); + m_windowFormat = QGLXContext::platformWindowFromGLXFBConfig(screen->display(),config,m_context); + +#ifdef MYX11_DEBUG + qDebug() << "QGLXGLContext::create context" << m_context; +#endif +} + +QGLXContext::QGLXContext(QXlibScreen *screen, Drawable drawable, GLXContext context) + : QPlatformGLContext(), m_screen(screen), m_drawable(drawable), m_context(context) +{ + +} + +QGLXContext::~QGLXContext() +{ + if (m_context) { + qDebug("Destroying GLX context 0x%p", m_context); + glXDestroyContext(m_screen->display(), m_context); + } +} + +void QGLXContext::createDefaultSharedContex(QXlibScreen *screen) +{ + int x = 0; + int y = 0; + int w = 3; + int h = 3; + + QPlatformWindowFormat format = QPlatformWindowFormat::defaultFormat(); + GLXContext context; + GLXFBConfig config = findConfig(screen,format); + if (config) { + XVisualInfo *visualInfo = glXGetVisualFromFBConfig(screen->display(),config); + Colormap cmap = XCreateColormap(screen->display(),screen->rootWindow(),visualInfo->visual,AllocNone); + XSetWindowAttributes a; + a.colormap = cmap; + Window sharedWindow = XCreateWindow(screen->display(), screen->rootWindow(),x, y, w, h, + 0, visualInfo->depth, InputOutput, visualInfo->visual, + CWColormap, &a); + + context = glXCreateNewContext(screen->display(),config,GLX_RGBA_TYPE,0,TRUE); + QPlatformGLContext *sharedContext = new QGLXContext(screen,sharedWindow,context); + QPlatformGLContext::setDefaultSharedContext(sharedContext); + } else { + qWarning("Warning no shared context created"); + } +} + +void QGLXContext::makeCurrent() +{ + QPlatformGLContext::makeCurrent(); +#ifdef MYX11_DEBUG + qDebug("QGLXGLContext::makeCurrent(window=0x%x, ctx=0x%x)", m_drawable, m_context); +#endif + glXMakeCurrent(m_screen->display(), m_drawable, m_context); +} + +void QGLXContext::doneCurrent() +{ + QPlatformGLContext::doneCurrent(); + glXMakeCurrent(m_screen->display(), 0, 0); +} + +void QGLXContext::swapBuffers() +{ + glXSwapBuffers(m_screen->display(), m_drawable); +} + +void* QGLXContext::getProcAddress(const QString& procName) +{ + typedef void *(*qt_glXGetProcAddressARB)(const GLubyte *); + static qt_glXGetProcAddressARB glXGetProcAddressARB = 0; + static bool resolved = false; + + if (resolved && !glXGetProcAddressARB) + return 0; + if (!glXGetProcAddressARB) { + QList<QByteArray> glxExt = QByteArray(glXGetClientString(m_screen->display(), GLX_EXTENSIONS)).split(' '); + if (glxExt.contains("GLX_ARB_get_proc_address")) { +#if defined(Q_OS_LINUX) || defined(Q_OS_BSD4) + void *handle = dlopen(NULL, RTLD_LAZY); + if (handle) { + glXGetProcAddressARB = (qt_glXGetProcAddressARB) dlsym(handle, "glXGetProcAddressARB"); + dlclose(handle); + } + if (!glXGetProcAddressARB) +#endif + { + extern const QString qt_gl_library_name(); +// QLibrary lib(qt_gl_library_name()); + QLibrary lib(QLatin1String("GL")); + glXGetProcAddressARB = (qt_glXGetProcAddressARB) lib.resolve("glXGetProcAddressARB"); + } + } + resolved = true; + } + if (!glXGetProcAddressARB) + return 0; + return glXGetProcAddressARB(reinterpret_cast<const GLubyte *>(procName.toLatin1().data())); +} + +QPlatformWindowFormat QGLXContext::platformWindowFormat() const +{ + return m_windowFormat; +} + +QT_END_NAMESPACE + +#endif //!defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2) diff --git a/src/plugins/platforms/xlib/qglxintegration.h b/src/plugins/platforms/xlib/qglxintegration.h new file mode 100644 index 0000000..f982708 --- /dev/null +++ b/src/plugins/platforms/xlib/qglxintegration.h @@ -0,0 +1,94 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q_GLX_CONTEXT_H +#define Q_GLX_CONTEXT_H + +#include "qtestlitewindow.h" + +#include <QtGui/QPlatformGLContext> +#include <QtGui/QPlatformWindowFormat> + +#include <QtCore/QMutex> + +#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2) +#include <GL/glx.h> + +QT_BEGIN_NAMESPACE + +class QGLXContext : public QPlatformGLContext +{ +public: + QGLXContext(Window window, QXlibScreen *xd, const QPlatformWindowFormat &format); + ~QGLXContext(); + + virtual void makeCurrent(); + virtual void doneCurrent(); + virtual void swapBuffers(); + virtual void* getProcAddress(const QString& procName); + + GLXContext glxContext() const {return m_context;} + + QPlatformWindowFormat platformWindowFormat() const; + + static XVisualInfo *findVisualInfo(const QXlibScreen *xd, const QPlatformWindowFormat &format); +private: + static GLXFBConfig findConfig(const QXlibScreen *xd,const QPlatformWindowFormat &format); + static QVector<int> buildSpec(const QPlatformWindowFormat &format); + static QPlatformWindowFormat platformWindowFromGLXFBConfig(Display *display, GLXFBConfig config, GLXContext context); + static QPlatformWindowFormat reducePlatformWindowFormat(const QPlatformWindowFormat &format, bool *reduced); + + + QXlibScreen *m_screen; + Drawable m_drawable; + GLXContext m_context; + QPlatformWindowFormat m_windowFormat; + + QGLXContext (QXlibScreen *screen, Drawable drawable, GLXContext context); + static QMutex m_defaultSharedContextMutex; + static void createDefaultSharedContex(QXlibScreen *xd); +}; + +QT_END_NAMESPACE + +#endif //!defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2) + +#endif diff --git a/src/plugins/platforms/xlib/qtestliteclipboard.cpp b/src/plugins/platforms/xlib/qtestliteclipboard.cpp new file mode 100644 index 0000000..1264b5a --- /dev/null +++ b/src/plugins/platforms/xlib/qtestliteclipboard.cpp @@ -0,0 +1,676 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qtestliteclipboard.h" + +#include "qtestlitescreen.h" +#include "qtestlitemime.h" + +#include <private/qapplication_p.h> + +#include <QtCore/QDebug> + +class QXlibClipboardMime : public QXlibMime +{ + Q_OBJECT +public: + QXlibClipboardMime(QClipboard::Mode mode, QXlibClipboard *clipboard) + : QXlibMime() + , m_clipboard(clipboard) + { + switch (mode) { + case QClipboard::Selection: + modeAtom = XA_PRIMARY; + break; + + case QClipboard::Clipboard: + modeAtom = QXlibStatic::atom(QXlibStatic::CLIPBOARD); + break; + + default: + qWarning("QTestLiteMime: Internal error: Unsupported clipboard mode"); + break; + } + } + +protected: + QStringList formats_sys() const + { + if (empty()) + return QStringList(); + + if (!formatList.count()) { + QXlibClipboardMime *that = const_cast<QXlibClipboardMime *>(this); + // get the list of targets from the current clipboard owner - we do this + // once so that multiple calls to this function don't require multiple + // server round trips... + that->format_atoms = m_clipboard->getDataInFormat(modeAtom,QXlibStatic::atom(QXlibStatic::TARGETS)); + + if (format_atoms.size() > 0) { + Atom *targets = (Atom *) format_atoms.data(); + int size = format_atoms.size() / sizeof(Atom); + + for (int i = 0; i < size; ++i) { + if (targets[i] == 0) + continue; + + QStringList formatsForAtom = mimeFormatsForAtom(m_clipboard->screen()->display(),targets[i]); + for (int j = 0; j < formatsForAtom.size(); ++j) { + if (!formatList.contains(formatsForAtom.at(j))) + that->formatList.append(formatsForAtom.at(j)); + } + } + } + } + + return formatList; + } + + bool hasFormat_sys(const QString &format) const + { + QStringList list = formats(); + return list.contains(format); + } + + QVariant retrieveData_sys(const QString &fmt, QVariant::Type requestedType) const + { + if (fmt.isEmpty() || empty()) + return QByteArray(); + + (void)formats(); // trigger update of format list + + QList<Atom> atoms; + Atom *targets = (Atom *) format_atoms.data(); + int size = format_atoms.size() / sizeof(Atom); + for (int i = 0; i < size; ++i) + atoms.append(targets[i]); + + QByteArray encoding; + Atom fmtatom = mimeAtomForFormat(m_clipboard->screen()->display(),fmt, requestedType, atoms, &encoding); + + if (fmtatom == 0) + return QVariant(); + + return mimeConvertToFormat(m_clipboard->screen()->display(),fmtatom, m_clipboard->getDataInFormat(modeAtom,fmtatom), fmt, requestedType, encoding); + } +private: + bool empty() const + { + Window win = XGetSelectionOwner(m_clipboard->screen()->display(), modeAtom); + + return win == XNone; + } + + + Atom modeAtom; + QXlibClipboard *m_clipboard; + QStringList formatList; + QByteArray format_atoms; +}; + +const int QXlibClipboard::clipboard_timeout = 5000; + +QXlibClipboard::QXlibClipboard(QXlibScreen *screen) + : QPlatformClipboard() + , m_screen(screen) + , m_xClipboard(0) + , m_clientClipboard(0) + , m_xSelection(0) + , m_clientSelection(0) + , m_requestor(XNone) + , m_owner(XNone) +{ +} + +const QMimeData * QXlibClipboard::mimeData(QClipboard::Mode mode) const +{ + if (mode == QClipboard::Clipboard) { + if (!m_xClipboard) { + QXlibClipboard *that = const_cast<QXlibClipboard *>(this); + that->m_xClipboard = new QXlibClipboardMime(mode,that); + } + Window clipboardOwner = XGetSelectionOwner(screen()->display(),QXlibStatic::atom(QXlibStatic::CLIPBOARD)); + if (clipboardOwner == owner()) { + return m_clientClipboard; + } else { + return m_xClipboard; + } + } else if (mode == QClipboard::Selection) { + if (!m_xSelection) { + QXlibClipboard *that = const_cast<QXlibClipboard *>(this); + that->m_xSelection = new QXlibClipboardMime(mode,that); + } + Window clipboardOwner = XGetSelectionOwner(screen()->display(),XA_PRIMARY); + if (clipboardOwner == owner()) { + return m_clientSelection; + } else { + return m_xSelection; + } + } + return 0; +} + +void QXlibClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode) +{ + Atom modeAtom; + QMimeData **d; + switch (mode) { + case QClipboard::Selection: + modeAtom = XA_PRIMARY; + d = &m_clientSelection; + break; + + case QClipboard::Clipboard: + modeAtom = QXlibStatic::atom(QXlibStatic::CLIPBOARD); + d = &m_clientClipboard; + break; + + default: + qWarning("QClipboard::setMimeData: unsupported mode '%d'", mode); + return; + } + + Window newOwner; + + if (! data) { // no data, clear clipboard contents + newOwner = XNone; + } else { + newOwner = owner(); + + *d = data; + } + + XSetSelectionOwner(m_screen->display(), modeAtom, newOwner, CurrentTime); + + if (XGetSelectionOwner(m_screen->display(), modeAtom) != newOwner) { + qWarning("QClipboard::setData: Cannot set X11 selection owner"); + } + +} + +bool QXlibClipboard::supportsMode(QClipboard::Mode mode) const +{ + if (mode == QClipboard::Clipboard || mode == QClipboard::Selection) + return true; + return false; +} + + +QXlibScreen * QXlibClipboard::screen() const +{ + return m_screen; +} + +Window QXlibClipboard::requestor() const +{ + if (!m_requestor) { + int x = 0, y = 0, w = 3, h = 3; + QXlibClipboard *that = const_cast<QXlibClipboard *>(this); + Window window = XCreateSimpleWindow(m_screen->display(), m_screen->rootWindow(), + x, y, w, h, 0 /*border_width*/, + m_screen->blackPixel(), m_screen->whitePixel()); + that->setRequestor(window); + } + return m_requestor; +} + +void QXlibClipboard::setRequestor(Window window) +{ + if (m_requestor != XNone) { + XDestroyWindow(m_screen->display(),m_requestor); + } + m_requestor = window; +} + +Window QXlibClipboard::owner() const +{ + if (!m_owner) { + int x = 0, y = 0, w = 3, h = 3; + QXlibClipboard *that = const_cast<QXlibClipboard *>(this); + Window window = XCreateSimpleWindow(m_screen->display(), m_screen->rootWindow(), + x, y, w, h, 0 /*border_width*/, + m_screen->blackPixel(), m_screen->whitePixel()); + that->setOwner(window); + } + return m_owner; +} + +void QXlibClipboard::setOwner(Window window) +{ + if (m_owner != XNone){ + XDestroyWindow(m_screen->display(),m_owner); + } + m_owner = window; +} + +Atom QXlibClipboard::sendTargetsSelection(QMimeData *d, Window window, Atom property) +{ + QVector<Atom> types; + QStringList formats = QInternalMimeData::formatsHelper(d); + for (int i = 0; i < formats.size(); ++i) { + QList<Atom> atoms = QXlibMime::mimeAtomsForFormat(screen()->display(),formats.at(i)); + for (int j = 0; j < atoms.size(); ++j) { + if (!types.contains(atoms.at(j))) + types.append(atoms.at(j)); + } + } + types.append(QXlibStatic::atom(QXlibStatic::TARGETS)); + types.append(QXlibStatic::atom(QXlibStatic::MULTIPLE)); + types.append(QXlibStatic::atom(QXlibStatic::TIMESTAMP)); + types.append(QXlibStatic::atom(QXlibStatic::SAVE_TARGETS)); + + XChangeProperty(screen()->display(), window, property, XA_ATOM, 32, + PropModeReplace, (uchar *) types.data(), types.size()); + return property; +} + +Atom QXlibClipboard::sendSelection(QMimeData *d, Atom target, Window window, Atom property) +{ + Atom atomFormat = target; + int dataFormat = 0; + QByteArray data; + + QString fmt = QXlibMime::mimeAtomToString(screen()->display(), target); + if (fmt.isEmpty()) { // Not a MIME type we have + qDebug() << "QClipboard: send_selection(): converting to type '%s' is not supported" << fmt.data(); + return XNone; + } + qDebug() << "QClipboard: send_selection(): converting to type '%s'" << fmt.data(); + + if (QXlibMime::mimeDataForAtom(screen()->display(),target, d, &data, &atomFormat, &dataFormat)) { + + // don't allow INCR transfers when using MULTIPLE or to + // Motif clients (since Motif doesn't support INCR) + static Atom motif_clip_temporary = QXlibStatic::atom(QXlibStatic::CLIP_TEMPORARY); + bool allow_incr = property != motif_clip_temporary; + + // X_ChangeProperty protocol request is 24 bytes + const int increment = (XMaxRequestSize(screen()->display()) * 4) - 24; + if (data.size() > increment && allow_incr) { + long bytes = data.size(); + XChangeProperty(screen()->display(), window, property, + QXlibStatic::atom(QXlibStatic::INCR), 32, PropModeReplace, (uchar *) &bytes, 1); + +// (void)new QClipboardINCRTransaction(window, property, atomFormat, dataFormat, data, increment); + qDebug() << "not implemented INCRT just YET!"; + return property; + } + + // make sure we can perform the XChangeProperty in a single request + if (data.size() > increment) + return XNone; // ### perhaps use several XChangeProperty calls w/ PropModeAppend? + int dataSize = data.size() / (dataFormat / 8); + // use a single request to transfer data + XChangeProperty(screen()->display(), window, property, atomFormat, + dataFormat, PropModeReplace, (uchar *) data.data(), + dataSize); + } + return property; +} + +void QXlibClipboard::handleSelectionRequest(XEvent *xevent) +{ + XSelectionRequestEvent *req = &xevent->xselectionrequest; + + if (requestor() && req->requestor == requestor()) { + qDebug() << "This should be caught before"; + return; + } + + XEvent event; + event.xselection.type = SelectionNotify; + event.xselection.display = req->display; + event.xselection.requestor = req->requestor; + event.xselection.selection = req->selection; + event.xselection.target = req->target; + event.xselection.property = XNone; + event.xselection.time = req->time; + + QMimeData *d; + if (req->selection == XA_PRIMARY) { + d = m_clientSelection; + } else if (req->selection == QXlibStatic::atom(QXlibStatic::CLIPBOARD)) { + d = m_clientClipboard; + } else { + qWarning("QClipboard: Unknown selection '%lx'", req->selection); + XSendEvent(screen()->display(), req->requestor, False, NoEventMask, &event); + return; + } + + if (!d) { + qWarning("QClipboard: Cannot transfer data, no data available"); + XSendEvent(screen()->display(), req->requestor, False, NoEventMask, &event); + return; + } + + Atom xa_targets = QXlibStatic::atom(QXlibStatic::TARGETS); + Atom xa_multiple = QXlibStatic::atom(QXlibStatic::MULTIPLE); + Atom xa_timestamp = QXlibStatic::atom(QXlibStatic::TIMESTAMP); + + struct AtomPair { Atom target; Atom property; } *multi = 0; + Atom multi_type = XNone; + int multi_format = 0; + int nmulti = 0; + int imulti = -1; + bool multi_writeback = false; + + if (req->target == xa_multiple) { + QByteArray multi_data; + if (req->property == XNone + || !clipboardReadProperty(req->requestor, req->property, false, &multi_data, + 0, &multi_type, &multi_format) + || multi_format != 32) { + // MULTIPLE property not formatted correctly + XSendEvent(screen()->display(), req->requestor, False, NoEventMask, &event); + return; + } + nmulti = multi_data.size()/sizeof(*multi); + multi = new AtomPair[nmulti]; + memcpy(multi,multi_data.data(),multi_data.size()); + imulti = 0; + } + + for (; imulti < nmulti; ++imulti) { + Atom target; + Atom property; + + if (multi) { + target = multi[imulti].target; + property = multi[imulti].property; + } else { + target = req->target; + property = req->property; + if (property == XNone) // obsolete client + property = target; + } + + Atom ret = XNone; + if (target == XNone || property == XNone) { + ; + } else if (target == xa_timestamp) { +// if (d->timestamp != CurrentTime) { +// XChangeProperty(screen()->display(), req->requestor, property, XA_INTEGER, 32, +// PropModeReplace, CurrentTime, 1); +// ret = property; +// } else { +// qWarning("QClipboard: Invalid data timestamp"); +// } + } else if (target == xa_targets) { + ret = sendTargetsSelection(d, req->requestor, property); + } else { + ret = sendSelection(d, target, req->requestor, property); + } + + if (nmulti > 0) { + if (ret == XNone) { + multi[imulti].property = XNone; + multi_writeback = true; + } + } else { + event.xselection.property = ret; + break; + } + } + + if (nmulti > 0) { + if (multi_writeback) { + // according to ICCCM 2.6.2 says to put None back + // into the original property on the requestor window + XChangeProperty(screen()->display(), req->requestor, req->property, multi_type, 32, + PropModeReplace, (uchar *) multi, nmulti * 2); + } + + delete [] multi; + event.xselection.property = req->property; + } + + // send selection notify to requestor + XSendEvent(screen()->display(), req->requestor, False, NoEventMask, &event); +} + +static inline int maxSelectionIncr(Display *dpy) +{ return XMaxRequestSize(dpy) > 65536 ? 65536*4 : XMaxRequestSize(dpy)*4 - 100; } + +bool QXlibClipboard::clipboardReadProperty(Window win, Atom property, bool deleteProperty, QByteArray *buffer, int *size, Atom *type, int *format) const +{ + int maxsize = maxSelectionIncr(screen()->display()); + ulong bytes_left; // bytes_after + ulong length; // nitems + uchar *data; + Atom dummy_type; + int dummy_format; + int r; + + if (!type) // allow null args + type = &dummy_type; + if (!format) + format = &dummy_format; + + // Don't read anything, just get the size of the property data + r = XGetWindowProperty(screen()->display(), win, property, 0, 0, False, + AnyPropertyType, type, format, + &length, &bytes_left, &data); + if (r != Success || (type && *type == XNone)) { + buffer->resize(0); + return false; + } + XFree((char*)data); + + int offset = 0, buffer_offset = 0, format_inc = 1, proplen = bytes_left; + + switch (*format) { + case 8: + default: + format_inc = sizeof(char) / 1; + break; + + case 16: + format_inc = sizeof(short) / 2; + proplen *= sizeof(short) / 2; + break; + + case 32: + format_inc = sizeof(long) / 4; + proplen *= sizeof(long) / 4; + break; + } + + int newSize = proplen; + buffer->resize(newSize); + + bool ok = (buffer->size() == newSize); + + if (ok && newSize) { + // could allocate buffer + + while (bytes_left) { + // more to read... + + r = XGetWindowProperty(screen()->display(), win, property, offset, maxsize/4, + False, AnyPropertyType, type, format, + &length, &bytes_left, &data); + if (r != Success || (type && *type == XNone)) + break; + + offset += length / (32 / *format); + length *= format_inc * (*format) / 8; + + // Here we check if we get a buffer overflow and tries to + // recover -- this shouldn't normally happen, but it doesn't + // hurt to be defensive + if ((int)(buffer_offset + length) > buffer->size()) { + length = buffer->size() - buffer_offset; + + // escape loop + bytes_left = 0; + } + + memcpy(buffer->data() + buffer_offset, data, length); + buffer_offset += length; + + XFree((char*)data); + } + + if (*format == 8 && *type == QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT)) { + // convert COMPOUND_TEXT to a multibyte string + XTextProperty textprop; + textprop.encoding = *type; + textprop.format = *format; + textprop.nitems = buffer_offset; + textprop.value = (unsigned char *) buffer->data(); + + char **list_ret = 0; + int count; + if (XmbTextPropertyToTextList(screen()->display(), &textprop, &list_ret, + &count) == Success && count && list_ret) { + offset = buffer_offset = strlen(list_ret[0]); + buffer->resize(offset); + memcpy(buffer->data(), list_ret[0], offset); + } + if (list_ret) XFreeStringList(list_ret); + } + } + + // correct size, not 0-term. + if (size) + *size = buffer_offset; + + if (deleteProperty) + XDeleteProperty(screen()->display(), win, property); + + XFlush(screen()->display()); + + return ok; +} + +QByteArray QXlibClipboard::clipboardReadIncrementalProperty(Window win, Atom property, int nbytes, bool nullterm) +{ + XEvent event; + + QByteArray buf; + QByteArray tmp_buf; + bool alloc_error = false; + int length; + int offset = 0; + + if (nbytes > 0) { + // Reserve buffer + zero-terminator (for text data) + // We want to complete the INCR transfer even if we cannot + // allocate more memory + buf.resize(nbytes+1); + alloc_error = buf.size() != nbytes+1; + } + + for (;;) { + XFlush(screen()->display()); + if (!screen()->waitForClipboardEvent(win,PropertyNotify,&event,clipboard_timeout)) + break; + if (event.xproperty.atom != property || + event.xproperty.state != PropertyNewValue) + continue; + if (clipboardReadProperty(win, property, true, &tmp_buf, &length, 0, 0)) { + if (length == 0) { // no more data, we're done + if (nullterm) { + buf.resize(offset+1); + buf[offset] = '\0'; + } else { + buf.resize(offset); + } + return buf; + } else if (!alloc_error) { + if (offset+length > (int)buf.size()) { + buf.resize(offset+length+65535); + if (buf.size() != offset+length+65535) { + alloc_error = true; + length = buf.size() - offset; + } + } + memcpy(buf.data()+offset, tmp_buf.constData(), length); + tmp_buf.resize(0); + offset += length; + } + } else { + break; + } + } + + // timed out ... create a new requestor window, otherwise the requestor + // could consider next request to be still part of this timed out request + setRequestor(0); + + return QByteArray(); +} + +QByteArray QXlibClipboard::getDataInFormat(Atom modeAtom, Atom fmtatom) +{ + QByteArray buf; + + Window win = requestor(); + + XSelectInput(screen()->display(), win, NoEventMask); // don't listen for any events + + XDeleteProperty(screen()->display(), win, QXlibStatic::atom(QXlibStatic::_QT_SELECTION)); + XConvertSelection(screen()->display(), modeAtom, fmtatom, QXlibStatic::atom(QXlibStatic::_QT_SELECTION), win, CurrentTime); + XSync(screen()->display(), false); + + XEvent xevent; + if (!screen()->waitForClipboardEvent(win,SelectionNotify,&xevent,clipboard_timeout) || + xevent.xselection.property == XNone) { + return buf; + } + + Atom type; + XSelectInput(screen()->display(), win, PropertyChangeMask); + + if (clipboardReadProperty(win, QXlibStatic::atom(QXlibStatic::_QT_SELECTION), true, &buf, 0, &type, 0)) { + if (type == QXlibStatic::atom(QXlibStatic::INCR)) { + int nbytes = buf.size() >= 4 ? *((int*)buf.data()) : 0; + buf = clipboardReadIncrementalProperty(win, QXlibStatic::atom(QXlibStatic::_QT_SELECTION), nbytes, false); + } + } + + XSelectInput(screen()->display(), win, NoEventMask); + + + return buf; +} + +#include "qtestliteclipboard.moc" diff --git a/src/plugins/platforms/xlib/qtestliteclipboard.h b/src/plugins/platforms/xlib/qtestliteclipboard.h new file mode 100644 index 0000000..109714c --- /dev/null +++ b/src/plugins/platforms/xlib/qtestliteclipboard.h @@ -0,0 +1,94 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTESTLITECLIPBOARD_H +#define QTESTLITECLIPBOARD_H + +#include <QPlatformClipboard> +#include "qtestlitestaticinfo.h" + +class QXlibScreen; +class QXlibClipboard : public QPlatformClipboard +{ +public: + QXlibClipboard(QXlibScreen *screen); + + const QMimeData *mimeData(QClipboard::Mode mode) const; + void setMimeData(QMimeData *data, QClipboard::Mode mode); + + bool supportsMode(QClipboard::Mode mode) const; + + QXlibScreen *screen() const; + + Window requestor() const; + void setRequestor(Window window); + + Window owner() const; + + void handleSelectionRequest(XEvent *event); + + bool clipboardReadProperty(Window win, Atom property, bool deleteProperty, QByteArray *buffer, int *size, Atom *type, int *format) const; + QByteArray clipboardReadIncrementalProperty(Window win, Atom property, int nbytes, bool nullterm); + + QByteArray getDataInFormat(Atom modeAtom, Atom fmtatom); + +private: + void setOwner(Window window); + + Atom sendTargetsSelection(QMimeData *d, Window window, Atom property); + Atom sendSelection(QMimeData *d, Atom target, Window window, Atom property); + + QXlibScreen *m_screen; + + QMimeData *m_xClipboard; + QMimeData *m_clientClipboard; + + QMimeData *m_xSelection; + QMimeData *m_clientSelection; + + Window m_requestor; + Window m_owner; + + static const int clipboard_timeout; + +}; + +#endif // QTESTLITECLIPBOARD_H diff --git a/src/plugins/platforms/xlib/qtestlitecursor.cpp b/src/plugins/platforms/xlib/qtestlitecursor.cpp new file mode 100644 index 0000000..2f7cfbf --- /dev/null +++ b/src/plugins/platforms/xlib/qtestlitecursor.cpp @@ -0,0 +1,199 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qtestlitecursor.h" + +#include "qtestliteintegration.h" +#include "qtestlitescreen.h" +#include "qtestlitewindow.h" + +#include <QtGui/QBitmap> + +#include <X11/cursorfont.h> + +QT_BEGIN_NAMESPACE + +QXlibCursor::QXlibCursor(QXlibScreen *screen) + : QPlatformCursor(screen) +{ +} + +void QXlibCursor::changeCursor(QCursor *cursor, QWidget *widget) +{ + QXlibWindow *w = 0; + if (widget) { + QWidget *window = widget->window(); + w = static_cast<QXlibWindow*>(window->platformWindow()); + } else { + // No X11 cursor control when there is no widget under the cursor + return; + } + + if (!w) + return; + + int id = cursor->handle(); + + Cursor c; + if (!cursorMap.contains(id)) { + if (cursor->shape() == Qt::BitmapCursor) + c = createCursorBitmap(cursor); + else + c = createCursorShape(cursor->shape()); + if (!c) { + return; + } + cursorMap.insert(id, c); + } else { + c = cursorMap.value(id); + } + + w->setCursor(c); +} + +Cursor QXlibCursor::createCursorBitmap(QCursor * cursor) +{ + XColor bg, fg; + bg.red = 255 << 8; + bg.green = 255 << 8; + bg.blue = 255 << 8; + fg.red = 0; + fg.green = 0; + fg.blue = 0; + QPoint spot = cursor->hotSpot(); + Window rootwin = testLiteScreen()->rootWindow(); + + QImage mapImage = cursor->bitmap()->toImage().convertToFormat(QImage::Format_MonoLSB); + QImage maskImage = cursor->mask()->toImage().convertToFormat(QImage::Format_MonoLSB); + + int width = cursor->bitmap()->width(); + int height = cursor->bitmap()->height(); + int bytesPerLine = mapImage.bytesPerLine(); + int destLineSize = width / 8; + if (width % 8) + destLineSize++; + + const uchar * map = mapImage.bits(); + const uchar * mask = maskImage.bits(); + + char * mapBits = new char[height * destLineSize]; + char * maskBits = new char[height * destLineSize]; + for (int i = 0; i < height; i++) { + memcpy(mapBits + (destLineSize * i),map + (bytesPerLine * i), destLineSize); + memcpy(maskBits + (destLineSize * i),mask + (bytesPerLine * i), destLineSize); + } + + Pixmap cp = XCreateBitmapFromData(testLiteScreen()->display(), rootwin, mapBits, width, height); + Pixmap mp = XCreateBitmapFromData(testLiteScreen()->display(), rootwin, maskBits, width, height); + Cursor c = XCreatePixmapCursor(testLiteScreen()->display(), cp, mp, &fg, &bg, spot.x(), spot.y()); + XFreePixmap(testLiteScreen()->display(), cp); + XFreePixmap(testLiteScreen()->display(), mp); + delete[] mapBits; + delete[] maskBits; + + return c; +} + +Cursor QXlibCursor::createCursorShape(int cshape) +{ + Cursor cursor = 0; + + if (cshape < 0 || cshape > Qt::LastCursor) + return 0; + + switch (cshape) { + case Qt::ArrowCursor: + cursor = XCreateFontCursor(testLiteScreen()->display(), XC_left_ptr); + break; + case Qt::UpArrowCursor: + cursor = XCreateFontCursor(testLiteScreen()->display(), XC_center_ptr); + break; + case Qt::CrossCursor: + cursor = XCreateFontCursor(testLiteScreen()->display(), XC_crosshair); + break; + case Qt::WaitCursor: + cursor = XCreateFontCursor(testLiteScreen()->display(), XC_watch); + break; + case Qt::IBeamCursor: + cursor = XCreateFontCursor(testLiteScreen()->display(), XC_xterm); + break; + case Qt::SizeAllCursor: + cursor = XCreateFontCursor(testLiteScreen()->display(), XC_fleur); + break; + case Qt::PointingHandCursor: + cursor = XCreateFontCursor(testLiteScreen()->display(), XC_hand2); + break; + case Qt::SizeBDiagCursor: + cursor = XCreateFontCursor(testLiteScreen()->display(), XC_top_right_corner); + break; + case Qt::SizeFDiagCursor: + cursor = XCreateFontCursor(testLiteScreen()->display(), XC_bottom_right_corner); + break; + case Qt::SizeVerCursor: + case Qt::SplitVCursor: + cursor = XCreateFontCursor(testLiteScreen()->display(), XC_sb_v_double_arrow); + break; + case Qt::SizeHorCursor: + case Qt::SplitHCursor: + cursor = XCreateFontCursor(testLiteScreen()->display(), XC_sb_h_double_arrow); + break; + case Qt::WhatsThisCursor: + cursor = XCreateFontCursor(testLiteScreen()->display(), XC_question_arrow); + break; + case Qt::ForbiddenCursor: + cursor = XCreateFontCursor(testLiteScreen()->display(), XC_circle); + break; + case Qt::BusyCursor: + cursor = XCreateFontCursor(testLiteScreen()->display(), XC_watch); + break; + + default: //default cursor for all the rest + break; + } + return cursor; +} + +QXlibScreen * QXlibCursor::testLiteScreen() const +{ + return static_cast<QXlibScreen *>(screen); +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/xlib/qtestlitecursor.h b/src/plugins/platforms/xlib/qtestlitecursor.h new file mode 100644 index 0000000..db9f9e2 --- /dev/null +++ b/src/plugins/platforms/xlib/qtestlitecursor.h @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTESTLITECURSOR_H +#define QTESTLITECURSOR_H + +#include <QtGui/QPlatformCursor> + +#include "qtestliteintegration.h" + +QT_BEGIN_NAMESPACE + +class QXlibCursor : QPlatformCursor +{ +public: + QXlibCursor(QXlibScreen *screen); + + void changeCursor(QCursor * cursor, QWidget * widget); +private: + + Cursor createCursorBitmap(QCursor * cursor); + Cursor createCursorShape(int cshape); + + QXlibScreen *testLiteScreen() const; + QMap<int, Cursor> cursorMap; +}; + +QT_END_NAMESPACE + +#endif // QTESTLITECURSOR_H diff --git a/src/plugins/platforms/xlib/qtestliteeglintegration.cpp b/src/plugins/platforms/xlib/qtestliteeglintegration.cpp new file mode 100644 index 0000000..9bbe0ca --- /dev/null +++ b/src/plugins/platforms/xlib/qtestliteeglintegration.cpp @@ -0,0 +1,186 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qtestliteeglintegration.h" + +static int countBits(unsigned long mask) +{ + int count = 0; + while (mask != 0) { + if (mask & 1) + ++count; + mask >>= 1; + } + return count; +} + +VisualID QXlibEglIntegration::getCompatibleVisualId(Display *display, EGLConfig config) +{ + VisualID visualId = 0; + EGLint eglValue = 0; + + EGLDisplay eglDisplay = eglGetDisplay(display); + + EGLint configRedSize = 0; + eglGetConfigAttrib(eglDisplay, config, EGL_RED_SIZE, &configRedSize); + + EGLint configGreenSize = 0; + eglGetConfigAttrib(eglDisplay, config, EGL_GREEN_SIZE, &configGreenSize); + + EGLint configBlueSize = 0; + eglGetConfigAttrib(eglDisplay, config, EGL_BLUE_SIZE, &configBlueSize); + + EGLint configAlphaSize = 0; + eglGetConfigAttrib(eglDisplay, config, EGL_ALPHA_SIZE, &configAlphaSize); + + eglGetConfigAttrib(eglDisplay, config, EGL_CONFIG_ID, &eglValue); + int configId = eglValue; + + // See if EGL provided a valid VisualID: + eglGetConfigAttrib(eglDisplay, config, EGL_NATIVE_VISUAL_ID, &eglValue); + visualId = (VisualID)eglValue; + if (visualId) { + // EGL has suggested a visual id, so get the rest of the visual info for that id: + XVisualInfo visualInfoTemplate; + memset(&visualInfoTemplate, 0, sizeof(XVisualInfo)); + visualInfoTemplate.visualid = visualId; + + XVisualInfo *chosenVisualInfo; + int matchingCount = 0; + chosenVisualInfo = XGetVisualInfo(display, VisualIDMask, &visualInfoTemplate, &matchingCount); + if (chosenVisualInfo) { + // Skip size checks if implementation supports non-matching visual + // and config (http://bugreports.qt.nokia.com/browse/QTBUG-9444). + if (q_hasEglExtension(eglDisplay,"EGL_NV_post_convert_rounding")) { + XFree(chosenVisualInfo); + return visualId; + } + + int visualRedSize = countBits(chosenVisualInfo->red_mask); + int visualGreenSize = countBits(chosenVisualInfo->green_mask); + int visualBlueSize = countBits(chosenVisualInfo->blue_mask); + int visualAlphaSize = -1; // Need XRender to tell us the alpha channel size + + bool visualMatchesConfig = false; + if ( visualRedSize == configRedSize && + visualGreenSize == configGreenSize && + visualBlueSize == configBlueSize ) + { + // We need XRender to check the alpha channel size of the visual. If we don't have + // the alpha size, we don't check it against the EGL config's alpha size. + if (visualAlphaSize >= 0) + visualMatchesConfig = visualAlphaSize == configAlphaSize; + else + visualMatchesConfig = true; + } + + if (!visualMatchesConfig) { + if (visualAlphaSize >= 0) { + qWarning("Warning: EGL suggested using X Visual ID %d (ARGB%d%d%d%d) for EGL config %d (ARGB%d%d%d%d), but this is incompatable", + (int)visualId, visualAlphaSize, visualRedSize, visualGreenSize, visualBlueSize, + configId, configAlphaSize, configRedSize, configGreenSize, configBlueSize); + } else { + qWarning("Warning: EGL suggested using X Visual ID %d (RGB%d%d%d) for EGL config %d (RGB%d%d%d), but this is incompatable", + (int)visualId, visualRedSize, visualGreenSize, visualBlueSize, + configId, configRedSize, configGreenSize, configBlueSize); + } + visualId = 0; + } + } else { + qWarning("Warning: EGL suggested using X Visual ID %d for EGL config %d, but that isn't a valid ID", + (int)visualId, configId); + visualId = 0; + } + XFree(chosenVisualInfo); + } +#ifdef QT_DEBUG_X11_VISUAL_SELECTION + else + qDebug("EGL did not suggest a VisualID (EGL_NATIVE_VISUAL_ID was zero) for EGLConfig %d", configId); +#endif + + if (visualId) { +#ifdef QT_DEBUG_X11_VISUAL_SELECTION + if (configAlphaSize > 0) + qDebug("Using ARGB Visual ID %d provided by EGL for config %d", (int)visualId, configId); + else + qDebug("Using Opaque Visual ID %d provided by EGL for config %d", (int)visualId, configId); +#endif + return visualId; + } + + // Finally, try to + // use XGetVisualInfo and only use the bit depths to match on: + if (!visualId) { + XVisualInfo visualInfoTemplate; + memset(&visualInfoTemplate, 0, sizeof(XVisualInfo)); + XVisualInfo *matchingVisuals; + int matchingCount = 0; + + visualInfoTemplate.depth = configRedSize + configGreenSize + configBlueSize + configAlphaSize; + matchingVisuals = XGetVisualInfo(display, + VisualDepthMask, + &visualInfoTemplate, + &matchingCount); + if (!matchingVisuals) { + // Try again without taking the alpha channel into account: + visualInfoTemplate.depth = configRedSize + configGreenSize + configBlueSize; + matchingVisuals = XGetVisualInfo(display, + VisualDepthMask, + &visualInfoTemplate, + &matchingCount); + } + + if (matchingVisuals) { + visualId = matchingVisuals[0].visualid; + XFree(matchingVisuals); + } + } + + if (visualId) { +#ifdef QT_DEBUG_X11_VISUAL_SELECTION + qDebug("Using Visual ID %d provided by XGetVisualInfo for EGL config %d", (int)visualId, configId); +#endif + return visualId; + } + + qWarning("Unable to find an X11 visual which matches EGL config %d", configId); + return (VisualID)0; +} diff --git a/src/plugins/platforms/xlib/qtestliteeglintegration.h b/src/plugins/platforms/xlib/qtestliteeglintegration.h new file mode 100644 index 0000000..4c2e50d --- /dev/null +++ b/src/plugins/platforms/xlib/qtestliteeglintegration.h @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTESTLITEEGLINTEGRATION_H +#define QTESTLITEEGLINTEGRATION_H + +#include "qtestlitestaticinfo.h" +#include "../eglconvenience/qeglconvenience.h" + +class QXlibEglIntegration +{ +public: + static VisualID getCompatibleVisualId(Display *display, EGLConfig config); +}; + +#endif // QTESTLITEEGLINTEGRATION_H diff --git a/src/plugins/platforms/xlib/qtestliteintegration.cpp b/src/plugins/platforms/xlib/qtestliteintegration.cpp new file mode 100644 index 0000000..cdc5c29 --- /dev/null +++ b/src/plugins/platforms/xlib/qtestliteintegration.cpp @@ -0,0 +1,156 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qtestliteintegration.h" +#include "qtestlitewindowsurface.h" +#include <QtGui/private/qpixmap_raster_p.h> +#include <QtCore/qdebug.h> + +#include "qtestlitewindow.h" +#include "qgenericunixfontdatabase.h" +#include "qtestlitescreen.h" +#include "qtestliteclipboard.h" + +#if !defined(QT_NO_OPENGL) +#if !defined(QT_OPENGL_ES_2) +#include <GL/glx.h> +#else +#include <EGL/egl.h> +#endif //!defined(QT_OPENGL_ES_2) +#include <private/qwindowsurface_gl_p.h> +#include <private/qpixmapdata_gl_p.h> +#endif //QT_NO_OPENGL + +QT_BEGIN_NAMESPACE + +QXlibIntegration::QXlibIntegration(bool useOpenGL) + : mUseOpenGL(useOpenGL) + , mFontDb(new QGenericUnixFontDatabase()) + , mClipboard(0) +{ + mPrimaryScreen = new QXlibScreen(); + mScreens.append(mPrimaryScreen); +} + +QPixmapData *QXlibIntegration::createPixmapData(QPixmapData::PixelType type) const +{ +#ifndef QT_NO_OPENGL + if (mUseOpenGL) + return new QGLPixmapData(type); +#endif + return new QRasterPixmapData(type); +} + +QWindowSurface *QXlibIntegration::createWindowSurface(QWidget *widget, WId) const +{ +#ifndef QT_NO_OPENGL + if (mUseOpenGL) + return new QGLWindowSurface(widget); +#endif + return new QXlibWindowSurface(widget); +} + + +QPlatformWindow *QXlibIntegration::createPlatformWindow(QWidget *widget, WId /*winId*/) const +{ + return new QXlibWindow(widget); +} + + + +QPixmap QXlibIntegration::grabWindow(WId window, int x, int y, int width, int height) const +{ + QImage image; + QWidget *widget = QWidget::find(window); + if (widget) { + QXlibScreen *screen = QXlibScreen::testLiteScreenForWidget(widget); + image = screen->grabWindow(window,x,y,width,height); + } else { + for (int i = 0; i < mScreens.size(); i++) { + QXlibScreen *screen = static_cast<QXlibScreen *>(mScreens[i]); + if (screen->rootWindow() == window) { + image = screen->grabWindow(window,x,y,width,height); + } + } + } + return QPixmap::fromImage(image); +} + +QPlatformFontDatabase *QXlibIntegration::fontDatabase() const +{ + return mFontDb; +} + +QPlatformClipboard * QXlibIntegration::clipboard() const +{ + //Use lazy init since clipboard needs QTestliteScreen + if (!mClipboard) { + QXlibIntegration *that = const_cast<QXlibIntegration *>(this); + that->mClipboard = new QXlibClipboard(mPrimaryScreen); + } + return mClipboard; +} + +bool QXlibIntegration::hasOpenGL() const +{ +#if !defined(QT_NO_OPENGL) +#if !defined(QT_OPENGL_ES_2) + QXlibScreen *screen = static_cast<const QXlibScreen *>(mScreens.at(0)); + return glXQueryExtension(screen->display(), 0, 0) != 0; +#else + static bool eglHasbeenInitialized = false; + static bool wasEglInitialized = false; + if (!eglHasbeenInitialized) { + eglHasbeenInitialized = true; + const QXlibScreen *screen = static_cast<const QXlibScreen *>(mScreens.at(0)); + EGLint major, minor; + eglBindAPI(EGL_OPENGL_ES_API); + EGLDisplay disp = eglGetDisplay(screen->display()); + wasEglInitialized = eglInitialize(disp,&major,&minor); + } + return wasEglInitialized; +#endif +#endif + return false; +} + + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/xlib/qtestliteintegration.h b/src/plugins/platforms/xlib/qtestliteintegration.h new file mode 100644 index 0000000..c3125b8 --- /dev/null +++ b/src/plugins/platforms/xlib/qtestliteintegration.h @@ -0,0 +1,85 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QGRAPHICSSYSTEM_TESTLITE_H +#define QGRAPHICSSYSTEM_TESTLITE_H + +//make sure textstream is included before any X11 headers +#include <QtCore/QTextStream> + +#include <QtGui/QPlatformIntegration> +#include <QtGui/QPlatformScreen> + +#include "qtestlitestaticinfo.h" + +QT_BEGIN_NAMESPACE + +class QXlibScreen; + +class QXlibIntegration : public QPlatformIntegration +{ +public: + QXlibIntegration(bool useOpenGL = false); + + QPixmapData *createPixmapData(QPixmapData::PixelType type) const; + QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId) const; + QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const; + + QPixmap grabWindow(WId window, int x, int y, int width, int height) const; + + QList<QPlatformScreen *> screens() const { return mScreens; } + + QPlatformFontDatabase *fontDatabase() const; + QPlatformClipboard *clipboard() const; + + bool hasOpenGL() const; + +private: + bool mUseOpenGL; + QXlibScreen *mPrimaryScreen; + QList<QPlatformScreen *> mScreens; + QPlatformFontDatabase *mFontDb; + QPlatformClipboard *mClipboard; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/platforms/xlib/qtestlitekeyboard.cpp b/src/plugins/platforms/xlib/qtestlitekeyboard.cpp new file mode 100644 index 0000000..fb0cf2e --- /dev/null +++ b/src/plugins/platforms/xlib/qtestlitekeyboard.cpp @@ -0,0 +1,1000 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qtestlitekeyboard.h" + +#include "qtestlitescreen.h" + +#include <QtGui/QWindowSystemInterface> + +#include <QtCore/QTextCodec> + +#ifndef XK_ISO_Left_Tab +#define XK_ISO_Left_Tab 0xFE20 +#endif + +#ifndef XK_dead_hook +#define XK_dead_hook 0xFE61 +#endif + +#ifndef XK_dead_horn +#define XK_dead_horn 0xFE62 +#endif + +#ifndef XK_Codeinput +#define XK_Codeinput 0xFF37 +#endif + +#ifndef XK_Kanji_Bangou +#define XK_Kanji_Bangou 0xFF37 /* same as codeinput */ +#endif + +// Fix old X libraries +#ifndef XK_KP_Home +#define XK_KP_Home 0xFF95 +#endif +#ifndef XK_KP_Left +#define XK_KP_Left 0xFF96 +#endif +#ifndef XK_KP_Up +#define XK_KP_Up 0xFF97 +#endif +#ifndef XK_KP_Right +#define XK_KP_Right 0xFF98 +#endif +#ifndef XK_KP_Down +#define XK_KP_Down 0xFF99 +#endif +#ifndef XK_KP_Prior +#define XK_KP_Prior 0xFF9A +#endif +#ifndef XK_KP_Next +#define XK_KP_Next 0xFF9B +#endif +#ifndef XK_KP_End +#define XK_KP_End 0xFF9C +#endif +#ifndef XK_KP_Insert +#define XK_KP_Insert 0xFF9E +#endif +#ifndef XK_KP_Delete +#define XK_KP_Delete 0xFF9F +#endif + +// the next lines are taken on 10/2009 from X.org (X11/XF86keysym.h), defining some special +// multimedia keys. They are included here as not every system has them. +#define XF86XK_MonBrightnessUp 0x1008FF02 +#define XF86XK_MonBrightnessDown 0x1008FF03 +#define XF86XK_KbdLightOnOff 0x1008FF04 +#define XF86XK_KbdBrightnessUp 0x1008FF05 +#define XF86XK_KbdBrightnessDown 0x1008FF06 +#define XF86XK_Standby 0x1008FF10 +#define XF86XK_AudioLowerVolume 0x1008FF11 +#define XF86XK_AudioMute 0x1008FF12 +#define XF86XK_AudioRaiseVolume 0x1008FF13 +#define XF86XK_AudioPlay 0x1008FF14 +#define XF86XK_AudioStop 0x1008FF15 +#define XF86XK_AudioPrev 0x1008FF16 +#define XF86XK_AudioNext 0x1008FF17 +#define XF86XK_HomePage 0x1008FF18 +#define XF86XK_Mail 0x1008FF19 +#define XF86XK_Start 0x1008FF1A +#define XF86XK_Search 0x1008FF1B +#define XF86XK_AudioRecord 0x1008FF1C +#define XF86XK_Calculator 0x1008FF1D +#define XF86XK_Memo 0x1008FF1E +#define XF86XK_ToDoList 0x1008FF1F +#define XF86XK_Calendar 0x1008FF20 +#define XF86XK_PowerDown 0x1008FF21 +#define XF86XK_ContrastAdjust 0x1008FF22 +#define XF86XK_Back 0x1008FF26 +#define XF86XK_Forward 0x1008FF27 +#define XF86XK_Stop 0x1008FF28 +#define XF86XK_Refresh 0x1008FF29 +#define XF86XK_PowerOff 0x1008FF2A +#define XF86XK_WakeUp 0x1008FF2B +#define XF86XK_Eject 0x1008FF2C +#define XF86XK_ScreenSaver 0x1008FF2D +#define XF86XK_WWW 0x1008FF2E +#define XF86XK_Sleep 0x1008FF2F +#define XF86XK_Favorites 0x1008FF30 +#define XF86XK_AudioPause 0x1008FF31 +#define XF86XK_AudioMedia 0x1008FF32 +#define XF86XK_MyComputer 0x1008FF33 +#define XF86XK_LightBulb 0x1008FF35 +#define XF86XK_Shop 0x1008FF36 +#define XF86XK_History 0x1008FF37 +#define XF86XK_OpenURL 0x1008FF38 +#define XF86XK_AddFavorite 0x1008FF39 +#define XF86XK_HotLinks 0x1008FF3A +#define XF86XK_BrightnessAdjust 0x1008FF3B +#define XF86XK_Finance 0x1008FF3C +#define XF86XK_Community 0x1008FF3D +#define XF86XK_AudioRewind 0x1008FF3E +#define XF86XK_BackForward 0x1008FF3F +#define XF86XK_Launch0 0x1008FF40 +#define XF86XK_Launch1 0x1008FF41 +#define XF86XK_Launch2 0x1008FF42 +#define XF86XK_Launch3 0x1008FF43 +#define XF86XK_Launch4 0x1008FF44 +#define XF86XK_Launch5 0x1008FF45 +#define XF86XK_Launch6 0x1008FF46 +#define XF86XK_Launch7 0x1008FF47 +#define XF86XK_Launch8 0x1008FF48 +#define XF86XK_Launch9 0x1008FF49 +#define XF86XK_LaunchA 0x1008FF4A +#define XF86XK_LaunchB 0x1008FF4B +#define XF86XK_LaunchC 0x1008FF4C +#define XF86XK_LaunchD 0x1008FF4D +#define XF86XK_LaunchE 0x1008FF4E +#define XF86XK_LaunchF 0x1008FF4F +#define XF86XK_ApplicationLeft 0x1008FF50 +#define XF86XK_ApplicationRight 0x1008FF51 +#define XF86XK_Book 0x1008FF52 +#define XF86XK_CD 0x1008FF53 +#define XF86XK_Calculater 0x1008FF54 +#define XF86XK_Clear 0x1008FF55 +#define XF86XK_ClearGrab 0x1008FE21 +#define XF86XK_Close 0x1008FF56 +#define XF86XK_Copy 0x1008FF57 +#define XF86XK_Cut 0x1008FF58 +#define XF86XK_Display 0x1008FF59 +#define XF86XK_DOS 0x1008FF5A +#define XF86XK_Documents 0x1008FF5B +#define XF86XK_Excel 0x1008FF5C +#define XF86XK_Explorer 0x1008FF5D +#define XF86XK_Game 0x1008FF5E +#define XF86XK_Go 0x1008FF5F +#define XF86XK_iTouch 0x1008FF60 +#define XF86XK_LogOff 0x1008FF61 +#define XF86XK_Market 0x1008FF62 +#define XF86XK_Meeting 0x1008FF63 +#define XF86XK_MenuKB 0x1008FF65 +#define XF86XK_MenuPB 0x1008FF66 +#define XF86XK_MySites 0x1008FF67 +#define XF86XK_News 0x1008FF69 +#define XF86XK_OfficeHome 0x1008FF6A +#define XF86XK_Option 0x1008FF6C +#define XF86XK_Paste 0x1008FF6D +#define XF86XK_Phone 0x1008FF6E +#define XF86XK_Reply 0x1008FF72 +#define XF86XK_Reload 0x1008FF73 +#define XF86XK_RotateWindows 0x1008FF74 +#define XF86XK_RotationPB 0x1008FF75 +#define XF86XK_RotationKB 0x1008FF76 +#define XF86XK_Save 0x1008FF77 +#define XF86XK_Send 0x1008FF7B +#define XF86XK_Spell 0x1008FF7C +#define XF86XK_SplitScreen 0x1008FF7D +#define XF86XK_Support 0x1008FF7E +#define XF86XK_TaskPane 0x1008FF7F +#define XF86XK_Terminal 0x1008FF80 +#define XF86XK_Tools 0x1008FF81 +#define XF86XK_Travel 0x1008FF82 +#define XF86XK_Video 0x1008FF87 +#define XF86XK_Word 0x1008FF89 +#define XF86XK_Xfer 0x1008FF8A +#define XF86XK_ZoomIn 0x1008FF8B +#define XF86XK_ZoomOut 0x1008FF8C +#define XF86XK_Away 0x1008FF8D +#define XF86XK_Messenger 0x1008FF8E +#define XF86XK_WebCam 0x1008FF8F +#define XF86XK_MailForward 0x1008FF90 +#define XF86XK_Pictures 0x1008FF91 +#define XF86XK_Music 0x1008FF92 +#define XF86XK_Battery 0x1008FF93 +#define XF86XK_Bluetooth 0x1008FF94 +#define XF86XK_WLAN 0x1008FF95 +#define XF86XK_UWB 0x1008FF96 +#define XF86XK_AudioForward 0x1008FF97 +#define XF86XK_AudioRepeat 0x1008FF98 +#define XF86XK_AudioRandomPlay 0x1008FF99 +#define XF86XK_Subtitle 0x1008FF9A +#define XF86XK_AudioCycleTrack 0x1008FF9B +#define XF86XK_Time 0x1008FF9F +#define XF86XK_Select 0x1008FFA0 +#define XF86XK_View 0x1008FFA1 +#define XF86XK_TopMenu 0x1008FFA2 +#define XF86XK_Suspend 0x1008FFA7 +#define XF86XK_Hibernate 0x1008FFA8 + + +// end of XF86keysyms.h + +// Special keys used by Qtopia, mapped into the X11 private keypad range. +#define QTOPIAXK_Select 0x11000601 +#define QTOPIAXK_Yes 0x11000602 +#define QTOPIAXK_No 0x11000603 +#define QTOPIAXK_Cancel 0x11000604 +#define QTOPIAXK_Printer 0x11000605 +#define QTOPIAXK_Execute 0x11000606 +#define QTOPIAXK_Sleep 0x11000607 +#define QTOPIAXK_Play 0x11000608 +#define QTOPIAXK_Zoom 0x11000609 +#define QTOPIAXK_Context1 0x1100060A +#define QTOPIAXK_Context2 0x1100060B +#define QTOPIAXK_Context3 0x1100060C +#define QTOPIAXK_Context4 0x1100060D +#define QTOPIAXK_Call 0x1100060E +#define QTOPIAXK_Hangup 0x1100060F +#define QTOPIAXK_Flip 0x11000610 + +// keyboard mapping table +static const unsigned int KeyTbl[] = { + + // misc keys + + XK_Escape, Qt::Key_Escape, + XK_Tab, Qt::Key_Tab, + XK_ISO_Left_Tab, Qt::Key_Backtab, + XK_BackSpace, Qt::Key_Backspace, + XK_Return, Qt::Key_Return, + XK_Insert, Qt::Key_Insert, + XK_Delete, Qt::Key_Delete, + XK_Clear, Qt::Key_Delete, + XK_Pause, Qt::Key_Pause, + XK_Print, Qt::Key_Print, + 0x1005FF60, Qt::Key_SysReq, // hardcoded Sun SysReq + 0x1007ff00, Qt::Key_SysReq, // hardcoded X386 SysReq + + // cursor movement + + XK_Home, Qt::Key_Home, + XK_End, Qt::Key_End, + XK_Left, Qt::Key_Left, + XK_Up, Qt::Key_Up, + XK_Right, Qt::Key_Right, + XK_Down, Qt::Key_Down, + XK_Prior, Qt::Key_PageUp, + XK_Next, Qt::Key_PageDown, + + // modifiers + + XK_Shift_L, Qt::Key_Shift, + XK_Shift_R, Qt::Key_Shift, + XK_Shift_Lock, Qt::Key_Shift, + XK_Control_L, Qt::Key_Control, + XK_Control_R, Qt::Key_Control, + XK_Meta_L, Qt::Key_Meta, + XK_Meta_R, Qt::Key_Meta, + XK_Alt_L, Qt::Key_Alt, + XK_Alt_R, Qt::Key_Alt, + XK_Caps_Lock, Qt::Key_CapsLock, + XK_Num_Lock, Qt::Key_NumLock, + XK_Scroll_Lock, Qt::Key_ScrollLock, + XK_Super_L, Qt::Key_Super_L, + XK_Super_R, Qt::Key_Super_R, + XK_Menu, Qt::Key_Menu, + XK_Hyper_L, Qt::Key_Hyper_L, + XK_Hyper_R, Qt::Key_Hyper_R, + XK_Help, Qt::Key_Help, + 0x1000FF74, Qt::Key_Backtab, // hardcoded HP backtab + 0x1005FF10, Qt::Key_F11, // hardcoded Sun F36 (labeled F11) + 0x1005FF11, Qt::Key_F12, // hardcoded Sun F37 (labeled F12) + + // numeric and function keypad keys + + XK_KP_Space, Qt::Key_Space, + XK_KP_Tab, Qt::Key_Tab, + XK_KP_Enter, Qt::Key_Enter, + //XK_KP_F1, Qt::Key_F1, + //XK_KP_F2, Qt::Key_F2, + //XK_KP_F3, Qt::Key_F3, + //XK_KP_F4, Qt::Key_F4, + XK_KP_Home, Qt::Key_Home, + XK_KP_Left, Qt::Key_Left, + XK_KP_Up, Qt::Key_Up, + XK_KP_Right, Qt::Key_Right, + XK_KP_Down, Qt::Key_Down, + XK_KP_Prior, Qt::Key_PageUp, + XK_KP_Next, Qt::Key_PageDown, + XK_KP_End, Qt::Key_End, + XK_KP_Begin, Qt::Key_Clear, + XK_KP_Insert, Qt::Key_Insert, + XK_KP_Delete, Qt::Key_Delete, + XK_KP_Equal, Qt::Key_Equal, + XK_KP_Multiply, Qt::Key_Asterisk, + XK_KP_Add, Qt::Key_Plus, + XK_KP_Separator, Qt::Key_Comma, + XK_KP_Subtract, Qt::Key_Minus, + XK_KP_Decimal, Qt::Key_Period, + XK_KP_Divide, Qt::Key_Slash, + + // International input method support keys + + // International & multi-key character composition + XK_ISO_Level3_Shift, Qt::Key_AltGr, + XK_Multi_key, Qt::Key_Multi_key, + XK_Codeinput, Qt::Key_Codeinput, + XK_SingleCandidate, Qt::Key_SingleCandidate, + XK_MultipleCandidate, Qt::Key_MultipleCandidate, + XK_PreviousCandidate, Qt::Key_PreviousCandidate, + + // Misc Functions + XK_Mode_switch, Qt::Key_Mode_switch, + XK_script_switch, Qt::Key_Mode_switch, + + // Japanese keyboard support + XK_Kanji, Qt::Key_Kanji, + XK_Muhenkan, Qt::Key_Muhenkan, + //XK_Henkan_Mode, Qt::Key_Henkan_Mode, + XK_Henkan_Mode, Qt::Key_Henkan, + XK_Henkan, Qt::Key_Henkan, + XK_Romaji, Qt::Key_Romaji, + XK_Hiragana, Qt::Key_Hiragana, + XK_Katakana, Qt::Key_Katakana, + XK_Hiragana_Katakana, Qt::Key_Hiragana_Katakana, + XK_Zenkaku, Qt::Key_Zenkaku, + XK_Hankaku, Qt::Key_Hankaku, + XK_Zenkaku_Hankaku, Qt::Key_Zenkaku_Hankaku, + XK_Touroku, Qt::Key_Touroku, + XK_Massyo, Qt::Key_Massyo, + XK_Kana_Lock, Qt::Key_Kana_Lock, + XK_Kana_Shift, Qt::Key_Kana_Shift, + XK_Eisu_Shift, Qt::Key_Eisu_Shift, + XK_Eisu_toggle, Qt::Key_Eisu_toggle, + //XK_Kanji_Bangou, Qt::Key_Kanji_Bangou, + //XK_Zen_Koho, Qt::Key_Zen_Koho, + //XK_Mae_Koho, Qt::Key_Mae_Koho, + XK_Kanji_Bangou, Qt::Key_Codeinput, + XK_Zen_Koho, Qt::Key_MultipleCandidate, + XK_Mae_Koho, Qt::Key_PreviousCandidate, + +#ifdef XK_KOREAN + // Korean keyboard support + XK_Hangul, Qt::Key_Hangul, + XK_Hangul_Start, Qt::Key_Hangul_Start, + XK_Hangul_End, Qt::Key_Hangul_End, + XK_Hangul_Hanja, Qt::Key_Hangul_Hanja, + XK_Hangul_Jamo, Qt::Key_Hangul_Jamo, + XK_Hangul_Romaja, Qt::Key_Hangul_Romaja, + //XK_Hangul_Codeinput, Qt::Key_Hangul_Codeinput, + XK_Hangul_Codeinput, Qt::Key_Codeinput, + XK_Hangul_Jeonja, Qt::Key_Hangul_Jeonja, + XK_Hangul_Banja, Qt::Key_Hangul_Banja, + XK_Hangul_PreHanja, Qt::Key_Hangul_PreHanja, + XK_Hangul_PostHanja, Qt::Key_Hangul_PostHanja, + //XK_Hangul_SingleCandidate,Qt::Key_Hangul_SingleCandidate, + //XK_Hangul_MultipleCandidate,Qt::Key_Hangul_MultipleCandidate, + //XK_Hangul_PreviousCandidate,Qt::Key_Hangul_PreviousCandidate, + XK_Hangul_SingleCandidate, Qt::Key_SingleCandidate, + XK_Hangul_MultipleCandidate,Qt::Key_MultipleCandidate, + XK_Hangul_PreviousCandidate,Qt::Key_PreviousCandidate, + XK_Hangul_Special, Qt::Key_Hangul_Special, + //XK_Hangul_switch, Qt::Key_Hangul_switch, + XK_Hangul_switch, Qt::Key_Mode_switch, +#endif // XK_KOREAN + + // dead keys + XK_dead_grave, Qt::Key_Dead_Grave, + XK_dead_acute, Qt::Key_Dead_Acute, + XK_dead_circumflex, Qt::Key_Dead_Circumflex, + XK_dead_tilde, Qt::Key_Dead_Tilde, + XK_dead_macron, Qt::Key_Dead_Macron, + XK_dead_breve, Qt::Key_Dead_Breve, + XK_dead_abovedot, Qt::Key_Dead_Abovedot, + XK_dead_diaeresis, Qt::Key_Dead_Diaeresis, + XK_dead_abovering, Qt::Key_Dead_Abovering, + XK_dead_doubleacute, Qt::Key_Dead_Doubleacute, + XK_dead_caron, Qt::Key_Dead_Caron, + XK_dead_cedilla, Qt::Key_Dead_Cedilla, + XK_dead_ogonek, Qt::Key_Dead_Ogonek, + XK_dead_iota, Qt::Key_Dead_Iota, + XK_dead_voiced_sound, Qt::Key_Dead_Voiced_Sound, + XK_dead_semivoiced_sound, Qt::Key_Dead_Semivoiced_Sound, + XK_dead_belowdot, Qt::Key_Dead_Belowdot, + XK_dead_hook, Qt::Key_Dead_Hook, + XK_dead_horn, Qt::Key_Dead_Horn, + + // Special keys from X.org - This include multimedia keys, + // wireless/bluetooth/uwb keys, special launcher keys, etc. + XF86XK_Back, Qt::Key_Back, + XF86XK_Forward, Qt::Key_Forward, + XF86XK_Stop, Qt::Key_Stop, + XF86XK_Refresh, Qt::Key_Refresh, + XF86XK_Favorites, Qt::Key_Favorites, + XF86XK_AudioMedia, Qt::Key_LaunchMedia, + XF86XK_OpenURL, Qt::Key_OpenUrl, + XF86XK_HomePage, Qt::Key_HomePage, + XF86XK_Search, Qt::Key_Search, + XF86XK_AudioLowerVolume, Qt::Key_VolumeDown, + XF86XK_AudioMute, Qt::Key_VolumeMute, + XF86XK_AudioRaiseVolume, Qt::Key_VolumeUp, + XF86XK_AudioPlay, Qt::Key_MediaPlay, + XF86XK_AudioStop, Qt::Key_MediaStop, + XF86XK_AudioPrev, Qt::Key_MediaPrevious, + XF86XK_AudioNext, Qt::Key_MediaNext, + XF86XK_AudioRecord, Qt::Key_MediaRecord, + XF86XK_Mail, Qt::Key_LaunchMail, + XF86XK_MyComputer, Qt::Key_Launch0, // ### Qt 5: remap properly + XF86XK_Calculator, Qt::Key_Launch1, + XF86XK_Memo, Qt::Key_Memo, + XF86XK_ToDoList, Qt::Key_ToDoList, + XF86XK_Calendar, Qt::Key_Calendar, + XF86XK_PowerDown, Qt::Key_PowerDown, + XF86XK_ContrastAdjust, Qt::Key_ContrastAdjust, + XF86XK_Standby, Qt::Key_Standby, + XF86XK_MonBrightnessUp, Qt::Key_MonBrightnessUp, + XF86XK_MonBrightnessDown, Qt::Key_MonBrightnessDown, + XF86XK_KbdLightOnOff, Qt::Key_KeyboardLightOnOff, + XF86XK_KbdBrightnessUp, Qt::Key_KeyboardBrightnessUp, + XF86XK_KbdBrightnessDown, Qt::Key_KeyboardBrightnessDown, + XF86XK_PowerOff, Qt::Key_PowerOff, + XF86XK_WakeUp, Qt::Key_WakeUp, + XF86XK_Eject, Qt::Key_Eject, + XF86XK_ScreenSaver, Qt::Key_ScreenSaver, + XF86XK_WWW, Qt::Key_WWW, + XF86XK_Sleep, Qt::Key_Sleep, + XF86XK_LightBulb, Qt::Key_LightBulb, + XF86XK_Shop, Qt::Key_Shop, + XF86XK_History, Qt::Key_History, + XF86XK_AddFavorite, Qt::Key_AddFavorite, + XF86XK_HotLinks, Qt::Key_HotLinks, + XF86XK_BrightnessAdjust, Qt::Key_BrightnessAdjust, + XF86XK_Finance, Qt::Key_Finance, + XF86XK_Community, Qt::Key_Community, + XF86XK_AudioRewind, Qt::Key_AudioRewind, + XF86XK_BackForward, Qt::Key_BackForward, + XF86XK_ApplicationLeft, Qt::Key_ApplicationLeft, + XF86XK_ApplicationRight, Qt::Key_ApplicationRight, + XF86XK_Book, Qt::Key_Book, + XF86XK_CD, Qt::Key_CD, + XF86XK_Calculater, Qt::Key_Calculator, + XF86XK_Clear, Qt::Key_Clear, + XF86XK_ClearGrab, Qt::Key_ClearGrab, + XF86XK_Close, Qt::Key_Close, + XF86XK_Copy, Qt::Key_Copy, + XF86XK_Cut, Qt::Key_Cut, + XF86XK_Display, Qt::Key_Display, + XF86XK_DOS, Qt::Key_DOS, + XF86XK_Documents, Qt::Key_Documents, + XF86XK_Excel, Qt::Key_Excel, + XF86XK_Explorer, Qt::Key_Explorer, + XF86XK_Game, Qt::Key_Game, + XF86XK_Go, Qt::Key_Go, + XF86XK_iTouch, Qt::Key_iTouch, + XF86XK_LogOff, Qt::Key_LogOff, + XF86XK_Market, Qt::Key_Market, + XF86XK_Meeting, Qt::Key_Meeting, + XF86XK_MenuKB, Qt::Key_MenuKB, + XF86XK_MenuPB, Qt::Key_MenuPB, + XF86XK_MySites, Qt::Key_MySites, + XF86XK_News, Qt::Key_News, + XF86XK_OfficeHome, Qt::Key_OfficeHome, + XF86XK_Option, Qt::Key_Option, + XF86XK_Paste, Qt::Key_Paste, + XF86XK_Phone, Qt::Key_Phone, + XF86XK_Reply, Qt::Key_Reply, + XF86XK_Reload, Qt::Key_Reload, + XF86XK_RotateWindows, Qt::Key_RotateWindows, + XF86XK_RotationPB, Qt::Key_RotationPB, + XF86XK_RotationKB, Qt::Key_RotationKB, + XF86XK_Save, Qt::Key_Save, + XF86XK_Send, Qt::Key_Send, + XF86XK_Spell, Qt::Key_Spell, + XF86XK_SplitScreen, Qt::Key_SplitScreen, + XF86XK_Support, Qt::Key_Support, + XF86XK_TaskPane, Qt::Key_TaskPane, + XF86XK_Terminal, Qt::Key_Terminal, + XF86XK_Tools, Qt::Key_Tools, + XF86XK_Travel, Qt::Key_Travel, + XF86XK_Video, Qt::Key_Video, + XF86XK_Word, Qt::Key_Word, + XF86XK_Xfer, Qt::Key_Xfer, + XF86XK_ZoomIn, Qt::Key_ZoomIn, + XF86XK_ZoomOut, Qt::Key_ZoomOut, + XF86XK_Away, Qt::Key_Away, + XF86XK_Messenger, Qt::Key_Messenger, + XF86XK_WebCam, Qt::Key_WebCam, + XF86XK_MailForward, Qt::Key_MailForward, + XF86XK_Pictures, Qt::Key_Pictures, + XF86XK_Music, Qt::Key_Music, + XF86XK_Battery, Qt::Key_Battery, + XF86XK_Bluetooth, Qt::Key_Bluetooth, + XF86XK_WLAN, Qt::Key_WLAN, + XF86XK_UWB, Qt::Key_UWB, + XF86XK_AudioForward, Qt::Key_AudioForward, + XF86XK_AudioRepeat, Qt::Key_AudioRepeat, + XF86XK_AudioRandomPlay, Qt::Key_AudioRandomPlay, + XF86XK_Subtitle, Qt::Key_Subtitle, + XF86XK_AudioCycleTrack, Qt::Key_AudioCycleTrack, + XF86XK_Time, Qt::Key_Time, + XF86XK_Select, Qt::Key_Select, + XF86XK_View, Qt::Key_View, + XF86XK_TopMenu, Qt::Key_TopMenu, + XF86XK_Bluetooth, Qt::Key_Bluetooth, + XF86XK_Suspend, Qt::Key_Suspend, + XF86XK_Hibernate, Qt::Key_Hibernate, + XF86XK_Launch0, Qt::Key_Launch2, // ### Qt 5: remap properly + XF86XK_Launch1, Qt::Key_Launch3, + XF86XK_Launch2, Qt::Key_Launch4, + XF86XK_Launch3, Qt::Key_Launch5, + XF86XK_Launch4, Qt::Key_Launch6, + XF86XK_Launch5, Qt::Key_Launch7, + XF86XK_Launch6, Qt::Key_Launch8, + XF86XK_Launch7, Qt::Key_Launch9, + XF86XK_Launch8, Qt::Key_LaunchA, + XF86XK_Launch9, Qt::Key_LaunchB, + XF86XK_LaunchA, Qt::Key_LaunchC, + XF86XK_LaunchB, Qt::Key_LaunchD, + XF86XK_LaunchC, Qt::Key_LaunchE, + XF86XK_LaunchD, Qt::Key_LaunchF, + XF86XK_LaunchE, Qt::Key_LaunchG, + XF86XK_LaunchF, Qt::Key_LaunchH, + + // Qtopia keys + QTOPIAXK_Select, Qt::Key_Select, + QTOPIAXK_Yes, Qt::Key_Yes, + QTOPIAXK_No, Qt::Key_No, + QTOPIAXK_Cancel, Qt::Key_Cancel, + QTOPIAXK_Printer, Qt::Key_Printer, + QTOPIAXK_Execute, Qt::Key_Execute, + QTOPIAXK_Sleep, Qt::Key_Sleep, + QTOPIAXK_Play, Qt::Key_Play, + QTOPIAXK_Zoom, Qt::Key_Zoom, + QTOPIAXK_Context1, Qt::Key_Context1, + QTOPIAXK_Context2, Qt::Key_Context2, + QTOPIAXK_Context3, Qt::Key_Context3, + QTOPIAXK_Context4, Qt::Key_Context4, + QTOPIAXK_Call, Qt::Key_Call, + QTOPIAXK_Hangup, Qt::Key_Hangup, + QTOPIAXK_Flip, Qt::Key_Flip, + + 0, 0 +}; + +static const unsigned short katakanaKeysymsToUnicode[] = { + 0x0000, 0x3002, 0x300C, 0x300D, 0x3001, 0x30FB, 0x30F2, 0x30A1, + 0x30A3, 0x30A5, 0x30A7, 0x30A9, 0x30E3, 0x30E5, 0x30E7, 0x30C3, + 0x30FC, 0x30A2, 0x30A4, 0x30A6, 0x30A8, 0x30AA, 0x30AB, 0x30AD, + 0x30AF, 0x30B1, 0x30B3, 0x30B5, 0x30B7, 0x30B9, 0x30BB, 0x30BD, + 0x30BF, 0x30C1, 0x30C4, 0x30C6, 0x30C8, 0x30CA, 0x30CB, 0x30CC, + 0x30CD, 0x30CE, 0x30CF, 0x30D2, 0x30D5, 0x30D8, 0x30DB, 0x30DE, + 0x30DF, 0x30E0, 0x30E1, 0x30E2, 0x30E4, 0x30E6, 0x30E8, 0x30E9, + 0x30EA, 0x30EB, 0x30EC, 0x30ED, 0x30EF, 0x30F3, 0x309B, 0x309C +}; + +static const unsigned short cyrillicKeysymsToUnicode[] = { + 0x0000, 0x0452, 0x0453, 0x0451, 0x0454, 0x0455, 0x0456, 0x0457, + 0x0458, 0x0459, 0x045a, 0x045b, 0x045c, 0x0000, 0x045e, 0x045f, + 0x2116, 0x0402, 0x0403, 0x0401, 0x0404, 0x0405, 0x0406, 0x0407, + 0x0408, 0x0409, 0x040a, 0x040b, 0x040c, 0x0000, 0x040e, 0x040f, + 0x044e, 0x0430, 0x0431, 0x0446, 0x0434, 0x0435, 0x0444, 0x0433, + 0x0445, 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, + 0x043f, 0x044f, 0x0440, 0x0441, 0x0442, 0x0443, 0x0436, 0x0432, + 0x044c, 0x044b, 0x0437, 0x0448, 0x044d, 0x0449, 0x0447, 0x044a, + 0x042e, 0x0410, 0x0411, 0x0426, 0x0414, 0x0415, 0x0424, 0x0413, + 0x0425, 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, + 0x041f, 0x042f, 0x0420, 0x0421, 0x0422, 0x0423, 0x0416, 0x0412, + 0x042c, 0x042b, 0x0417, 0x0428, 0x042d, 0x0429, 0x0427, 0x042a +}; + +static const unsigned short greekKeysymsToUnicode[] = { + 0x0000, 0x0386, 0x0388, 0x0389, 0x038a, 0x03aa, 0x0000, 0x038c, + 0x038e, 0x03ab, 0x0000, 0x038f, 0x0000, 0x0000, 0x0385, 0x2015, + 0x0000, 0x03ac, 0x03ad, 0x03ae, 0x03af, 0x03ca, 0x0390, 0x03cc, + 0x03cd, 0x03cb, 0x03b0, 0x03ce, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, + 0x0398, 0x0399, 0x039a, 0x039b, 0x039c, 0x039d, 0x039e, 0x039f, + 0x03a0, 0x03a1, 0x03a3, 0x0000, 0x03a4, 0x03a5, 0x03a6, 0x03a7, + 0x03a8, 0x03a9, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x03b1, 0x03b2, 0x03b3, 0x03b4, 0x03b5, 0x03b6, 0x03b7, + 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bc, 0x03bd, 0x03be, 0x03bf, + 0x03c0, 0x03c1, 0x03c3, 0x03c2, 0x03c4, 0x03c5, 0x03c6, 0x03c7, + 0x03c8, 0x03c9, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 +}; + +static const unsigned short technicalKeysymsToUnicode[] = { + 0x0000, 0x23B7, 0x250C, 0x2500, 0x2320, 0x2321, 0x2502, 0x23A1, + 0x23A3, 0x23A4, 0x23A6, 0x239B, 0x239D, 0x239E, 0x23A0, 0x23A8, + 0x23AC, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x2264, 0x2260, 0x2265, 0x222B, + 0x2234, 0x221D, 0x221E, 0x0000, 0x0000, 0x2207, 0x0000, 0x0000, + 0x223C, 0x2243, 0x0000, 0x0000, 0x0000, 0x21D4, 0x21D2, 0x2261, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x221A, 0x0000, + 0x0000, 0x0000, 0x2282, 0x2283, 0x2229, 0x222A, 0x2227, 0x2228, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2202, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0192, 0x0000, + 0x0000, 0x0000, 0x0000, 0x2190, 0x2191, 0x2192, 0x2193, 0x0000 +}; + +static const unsigned short specialKeysymsToUnicode[] = { + 0x25C6, 0x2592, 0x2409, 0x240C, 0x240D, 0x240A, 0x0000, 0x0000, + 0x2424, 0x240B, 0x2518, 0x2510, 0x250C, 0x2514, 0x253C, 0x23BA, + 0x23BB, 0x2500, 0x23BC, 0x23BD, 0x251C, 0x2524, 0x2534, 0x252C, + 0x2502, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 +}; + +static const unsigned short publishingKeysymsToUnicode[] = { + 0x0000, 0x2003, 0x2002, 0x2004, 0x2005, 0x2007, 0x2008, 0x2009, + 0x200a, 0x2014, 0x2013, 0x0000, 0x0000, 0x0000, 0x2026, 0x2025, + 0x2153, 0x2154, 0x2155, 0x2156, 0x2157, 0x2158, 0x2159, 0x215a, + 0x2105, 0x0000, 0x0000, 0x2012, 0x2329, 0x0000, 0x232a, 0x0000, + 0x0000, 0x0000, 0x0000, 0x215b, 0x215c, 0x215d, 0x215e, 0x0000, + 0x0000, 0x2122, 0x2613, 0x0000, 0x25c1, 0x25b7, 0x25cb, 0x25af, + 0x2018, 0x2019, 0x201c, 0x201d, 0x211e, 0x0000, 0x2032, 0x2033, + 0x0000, 0x271d, 0x0000, 0x25ac, 0x25c0, 0x25b6, 0x25cf, 0x25ae, + 0x25e6, 0x25ab, 0x25ad, 0x25b3, 0x25bd, 0x2606, 0x2022, 0x25aa, + 0x25b2, 0x25bc, 0x261c, 0x261e, 0x2663, 0x2666, 0x2665, 0x0000, + 0x2720, 0x2020, 0x2021, 0x2713, 0x2717, 0x266f, 0x266d, 0x2642, + 0x2640, 0x260e, 0x2315, 0x2117, 0x2038, 0x201a, 0x201e, 0x0000 +}; + +static const unsigned short aplKeysymsToUnicode[] = { + 0x0000, 0x0000, 0x0000, 0x003c, 0x0000, 0x0000, 0x003e, 0x0000, + 0x2228, 0x2227, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x00af, 0x0000, 0x22a5, 0x2229, 0x230a, 0x0000, 0x005f, 0x0000, + 0x0000, 0x0000, 0x2218, 0x0000, 0x2395, 0x0000, 0x22a4, 0x25cb, + 0x0000, 0x0000, 0x0000, 0x2308, 0x0000, 0x0000, 0x222a, 0x0000, + 0x2283, 0x0000, 0x2282, 0x0000, 0x22a2, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x22a3, 0x0000, 0x0000, 0x0000 +}; + +static const unsigned short koreanKeysymsToUnicode[] = { + 0x0000, 0x3131, 0x3132, 0x3133, 0x3134, 0x3135, 0x3136, 0x3137, + 0x3138, 0x3139, 0x313a, 0x313b, 0x313c, 0x313d, 0x313e, 0x313f, + 0x3140, 0x3141, 0x3142, 0x3143, 0x3144, 0x3145, 0x3146, 0x3147, + 0x3148, 0x3149, 0x314a, 0x314b, 0x314c, 0x314d, 0x314e, 0x314f, + 0x3150, 0x3151, 0x3152, 0x3153, 0x3154, 0x3155, 0x3156, 0x3157, + 0x3158, 0x3159, 0x315a, 0x315b, 0x315c, 0x315d, 0x315e, 0x315f, + 0x3160, 0x3161, 0x3162, 0x3163, 0x11a8, 0x11a9, 0x11aa, 0x11ab, + 0x11ac, 0x11ad, 0x11ae, 0x11af, 0x11b0, 0x11b1, 0x11b2, 0x11b3, + 0x11b4, 0x11b5, 0x11b6, 0x11b7, 0x11b8, 0x11b9, 0x11ba, 0x11bb, + 0x11bc, 0x11bd, 0x11be, 0x11bf, 0x11c0, 0x11c1, 0x11c2, 0x316d, + 0x3171, 0x3178, 0x317f, 0x3181, 0x3184, 0x3186, 0x318d, 0x318e, + 0x11eb, 0x11f0, 0x11f9, 0x0000, 0x0000, 0x0000, 0x0000, 0x20a9 +}; + +static QChar keysymToUnicode(unsigned char byte3, unsigned char byte4) +{ + switch (byte3) { + case 0x04: + // katakana + if (byte4 > 0xa0 && byte4 < 0xe0) + return QChar(katakanaKeysymsToUnicode[byte4 - 0xa0]); + else if (byte4 == 0x7e) + return QChar(0x203e); // Overline + break; + case 0x06: + // russian, use lookup table + if (byte4 > 0xa0) + return QChar(cyrillicKeysymsToUnicode[byte4 - 0xa0]); + break; + case 0x07: + // greek + if (byte4 > 0xa0) + return QChar(greekKeysymsToUnicode[byte4 - 0xa0]); + break; + case 0x08: + // technical + if (byte4 > 0xa0) + return QChar(technicalKeysymsToUnicode[byte4 - 0xa0]); + break; + case 0x09: + // special + if (byte4 >= 0xe0) + return QChar(specialKeysymsToUnicode[byte4 - 0xe0]); + break; + case 0x0a: + // publishing + if (byte4 > 0xa0) + return QChar(publishingKeysymsToUnicode[byte4 - 0xa0]); + break; + case 0x0b: + // APL + if (byte4 > 0xa0) + return QChar(aplKeysymsToUnicode[byte4 - 0xa0]); + break; + case 0x0e: + // Korean + if (byte4 > 0xa0) + return QChar(koreanKeysymsToUnicode[byte4 - 0xa0]); + break; + default: + break; + } + return QChar(0x0); +} + +Qt::KeyboardModifiers QXlibKeyboard::translateModifiers(int s) +{ + Qt::KeyboardModifiers ret = 0; + if (s & ShiftMask) + ret |= Qt::ShiftModifier; + if (s & ControlMask) + ret |= Qt::ControlModifier; + if (s & m_alt_mask) + ret |= Qt::AltModifier; + if (s & m_meta_mask) + ret |= Qt::MetaModifier; +// if (s & m_mode_switch_mask) //doesn't seem to work correctly +// ret |= Qt::GroupSwitchModifier; + return ret; +} + +void QXlibKeyboard::setMask(KeySym sym, uint mask) +{ + if (m_alt_mask == 0 + && m_meta_mask != mask + && m_super_mask != mask + && m_hyper_mask != mask + && (sym == XK_Alt_L || sym == XK_Alt_R)) { + m_alt_mask = mask; + } + if (m_meta_mask == 0 + && m_alt_mask != mask + && m_super_mask != mask + && m_hyper_mask != mask + && (sym == XK_Meta_L || sym == XK_Meta_R)) { + m_meta_mask = mask; + } + if (m_super_mask == 0 + && m_alt_mask != mask + && m_meta_mask != mask + && m_hyper_mask != mask + && (sym == XK_Super_L || sym == XK_Super_R)) { + m_super_mask = mask; + } + if (m_hyper_mask == 0 + && m_alt_mask != mask + && m_meta_mask != mask + && m_super_mask != mask + && (sym == XK_Hyper_L || sym == XK_Hyper_R)) { + m_hyper_mask = mask; + } + if (m_mode_switch_mask == 0 + && m_alt_mask != mask + && m_meta_mask != mask + && m_super_mask != mask + && m_hyper_mask != mask + && sym == XK_Mode_switch) { + m_mode_switch_mask = mask; + } + if (m_num_lock_mask == 0 + && sym == XK_Num_Lock) { + m_num_lock_mask = mask; + } +} + +int QXlibKeyboard::translateKeySym(uint key) const +{ + int code = -1; + int i = 0; // any other keys + while (KeyTbl[i]) { + if (key == KeyTbl[i]) { + code = (int)KeyTbl[i+1]; + break; + } + i += 2; + } + if (m_meta_mask) { + // translate Super/Hyper keys to Meta if we're using them as the MetaModifier + if (m_meta_mask == m_super_mask && (code == Qt::Key_Super_L || code == Qt::Key_Super_R)) { + code = Qt::Key_Meta; + } else if (m_meta_mask == m_hyper_mask && (code == Qt::Key_Hyper_L || code == Qt::Key_Hyper_R)) { + code = Qt::Key_Meta; + } + } + return code; +} + +QString QXlibKeyboard::translateKeySym(KeySym keysym, uint xmodifiers, + int &code, Qt::KeyboardModifiers &modifiers, + QByteArray &chars, int &count) +{ + // all keysyms smaller than 0xff00 are actally keys that can be mapped to unicode chars + + QTextCodec *mapper = QTextCodec::codecForLocale(); + QChar converted; + + if (/*count == 0 &&*/ keysym < 0xff00) { + unsigned char byte3 = (unsigned char)(keysym >> 8); + int mib = -1; + switch(byte3) { + case 0: // Latin 1 + case 1: // Latin 2 + case 2: //latin 3 + case 3: // latin4 + mib = byte3 + 4; break; + case 5: // arabic + mib = 82; break; + case 12: // Hebrew + mib = 85; break; + case 13: // Thai + mib = 2259; break; + case 4: // kana + case 6: // cyrillic + case 7: // greek + case 8: // technical, no mapping here at the moment + case 9: // Special + case 10: // Publishing + case 11: // APL + case 14: // Korean, no mapping + mib = -1; // manual conversion + mapper= 0; +#if !defined(QT_NO_XIM) + converted = keysymToUnicode(byte3, keysym & 0xff); +#endif + case 0x20: + // currency symbols + if (keysym >= 0x20a0 && keysym <= 0x20ac) { + mib = -1; // manual conversion + mapper = 0; + converted = (uint)keysym; + } + break; + default: + break; + } + if (mib != -1) { + mapper = QTextCodec::codecForMib(mib); + if (chars.isEmpty()) + chars.resize(1); + chars[0] = (unsigned char) (keysym & 0xff); // get only the fourth bit for conversion later + count = 1; + } + } else if (keysym >= 0x1000000 && keysym <= 0x100ffff) { + converted = (ushort) (keysym - 0x1000000); + mapper = 0; + } + if (count < (int)chars.size()-1) + chars[count] = '\0'; + + QString text; + if (!mapper && converted.unicode() != 0x0) { + text = converted; + } else if (!chars.isEmpty()) { + // convert chars (8bit) to text (unicode). + if (mapper) + text = mapper->toUnicode(chars.data(), count, 0); + if (text.isEmpty()) { + // no mapper, or codec couldn't convert to unicode (this + // can happen when running in the C locale or with no LANG + // set). try converting from latin-1 + text = QString::fromLatin1(chars); + } + } + + modifiers = translateModifiers(xmodifiers); + + // Commentary in X11/keysymdef says that X codes match ASCII, so it + // is safe to use the locale functions to process X codes in ISO8859-1. + // + // This is mainly for compatibility - applications should not use the + // Qt keycodes between 128 and 255, but should rather use the + // QKeyEvent::text(). + // + if (keysym < 128 || (keysym < 256 && (!mapper || mapper->mibEnum()==4))) { + // upper-case key, if known + code = isprint((int)keysym) ? toupper((int)keysym) : 0; + } else if (keysym >= XK_F1 && keysym <= XK_F35) { + // function keys + code = Qt::Key_F1 + ((int)keysym - XK_F1); + } else if (keysym >= XK_KP_Space && keysym <= XK_KP_9) { + if (keysym >= XK_KP_0) { + // numeric keypad keys + code = Qt::Key_0 + ((int)keysym - XK_KP_0); + } else { + code = translateKeySym(keysym); + } + modifiers |= Qt::KeypadModifier; + } else if (text.length() == 1 && text.unicode()->unicode() > 0x1f && text.unicode()->unicode() != 0x7f && !(keysym >= XK_dead_grave && keysym <= XK_dead_horn)) { + code = text.unicode()->toUpper().unicode(); + } else { + // any other keys + code = translateKeySym(keysym); + + if (code == Qt::Key_Tab && (modifiers & Qt::ShiftModifier)) { + // map shift+tab to shift+backtab, QShortcutMap knows about it + // and will handle it. + code = Qt::Key_Backtab; + text = QString(); + } + } + + return text; +} + +QXlibKeyboard::QXlibKeyboard(QXlibScreen *screen) + : m_screen(screen) + , m_alt_mask(0) + , m_super_mask(0) + , m_hyper_mask(0) + , m_meta_mask(0) +{ + changeLayout(); +} + +void QXlibKeyboard::changeLayout() +{ + XkbDescPtr xkbDesc = XkbGetMap(m_screen->display(), XkbAllClientInfoMask, XkbUseCoreKbd); + for (int i = xkbDesc->min_key_code; i < xkbDesc->max_key_code; ++i) { + const uint mask = xkbDesc->map->modmap ? xkbDesc->map->modmap[i] : 0; + if (mask == 0) { + // key is not bound to a modifier + continue; + } + + for (int j = 0; j < XkbKeyGroupsWidth(xkbDesc, i); ++j) { + KeySym keySym = XkbKeySym(xkbDesc, i, j); + if (keySym == NoSymbol) + continue; + setMask(keySym, mask); + } + } + XkbFreeKeyboard(xkbDesc, XkbAllComponentsMask, true); + +} + +static Qt::KeyboardModifiers modifierFromKeyCode(int qtcode) +{ + switch (qtcode) { + case Qt::Key_Control: + return Qt::ControlModifier; + case Qt::Key_Alt: + return Qt::AltModifier; + case Qt::Key_Shift: + return Qt::ShiftModifier; + case Qt::Key_Meta: + return Qt::MetaModifier; + default: + return Qt::NoModifier; + } +} + +void QXlibKeyboard::handleKeyEvent(QWidget *widget, QEvent::Type type, XKeyEvent *ev) +{ + int qtcode = 0; + Qt::KeyboardModifiers modifiers = translateModifiers(ev->state); + QByteArray chars; + chars.resize(513); + int count = 0; + KeySym keySym; + count = XLookupString(ev,chars.data(),chars.size(),&keySym,0); + QString text = translateKeySym(keySym,ev->state,qtcode,modifiers,chars,count); + QWindowSystemInterface::handleKeyEvent(widget,ev->time,type,qtcode,modifiers,text.left(count)); +} diff --git a/src/plugins/platforms/xlib/qtestlitekeyboard.h b/src/plugins/platforms/xlib/qtestlitekeyboard.h new file mode 100644 index 0000000..98df4e1 --- /dev/null +++ b/src/plugins/platforms/xlib/qtestlitekeyboard.h @@ -0,0 +1,76 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTESTLITEKEYBOARD_H +#define QTESTLITEKEYBOARD_H + +#include "qtestliteintegration.h" + +class QXlibKeyboard +{ +public: + QXlibKeyboard(QXlibScreen *screen); + + void changeLayout(); + + void handleKeyEvent(QWidget *widget, QEvent::Type type, XKeyEvent *ev); + + Qt::KeyboardModifiers translateModifiers(int s); + +private: + + void setMask(KeySym sym, uint mask); + int translateKeySym(uint key) const; + QString translateKeySym(KeySym keysym, uint xmodifiers, + int &code, Qt::KeyboardModifiers &modifiers, + QByteArray &chars, int &count); + + QXlibScreen *m_screen; + + uint m_alt_mask; + uint m_super_mask; + uint m_hyper_mask; + uint m_meta_mask; + uint m_mode_switch_mask; + uint m_num_lock_mask; +}; + +#endif // QTESTLITEKEYBOARD_H diff --git a/src/plugins/platforms/xlib/qtestlitemime.cpp b/src/plugins/platforms/xlib/qtestlitemime.cpp new file mode 100644 index 0000000..5335ae9 --- /dev/null +++ b/src/plugins/platforms/xlib/qtestlitemime.cpp @@ -0,0 +1,322 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qtestlitemime.h" + +#include "qtestlitestaticinfo.h" +#include "qtestlitescreen.h" + +#include <QtCore/QTextCodec> +#include <QtGui/QImageWriter> +#include <QtCore/QBuffer> + +QXlibMime::QXlibMime() + : QInternalMimeData() +{ } + +QXlibMime::~QXlibMime() +{} + + + + + +QString QXlibMime::mimeAtomToString(Display *display, Atom a) +{ + if (!a) return 0; + + if (a == XA_STRING || a == QXlibStatic::atom(QXlibStatic::UTF8_STRING)) { + return "text/plain"; // some Xdnd clients are dumb + } + char *atom = XGetAtomName(display, a); + QString result = QString::fromLatin1(atom); + XFree(atom); + return result; +} + +Atom QXlibMime::mimeStringToAtom(Display *display, const QString &mimeType) +{ + if (mimeType.isEmpty()) + return 0; + return XInternAtom(display, mimeType.toLatin1().constData(), False); +} + +QStringList QXlibMime::mimeFormatsForAtom(Display *display, Atom a) +{ + QStringList formats; + if (a) { + QString atomName = mimeAtomToString(display, a); + formats.append(atomName); + + // special cases for string type + if (a == QXlibStatic::atom(QXlibStatic::UTF8_STRING) + || a == XA_STRING + || a == QXlibStatic::atom(QXlibStatic::TEXT) + || a == QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT)) + formats.append(QLatin1String("text/plain")); + + // special cases for uris + if (atomName == QLatin1String("text/x-moz-url")) + formats.append(QLatin1String("text/uri-list")); + + // special case for images + if (a == XA_PIXMAP) + formats.append(QLatin1String("image/ppm")); + } + return formats; +} + +bool QXlibMime::mimeDataForAtom(Display *display, Atom a, QMimeData *mimeData, QByteArray *data, Atom *atomFormat, int *dataFormat) +{ + bool ret = false; + *atomFormat = a; + *dataFormat = 8; + QString atomName = mimeAtomToString(display, a); + if (QInternalMimeData::hasFormatHelper(atomName, mimeData)) { + *data = QInternalMimeData::renderDataHelper(atomName, mimeData); + if (atomName == QLatin1String("application/x-color")) + *dataFormat = 16; + ret = true; + } else { + if ((a == QXlibStatic::atom(QXlibStatic::UTF8_STRING) + || a == XA_STRING + || a == QXlibStatic::atom(QXlibStatic::TEXT) + || a == QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT)) + && QInternalMimeData::hasFormatHelper(QLatin1String("text/plain"), mimeData)) { + if (a == QXlibStatic::atom(QXlibStatic::UTF8_STRING)){ + *data = QInternalMimeData::renderDataHelper(QLatin1String("text/plain"), mimeData); + ret = true; + } else if (a == XA_STRING) { + *data = QString::fromUtf8(QInternalMimeData::renderDataHelper( + QLatin1String("text/plain"), mimeData)).toLocal8Bit(); + ret = true; + } else if (a == QXlibStatic::atom(QXlibStatic::TEXT) + || a == QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT)) { + // the ICCCM states that TEXT and COMPOUND_TEXT are in the + // encoding of choice, so we choose the encoding of the locale + QByteArray strData = QString::fromUtf8(QInternalMimeData::renderDataHelper( + QLatin1String("text/plain"), mimeData)).toLocal8Bit(); + char *list[] = { strData.data(), NULL }; + + XICCEncodingStyle style = (a == QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT)) + ? XCompoundTextStyle : XStdICCTextStyle; + XTextProperty textprop; + if (list[0] != NULL + && XmbTextListToTextProperty(display, list, 1, style, + &textprop) == Success) { + *atomFormat = textprop.encoding; + *dataFormat = textprop.format; + *data = QByteArray((const char *) textprop.value, textprop.nitems * textprop.format / 8); + ret = true; + + XFree(textprop.value); + } + } + } else if (atomName == QLatin1String("text/x-moz-url") && + QInternalMimeData::hasFormatHelper(QLatin1String("text/uri-list"), mimeData)) { + QByteArray uri = QInternalMimeData::renderDataHelper( + QLatin1String("text/uri-list"), mimeData).split('\n').first(); + QString mozUri = QString::fromLatin1(uri, uri.size()); + mozUri += QLatin1Char('\n'); + *data = QByteArray(reinterpret_cast<const char *>(mozUri.utf16()), mozUri.length() * 2); + ret = true; + } else if ((a == XA_PIXMAP || a == XA_BITMAP) && mimeData->hasImage()) { + ret = true; + } + } + return ret && data != 0; +} + +QList<Atom> QXlibMime::mimeAtomsForFormat(Display *display, const QString &format) +{ + QList<Atom> atoms; + atoms.append(mimeStringToAtom(display, format)); + + // special cases for strings + if (format == QLatin1String("text/plain")) { + atoms.append(QXlibStatic::atom(QXlibStatic::UTF8_STRING)); + atoms.append(XA_STRING); + atoms.append(QXlibStatic::atom(QXlibStatic::TEXT)); + atoms.append(QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT)); + } + + // special cases for uris + if (format == QLatin1String("text/uri-list")) { + atoms.append(mimeStringToAtom(display,QLatin1String("text/x-moz-url"))); + } + + //special cases for images + if (format == QLatin1String("image/ppm")) + atoms.append(XA_PIXMAP); + if (format == QLatin1String("image/pbm")) + atoms.append(XA_BITMAP); + + return atoms; +} + +QVariant QXlibMime::mimeConvertToFormat(Display *display, Atom a, const QByteArray &data, const QString &format, QVariant::Type requestedType, const QByteArray &encoding) +{ + QString atomName = mimeAtomToString(display,a); + if (atomName == format) + return data; + + if (!encoding.isEmpty() + && atomName == format + QLatin1String(";charset=") + QString::fromLatin1(encoding)) { + + if (requestedType == QVariant::String) { + QTextCodec *codec = QTextCodec::codecForName(encoding); + if (codec) + return codec->toUnicode(data); + } + + return data; + } + + // special cases for string types + if (format == QLatin1String("text/plain")) { + if (a == QXlibStatic::atom(QXlibStatic::UTF8_STRING)) + return QString::fromUtf8(data); + if (a == XA_STRING) + return QString::fromLatin1(data); + if (a == QXlibStatic::atom(QXlibStatic::TEXT) + || a == QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT)) + // #### might be wrong for COMPUND_TEXT + return QString::fromLocal8Bit(data, data.size()); + } + + // special case for uri types + if (format == QLatin1String("text/uri-list")) { + if (atomName == QLatin1String("text/x-moz-url")) { + // we expect this as utf16 <url><space><title> + // the first part is a url that should only contain ascci char + // so it should be safe to check that the second char is 0 + // to verify that it is utf16 + if (data.size() > 1 && data.at(1) == 0) + return QString::fromRawData((const QChar *)data.constData(), + data.size() / 2).split(QLatin1Char('\n')).first().toLatin1(); + } + } + + // special cas for images + if (format == QLatin1String("image/ppm")) { + if (a == XA_PIXMAP && data.size() == sizeof(Pixmap)) { + Pixmap xpm = *((Pixmap*)data.data()); + if (!xpm) + return QByteArray(); + Window root; + int x; + int y; + uint width; + uint height; + uint border_width; + uint depth; + + XGetGeometry(display, xpm, &root, &x, &y, &width, &height, &border_width, &depth); + XImage *ximg = XGetImage(display,xpm,x,y,width,height,AllPlanes,depth==1 ? XYPixmap : ZPixmap); + QImage qimg = QXlibStatic::qimageFromXImage(ximg); + XDestroyImage(ximg); + + QImageWriter imageWriter; + imageWriter.setFormat("PPMRAW"); + QBuffer buf; + buf.open(QIODevice::WriteOnly); + imageWriter.setDevice(&buf); + imageWriter.write(qimg); + return buf.buffer(); + } + } + return QVariant(); +} + +Atom QXlibMime::mimeAtomForFormat(Display *display, const QString &format, QVariant::Type requestedType, const QList<Atom> &atoms, QByteArray *requestedEncoding) +{ + requestedEncoding->clear(); + + // find matches for string types + if (format == QLatin1String("text/plain")) { + if (atoms.contains(QXlibStatic::atom(QXlibStatic::UTF8_STRING))) + return QXlibStatic::atom(QXlibStatic::UTF8_STRING); + if (atoms.contains(QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT))) + return QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT); + if (atoms.contains(QXlibStatic::atom(QXlibStatic::TEXT))) + return QXlibStatic::atom(QXlibStatic::TEXT); + if (atoms.contains(XA_STRING)) + return XA_STRING; + } + + // find matches for uri types + if (format == QLatin1String("text/uri-list")) { + Atom a = mimeStringToAtom(display,format); + if (a && atoms.contains(a)) + return a; + a = mimeStringToAtom(display,QLatin1String("text/x-moz-url")); + if (a && atoms.contains(a)) + return a; + } + + // find match for image + if (format == QLatin1String("image/ppm")) { + if (atoms.contains(XA_PIXMAP)) + return XA_PIXMAP; + } + + // for string/text requests try to use a format with a well-defined charset + // first to avoid encoding problems + if (requestedType == QVariant::String + && format.startsWith(QLatin1String("text/")) + && !format.contains(QLatin1String("charset="))) { + + QString formatWithCharset = format; + formatWithCharset.append(QLatin1String(";charset=utf-8")); + + Atom a = mimeStringToAtom(display,formatWithCharset); + if (a && atoms.contains(a)) { + *requestedEncoding = "utf-8"; + return a; + } + } + + Atom a = mimeStringToAtom(display,format); + if (a && atoms.contains(a)) + return a; + + return 0; +} diff --git a/src/plugins/platforms/xlib/qtestlitemime.h b/src/plugins/platforms/xlib/qtestlitemime.h new file mode 100644 index 0000000..6a70ea4 --- /dev/null +++ b/src/plugins/platforms/xlib/qtestlitemime.h @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTESTLITEMIME_H +#define QTESTLITEMIME_H + +#include <private/qdnd_p.h> + +#include <QtGui/QClipboard> + +#include "qtestliteintegration.h" +#include "qtestliteclipboard.h" + +class QXlibMime : public QInternalMimeData { + Q_OBJECT +public: + QXlibMime(); + ~QXlibMime(); + + static QList<Atom> mimeAtomsForFormat(Display *display, const QString &format); + static QString mimeAtomToString(Display *display, Atom a); + static bool mimeDataForAtom(Display *display, Atom a, QMimeData *mimeData, QByteArray *data, Atom *atomFormat, int *dataFormat); + static QStringList mimeFormatsForAtom(Display *display, Atom a); + static Atom mimeStringToAtom(Display *display, const QString &mimeType); + static QVariant mimeConvertToFormat(Display *display, Atom a, const QByteArray &data, const QString &format, QVariant::Type requestedType, const QByteArray &encoding); + static Atom mimeAtomForFormat(Display *display, const QString &format, QVariant::Type requestedType, const QList<Atom> &atoms, QByteArray *requestedEncoding); +}; + +#endif // QTESTLITEMIME_H diff --git a/src/plugins/platforms/xlib/qtestlitescreen.cpp b/src/plugins/platforms/xlib/qtestlitescreen.cpp new file mode 100644 index 0000000..714c17b --- /dev/null +++ b/src/plugins/platforms/xlib/qtestlitescreen.cpp @@ -0,0 +1,468 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qtestlitescreen.h" + +#include "qtestlitecursor.h" +#include "qtestlitewindow.h" +#include "qtestlitekeyboard.h" +#include "qtestlitestaticinfo.h" +#include "qtestliteclipboard.h" + +#include <QtCore/QDebug> +#include <QtCore/QSocketNotifier> +#include <QtCore/QElapsedTimer> + +#include <private/qapplication_p.h> + +#include <X11/extensions/Xfixes.h> + +QT_BEGIN_NAMESPACE + +static int (*original_x_errhandler)(Display *dpy, XErrorEvent *); +static bool seen_badwindow; + +static int qt_x_errhandler(Display *dpy, XErrorEvent *err) +{ + +qDebug() << "qt_x_errhandler" << err->error_code; + + switch (err->error_code) { + case BadAtom: +#if 0 + if (err->request_code == 20 /* X_GetProperty */ + && (err->resourceid == XA_RESOURCE_MANAGER + || err->resourceid == XA_RGB_DEFAULT_MAP + || err->resourceid == ATOM(_NET_SUPPORTED) + || err->resourceid == ATOM(_NET_SUPPORTING_WM_CHECK) + || err->resourceid == ATOM(KDE_FULL_SESSION) + || err->resourceid == ATOM(KWIN_RUNNING) + || err->resourceid == ATOM(XdndProxy) + || err->resourceid == ATOM(XdndAware)) + + + ) { + // Perhaps we're running under SECURITY reduction? :/ + return 0; + } +#endif + qDebug() << "BadAtom"; + break; + + case BadWindow: + if (err->request_code == 2 /* X_ChangeWindowAttributes */ + || err->request_code == 38 /* X_QueryPointer */) { + for (int i = 0; i < ScreenCount(dpy); ++i) { + if (err->resourceid == RootWindow(dpy, i)) { + // Perhaps we're running under SECURITY reduction? :/ + return 0; + } + } + } + seen_badwindow = true; + if (err->request_code == 25 /* X_SendEvent */) { + for (int i = 0; i < ScreenCount(dpy); ++i) { + if (err->resourceid == RootWindow(dpy, i)) { + // Perhaps we're running under SECURITY reduction? :/ + return 0; + } + } +#if 0 + if (X11->xdndHandleBadwindow()) { + qDebug("xdndHandleBadwindow returned true"); + return 0; + } +#endif + } +#if 0 + if (X11->ignore_badwindow) + return 0; +#endif + break; + + case BadMatch: + if (err->request_code == 42 /* X_SetInputFocus */) + return 0; + break; + + default: +#if 0 //!defined(QT_NO_XINPUT) + if (err->request_code == X11->xinput_major + && err->error_code == (X11->xinput_errorbase + XI_BadDevice) + && err->minor_code == 3 /* X_OpenDevice */) { + return 0; + } +#endif + break; + } + + char errstr[256]; + XGetErrorText( dpy, err->error_code, errstr, 256 ); + char buffer[256]; + char request_str[256]; + qsnprintf(buffer, 256, "%d", err->request_code); + XGetErrorDatabaseText(dpy, "XRequest", buffer, "", request_str, 256); + if (err->request_code < 128) { + // X error for a normal protocol request + qWarning( "X Error: %s %d\n" + " Major opcode: %d (%s)\n" + " Resource id: 0x%lx", + errstr, err->error_code, + err->request_code, + request_str, + err->resourceid ); + } else { + // X error for an extension request + const char *extensionName = 0; +#if 0 + if (err->request_code == X11->xrender_major) + extensionName = "RENDER"; + else if (err->request_code == X11->xrandr_major) + extensionName = "RANDR"; + else if (err->request_code == X11->xinput_major) + extensionName = "XInputExtension"; + else if (err->request_code == X11->mitshm_major) + extensionName = "MIT-SHM"; +#endif + char minor_str[256]; + if (extensionName) { + qsnprintf(buffer, 256, "%s.%d", extensionName, err->minor_code); + XGetErrorDatabaseText(dpy, "XRequest", buffer, "", minor_str, 256); + } else { + extensionName = "Uknown extension"; + qsnprintf(minor_str, 256, "Unknown request"); + } + qWarning( "X Error: %s %d\n" + " Extension: %d (%s)\n" + " Minor opcode: %d (%s)\n" + " Resource id: 0x%lx", + errstr, err->error_code, + err->request_code, + extensionName, + err->minor_code, + minor_str, + err->resourceid ); + } + + // ### we really should distinguish between severe, non-severe and + // ### application specific errors + + return 0; +} + +QXlibScreen::QXlibScreen() + : mFormat(QImage::Format_RGB32) +{ + char *display_name = getenv("DISPLAY"); + mDisplay = XOpenDisplay(display_name); + mDisplayName = QString::fromLocal8Bit(display_name); + if (!mDisplay) { + fprintf(stderr, "Cannot connect to X server: %s\n", + display_name); + exit(1); + } + +#ifndef DONT_USE_MIT_SHM + Status MIT_SHM_extension_supported = XShmQueryExtension (mDisplay); + Q_ASSERT(MIT_SHM_extension_supported == True); +#endif + original_x_errhandler = XSetErrorHandler(qt_x_errhandler); + + if (qgetenv("DO_X_SYNCHRONIZE").toInt()) + XSynchronize(mDisplay, true); + + mScreen = DefaultScreen(mDisplay); + XSelectInput(mDisplay,rootWindow(), KeymapStateMask | EnterWindowMask | LeaveWindowMask | PropertyChangeMask); + int width = DisplayWidth(mDisplay, mScreen); + int height = DisplayHeight(mDisplay, mScreen); + mGeometry = QRect(0,0,width,height); + + int physicalWidth = DisplayWidthMM(mDisplay, mScreen); + int physicalHeight = DisplayHeightMM(mDisplay, mScreen); + mPhysicalSize = QSize(physicalWidth,physicalHeight); + + int xSocketNumber = XConnectionNumber(mDisplay); + + mDepth = DefaultDepth(mDisplay,mScreen); +#ifdef MYX11_DEBUG + qDebug() << "X socket:"<< xSocketNumber; +#endif + QSocketNotifier *sock = new QSocketNotifier(xSocketNumber, QSocketNotifier::Read, this); + connect(sock, SIGNAL(activated(int)), this, SLOT(eventDispatcher())); + + mCursor = new QXlibCursor(this); + mKeyboard = new QXlibKeyboard(this); +} + +QXlibScreen::~QXlibScreen() +{ + delete mCursor; + XCloseDisplay(mDisplay); +} + +#ifdef KeyPress +#undef KeyPress +#endif +#ifdef KeyRelease +#undef KeyRelease +#endif + +bool QXlibScreen::handleEvent(XEvent *xe) +{ + int quit = false; + QXlibWindow *platformWindow = 0; + QWidget *widget = QWidget::find(xe->xany.window); + if (widget) { + platformWindow = static_cast<QXlibWindow *>(widget->platformWindow()); + } + + Atom wmProtocolsAtom = QXlibStatic::atom(QXlibStatic::WM_PROTOCOLS); + Atom wmDeleteWindowAtom = QXlibStatic::atom(QXlibStatic::WM_DELETE_WINDOW); + switch (xe->type) { + + case ClientMessage: + if (xe->xclient.format == 32 && xe->xclient.message_type == wmProtocolsAtom) { + Atom a = xe->xclient.data.l[0]; + if (a == wmDeleteWindowAtom) + platformWindow->handleCloseEvent(); + } + break; + + case Expose: + if (platformWindow) + if (xe->xexpose.count == 0) + platformWindow->paintEvent(); + break; + case ConfigureNotify: + if (platformWindow) + platformWindow->resizeEvent(&xe->xconfigure); + break; + + case ButtonPress: + if (platformWindow) + platformWindow->mousePressEvent(&xe->xbutton); + break; + + case ButtonRelease: + if (platformWindow) + platformWindow->handleMouseEvent(QEvent::MouseButtonRelease, &xe->xbutton); + break; + + case MotionNotify: + if (platformWindow) + platformWindow->handleMouseEvent(QEvent::MouseMove, &xe->xbutton); + break; + + case XKeyPress: + mKeyboard->handleKeyEvent(widget,QEvent::KeyPress, &xe->xkey); + break; + + case XKeyRelease: + mKeyboard->handleKeyEvent(widget,QEvent::KeyRelease, &xe->xkey); + break; + + case EnterNotify: + if (platformWindow) + platformWindow->handleEnterEvent(); + break; + + case LeaveNotify: + if (platformWindow) + platformWindow->handleLeaveEvent(); + break; + + case XFocusIn: + if (platformWindow) + platformWindow->handleFocusInEvent(); + break; + + case XFocusOut: + if (platformWindow) + platformWindow->handleFocusOutEvent(); + break; + + case PropertyNotify: + break; + + case SelectionClear: + qDebug() << "Selection Clear!!!"; + break; + case SelectionRequest: + handleSelectionRequest(xe); + break; + case SelectionNotify: + qDebug() << "Selection Notify!!!!"; + + break; + + + default: +#ifdef MYX11_DEBUG + qDebug() << hex << xe->xany.window << "Other X event" << xe->type; +#endif + break; + } + + return quit; +} + +static Bool checkForClipboardEvents(Display *, XEvent *e, XPointer) +{ + Atom clipboard = QXlibStatic::atom(QXlibStatic::CLIPBOARD); + return ((e->type == SelectionRequest && (e->xselectionrequest.selection == XA_PRIMARY + || e->xselectionrequest.selection == clipboard)) + || (e->type == SelectionClear && (e->xselectionclear.selection == XA_PRIMARY + || e->xselectionclear.selection == clipboard))); +} + +bool QXlibScreen::waitForClipboardEvent(Window win, int type, XEvent *event, int timeout) +{ + QElapsedTimer timer; + timer.start(); + do { + if (XCheckTypedWindowEvent(mDisplay,win,type,event)) + return true; + + // process other clipboard events, since someone is probably requesting data from us + XEvent e; + if (XCheckIfEvent(mDisplay, &e, checkForClipboardEvents, 0)) + handleEvent(&e); + + XFlush(mDisplay); + + // sleep 50 ms, so we don't use up CPU cycles all the time. + struct timeval usleep_tv; + usleep_tv.tv_sec = 0; + usleep_tv.tv_usec = 50000; + select(0, 0, 0, 0, &usleep_tv); + } while (timer.elapsed() < timeout); + return false; +} + +void QXlibScreen::eventDispatcher() +{ + ulong marker = XNextRequest(mDisplay); + // int i = 0; + while (XPending(mDisplay)) { + XEvent event; + XNextEvent(mDisplay, &event); + /* done = */ + handleEvent(&event); + + if (event.xany.serial >= marker) { + #ifdef MYX11_DEBUG + qDebug() << "potential livelock averted"; + #endif + #if 0 + if (XEventsQueued(mDisplay, QueuedAfterFlush)) { + qDebug() << " with events queued"; + QTimer::singleShot(0, this, SLOT(eventDispatcher())); + } + #endif + break; + } + } +} + +QImage QXlibScreen::grabWindow(Window window, int x, int y, int w, int h) +{ + if (w == 0 || h ==0) + return QImage(); + + //WinId 0 means the desktop widget + if (!window) + window = rootWindow(); + + XWindowAttributes window_attr; + if (!XGetWindowAttributes(mDisplay, window, &window_attr)) + return QImage(); + + if (w < 0) + w = window_attr.width - x; + if (h < 0) + h = window_attr.height - y; + + // Ideally, we should also limit ourselves to the screen area, but the Qt docs say + // that it's "unsafe" to go outside the screen, so we can ignore that problem. + + //We're definitely not optimizing for speed... + XImage *xi = XGetImage(mDisplay, window, x, y, w, h, AllPlanes, ZPixmap); + + if (!xi) + return QImage(); + + //taking a copy to make sure we have ownership -- not fast + QImage result = QImage( (uchar*) xi->data, xi->width, xi->height, xi->bytes_per_line, QImage::Format_RGB32 ).copy(); + + XDestroyImage(xi); + + return result; +} + +QXlibScreen * QXlibScreen::testLiteScreenForWidget(QWidget *widget) +{ + QPlatformScreen *platformScreen = platformScreenForWidget(widget); + return static_cast<QXlibScreen *>(platformScreen); +} + +Display * QXlibScreen::display() const +{ + return mDisplay; +} + +int QXlibScreen::xScreenNumber() const +{ + return mScreen; +} + +QXlibKeyboard * QXlibScreen::keyboard() const +{ + return mKeyboard; +} + +void QXlibScreen::handleSelectionRequest(XEvent *event) +{ + QPlatformIntegration *integration = QApplicationPrivate::platformIntegration(); + QXlibClipboard *clipboard = static_cast<QXlibClipboard *>(integration->clipboard()); + clipboard->handleSelectionRequest(event); +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/xlib/qtestlitescreen.h b/src/plugins/platforms/xlib/qtestlitescreen.h new file mode 100644 index 0000000..7e59a59 --- /dev/null +++ b/src/plugins/platforms/xlib/qtestlitescreen.h @@ -0,0 +1,104 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTESTLITESCREEN_H +#define QTESTLITESCREEN_H + +#include <QtGui/QPlatformScreen> +#include "qtestliteintegration.h" + +QT_BEGIN_NAMESPACE + +class QXlibCursor; +class QXlibKeyboard; + +class QXlibScreen : public QPlatformScreen +{ + Q_OBJECT +public: + QXlibScreen(); + + ~QXlibScreen(); + + QString displayName() const { return mDisplayName; } + + QRect geometry() const { return mGeometry; } + int depth() const { return mDepth; } + QImage::Format format() const { return mFormat; } + QSize physicalSize() const { return mPhysicalSize; } + + Window rootWindow() { return RootWindow(mDisplay, mScreen); } + unsigned long blackPixel() { return BlackPixel(mDisplay, mScreen); } + unsigned long whitePixel() { return WhitePixel(mDisplay, mScreen); } + + bool handleEvent(XEvent *xe); + bool waitForClipboardEvent(Window win, int type, XEvent *event, int timeout); + + QImage grabWindow(Window window, int x, int y, int w, int h); + + static QXlibScreen *testLiteScreenForWidget(QWidget *widget); + + Display *display() const; + int xScreenNumber() const; + + QXlibKeyboard *keyboard() const; + +public slots: + void eventDispatcher(); + +private: + + void handleSelectionRequest(XEvent *event); + QString mDisplayName; + QRect mGeometry; + QSize mPhysicalSize; + int mDepth; + QImage::Format mFormat; + QXlibCursor *mCursor; + QXlibKeyboard *mKeyboard; + + Display * mDisplay; + int mScreen; +}; + +QT_END_NAMESPACE + +#endif // QTESTLITESCREEN_H diff --git a/src/plugins/platforms/xlib/qtestlitestaticinfo.cpp b/src/plugins/platforms/xlib/qtestlitestaticinfo.cpp new file mode 100644 index 0000000..837636c --- /dev/null +++ b/src/plugins/platforms/xlib/qtestlitestaticinfo.cpp @@ -0,0 +1,511 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qtestlitestaticinfo.h" +#include "qtestlitescreen.h" + +#include <qplatformdefs.h> + +#include <QtGui/private/qapplication_p.h> +#include <QtCore/QBuffer> +#include <QtCore/QLibrary> + +#include <QDebug> + +#ifndef QT_NO_XFIXES +#include <X11/extensions/Xfixes.h> +#endif // QT_NO_XFIXES + +static const char * x11_atomnames = { + // window-manager <-> client protocols + "WM_PROTOCOLS\0" + "WM_DELETE_WINDOW\0" + "WM_TAKE_FOCUS\0" + "_NET_WM_PING\0" + "_NET_WM_CONTEXT_HELP\0" + "_NET_WM_SYNC_REQUEST\0" + "_NET_WM_SYNC_REQUEST_COUNTER\0" + + // ICCCM window state + "WM_STATE\0" + "WM_CHANGE_STATE\0" + + // Session management + "WM_CLIENT_LEADER\0" + "WM_WINDOW_ROLE\0" + "SM_CLIENT_ID\0" + + // Clipboard + "CLIPBOARD\0" + "INCR\0" + "TARGETS\0" + "MULTIPLE\0" + "TIMESTAMP\0" + "SAVE_TARGETS\0" + "CLIP_TEMPORARY\0" + "_QT_SELECTION\0" + "_QT_CLIPBOARD_SENTINEL\0" + "_QT_SELECTION_SENTINEL\0" + "CLIPBOARD_MANAGER\0" + + "RESOURCE_MANAGER\0" + + "_XSETROOT_ID\0" + + "_QT_SCROLL_DONE\0" + "_QT_INPUT_ENCODING\0" + + "_MOTIF_WM_HINTS\0" + + "DTWM_IS_RUNNING\0" + "ENLIGHTENMENT_DESKTOP\0" + "_DT_SAVE_MODE\0" + "_SGI_DESKS_MANAGER\0" + + // EWMH (aka NETWM) + "_NET_SUPPORTED\0" + "_NET_VIRTUAL_ROOTS\0" + "_NET_WORKAREA\0" + + "_NET_MOVERESIZE_WINDOW\0" + "_NET_WM_MOVERESIZE\0" + + "_NET_WM_NAME\0" + "_NET_WM_ICON_NAME\0" + "_NET_WM_ICON\0" + + "_NET_WM_PID\0" + + "_NET_WM_WINDOW_OPACITY\0" + + "_NET_WM_STATE\0" + "_NET_WM_STATE_ABOVE\0" + "_NET_WM_STATE_BELOW\0" + "_NET_WM_STATE_FULLSCREEN\0" + "_NET_WM_STATE_MAXIMIZED_HORZ\0" + "_NET_WM_STATE_MAXIMIZED_VERT\0" + "_NET_WM_STATE_MODAL\0" + "_NET_WM_STATE_STAYS_ON_TOP\0" + "_NET_WM_STATE_DEMANDS_ATTENTION\0" + + "_NET_WM_USER_TIME\0" + "_NET_WM_USER_TIME_WINDOW\0" + "_NET_WM_FULL_PLACEMENT\0" + + "_NET_WM_WINDOW_TYPE\0" + "_NET_WM_WINDOW_TYPE_DESKTOP\0" + "_NET_WM_WINDOW_TYPE_DOCK\0" + "_NET_WM_WINDOW_TYPE_TOOLBAR\0" + "_NET_WM_WINDOW_TYPE_MENU\0" + "_NET_WM_WINDOW_TYPE_UTILITY\0" + "_NET_WM_WINDOW_TYPE_SPLASH\0" + "_NET_WM_WINDOW_TYPE_DIALOG\0" + "_NET_WM_WINDOW_TYPE_DROPDOWN_MENU\0" + "_NET_WM_WINDOW_TYPE_POPUP_MENU\0" + "_NET_WM_WINDOW_TYPE_TOOLTIP\0" + "_NET_WM_WINDOW_TYPE_NOTIFICATION\0" + "_NET_WM_WINDOW_TYPE_COMBO\0" + "_NET_WM_WINDOW_TYPE_DND\0" + "_NET_WM_WINDOW_TYPE_NORMAL\0" + "_KDE_NET_WM_WINDOW_TYPE_OVERRIDE\0" + + "_KDE_NET_WM_FRAME_STRUT\0" + + "_NET_STARTUP_INFO\0" + "_NET_STARTUP_INFO_BEGIN\0" + + "_NET_SUPPORTING_WM_CHECK\0" + + "_NET_WM_CM_S0\0" + + "_NET_SYSTEM_TRAY_VISUAL\0" + + "_NET_ACTIVE_WINDOW\0" + + // Property formats + "COMPOUND_TEXT\0" + "TEXT\0" + "UTF8_STRING\0" + + // xdnd + "XdndEnter\0" + "XdndPosition\0" + "XdndStatus\0" + "XdndLeave\0" + "XdndDrop\0" + "XdndFinished\0" + "XdndTypeList\0" + "XdndActionList\0" + + "XdndSelection\0" + + "XdndAware\0" + "XdndProxy\0" + + "XdndActionCopy\0" + "XdndActionLink\0" + "XdndActionMove\0" + "XdndActionPrivate\0" + + // Motif DND + "_MOTIF_DRAG_AND_DROP_MESSAGE\0" + "_MOTIF_DRAG_INITIATOR_INFO\0" + "_MOTIF_DRAG_RECEIVER_INFO\0" + "_MOTIF_DRAG_WINDOW\0" + "_MOTIF_DRAG_TARGETS\0" + + "XmTRANSFER_SUCCESS\0" + "XmTRANSFER_FAILURE\0" + + // Xkb + "_XKB_RULES_NAMES\0" + + // XEMBED + "_XEMBED\0" + "_XEMBED_INFO\0" + + // Wacom old. (before version 0.10) + "Wacom Stylus\0" + "Wacom Cursor\0" + "Wacom Eraser\0" + + // Tablet + "STYLUS\0" + "ERASER\0" +}; + +/*! + \internal + Try to resolve a \a symbol from \a library with the version specified + by \a vernum. + + Note that, in the case of the Xfixes library, \a vernum is not the same as + \c XFIXES_MAJOR - it is a part of soname and may differ from the Xfixes + version. +*/ +static void* qt_load_library_runtime(const char *library, int vernum, + int highestVernum, const char *symbol) +{ + QList<int> versions; + // we try to load in the following order: + // explicit version -> the default one -> (from the highest (highestVernum) to the lowest (vernum) ) + if (vernum != -1) + versions << vernum; + versions << -1; + if (vernum != -1) { + for(int i = highestVernum; i > vernum; --i) + versions << i; + } + Q_FOREACH(int version, versions) { + QLatin1String libName(library); + QLibrary xfixesLib(libName, version); + void *ptr = xfixesLib.resolve(symbol); + if (ptr) + return ptr; + } + return 0; +} + +# define XFIXES_LOAD_RUNTIME(vernum, symbol, symbol_type) \ + (symbol_type)qt_load_library_runtime("libXfixes", vernum, 4, #symbol); +# define XFIXES_LOAD_V1(symbol) \ + XFIXES_LOAD_RUNTIME(1, symbol, Ptr##symbol) +# define XFIXES_LOAD_V2(symbol) \ + XFIXES_LOAD_RUNTIME(2, symbol, Ptr##symbol) + + +class QTestLiteStaticInfoPrivate +{ +public: + QTestLiteStaticInfoPrivate() + : use_xfixes(false) + , xfixes_major(0) + , xfixes_eventbase(0) + , xfixes_errorbase(0) + { + QXlibScreen *screen = qobject_cast<QXlibScreen *> (QApplicationPrivate::platformIntegration()->screens().at(0)); + Q_ASSERT(screen); + + initializeAllAtoms(screen); + initializeSupportedAtoms(screen); + + resolveXFixes(screen); + } + + bool isSupportedByWM(Atom atom) + { + if (!m_supportedAtoms) + return false; + + bool supported = false; + int i = 0; + while (m_supportedAtoms[i] != 0) { + if (m_supportedAtoms[i++] == atom) { + supported = true; + break; + } + } + + return supported; + } + + Atom atom(QXlibStatic::X11Atom atom) + { + return m_allAtoms[atom]; + } + + bool useXFixes() const { return use_xfixes; } + + int xFixesEventBase() const {return xfixes_eventbase; } + + PtrXFixesSelectSelectionInput xFixesSelectSelectionInput() const + { + return ptrXFixesSelectSelectionInput; + } + + QImage qimageFromXImage(XImage *xi) + { + QImage::Format format = QImage::Format_ARGB32_Premultiplied; + if (xi->depth == 24) + format = QImage::Format_RGB32; + else if (xi->depth == 16) + format = QImage::Format_RGB16; + + QImage image = QImage((uchar *)xi->data, xi->width, xi->height, xi->bytes_per_line, format).copy(); + + // we may have to swap the byte order + if ((QSysInfo::ByteOrder == QSysInfo::LittleEndian && xi->byte_order == MSBFirst) + || (QSysInfo::ByteOrder == QSysInfo::BigEndian && xi->byte_order == LSBFirst)) + { + for (int i=0; i < image.height(); i++) { + if (xi->depth == 16) { + ushort *p = (ushort*)image.scanLine(i); + ushort *end = p + image.width(); + while (p < end) { + *p = ((*p << 8) & 0xff00) | ((*p >> 8) & 0x00ff); + p++; + } + } else { + uint *p = (uint*)image.scanLine(i); + uint *end = p + image.width(); + while (p < end) { + *p = ((*p << 24) & 0xff000000) | ((*p << 8) & 0x00ff0000) + | ((*p >> 8) & 0x0000ff00) | ((*p >> 24) & 0x000000ff); + p++; + } + } + } + } + + // fix-up alpha channel + if (format == QImage::Format_RGB32) { + QRgb *p = (QRgb *)image.bits(); + for (int y = 0; y < xi->height; ++y) { + for (int x = 0; x < xi->width; ++x) + p[x] |= 0xff000000; + p += xi->bytes_per_line / 4; + } + } + + return image; + } + + +private: + + void initializeAllAtoms(QXlibScreen *screen) { + const char *names[QXlibStatic::NAtoms]; + const char *ptr = x11_atomnames; + + int i = 0; + while (*ptr) { + names[i++] = ptr; + while (*ptr) + ++ptr; + ++ptr; + } + + Q_ASSERT(i == QXlibStatic::NPredefinedAtoms); + + QByteArray settings_atom_name("_QT_SETTINGS_TIMESTAMP_"); + settings_atom_name += XDisplayName(qPrintable(screen->displayName())); + names[i++] = settings_atom_name; + + Q_ASSERT(i == QXlibStatic::NAtoms); + #if 0//defined(XlibSpecificationRelease) && (XlibSpecificationRelease >= 6) + XInternAtoms(screen->display(), (char **)names, i, False, m_allAtoms); + #else + for (i = 0; i < QXlibStatic::NAtoms; ++i) + m_allAtoms[i] = XInternAtom(screen->display(), (char *)names[i], False); + #endif + } + + void initializeSupportedAtoms(QXlibScreen *screen) + { + Atom type; + int format; + long offset = 0; + unsigned long nitems, after; + unsigned char *data = 0; + + int e = XGetWindowProperty(screen->display(), screen->rootWindow(), + this->atom(QXlibStatic::_NET_SUPPORTED), 0, 0, + False, XA_ATOM, &type, &format, &nitems, &after, &data); + if (data) + XFree(data); + + if (e == Success && type == XA_ATOM && format == 32) { + QBuffer ts; + ts.open(QIODevice::WriteOnly); + + while (after > 0) { + XGetWindowProperty(screen->display(), screen->rootWindow(), + this->atom(QXlibStatic::_NET_SUPPORTED), offset, 1024, + False, XA_ATOM, &type, &format, &nitems, &after, &data); + + if (type == XA_ATOM && format == 32) { + ts.write(reinterpret_cast<char *>(data), nitems * sizeof(long)); + offset += nitems; + } else + after = 0; + if (data) + XFree(data); + } + + // compute nitems + QByteArray buffer(ts.buffer()); + nitems = buffer.size() / sizeof(Atom); + m_supportedAtoms = new Atom[nitems + 1]; + Atom *a = (Atom *) buffer.data(); + uint i; + for (i = 0; i < nitems; i++) + m_supportedAtoms[i] = a[i]; + m_supportedAtoms[nitems] = 0; + + } + } + + void resolveXFixes(QXlibScreen *screen) + { +#ifndef QT_NO_XFIXES + // See if Xfixes is supported on the connected display + if (XQueryExtension(screen->display(), "XFIXES", &xfixes_major, + &xfixes_eventbase, &xfixes_errorbase)) { + ptrXFixesQueryExtension = XFIXES_LOAD_V1(XFixesQueryExtension); + ptrXFixesQueryVersion = XFIXES_LOAD_V1(XFixesQueryVersion); + ptrXFixesSetCursorName = XFIXES_LOAD_V2(XFixesSetCursorName); + ptrXFixesSelectSelectionInput = XFIXES_LOAD_V2(XFixesSelectSelectionInput); + + if(ptrXFixesQueryExtension && ptrXFixesQueryVersion + && ptrXFixesQueryExtension(screen->display(), &xfixes_eventbase, + &xfixes_errorbase)) { + // Xfixes is supported. + // Note: the XFixes protocol version is negotiated using QueryVersion. + // We supply the highest version we support, the X server replies with + // the highest version it supports, but no higher than the version we + // asked for. The version sent back is the protocol version the X server + // will use to talk us. If this call is removed, the behavior of the + // X server when it receives an XFixes request is undefined. + int major = 3; + int minor = 0; + ptrXFixesQueryVersion(screen->display(), &major, &minor); + use_xfixes = (major >= 1); + xfixes_major = major; + } + } +#endif // QT_NO_XFIXES + + } + + Atom *m_supportedAtoms; + Atom m_allAtoms[QXlibStatic::NAtoms]; + +#ifndef QT_NO_XFIXES + PtrXFixesQueryExtension ptrXFixesQueryExtension; + PtrXFixesQueryVersion ptrXFixesQueryVersion; + PtrXFixesSetCursorName ptrXFixesSetCursorName; + PtrXFixesSelectSelectionInput ptrXFixesSelectSelectionInput; +#endif + + bool use_xfixes; + int xfixes_major; + int xfixes_eventbase; + int xfixes_errorbase; + +}; +Q_GLOBAL_STATIC(QTestLiteStaticInfoPrivate, qTestLiteStaticInfoPrivate); + + +Atom QXlibStatic::atom(QXlibStatic::X11Atom atom) +{ + return qTestLiteStaticInfoPrivate()->atom(atom); +} + +bool QXlibStatic::isSupportedByWM(Atom atom) +{ + return qTestLiteStaticInfoPrivate()->isSupportedByWM(atom); +} + +bool QXlibStatic::useXFixes() +{ + return qTestLiteStaticInfoPrivate()->useXFixes(); +} + +int QXlibStatic::xFixesEventBase() +{ + return qTestLiteStaticInfoPrivate()->xFixesEventBase(); +} + +#ifndef QT_NO_XFIXES +PtrXFixesSelectSelectionInput QXlibStatic::xFixesSelectSelectionInput() +{ + qDebug() << qTestLiteStaticInfoPrivate()->useXFixes(); + if (!qTestLiteStaticInfoPrivate()->useXFixes()) + return 0; + + return qTestLiteStaticInfoPrivate()->xFixesSelectSelectionInput(); +} + +QImage QXlibStatic::qimageFromXImage(XImage *xi) +{ + return qTestLiteStaticInfoPrivate()->qimageFromXImage(xi); +} +#endif //QT_NO_XFIXES diff --git a/src/plugins/platforms/xlib/qtestlitestaticinfo.h b/src/plugins/platforms/xlib/qtestlitestaticinfo.h new file mode 100644 index 0000000..8473ee9 --- /dev/null +++ b/src/plugins/platforms/xlib/qtestlitestaticinfo.h @@ -0,0 +1,413 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTESTLITESTATICINFO_H +#define QTESTLITESTATICINFO_H + +#include <QtCore/QTextStream> +#include <QtCore/QDataStream> +#include <QtCore/QMetaType> +#include <QtCore/QVariant> + +#if defined(_XLIB_H_) // crude hack, but... +#error "cannot include <X11/Xlib.h> before this file" +#endif +#define XRegisterIMInstantiateCallback qt_XRegisterIMInstantiateCallback +#define XUnregisterIMInstantiateCallback qt_XUnregisterIMInstantiateCallback +#define XSetIMValues qt_XSetIMValues +#include <X11/Xlib.h> +#undef XRegisterIMInstantiateCallback +#undef XUnregisterIMInstantiateCallback +#undef XSetIMValues + +#include <X11/Xutil.h> +#include <X11/Xos.h> +#ifdef index +# undef index +#endif +#ifdef rindex +# undef rindex +#endif +#ifdef Q_OS_VXWORS +# ifdef open +# undef open +# endif +# ifdef getpid +# undef getpid +# endif +#endif // Q_OS_VXWORKS +#include <X11/Xatom.h> + +//#define QT_NO_SHAPE +#ifdef QT_NO_SHAPE +# define XShapeCombineRegion(a,b,c,d,e,f,g) +# define XShapeCombineMask(a,b,c,d,e,f,g) +#else +# include <X11/extensions/shape.h> +#endif // QT_NO_SHAPE + + +#if !defined (QT_NO_TABLET) +# include <X11/extensions/XInput.h> +#if defined (Q_OS_IRIX) +# include <X11/extensions/SGIMisc.h> +# include <wacom.h> +#endif +#endif // QT_NO_TABLET + + +// #define QT_NO_XINERAMA +#ifndef QT_NO_XINERAMA +// XFree86 does not C++ify Xinerama (at least up to XFree86 4.0.3). +extern "C" { +# include <X11/extensions/Xinerama.h> +} +#endif // QT_NO_XINERAMA + +// #define QT_NO_XRANDR +#ifndef QT_NO_XRANDR +# include <X11/extensions/Xrandr.h> +#endif // QT_NO_XRANDR + +// #define QT_NO_XRENDER +#ifndef QT_NO_XRENDER +# include <X11/extensions/Xrender.h> +#endif // QT_NO_XRENDER + +#ifndef QT_NO_XSYNC +extern "C" { +# include "X11/extensions/sync.h" +} +#endif + +// #define QT_NO_XKB +#ifndef QT_NO_XKB +# include <X11/XKBlib.h> +#endif // QT_NO_XKB + + +#if !defined(XlibSpecificationRelease) +# define X11R4 +typedef char *XPointer; +#else +# undef X11R4 +#endif + +#ifndef QT_NO_XFIXES +typedef Bool (*PtrXFixesQueryExtension)(Display *, int *, int *); +typedef Status (*PtrXFixesQueryVersion)(Display *, int *, int *); +typedef void (*PtrXFixesSetCursorName)(Display *dpy, Cursor cursor, const char *name); +typedef void (*PtrXFixesSelectSelectionInput)(Display *dpy, Window win, Atom selection, unsigned long eventMask); +#endif // QT_NO_XFIXES + +#ifndef QT_NO_XCURSOR +#include <X11/Xcursor/Xcursor.h> +typedef Cursor (*PtrXcursorLibraryLoadCursor)(Display *, const char *); +#endif // QT_NO_XCURSOR + +#ifndef QT_NO_XINERAMA +typedef Bool (*PtrXineramaQueryExtension)(Display *dpy, int *event_base, int *error_base); +typedef Bool (*PtrXineramaIsActive)(Display *dpy); +typedef XineramaScreenInfo *(*PtrXineramaQueryScreens)(Display *dpy, int *number); +#endif // QT_NO_XINERAMA + +#ifndef QT_NO_XRANDR +typedef void (*PtrXRRSelectInput)(Display *, Window, int); +typedef int (*PtrXRRUpdateConfiguration)(XEvent *); +typedef int (*PtrXRRRootToScreen)(Display *, Window); +typedef Bool (*PtrXRRQueryExtension)(Display *, int *, int *); +#endif // QT_NO_XRANDR + +#ifndef QT_NO_XINPUT +typedef int (*PtrXCloseDevice)(Display *, XDevice *); +typedef XDeviceInfo* (*PtrXListInputDevices)(Display *, int *); +typedef XDevice* (*PtrXOpenDevice)(Display *, XID); +typedef void (*PtrXFreeDeviceList)(XDeviceInfo *); +typedef int (*PtrXSelectExtensionEvent)(Display *, Window, XEventClass *, int); +#endif // QT_NO_XINPUT + +/* + * Solaris patch 108652-47 and higher fixes crases in + * XRegisterIMInstantiateCallback, but the function doesn't seem to + * work. + * + * Instead, we disabled R6 input, and open the input method + * immediately at application start. + */ + +//######### XFree86 has wrong declarations for XRegisterIMInstantiateCallback +//######### and XUnregisterIMInstantiateCallback in at least version 3.3.2. +//######### Many old X11R6 header files lack XSetIMValues. +//######### Therefore, we have to declare these functions ourselves. + +extern "C" Bool XRegisterIMInstantiateCallback( + Display*, + struct _XrmHashBucketRec*, + char*, + char*, + XIMProc, //XFree86 has XIDProc, which has to be wrong + XPointer +); + +extern "C" Bool XUnregisterIMInstantiateCallback( + Display*, + struct _XrmHashBucketRec*, + char*, + char*, + XIMProc, //XFree86 has XIDProc, which has to be wrong + XPointer +); + +#ifndef X11R4 +# include <X11/Xlocale.h> +#endif // X11R4 + + +#ifndef QT_NO_MITSHM +# include <X11/extensions/XShm.h> +#endif // QT_NO_MITSHM + +// rename a couple of X defines to get rid of name clashes +// resolve the conflict between X11's FocusIn and QEvent::FocusIn +enum { + XFocusOut = FocusOut, + XFocusIn = FocusIn, + XKeyPress = KeyPress, + XKeyRelease = KeyRelease, + XNone = None, + XRevertToParent = RevertToParent, + XGrayScale = GrayScale, + XCursorShape = CursorShape +}; +#undef FocusOut +#undef FocusIn +#undef KeyPress +#undef KeyRelease +#undef None +#undef RevertToParent +#undef GrayScale +#undef CursorShape + +#ifdef FontChange +#undef FontChange +#endif + + +class QXlibStatic +{ +public: + enum X11Atom { + // window-manager <-> client protocols + WM_PROTOCOLS, + WM_DELETE_WINDOW, + WM_TAKE_FOCUS, + _NET_WM_PING, + _NET_WM_CONTEXT_HELP, + _NET_WM_SYNC_REQUEST, + _NET_WM_SYNC_REQUEST_COUNTER, + + // ICCCM window state + WM_STATE, + WM_CHANGE_STATE, + + // Session management + WM_CLIENT_LEADER, + WM_WINDOW_ROLE, + SM_CLIENT_ID, + + // Clipboard + CLIPBOARD, + INCR, + TARGETS, + MULTIPLE, + TIMESTAMP, + SAVE_TARGETS, + CLIP_TEMPORARY, + _QT_SELECTION, + _QT_CLIPBOARD_SENTINEL, + _QT_SELECTION_SENTINEL, + CLIPBOARD_MANAGER, + + RESOURCE_MANAGER, + + _XSETROOT_ID, + + _QT_SCROLL_DONE, + _QT_INPUT_ENCODING, + + _MOTIF_WM_HINTS, + + DTWM_IS_RUNNING, + ENLIGHTENMENT_DESKTOP, + _DT_SAVE_MODE, + _SGI_DESKS_MANAGER, + + // EWMH (aka NETWM) + _NET_SUPPORTED, + _NET_VIRTUAL_ROOTS, + _NET_WORKAREA, + + _NET_MOVERESIZE_WINDOW, + _NET_WM_MOVERESIZE, + + _NET_WM_NAME, + _NET_WM_ICON_NAME, + _NET_WM_ICON, + + _NET_WM_PID, + + _NET_WM_WINDOW_OPACITY, + + _NET_WM_STATE, + _NET_WM_STATE_ABOVE, + _NET_WM_STATE_BELOW, + _NET_WM_STATE_FULLSCREEN, + _NET_WM_STATE_MAXIMIZED_HORZ, + _NET_WM_STATE_MAXIMIZED_VERT, + _NET_WM_STATE_MODAL, + _NET_WM_STATE_STAYS_ON_TOP, + _NET_WM_STATE_DEMANDS_ATTENTION, + + _NET_WM_USER_TIME, + _NET_WM_USER_TIME_WINDOW, + _NET_WM_FULL_PLACEMENT, + + _NET_WM_WINDOW_TYPE, + _NET_WM_WINDOW_TYPE_DESKTOP, + _NET_WM_WINDOW_TYPE_DOCK, + _NET_WM_WINDOW_TYPE_TOOLBAR, + _NET_WM_WINDOW_TYPE_MENU, + _NET_WM_WINDOW_TYPE_UTILITY, + _NET_WM_WINDOW_TYPE_SPLASH, + _NET_WM_WINDOW_TYPE_DIALOG, + _NET_WM_WINDOW_TYPE_DROPDOWN_MENU, + _NET_WM_WINDOW_TYPE_POPUP_MENU, + _NET_WM_WINDOW_TYPE_TOOLTIP, + _NET_WM_WINDOW_TYPE_NOTIFICATION, + _NET_WM_WINDOW_TYPE_COMBO, + _NET_WM_WINDOW_TYPE_DND, + _NET_WM_WINDOW_TYPE_NORMAL, + _KDE_NET_WM_WINDOW_TYPE_OVERRIDE, + + _KDE_NET_WM_FRAME_STRUT, + + _NET_STARTUP_INFO, + _NET_STARTUP_INFO_BEGIN, + + _NET_SUPPORTING_WM_CHECK, + + _NET_WM_CM_S0, + + _NET_SYSTEM_TRAY_VISUAL, + + _NET_ACTIVE_WINDOW, + + // Property formats + COMPOUND_TEXT, + TEXT, + UTF8_STRING, + + // Xdnd + XdndEnter, + XdndPosition, + XdndStatus, + XdndLeave, + XdndDrop, + XdndFinished, + XdndTypelist, + XdndActionList, + + XdndSelection, + + XdndAware, + XdndProxy, + + XdndActionCopy, + XdndActionLink, + XdndActionMove, + XdndActionPrivate, + + // Motif DND + _MOTIF_DRAG_AND_DROP_MESSAGE, + _MOTIF_DRAG_INITIATOR_INFO, + _MOTIF_DRAG_RECEIVER_INFO, + _MOTIF_DRAG_WINDOW, + _MOTIF_DRAG_TARGETS, + + XmTRANSFER_SUCCESS, + XmTRANSFER_FAILURE, + + // Xkb + _XKB_RULES_NAMES, + + // XEMBED + _XEMBED, + _XEMBED_INFO, + + XWacomStylus, + XWacomCursor, + XWacomEraser, + + XTabletStylus, + XTabletEraser, + + NPredefinedAtoms, + + _QT_SETTINGS_TIMESTAMP = NPredefinedAtoms, + NAtoms + }; + + static Atom atom(X11Atom atom); + static bool isSupportedByWM(Atom atom); + + static bool useXFixes(); + static int xFixesEventBase(); + + #ifndef QT_NO_XFIXES + static PtrXFixesSelectSelectionInput xFixesSelectSelectionInput(); + #endif //QT_NO_XFIXES + + static QImage qimageFromXImage(XImage *xi); + + +}; + +#endif // QTESTLITESTATICINFO_H diff --git a/src/plugins/platforms/xlib/qtestlitewindow.cpp b/src/plugins/platforms/xlib/qtestlitewindow.cpp new file mode 100644 index 0000000..0f11a81 --- /dev/null +++ b/src/plugins/platforms/xlib/qtestlitewindow.cpp @@ -0,0 +1,735 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qtestlitewindow.h" + +#include "qtestliteintegration.h" +#include "qtestlitescreen.h" +#include "qtestlitekeyboard.h" +#include "qtestlitestaticinfo.h" + +#include <QtGui/QWindowSystemInterface> +#include <QSocketNotifier> +#include <QApplication> +#include <QDebug> + +#include <QtGui/private/qwindowsurface_p.h> +#include <QtGui/private/qapplication_p.h> + +#if !defined(QT_NO_OPENGL) +#if !defined(QT_OPENGL_ES_2) +#include "qglxintegration.h" +#else +#include "../eglconvenience/qeglconvenience.h" +#include "../eglconvenience/qeglplatformcontext.h" +#include "qtestliteeglintegration.h" +#endif //QT_OPENGL_ES_2 +#endif //QT_NO_OPENGL + +//#define MYX11_DEBUG + +QT_BEGIN_NAMESPACE + +QXlibWindow::QXlibWindow(QWidget *window) + : QPlatformWindow(window) + , mGLContext(0) + , mScreen(QXlibScreen::testLiteScreenForWidget(window)) +{ + int x = window->x(); + int y = window->y(); + int w = window->width(); + int h = window->height(); + + if(window->platformWindowFormat().windowApi() == QPlatformWindowFormat::OpenGL + && QApplicationPrivate::platformIntegration()->hasOpenGL() ) { +#if !defined(QT_NO_OPENGL) +#if !defined(QT_OPENGL_ES_2) + XVisualInfo *visualInfo = QGLXContext::findVisualInfo(mScreen,window->platformWindowFormat()); +#else + QPlatformWindowFormat windowFormat = correctColorBuffers(window->platformWindowFormat()); + + EGLDisplay eglDisplay = eglGetDisplay(mScreen->display()); + EGLConfig eglConfig = q_configFromQPlatformWindowFormat(eglDisplay,windowFormat); + VisualID id = QXlibEglIntegration::getCompatibleVisualId(mScreen->display(),eglConfig); + + XVisualInfo visualInfoTemplate; + memset(&visualInfoTemplate, 0, sizeof(XVisualInfo)); + visualInfoTemplate.visualid = id; + + XVisualInfo *visualInfo; + int matchingCount = 0; + visualInfo = XGetVisualInfo(mScreen->display(), VisualIDMask, &visualInfoTemplate, &matchingCount); +#endif //!defined(QT_OPENGL_ES_2) + if (visualInfo) { + Colormap cmap = XCreateColormap(mScreen->display(),mScreen->rootWindow(),visualInfo->visual,AllocNone); + + XSetWindowAttributes a; + a.colormap = cmap; + x_window = XCreateWindow(mScreen->display(), mScreen->rootWindow(),x, y, w, h, + 0, visualInfo->depth, InputOutput, visualInfo->visual, + CWColormap, &a); + } else { + qFatal("no window!"); + } +#endif //!defined(QT_NO_OPENGL) + } else { + x_window = XCreateSimpleWindow(mScreen->display(), mScreen->rootWindow(), + x, y, w, h, 0 /*border_width*/, + mScreen->blackPixel(), mScreen->whitePixel()); + } + +#ifdef MYX11_DEBUG + qDebug() << "QTestLiteWindow::QTestLiteWindow creating" << hex << x_window << window; +#endif + + XSetWindowBackgroundPixmap(mScreen->display(), x_window, XNone); + + XSelectInput(mScreen->display(), x_window, + ExposureMask | KeyPressMask | KeyReleaseMask | + EnterWindowMask | LeaveWindowMask | FocusChangeMask | + PointerMotionMask | ButtonPressMask | ButtonReleaseMask | + ButtonMotionMask | PropertyChangeMask | + StructureNotifyMask); + + gc = createGC(); + + Atom protocols[5]; + int n = 0; + protocols[n++] = QXlibStatic::atom(QXlibStatic::WM_DELETE_WINDOW); // support del window protocol + protocols[n++] = QXlibStatic::atom(QXlibStatic::WM_TAKE_FOCUS); // support take focus window protocol + protocols[n++] = QXlibStatic::atom(QXlibStatic::_NET_WM_PING); // support _NET_WM_PING protocol +#ifndef QT_NO_XSYNC + protocols[n++] = QXlibStatic::atom(QXlibStatic::_NET_WM_SYNC_REQUEST); // support _NET_WM_SYNC_REQUEST protocol +#endif // QT_NO_XSYNC + if (window->windowFlags() & Qt::WindowContextHelpButtonHint) + protocols[n++] = QXlibStatic::atom(QXlibStatic::_NET_WM_CONTEXT_HELP); + XSetWMProtocols(mScreen->display(), x_window, protocols, n); +} + + + +QXlibWindow::~QXlibWindow() +{ +#ifdef MYX11_DEBUG + qDebug() << "~QTestLiteWindow" << hex << x_window; +#endif + delete mGLContext; + XFreeGC(mScreen->display(), gc); + XDestroyWindow(mScreen->display(), x_window); +} + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Mouse event stuff +static Qt::MouseButtons translateMouseButtons(int s) +{ + Qt::MouseButtons ret = 0; + if (s & Button1Mask) + ret |= Qt::LeftButton; + if (s & Button2Mask) + ret |= Qt::MidButton; + if (s & Button3Mask) + ret |= Qt::RightButton; + return ret; +} + + + +void QXlibWindow::handleMouseEvent(QEvent::Type type, XButtonEvent *e) +{ + static QPoint mousePoint; + + Qt::MouseButton button = Qt::NoButton; + Qt::MouseButtons buttons = translateMouseButtons(e->state); + Qt::KeyboardModifiers modifiers = mScreen->keyboard()->translateModifiers(e->state); + if (type != QEvent::MouseMove) { + switch (e->button) { + case Button1: button = Qt::LeftButton; break; + case Button2: button = Qt::MidButton; break; + case Button3: button = Qt::RightButton; break; + case Button4: + case Button5: + case 6: + case 7: { + //mouse wheel + if (type == QEvent::MouseButtonPress) { + //logic borrowed from qapplication_x11.cpp + int delta = 120 * ((e->button == Button4 || e->button == 6) ? 1 : -1); + bool hor = (((e->button == Button4 || e->button == Button5) + && (modifiers & Qt::AltModifier)) + || (e->button == 6 || e->button == 7)); + QWindowSystemInterface::handleWheelEvent(widget(), e->time, + QPoint(e->x, e->y), + QPoint(e->x_root, e->y_root), + delta, hor ? Qt::Horizontal : Qt::Vertical); + } + return; + } + default: break; + } + } + + buttons ^= button; // X event uses state *before*, Qt uses state *after* + + QWindowSystemInterface::handleMouseEvent(widget(), e->time, QPoint(e->x, e->y), + QPoint(e->x_root, e->y_root), + buttons); + + mousePoint = QPoint(e->x_root, e->y_root); +} + +void QXlibWindow::handleCloseEvent() +{ + QWindowSystemInterface::handleCloseEvent(widget()); +} + + +void QXlibWindow::handleEnterEvent() +{ + QWindowSystemInterface::handleEnterEvent(widget()); +} + +void QXlibWindow::handleLeaveEvent() +{ + QWindowSystemInterface::handleLeaveEvent(widget()); +} + +void QXlibWindow::handleFocusInEvent() +{ + QWindowSystemInterface::handleWindowActivated(widget()); +} + +void QXlibWindow::handleFocusOutEvent() +{ + QWindowSystemInterface::handleWindowActivated(0); +} + + + +void QXlibWindow::setGeometry(const QRect &rect) +{ + XMoveResizeWindow(mScreen->display(), x_window, rect.x(), rect.y(), rect.width(), rect.height()); + QPlatformWindow::setGeometry(rect); +} + + +Qt::WindowFlags QXlibWindow::windowFlags() const +{ + return mWindowFlags; +} + +WId QXlibWindow::winId() const +{ + return x_window; +} + +void QXlibWindow::setParent(const QPlatformWindow *window) +{ + QPoint topLeft = geometry().topLeft(); + XReparentWindow(mScreen->display(),x_window,window->winId(),topLeft.x(),topLeft.y()); +} + +void QXlibWindow::raise() +{ + XRaiseWindow(mScreen->display(), x_window); +} + +void QXlibWindow::lower() +{ + XLowerWindow(mScreen->display(), x_window); +} + +void QXlibWindow::setWindowTitle(const QString &title) +{ + QByteArray ba = title.toLatin1(); //We're not making a general solution here... + XTextProperty windowName; + windowName.value = (unsigned char *)ba.constData(); + windowName.encoding = XA_STRING; + windowName.format = 8; + windowName.nitems = ba.length(); + + XSetWMName(mScreen->display(), x_window, &windowName); +} + +GC QXlibWindow::createGC() +{ + GC gc; + + gc = XCreateGC(mScreen->display(), x_window, 0, 0); + if (gc < 0) { + qWarning("QTestLiteWindow::createGC() could not create GC"); + } + return gc; +} + +void QXlibWindow::paintEvent() +{ +#ifdef MYX11_DEBUG +// qDebug() << "QTestLiteWindow::paintEvent" << shm_img.size() << painted; +#endif + + if (QWindowSurface *surface = widget()->windowSurface()) + surface->flush(widget(), widget()->geometry(), QPoint()); +} + +void QXlibWindow::requestActivateWindow() +{ + XSetInputFocus(mScreen->display(), x_window, XRevertToParent, CurrentTime); +} + +void QXlibWindow::resizeEvent(XConfigureEvent *e) +{ + int xpos = geometry().x(); + int ypos = geometry().y(); + if ((e->width != geometry().width() || e->height != geometry().height()) && e->x == 0 && e->y == 0) { + //qDebug() << "resize with bogus pos" << e->x << e->y << e->width << e->height << "window"<< hex << window; + } else { + //qDebug() << "geometry change" << e->x << e->y << e->width << e->height << "window"<< hex << window; + xpos = e->x; + ypos = e->y; + } +#ifdef MYX11_DEBUG + qDebug() << hex << x_window << dec << "ConfigureNotify" << e->x << e->y << e->width << e->height << "geometry" << xpos << ypos << width << height; +#endif + + QRect newRect(xpos, ypos, e->width, e->height); + QWindowSystemInterface::handleGeometryChange(widget(), newRect); +} + +void QXlibWindow::mousePressEvent(XButtonEvent *e) +{ + static long prevTime = 0; + static Window prevWindow; + static int prevX = -999; + static int prevY = -999; + + QEvent::Type type = QEvent::MouseButtonPress; + + if (e->window == prevWindow && long(e->time) - prevTime < QApplication::doubleClickInterval() + && qAbs(e->x - prevX) < 5 && qAbs(e->y - prevY) < 5) { + type = QEvent::MouseButtonDblClick; + prevTime = e->time - QApplication::doubleClickInterval(); //no double click next time + } else { + prevTime = e->time; + } + prevWindow = e->window; + prevX = e->x; + prevY = e->y; + + handleMouseEvent(type, e); +} + +QXlibMWMHints QXlibWindow::getMWMHints() const +{ + QXlibMWMHints mwmhints; + + Atom type; + int format; + ulong nitems, bytesLeft; + uchar *data = 0; + Atom atomForMotifWmHints = QXlibStatic::atom(QXlibStatic::_MOTIF_WM_HINTS); + if ((XGetWindowProperty(mScreen->display(), x_window, atomForMotifWmHints, 0, 5, false, + atomForMotifWmHints, &type, &format, &nitems, &bytesLeft, + &data) == Success) + && (type == atomForMotifWmHints + && format == 32 + && nitems >= 5)) { + mwmhints = *(reinterpret_cast<QXlibMWMHints *>(data)); + } else { + mwmhints.flags = 0L; + mwmhints.functions = MWM_FUNC_ALL; + mwmhints.decorations = MWM_DECOR_ALL; + mwmhints.input_mode = 0L; + mwmhints.status = 0L; + } + + if (data) + XFree(data); + + return mwmhints; +} + +void QXlibWindow::setMWMHints(const QXlibMWMHints &mwmhints) +{ + Atom atomForMotifWmHints = QXlibStatic::atom(QXlibStatic::_MOTIF_WM_HINTS); + if (mwmhints.flags != 0l) { + XChangeProperty(mScreen->display(), x_window, + atomForMotifWmHints, atomForMotifWmHints, 32, + PropModeReplace, (unsigned char *) &mwmhints, 5); + } else { + XDeleteProperty(mScreen->display(), x_window, atomForMotifWmHints); + } +} + +// Returns true if we should set WM_TRANSIENT_FOR on \a w +static inline bool isTransient(const QWidget *w) +{ + return ((w->windowType() == Qt::Dialog + || w->windowType() == Qt::Sheet + || w->windowType() == Qt::Tool + || w->windowType() == Qt::SplashScreen + || w->windowType() == Qt::ToolTip + || w->windowType() == Qt::Drawer + || w->windowType() == Qt::Popup) + && !w->testAttribute(Qt::WA_X11BypassTransientForHint)); +} + +QVector<Atom> QXlibWindow::getNetWmState() const +{ + QVector<Atom> returnValue; + + // Don't read anything, just get the size of the property data + Atom actualType; + int actualFormat; + ulong propertyLength; + ulong bytesLeft; + uchar *propertyData = 0; + if (XGetWindowProperty(mScreen->display(), x_window, QXlibStatic::atom(QXlibStatic::_NET_WM_STATE), 0, 0, + False, XA_ATOM, &actualType, &actualFormat, + &propertyLength, &bytesLeft, &propertyData) == Success + && actualType == XA_ATOM && actualFormat == 32) { + returnValue.resize(bytesLeft / 4); + XFree((char*) propertyData); + + // fetch all data + if (XGetWindowProperty(mScreen->display(), x_window, QXlibStatic::atom(QXlibStatic::_NET_WM_STATE), 0, + returnValue.size(), False, XA_ATOM, &actualType, &actualFormat, + &propertyLength, &bytesLeft, &propertyData) != Success) { + returnValue.clear(); + } else if (propertyLength != (ulong)returnValue.size()) { + returnValue.resize(propertyLength); + } + + // put it into netWmState + if (!returnValue.isEmpty()) { + memcpy(returnValue.data(), propertyData, returnValue.size() * sizeof(Atom)); + } + XFree((char*) propertyData); + } + + return returnValue; +} + +Qt::WindowFlags QXlibWindow::setWindowFlags(Qt::WindowFlags flags) +{ +// Q_ASSERT(flags & Qt::Window); + mWindowFlags = flags; + +#ifdef MYX11_DEBUG + qDebug() << "QTestLiteWindow::setWindowFlags" << hex << x_window << "flags" << flags; +#endif + Qt::WindowType type = static_cast<Qt::WindowType>(int(flags & Qt::WindowType_Mask)); + + if (type == Qt::ToolTip) + flags |= Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint; + if (type == Qt::Popup) + flags |= Qt::X11BypassWindowManagerHint; + + bool topLevel = (flags & Qt::Window); + bool popup = (type == Qt::Popup); + bool dialog = (type == Qt::Dialog + || type == Qt::Sheet); + bool desktop = (type == Qt::Desktop); + bool tool = (type == Qt::Tool || type == Qt::SplashScreen + || type == Qt::ToolTip || type == Qt::Drawer); + + Q_UNUSED(topLevel); + Q_UNUSED(dialog); + Q_UNUSED(desktop); + + bool tooltip = (type == Qt::ToolTip); + + XSetWindowAttributes wsa; + + QXlibMWMHints mwmhints; + mwmhints.flags = 0L; + mwmhints.functions = 0L; + mwmhints.decorations = 0; + mwmhints.input_mode = 0L; + mwmhints.status = 0L; + + + ulong wsa_mask = 0; + if (type != Qt::SplashScreen) { // && customize) { + mwmhints.flags |= MWM_HINTS_DECORATIONS; + + bool customize = flags & Qt::CustomizeWindowHint; + if (!(flags & Qt::FramelessWindowHint) && !(customize && !(flags & Qt::WindowTitleHint))) { + mwmhints.decorations |= MWM_DECOR_BORDER; + mwmhints.decorations |= MWM_DECOR_RESIZEH; + + if (flags & Qt::WindowTitleHint) + mwmhints.decorations |= MWM_DECOR_TITLE; + + if (flags & Qt::WindowSystemMenuHint) + mwmhints.decorations |= MWM_DECOR_MENU; + + if (flags & Qt::WindowMinimizeButtonHint) { + mwmhints.decorations |= MWM_DECOR_MINIMIZE; + mwmhints.functions |= MWM_FUNC_MINIMIZE; + } + + if (flags & Qt::WindowMaximizeButtonHint) { + mwmhints.decorations |= MWM_DECOR_MAXIMIZE; + mwmhints.functions |= MWM_FUNC_MAXIMIZE; + } + + if (flags & Qt::WindowCloseButtonHint) + mwmhints.functions |= MWM_FUNC_CLOSE; + } + } else { + // if type == Qt::SplashScreen + mwmhints.decorations = MWM_DECOR_ALL; + } + + if (tool) { + wsa.save_under = True; + wsa_mask |= CWSaveUnder; + } + + if (flags & Qt::X11BypassWindowManagerHint) { + wsa.override_redirect = True; + wsa_mask |= CWOverrideRedirect; + } +#if 0 + if (wsa_mask && initializeWindow) { + Q_ASSERT(id); + XChangeWindowAttributes(dpy, id, wsa_mask, &wsa); + } +#endif + if (mwmhints.functions != 0) { + mwmhints.flags |= MWM_HINTS_FUNCTIONS; + mwmhints.functions |= MWM_FUNC_MOVE | MWM_FUNC_RESIZE; + } else { + mwmhints.functions = MWM_FUNC_ALL; + } + + if (!(flags & Qt::FramelessWindowHint) + && flags & Qt::CustomizeWindowHint + && flags & Qt::WindowTitleHint + && !(flags & + (Qt::WindowMinimizeButtonHint + | Qt::WindowMaximizeButtonHint + | Qt::WindowCloseButtonHint))) { + // a special case - only the titlebar without any button + mwmhints.flags = MWM_HINTS_FUNCTIONS; + mwmhints.functions = MWM_FUNC_MOVE | MWM_FUNC_RESIZE; + mwmhints.decorations = 0; + } + + if (widget()->windowModality() == Qt::WindowModal) { + mwmhints.input_mode = MWM_INPUT_PRIMARY_APPLICATION_MODAL; + } else if (widget()->windowModality() == Qt::ApplicationModal) { + mwmhints.input_mode = MWM_INPUT_FULL_APPLICATION_MODAL; + } + + setMWMHints(mwmhints); + + QVector<Atom> netWmState = getNetWmState(); + + if (flags & Qt::WindowStaysOnTopHint) { + if (flags & Qt::WindowStaysOnBottomHint) + qWarning() << "QWidget: Incompatible window flags: the window can't be on top and on bottom at the same time"; + if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_ABOVE))) + netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_ABOVE)); + if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_STAYS_ON_TOP))) + netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_STAYS_ON_TOP)); + } else if (flags & Qt::WindowStaysOnBottomHint) { + if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_BELOW))) + netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_BELOW)); + } + if (widget()->isFullScreen()) { + if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_FULLSCREEN))) + netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_FULLSCREEN)); + } + if (widget()->isMaximized()) { + if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_MAXIMIZED_HORZ))) + netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_MAXIMIZED_HORZ)); + if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_MAXIMIZED_VERT))) + netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_MAXIMIZED_VERT)); + } + if (widget()->windowModality() != Qt::NonModal) { + if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_MODAL))) + netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_MODAL)); + } + + if (!netWmState.isEmpty()) { + XChangeProperty(mScreen->display(), x_window, + QXlibStatic::atom(QXlibStatic::_NET_WM_STATE), XA_ATOM, 32, PropModeReplace, + (unsigned char *) netWmState.data(), netWmState.size()); + } else { + XDeleteProperty(mScreen->display(), x_window, QXlibStatic::atom(QXlibStatic::_NET_WM_STATE)); + } + +//##### only if initializeWindow??? + + if (popup || tooltip) { // popup widget +#ifdef MYX11_DEBUG + qDebug() << "Doing XChangeWindowAttributes for popup" << wsa.override_redirect; +#endif + // set EWMH window types + // setNetWmWindowTypes(); + + wsa.override_redirect = True; + wsa.save_under = True; + XChangeWindowAttributes(mScreen->display(), x_window, CWOverrideRedirect | CWSaveUnder, + &wsa); + } else { +#ifdef MYX11_DEBUG + qDebug() << "Doing XChangeWindowAttributes for non-popup"; +#endif + } + + return flags; +} + +void QXlibWindow::setVisible(bool visible) +{ +#ifdef MYX11_DEBUG + qDebug() << "QTestLiteWindow::setVisible" << visible << hex << x_window; +#endif + if (isTransient(widget())) { + Window parentXWindow = x_window; + if (widget()->parentWidget()) { + QWidget *widgetParent = widget()->parentWidget()->window(); + if (widgetParent && widgetParent->platformWindow()) { + QXlibWindow *parentWidnow = static_cast<QXlibWindow *>(widgetParent->platformWindow()); + parentXWindow = parentWidnow->x_window; + } + } + XSetTransientForHint(mScreen->display(),x_window,parentXWindow); + } + + if (visible) { + //ensure that the window is viewed in correct position. + doSizeHints(); + XMapWindow(mScreen->display(), x_window); + } else { + XUnmapWindow(mScreen->display(), x_window); + } +} + +void QXlibWindow::setCursor(const Cursor &cursor) +{ + XDefineCursor(mScreen->display(), x_window, cursor); + XFlush(mScreen->display()); +} + +QPlatformGLContext *QXlibWindow::glContext() const +{ + if (!QApplicationPrivate::platformIntegration()->hasOpenGL()) + return 0; + if (!mGLContext) { + QXlibWindow *that = const_cast<QXlibWindow *>(this); +#if !defined(QT_NO_OPENGL) +#if !defined(QT_OPENGL_ES_2) + that->mGLContext = new QGLXContext(x_window, mScreen,widget()->platformWindowFormat()); +#else + EGLDisplay display = eglGetDisplay(mScreen->display()); + + QPlatformWindowFormat windowFormat = correctColorBuffers(widget()->platformWindowFormat()); + + EGLConfig config = q_configFromQPlatformWindowFormat(display,windowFormat); + QVector<EGLint> eglContextAttrs; + eglContextAttrs.append(EGL_CONTEXT_CLIENT_VERSION); + eglContextAttrs.append(2); + eglContextAttrs.append(EGL_NONE); + + EGLSurface eglSurface = eglCreateWindowSurface(display,config,(EGLNativeWindowType)x_window,0); + that->mGLContext = new QEGLPlatformContext(display, config, eglContextAttrs.data(), eglSurface, EGL_OPENGL_ES_API); +#endif +#endif + } + return mGLContext; +} + +Window QXlibWindow::xWindow() const +{ + return x_window; +} + +GC QXlibWindow::graphicsContext() const +{ + return gc; +} + +void QXlibWindow::doSizeHints() +{ + Q_ASSERT(widget()->testAttribute(Qt::WA_WState_Created)); + XSizeHints s; + s.flags = 0; + QRect g = geometry(); + s.x = g.x(); + s.y = g.y(); + s.width = g.width(); + s.height = g.height(); + s.flags |= USPosition; + s.flags |= PPosition; + s.flags |= USSize; + s.flags |= PSize; + s.flags |= PWinGravity; + s.win_gravity = QApplication::isRightToLeft() ? NorthEastGravity : NorthWestGravity; + XSetWMNormalHints(mScreen->display(), x_window, &s); +} + +QPlatformWindowFormat QXlibWindow::correctColorBuffers(const QPlatformWindowFormat &platformWindowFormat) const +{ + // I have only tested this setup on a dodgy intel setup, where I didn't use standard libs, + // so this might be not what we want to do :) + if ( !(platformWindowFormat.redBufferSize() == -1 && + platformWindowFormat.greenBufferSize() == -1 && + platformWindowFormat.blueBufferSize() == -1)) + return platformWindowFormat; + + QPlatformWindowFormat windowFormat = platformWindowFormat; + if (mScreen->depth() == 16) { + windowFormat.setRedBufferSize(5); + windowFormat.setGreenBufferSize(6); + windowFormat.setBlueBufferSize(5); + } else { + windowFormat.setRedBufferSize(8); + windowFormat.setGreenBufferSize(8); + windowFormat.setBlueBufferSize(8); + } + + return windowFormat; +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/xlib/qtestlitewindow.h b/src/plugins/platforms/xlib/qtestlitewindow.h new file mode 100644 index 0000000..ccf6867 --- /dev/null +++ b/src/plugins/platforms/xlib/qtestlitewindow.h @@ -0,0 +1,145 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTESTLITEWINDOW_H +#define QTESTLITEWINDOW_H + +#include "qtestliteintegration.h" + +#include <QPlatformWindow> +#include <QEvent> + +#include <QObject> +#include <QImage> + +struct QXlibMWMHints { + ulong flags, functions, decorations; + long input_mode; + ulong status; +}; + +enum { + MWM_HINTS_FUNCTIONS = (1L << 0), + + MWM_FUNC_ALL = (1L << 0), + MWM_FUNC_RESIZE = (1L << 1), + MWM_FUNC_MOVE = (1L << 2), + MWM_FUNC_MINIMIZE = (1L << 3), + MWM_FUNC_MAXIMIZE = (1L << 4), + MWM_FUNC_CLOSE = (1L << 5), + + MWM_HINTS_DECORATIONS = (1L << 1), + + MWM_DECOR_ALL = (1L << 0), + MWM_DECOR_BORDER = (1L << 1), + MWM_DECOR_RESIZEH = (1L << 2), + MWM_DECOR_TITLE = (1L << 3), + MWM_DECOR_MENU = (1L << 4), + MWM_DECOR_MINIMIZE = (1L << 5), + MWM_DECOR_MAXIMIZE = (1L << 6), + + MWM_HINTS_INPUT_MODE = (1L << 2), + + MWM_INPUT_MODELESS = 0L, + MWM_INPUT_PRIMARY_APPLICATION_MODAL = 1L, + MWM_INPUT_FULL_APPLICATION_MODAL = 3L +}; + +class QXlibWindow : public QPlatformWindow +{ +public: + QXlibWindow(QWidget *window); + ~QXlibWindow(); + + + void mousePressEvent(XButtonEvent*); + void handleMouseEvent(QEvent::Type, XButtonEvent *ev); + + void handleCloseEvent(); + void handleEnterEvent(); + void handleLeaveEvent(); + void handleFocusInEvent(); + void handleFocusOutEvent(); + + void resizeEvent(XConfigureEvent *configure_event); + void paintEvent(); + + void requestActivateWindow(); + + void setGeometry(const QRect &rect); + + Qt::WindowFlags setWindowFlags(Qt::WindowFlags type); + Qt::WindowFlags windowFlags() const; + void setVisible(bool visible); + WId winId() const; + void setParent(const QPlatformWindow *window); + void raise(); + void lower(); + void setWindowTitle(const QString &title); + + void setCursor(const Cursor &cursor); + + QPlatformGLContext *glContext() const; + + Window xWindow() const; + GC graphicsContext() const; + +protected: + QVector<Atom> getNetWmState() const; + void setMWMHints(const QXlibMWMHints &mwmhints); + QXlibMWMHints getMWMHints() const; + + void doSizeHints(); + +private: + QPlatformWindowFormat correctColorBuffers(const QPlatformWindowFormat &windowFormat)const; + + Window x_window; + GC gc; + + GC createGC(); + + QPlatformGLContext *mGLContext; + QXlibScreen *mScreen; + Qt::WindowFlags mWindowFlags; +}; + +#endif diff --git a/src/plugins/platforms/xlib/qtestlitewindowsurface.cpp b/src/plugins/platforms/xlib/qtestlitewindowsurface.cpp new file mode 100644 index 0000000..088730d --- /dev/null +++ b/src/plugins/platforms/xlib/qtestlitewindowsurface.cpp @@ -0,0 +1,224 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qtestlitewindowsurface.h" +#include "qtestliteintegration.h" + +#include <QtCore/qdebug.h> +#include <QWindowSystemInterface> + +#include "qtestlitewindow.h" +#include "qtestlitescreen.h" + +# include <sys/ipc.h> +# include <sys/shm.h> +# include <X11/extensions/XShm.h> + +QT_BEGIN_NAMESPACE + + +struct QXlibShmImageInfo { + QXlibShmImageInfo(Display *xdisplay) : image(0), display(xdisplay) {} + ~QXlibShmImageInfo() { destroy(); } + + void destroy(); + + XShmSegmentInfo shminfo; + XImage *image; + Display *display; +}; + + +#ifndef DONT_USE_MIT_SHM +void QXlibShmImageInfo::destroy() +{ + XShmDetach (display, &shminfo); + XDestroyImage (image); + shmdt (shminfo.shmaddr); + shmctl (shminfo.shmid, IPC_RMID, 0); +} +#endif + +void QXlibWindowSurface::resizeShmImage(int width, int height) +{ + +#ifdef DONT_USE_MIT_SHM + shm_img = QImage(width, height, QImage::Format_RGB32); +#else + + QXlibScreen *screen = QXlibScreen::testLiteScreenForWidget(window()); + if (image_info) + image_info->destroy(); + else + image_info = new QXlibShmImageInfo(screen->display()); + + Visual *visual = DefaultVisual(screen->display(), screen->xScreenNumber()); + + + XImage *image = XShmCreateImage (screen->display(), visual, 24, ZPixmap, 0, + &image_info->shminfo, width, height); + + + image_info->shminfo.shmid = shmget (IPC_PRIVATE, + image->bytes_per_line * image->height, IPC_CREAT|0777); + + image_info->shminfo.shmaddr = image->data = (char*)shmat (image_info->shminfo.shmid, 0, 0); + image_info->shminfo.readOnly = False; + + image_info->image = image; + + Status shm_attach_status = XShmAttach(screen->display(), &image_info->shminfo); + + Q_ASSERT(shm_attach_status == True); + + shm_img = QImage( (uchar*) image->data, image->width, image->height, image->bytes_per_line, QImage::Format_RGB32 ); +#endif + painted = false; +} + + +void QXlibWindowSurface::resizeBuffer(QSize s) +{ + if (shm_img.size() != s) + resizeShmImage(s.width(), s.height()); +} + +QSize QXlibWindowSurface::bufferSize() const +{ + return shm_img.size(); +} + +QXlibWindowSurface::QXlibWindowSurface (QWidget *window) + : QWindowSurface(window), + painted(false), image_info(0) +{ + xw = static_cast<QXlibWindow*>(window->platformWindow()); +// qDebug() << "QTestLiteWindowSurface::QTestLiteWindowSurface:" << xw->window; +} + +QXlibWindowSurface::~QXlibWindowSurface() +{ + delete image_info; +} + +QPaintDevice *QXlibWindowSurface::paintDevice() +{ + return &shm_img; +} + + +void QXlibWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) +{ + Q_UNUSED(widget); + Q_UNUSED(region); + Q_UNUSED(offset); + + if (!painted) + return; + + QXlibScreen *screen = QXlibScreen::testLiteScreenForWidget(widget); + GC gc = xw->graphicsContext(); + Window window = xw->xWindow(); +#ifdef DONT_USE_MIT_SHM + // just convert the image every time... + if (!shm_img.isNull()) { + Visual *visual = DefaultVisual(screen->display(), screen->xScreenNumber()); + + QImage image = shm_img; + //img.convertToFormat( + XImage *xi = XCreateImage(screen->display(), visual, 24, ZPixmap, + 0, (char *) image.scanLine(0), image.width(), image.height(), + 32, image.bytesPerLine()); + + int x = 0; + int y = 0; + + /*int r =*/ XPutImage(screen->display(), window, gc, xi, 0, 0, x, y, image.width(), image.height()); + + xi->data = 0; // QImage owns these bits + XDestroyImage(xi); + } +#else + // Use MIT_SHM + if (image_info && image_info->image) { + //qDebug() << "Here we go" << image_info->image->width << image_info->image->height; + int x = 0; + int y = 0; + + // We could set send_event to true, and then use the ShmCompletion to synchronize, + // but let's do like Qt/11 and just use XSync + XShmPutImage (screen->display(), window, gc, image_info->image, 0, 0, + x, y, image_info->image->width, image_info->image->height, + /*send_event*/ False); + + XSync(screen->display(), False); + } +#endif +} + +// from qwindowsurface.cpp +extern void qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &offset); + +bool QXlibWindowSurface::scroll(const QRegion &area, int dx, int dy) +{ + if (shm_img.isNull()) + return false; + + const QVector<QRect> rects = area.rects(); + for (int i = 0; i < rects.size(); ++i) + qt_scrollRectInImage(shm_img, rects.at(i), QPoint(dx, dy)); + + return true; +} + + +void QXlibWindowSurface::beginPaint(const QRegion ®ion) +{ + Q_UNUSED(region); + resizeBuffer(size()); +} + +void QXlibWindowSurface::endPaint(const QRegion ®ion) +{ + Q_UNUSED(region); + painted = true; //there is content in the buffer +} +QT_END_NAMESPACE diff --git a/src/plugins/platforms/xlib/qtestlitewindowsurface.h b/src/plugins/platforms/xlib/qtestlitewindowsurface.h new file mode 100644 index 0000000..12b4c60 --- /dev/null +++ b/src/plugins/platforms/xlib/qtestlitewindowsurface.h @@ -0,0 +1,86 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWINDOWSURFACE_TESTLITE_H +#define QWINDOWSURFACE_TESTLITE_H + +#include <QtGui/private/qwindowsurface_p.h> + + +QT_BEGIN_NAMESPACE + +class QXlibWindow; +class QXlibIntegration; +class QXlibScreen; +class QXlibShmImageInfo; + +class QXlibWindowSurface : public QWindowSurface +{ +public: + QXlibWindowSurface (QWidget *window); + ~QXlibWindowSurface(); + + QPaintDevice *paintDevice(); + void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); + bool scroll(const QRegion &area, int dx, int dy); + + void beginPaint(const QRegion ®ion); + void endPaint(const QRegion ®ion); + +private: + bool painted; + void resizeBuffer(QSize); + QSize bufferSize() const; + + + void resizeShmImage(int width, int height); + + QImage shm_img; + QXlibShmImageInfo *image_info; + + QXlibWindow *xw; + +}; + + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/platforms/xlib/testlite.pro b/src/plugins/platforms/xlib/testlite.pro new file mode 100644 index 0000000..7fb3304 --- /dev/null +++ b/src/plugins/platforms/xlib/testlite.pro @@ -0,0 +1,57 @@ +TARGET = qtestlite + +include(../../qpluginbase.pri) +QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforms + +SOURCES = \ + main.cpp \ + qtestliteintegration.cpp \ + qtestlitewindowsurface.cpp \ + qtestlitewindow.cpp \ + qtestlitecursor.cpp \ + qtestlitescreen.cpp \ + qtestlitekeyboard.cpp \ + qtestliteclipboard.cpp \ + qtestlitemime.cpp \ + qtestlitestaticinfo.cpp + +HEADERS = \ + qtestliteintegration.h \ + qtestlitewindowsurface.h \ + qtestlitewindow.h \ + qtestlitecursor.h \ + qtestlitescreen.h \ + qtestlitekeyboard.h \ + qtestliteclipboard.h \ + qtestlitemime.h \ + qtestlitestaticinfo.h + +LIBS += -lX11 -lXext + +mac { + LIBS += -L/usr/X11/lib -lz -framework Carbon +} + +include (../fontdatabases/genericunix/genericunix.pri) + +contains(QT_CONFIG, opengl) { + QT += opengl + !contains(QT_CONFIG, opengles2) { + HEADERS += qglxintegration.h + SOURCES += qglxintegration.cpp + } else { # There is no easy way to detect if we'r suppose to use glx or not + HEADERS += \ + ../eglconvenience/qeglplatformcontext.h \ + ../eglconvenience/qeglconvenience.h \ + qtestliteeglintegration.h + + SOURCES += \ + ../eglconvenience/qeglplatformcontext.cpp \ + ../eglconvenience/qeglconvenience.cpp \ + qtestliteeglintegration.cpp + LIBS += -lEGL + } +} + +target.path += $$[QT_INSTALL_PLUGINS]/platforms +INSTALLS += target -- cgit v0.12 From 29e009b19593bb42c65fd3a7e6646e929c514b44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= <jorgen.lind@nokia.com> Date: Mon, 14 Feb 2011 13:42:42 +0100 Subject: Lighthouse Renamed testlite files to xlib --- src/plugins/platforms/xlib/qtestliteclipboard.cpp | 676 ------------- src/plugins/platforms/xlib/qtestliteclipboard.h | 94 -- src/plugins/platforms/xlib/qtestlitecursor.cpp | 199 ---- src/plugins/platforms/xlib/qtestlitecursor.h | 68 -- .../platforms/xlib/qtestliteeglintegration.cpp | 186 ---- .../platforms/xlib/qtestliteeglintegration.h | 54 -- .../platforms/xlib/qtestliteintegration.cpp | 156 --- src/plugins/platforms/xlib/qtestliteintegration.h | 85 -- src/plugins/platforms/xlib/qtestlitekeyboard.cpp | 1000 -------------------- src/plugins/platforms/xlib/qtestlitekeyboard.h | 76 -- src/plugins/platforms/xlib/qtestlitemime.cpp | 322 ------- src/plugins/platforms/xlib/qtestlitemime.h | 67 -- src/plugins/platforms/xlib/qtestlitescreen.cpp | 468 --------- src/plugins/platforms/xlib/qtestlitescreen.h | 104 -- src/plugins/platforms/xlib/qtestlitestaticinfo.cpp | 511 ---------- src/plugins/platforms/xlib/qtestlitestaticinfo.h | 413 -------- src/plugins/platforms/xlib/qtestlitewindow.cpp | 735 -------------- src/plugins/platforms/xlib/qtestlitewindow.h | 145 --- .../platforms/xlib/qtestlitewindowsurface.cpp | 224 ----- .../platforms/xlib/qtestlitewindowsurface.h | 86 -- src/plugins/platforms/xlib/qxlibclipboard.cpp | 676 +++++++++++++ src/plugins/platforms/xlib/qxlibclipboard.h | 94 ++ src/plugins/platforms/xlib/qxlibcursor.cpp | 199 ++++ src/plugins/platforms/xlib/qxlibcursor.h | 68 ++ src/plugins/platforms/xlib/qxlibeglintegration.cpp | 186 ++++ src/plugins/platforms/xlib/qxlibeglintegration.h | 54 ++ src/plugins/platforms/xlib/qxlibintegration.cpp | 156 +++ src/plugins/platforms/xlib/qxlibintegration.h | 85 ++ src/plugins/platforms/xlib/qxlibkeyboard.cpp | 1000 ++++++++++++++++++++ src/plugins/platforms/xlib/qxlibkeyboard.h | 76 ++ src/plugins/platforms/xlib/qxlibmime.cpp | 322 +++++++ src/plugins/platforms/xlib/qxlibmime.h | 67 ++ src/plugins/platforms/xlib/qxlibscreen.cpp | 468 +++++++++ src/plugins/platforms/xlib/qxlibscreen.h | 104 ++ src/plugins/platforms/xlib/qxlibstatic.cpp | 511 ++++++++++ src/plugins/platforms/xlib/qxlibstatic.h | 413 ++++++++ src/plugins/platforms/xlib/qxlibwindow.cpp | 735 ++++++++++++++ src/plugins/platforms/xlib/qxlibwindow.h | 145 +++ src/plugins/platforms/xlib/qxlibwindowsurface.cpp | 224 +++++ src/plugins/platforms/xlib/qxlibwindowsurface.h | 86 ++ src/plugins/platforms/xlib/testlite.pro | 57 -- src/plugins/platforms/xlib/xlib.pro | 57 ++ 42 files changed, 5726 insertions(+), 5726 deletions(-) delete mode 100644 src/plugins/platforms/xlib/qtestliteclipboard.cpp delete mode 100644 src/plugins/platforms/xlib/qtestliteclipboard.h delete mode 100644 src/plugins/platforms/xlib/qtestlitecursor.cpp delete mode 100644 src/plugins/platforms/xlib/qtestlitecursor.h delete mode 100644 src/plugins/platforms/xlib/qtestliteeglintegration.cpp delete mode 100644 src/plugins/platforms/xlib/qtestliteeglintegration.h delete mode 100644 src/plugins/platforms/xlib/qtestliteintegration.cpp delete mode 100644 src/plugins/platforms/xlib/qtestliteintegration.h delete mode 100644 src/plugins/platforms/xlib/qtestlitekeyboard.cpp delete mode 100644 src/plugins/platforms/xlib/qtestlitekeyboard.h delete mode 100644 src/plugins/platforms/xlib/qtestlitemime.cpp delete mode 100644 src/plugins/platforms/xlib/qtestlitemime.h delete mode 100644 src/plugins/platforms/xlib/qtestlitescreen.cpp delete mode 100644 src/plugins/platforms/xlib/qtestlitescreen.h delete mode 100644 src/plugins/platforms/xlib/qtestlitestaticinfo.cpp delete mode 100644 src/plugins/platforms/xlib/qtestlitestaticinfo.h delete mode 100644 src/plugins/platforms/xlib/qtestlitewindow.cpp delete mode 100644 src/plugins/platforms/xlib/qtestlitewindow.h delete mode 100644 src/plugins/platforms/xlib/qtestlitewindowsurface.cpp delete mode 100644 src/plugins/platforms/xlib/qtestlitewindowsurface.h create mode 100644 src/plugins/platforms/xlib/qxlibclipboard.cpp create mode 100644 src/plugins/platforms/xlib/qxlibclipboard.h create mode 100644 src/plugins/platforms/xlib/qxlibcursor.cpp create mode 100644 src/plugins/platforms/xlib/qxlibcursor.h create mode 100644 src/plugins/platforms/xlib/qxlibeglintegration.cpp create mode 100644 src/plugins/platforms/xlib/qxlibeglintegration.h create mode 100644 src/plugins/platforms/xlib/qxlibintegration.cpp create mode 100644 src/plugins/platforms/xlib/qxlibintegration.h create mode 100644 src/plugins/platforms/xlib/qxlibkeyboard.cpp create mode 100644 src/plugins/platforms/xlib/qxlibkeyboard.h create mode 100644 src/plugins/platforms/xlib/qxlibmime.cpp create mode 100644 src/plugins/platforms/xlib/qxlibmime.h create mode 100644 src/plugins/platforms/xlib/qxlibscreen.cpp create mode 100644 src/plugins/platforms/xlib/qxlibscreen.h create mode 100644 src/plugins/platforms/xlib/qxlibstatic.cpp create mode 100644 src/plugins/platforms/xlib/qxlibstatic.h create mode 100644 src/plugins/platforms/xlib/qxlibwindow.cpp create mode 100644 src/plugins/platforms/xlib/qxlibwindow.h create mode 100644 src/plugins/platforms/xlib/qxlibwindowsurface.cpp create mode 100644 src/plugins/platforms/xlib/qxlibwindowsurface.h delete mode 100644 src/plugins/platforms/xlib/testlite.pro create mode 100644 src/plugins/platforms/xlib/xlib.pro diff --git a/src/plugins/platforms/xlib/qtestliteclipboard.cpp b/src/plugins/platforms/xlib/qtestliteclipboard.cpp deleted file mode 100644 index 1264b5a..0000000 --- a/src/plugins/platforms/xlib/qtestliteclipboard.cpp +++ /dev/null @@ -1,676 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qtestliteclipboard.h" - -#include "qtestlitescreen.h" -#include "qtestlitemime.h" - -#include <private/qapplication_p.h> - -#include <QtCore/QDebug> - -class QXlibClipboardMime : public QXlibMime -{ - Q_OBJECT -public: - QXlibClipboardMime(QClipboard::Mode mode, QXlibClipboard *clipboard) - : QXlibMime() - , m_clipboard(clipboard) - { - switch (mode) { - case QClipboard::Selection: - modeAtom = XA_PRIMARY; - break; - - case QClipboard::Clipboard: - modeAtom = QXlibStatic::atom(QXlibStatic::CLIPBOARD); - break; - - default: - qWarning("QTestLiteMime: Internal error: Unsupported clipboard mode"); - break; - } - } - -protected: - QStringList formats_sys() const - { - if (empty()) - return QStringList(); - - if (!formatList.count()) { - QXlibClipboardMime *that = const_cast<QXlibClipboardMime *>(this); - // get the list of targets from the current clipboard owner - we do this - // once so that multiple calls to this function don't require multiple - // server round trips... - that->format_atoms = m_clipboard->getDataInFormat(modeAtom,QXlibStatic::atom(QXlibStatic::TARGETS)); - - if (format_atoms.size() > 0) { - Atom *targets = (Atom *) format_atoms.data(); - int size = format_atoms.size() / sizeof(Atom); - - for (int i = 0; i < size; ++i) { - if (targets[i] == 0) - continue; - - QStringList formatsForAtom = mimeFormatsForAtom(m_clipboard->screen()->display(),targets[i]); - for (int j = 0; j < formatsForAtom.size(); ++j) { - if (!formatList.contains(formatsForAtom.at(j))) - that->formatList.append(formatsForAtom.at(j)); - } - } - } - } - - return formatList; - } - - bool hasFormat_sys(const QString &format) const - { - QStringList list = formats(); - return list.contains(format); - } - - QVariant retrieveData_sys(const QString &fmt, QVariant::Type requestedType) const - { - if (fmt.isEmpty() || empty()) - return QByteArray(); - - (void)formats(); // trigger update of format list - - QList<Atom> atoms; - Atom *targets = (Atom *) format_atoms.data(); - int size = format_atoms.size() / sizeof(Atom); - for (int i = 0; i < size; ++i) - atoms.append(targets[i]); - - QByteArray encoding; - Atom fmtatom = mimeAtomForFormat(m_clipboard->screen()->display(),fmt, requestedType, atoms, &encoding); - - if (fmtatom == 0) - return QVariant(); - - return mimeConvertToFormat(m_clipboard->screen()->display(),fmtatom, m_clipboard->getDataInFormat(modeAtom,fmtatom), fmt, requestedType, encoding); - } -private: - bool empty() const - { - Window win = XGetSelectionOwner(m_clipboard->screen()->display(), modeAtom); - - return win == XNone; - } - - - Atom modeAtom; - QXlibClipboard *m_clipboard; - QStringList formatList; - QByteArray format_atoms; -}; - -const int QXlibClipboard::clipboard_timeout = 5000; - -QXlibClipboard::QXlibClipboard(QXlibScreen *screen) - : QPlatformClipboard() - , m_screen(screen) - , m_xClipboard(0) - , m_clientClipboard(0) - , m_xSelection(0) - , m_clientSelection(0) - , m_requestor(XNone) - , m_owner(XNone) -{ -} - -const QMimeData * QXlibClipboard::mimeData(QClipboard::Mode mode) const -{ - if (mode == QClipboard::Clipboard) { - if (!m_xClipboard) { - QXlibClipboard *that = const_cast<QXlibClipboard *>(this); - that->m_xClipboard = new QXlibClipboardMime(mode,that); - } - Window clipboardOwner = XGetSelectionOwner(screen()->display(),QXlibStatic::atom(QXlibStatic::CLIPBOARD)); - if (clipboardOwner == owner()) { - return m_clientClipboard; - } else { - return m_xClipboard; - } - } else if (mode == QClipboard::Selection) { - if (!m_xSelection) { - QXlibClipboard *that = const_cast<QXlibClipboard *>(this); - that->m_xSelection = new QXlibClipboardMime(mode,that); - } - Window clipboardOwner = XGetSelectionOwner(screen()->display(),XA_PRIMARY); - if (clipboardOwner == owner()) { - return m_clientSelection; - } else { - return m_xSelection; - } - } - return 0; -} - -void QXlibClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode) -{ - Atom modeAtom; - QMimeData **d; - switch (mode) { - case QClipboard::Selection: - modeAtom = XA_PRIMARY; - d = &m_clientSelection; - break; - - case QClipboard::Clipboard: - modeAtom = QXlibStatic::atom(QXlibStatic::CLIPBOARD); - d = &m_clientClipboard; - break; - - default: - qWarning("QClipboard::setMimeData: unsupported mode '%d'", mode); - return; - } - - Window newOwner; - - if (! data) { // no data, clear clipboard contents - newOwner = XNone; - } else { - newOwner = owner(); - - *d = data; - } - - XSetSelectionOwner(m_screen->display(), modeAtom, newOwner, CurrentTime); - - if (XGetSelectionOwner(m_screen->display(), modeAtom) != newOwner) { - qWarning("QClipboard::setData: Cannot set X11 selection owner"); - } - -} - -bool QXlibClipboard::supportsMode(QClipboard::Mode mode) const -{ - if (mode == QClipboard::Clipboard || mode == QClipboard::Selection) - return true; - return false; -} - - -QXlibScreen * QXlibClipboard::screen() const -{ - return m_screen; -} - -Window QXlibClipboard::requestor() const -{ - if (!m_requestor) { - int x = 0, y = 0, w = 3, h = 3; - QXlibClipboard *that = const_cast<QXlibClipboard *>(this); - Window window = XCreateSimpleWindow(m_screen->display(), m_screen->rootWindow(), - x, y, w, h, 0 /*border_width*/, - m_screen->blackPixel(), m_screen->whitePixel()); - that->setRequestor(window); - } - return m_requestor; -} - -void QXlibClipboard::setRequestor(Window window) -{ - if (m_requestor != XNone) { - XDestroyWindow(m_screen->display(),m_requestor); - } - m_requestor = window; -} - -Window QXlibClipboard::owner() const -{ - if (!m_owner) { - int x = 0, y = 0, w = 3, h = 3; - QXlibClipboard *that = const_cast<QXlibClipboard *>(this); - Window window = XCreateSimpleWindow(m_screen->display(), m_screen->rootWindow(), - x, y, w, h, 0 /*border_width*/, - m_screen->blackPixel(), m_screen->whitePixel()); - that->setOwner(window); - } - return m_owner; -} - -void QXlibClipboard::setOwner(Window window) -{ - if (m_owner != XNone){ - XDestroyWindow(m_screen->display(),m_owner); - } - m_owner = window; -} - -Atom QXlibClipboard::sendTargetsSelection(QMimeData *d, Window window, Atom property) -{ - QVector<Atom> types; - QStringList formats = QInternalMimeData::formatsHelper(d); - for (int i = 0; i < formats.size(); ++i) { - QList<Atom> atoms = QXlibMime::mimeAtomsForFormat(screen()->display(),formats.at(i)); - for (int j = 0; j < atoms.size(); ++j) { - if (!types.contains(atoms.at(j))) - types.append(atoms.at(j)); - } - } - types.append(QXlibStatic::atom(QXlibStatic::TARGETS)); - types.append(QXlibStatic::atom(QXlibStatic::MULTIPLE)); - types.append(QXlibStatic::atom(QXlibStatic::TIMESTAMP)); - types.append(QXlibStatic::atom(QXlibStatic::SAVE_TARGETS)); - - XChangeProperty(screen()->display(), window, property, XA_ATOM, 32, - PropModeReplace, (uchar *) types.data(), types.size()); - return property; -} - -Atom QXlibClipboard::sendSelection(QMimeData *d, Atom target, Window window, Atom property) -{ - Atom atomFormat = target; - int dataFormat = 0; - QByteArray data; - - QString fmt = QXlibMime::mimeAtomToString(screen()->display(), target); - if (fmt.isEmpty()) { // Not a MIME type we have - qDebug() << "QClipboard: send_selection(): converting to type '%s' is not supported" << fmt.data(); - return XNone; - } - qDebug() << "QClipboard: send_selection(): converting to type '%s'" << fmt.data(); - - if (QXlibMime::mimeDataForAtom(screen()->display(),target, d, &data, &atomFormat, &dataFormat)) { - - // don't allow INCR transfers when using MULTIPLE or to - // Motif clients (since Motif doesn't support INCR) - static Atom motif_clip_temporary = QXlibStatic::atom(QXlibStatic::CLIP_TEMPORARY); - bool allow_incr = property != motif_clip_temporary; - - // X_ChangeProperty protocol request is 24 bytes - const int increment = (XMaxRequestSize(screen()->display()) * 4) - 24; - if (data.size() > increment && allow_incr) { - long bytes = data.size(); - XChangeProperty(screen()->display(), window, property, - QXlibStatic::atom(QXlibStatic::INCR), 32, PropModeReplace, (uchar *) &bytes, 1); - -// (void)new QClipboardINCRTransaction(window, property, atomFormat, dataFormat, data, increment); - qDebug() << "not implemented INCRT just YET!"; - return property; - } - - // make sure we can perform the XChangeProperty in a single request - if (data.size() > increment) - return XNone; // ### perhaps use several XChangeProperty calls w/ PropModeAppend? - int dataSize = data.size() / (dataFormat / 8); - // use a single request to transfer data - XChangeProperty(screen()->display(), window, property, atomFormat, - dataFormat, PropModeReplace, (uchar *) data.data(), - dataSize); - } - return property; -} - -void QXlibClipboard::handleSelectionRequest(XEvent *xevent) -{ - XSelectionRequestEvent *req = &xevent->xselectionrequest; - - if (requestor() && req->requestor == requestor()) { - qDebug() << "This should be caught before"; - return; - } - - XEvent event; - event.xselection.type = SelectionNotify; - event.xselection.display = req->display; - event.xselection.requestor = req->requestor; - event.xselection.selection = req->selection; - event.xselection.target = req->target; - event.xselection.property = XNone; - event.xselection.time = req->time; - - QMimeData *d; - if (req->selection == XA_PRIMARY) { - d = m_clientSelection; - } else if (req->selection == QXlibStatic::atom(QXlibStatic::CLIPBOARD)) { - d = m_clientClipboard; - } else { - qWarning("QClipboard: Unknown selection '%lx'", req->selection); - XSendEvent(screen()->display(), req->requestor, False, NoEventMask, &event); - return; - } - - if (!d) { - qWarning("QClipboard: Cannot transfer data, no data available"); - XSendEvent(screen()->display(), req->requestor, False, NoEventMask, &event); - return; - } - - Atom xa_targets = QXlibStatic::atom(QXlibStatic::TARGETS); - Atom xa_multiple = QXlibStatic::atom(QXlibStatic::MULTIPLE); - Atom xa_timestamp = QXlibStatic::atom(QXlibStatic::TIMESTAMP); - - struct AtomPair { Atom target; Atom property; } *multi = 0; - Atom multi_type = XNone; - int multi_format = 0; - int nmulti = 0; - int imulti = -1; - bool multi_writeback = false; - - if (req->target == xa_multiple) { - QByteArray multi_data; - if (req->property == XNone - || !clipboardReadProperty(req->requestor, req->property, false, &multi_data, - 0, &multi_type, &multi_format) - || multi_format != 32) { - // MULTIPLE property not formatted correctly - XSendEvent(screen()->display(), req->requestor, False, NoEventMask, &event); - return; - } - nmulti = multi_data.size()/sizeof(*multi); - multi = new AtomPair[nmulti]; - memcpy(multi,multi_data.data(),multi_data.size()); - imulti = 0; - } - - for (; imulti < nmulti; ++imulti) { - Atom target; - Atom property; - - if (multi) { - target = multi[imulti].target; - property = multi[imulti].property; - } else { - target = req->target; - property = req->property; - if (property == XNone) // obsolete client - property = target; - } - - Atom ret = XNone; - if (target == XNone || property == XNone) { - ; - } else if (target == xa_timestamp) { -// if (d->timestamp != CurrentTime) { -// XChangeProperty(screen()->display(), req->requestor, property, XA_INTEGER, 32, -// PropModeReplace, CurrentTime, 1); -// ret = property; -// } else { -// qWarning("QClipboard: Invalid data timestamp"); -// } - } else if (target == xa_targets) { - ret = sendTargetsSelection(d, req->requestor, property); - } else { - ret = sendSelection(d, target, req->requestor, property); - } - - if (nmulti > 0) { - if (ret == XNone) { - multi[imulti].property = XNone; - multi_writeback = true; - } - } else { - event.xselection.property = ret; - break; - } - } - - if (nmulti > 0) { - if (multi_writeback) { - // according to ICCCM 2.6.2 says to put None back - // into the original property on the requestor window - XChangeProperty(screen()->display(), req->requestor, req->property, multi_type, 32, - PropModeReplace, (uchar *) multi, nmulti * 2); - } - - delete [] multi; - event.xselection.property = req->property; - } - - // send selection notify to requestor - XSendEvent(screen()->display(), req->requestor, False, NoEventMask, &event); -} - -static inline int maxSelectionIncr(Display *dpy) -{ return XMaxRequestSize(dpy) > 65536 ? 65536*4 : XMaxRequestSize(dpy)*4 - 100; } - -bool QXlibClipboard::clipboardReadProperty(Window win, Atom property, bool deleteProperty, QByteArray *buffer, int *size, Atom *type, int *format) const -{ - int maxsize = maxSelectionIncr(screen()->display()); - ulong bytes_left; // bytes_after - ulong length; // nitems - uchar *data; - Atom dummy_type; - int dummy_format; - int r; - - if (!type) // allow null args - type = &dummy_type; - if (!format) - format = &dummy_format; - - // Don't read anything, just get the size of the property data - r = XGetWindowProperty(screen()->display(), win, property, 0, 0, False, - AnyPropertyType, type, format, - &length, &bytes_left, &data); - if (r != Success || (type && *type == XNone)) { - buffer->resize(0); - return false; - } - XFree((char*)data); - - int offset = 0, buffer_offset = 0, format_inc = 1, proplen = bytes_left; - - switch (*format) { - case 8: - default: - format_inc = sizeof(char) / 1; - break; - - case 16: - format_inc = sizeof(short) / 2; - proplen *= sizeof(short) / 2; - break; - - case 32: - format_inc = sizeof(long) / 4; - proplen *= sizeof(long) / 4; - break; - } - - int newSize = proplen; - buffer->resize(newSize); - - bool ok = (buffer->size() == newSize); - - if (ok && newSize) { - // could allocate buffer - - while (bytes_left) { - // more to read... - - r = XGetWindowProperty(screen()->display(), win, property, offset, maxsize/4, - False, AnyPropertyType, type, format, - &length, &bytes_left, &data); - if (r != Success || (type && *type == XNone)) - break; - - offset += length / (32 / *format); - length *= format_inc * (*format) / 8; - - // Here we check if we get a buffer overflow and tries to - // recover -- this shouldn't normally happen, but it doesn't - // hurt to be defensive - if ((int)(buffer_offset + length) > buffer->size()) { - length = buffer->size() - buffer_offset; - - // escape loop - bytes_left = 0; - } - - memcpy(buffer->data() + buffer_offset, data, length); - buffer_offset += length; - - XFree((char*)data); - } - - if (*format == 8 && *type == QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT)) { - // convert COMPOUND_TEXT to a multibyte string - XTextProperty textprop; - textprop.encoding = *type; - textprop.format = *format; - textprop.nitems = buffer_offset; - textprop.value = (unsigned char *) buffer->data(); - - char **list_ret = 0; - int count; - if (XmbTextPropertyToTextList(screen()->display(), &textprop, &list_ret, - &count) == Success && count && list_ret) { - offset = buffer_offset = strlen(list_ret[0]); - buffer->resize(offset); - memcpy(buffer->data(), list_ret[0], offset); - } - if (list_ret) XFreeStringList(list_ret); - } - } - - // correct size, not 0-term. - if (size) - *size = buffer_offset; - - if (deleteProperty) - XDeleteProperty(screen()->display(), win, property); - - XFlush(screen()->display()); - - return ok; -} - -QByteArray QXlibClipboard::clipboardReadIncrementalProperty(Window win, Atom property, int nbytes, bool nullterm) -{ - XEvent event; - - QByteArray buf; - QByteArray tmp_buf; - bool alloc_error = false; - int length; - int offset = 0; - - if (nbytes > 0) { - // Reserve buffer + zero-terminator (for text data) - // We want to complete the INCR transfer even if we cannot - // allocate more memory - buf.resize(nbytes+1); - alloc_error = buf.size() != nbytes+1; - } - - for (;;) { - XFlush(screen()->display()); - if (!screen()->waitForClipboardEvent(win,PropertyNotify,&event,clipboard_timeout)) - break; - if (event.xproperty.atom != property || - event.xproperty.state != PropertyNewValue) - continue; - if (clipboardReadProperty(win, property, true, &tmp_buf, &length, 0, 0)) { - if (length == 0) { // no more data, we're done - if (nullterm) { - buf.resize(offset+1); - buf[offset] = '\0'; - } else { - buf.resize(offset); - } - return buf; - } else if (!alloc_error) { - if (offset+length > (int)buf.size()) { - buf.resize(offset+length+65535); - if (buf.size() != offset+length+65535) { - alloc_error = true; - length = buf.size() - offset; - } - } - memcpy(buf.data()+offset, tmp_buf.constData(), length); - tmp_buf.resize(0); - offset += length; - } - } else { - break; - } - } - - // timed out ... create a new requestor window, otherwise the requestor - // could consider next request to be still part of this timed out request - setRequestor(0); - - return QByteArray(); -} - -QByteArray QXlibClipboard::getDataInFormat(Atom modeAtom, Atom fmtatom) -{ - QByteArray buf; - - Window win = requestor(); - - XSelectInput(screen()->display(), win, NoEventMask); // don't listen for any events - - XDeleteProperty(screen()->display(), win, QXlibStatic::atom(QXlibStatic::_QT_SELECTION)); - XConvertSelection(screen()->display(), modeAtom, fmtatom, QXlibStatic::atom(QXlibStatic::_QT_SELECTION), win, CurrentTime); - XSync(screen()->display(), false); - - XEvent xevent; - if (!screen()->waitForClipboardEvent(win,SelectionNotify,&xevent,clipboard_timeout) || - xevent.xselection.property == XNone) { - return buf; - } - - Atom type; - XSelectInput(screen()->display(), win, PropertyChangeMask); - - if (clipboardReadProperty(win, QXlibStatic::atom(QXlibStatic::_QT_SELECTION), true, &buf, 0, &type, 0)) { - if (type == QXlibStatic::atom(QXlibStatic::INCR)) { - int nbytes = buf.size() >= 4 ? *((int*)buf.data()) : 0; - buf = clipboardReadIncrementalProperty(win, QXlibStatic::atom(QXlibStatic::_QT_SELECTION), nbytes, false); - } - } - - XSelectInput(screen()->display(), win, NoEventMask); - - - return buf; -} - -#include "qtestliteclipboard.moc" diff --git a/src/plugins/platforms/xlib/qtestliteclipboard.h b/src/plugins/platforms/xlib/qtestliteclipboard.h deleted file mode 100644 index 109714c..0000000 --- a/src/plugins/platforms/xlib/qtestliteclipboard.h +++ /dev/null @@ -1,94 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QTESTLITECLIPBOARD_H -#define QTESTLITECLIPBOARD_H - -#include <QPlatformClipboard> -#include "qtestlitestaticinfo.h" - -class QXlibScreen; -class QXlibClipboard : public QPlatformClipboard -{ -public: - QXlibClipboard(QXlibScreen *screen); - - const QMimeData *mimeData(QClipboard::Mode mode) const; - void setMimeData(QMimeData *data, QClipboard::Mode mode); - - bool supportsMode(QClipboard::Mode mode) const; - - QXlibScreen *screen() const; - - Window requestor() const; - void setRequestor(Window window); - - Window owner() const; - - void handleSelectionRequest(XEvent *event); - - bool clipboardReadProperty(Window win, Atom property, bool deleteProperty, QByteArray *buffer, int *size, Atom *type, int *format) const; - QByteArray clipboardReadIncrementalProperty(Window win, Atom property, int nbytes, bool nullterm); - - QByteArray getDataInFormat(Atom modeAtom, Atom fmtatom); - -private: - void setOwner(Window window); - - Atom sendTargetsSelection(QMimeData *d, Window window, Atom property); - Atom sendSelection(QMimeData *d, Atom target, Window window, Atom property); - - QXlibScreen *m_screen; - - QMimeData *m_xClipboard; - QMimeData *m_clientClipboard; - - QMimeData *m_xSelection; - QMimeData *m_clientSelection; - - Window m_requestor; - Window m_owner; - - static const int clipboard_timeout; - -}; - -#endif // QTESTLITECLIPBOARD_H diff --git a/src/plugins/platforms/xlib/qtestlitecursor.cpp b/src/plugins/platforms/xlib/qtestlitecursor.cpp deleted file mode 100644 index 2f7cfbf..0000000 --- a/src/plugins/platforms/xlib/qtestlitecursor.cpp +++ /dev/null @@ -1,199 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qtestlitecursor.h" - -#include "qtestliteintegration.h" -#include "qtestlitescreen.h" -#include "qtestlitewindow.h" - -#include <QtGui/QBitmap> - -#include <X11/cursorfont.h> - -QT_BEGIN_NAMESPACE - -QXlibCursor::QXlibCursor(QXlibScreen *screen) - : QPlatformCursor(screen) -{ -} - -void QXlibCursor::changeCursor(QCursor *cursor, QWidget *widget) -{ - QXlibWindow *w = 0; - if (widget) { - QWidget *window = widget->window(); - w = static_cast<QXlibWindow*>(window->platformWindow()); - } else { - // No X11 cursor control when there is no widget under the cursor - return; - } - - if (!w) - return; - - int id = cursor->handle(); - - Cursor c; - if (!cursorMap.contains(id)) { - if (cursor->shape() == Qt::BitmapCursor) - c = createCursorBitmap(cursor); - else - c = createCursorShape(cursor->shape()); - if (!c) { - return; - } - cursorMap.insert(id, c); - } else { - c = cursorMap.value(id); - } - - w->setCursor(c); -} - -Cursor QXlibCursor::createCursorBitmap(QCursor * cursor) -{ - XColor bg, fg; - bg.red = 255 << 8; - bg.green = 255 << 8; - bg.blue = 255 << 8; - fg.red = 0; - fg.green = 0; - fg.blue = 0; - QPoint spot = cursor->hotSpot(); - Window rootwin = testLiteScreen()->rootWindow(); - - QImage mapImage = cursor->bitmap()->toImage().convertToFormat(QImage::Format_MonoLSB); - QImage maskImage = cursor->mask()->toImage().convertToFormat(QImage::Format_MonoLSB); - - int width = cursor->bitmap()->width(); - int height = cursor->bitmap()->height(); - int bytesPerLine = mapImage.bytesPerLine(); - int destLineSize = width / 8; - if (width % 8) - destLineSize++; - - const uchar * map = mapImage.bits(); - const uchar * mask = maskImage.bits(); - - char * mapBits = new char[height * destLineSize]; - char * maskBits = new char[height * destLineSize]; - for (int i = 0; i < height; i++) { - memcpy(mapBits + (destLineSize * i),map + (bytesPerLine * i), destLineSize); - memcpy(maskBits + (destLineSize * i),mask + (bytesPerLine * i), destLineSize); - } - - Pixmap cp = XCreateBitmapFromData(testLiteScreen()->display(), rootwin, mapBits, width, height); - Pixmap mp = XCreateBitmapFromData(testLiteScreen()->display(), rootwin, maskBits, width, height); - Cursor c = XCreatePixmapCursor(testLiteScreen()->display(), cp, mp, &fg, &bg, spot.x(), spot.y()); - XFreePixmap(testLiteScreen()->display(), cp); - XFreePixmap(testLiteScreen()->display(), mp); - delete[] mapBits; - delete[] maskBits; - - return c; -} - -Cursor QXlibCursor::createCursorShape(int cshape) -{ - Cursor cursor = 0; - - if (cshape < 0 || cshape > Qt::LastCursor) - return 0; - - switch (cshape) { - case Qt::ArrowCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_left_ptr); - break; - case Qt::UpArrowCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_center_ptr); - break; - case Qt::CrossCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_crosshair); - break; - case Qt::WaitCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_watch); - break; - case Qt::IBeamCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_xterm); - break; - case Qt::SizeAllCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_fleur); - break; - case Qt::PointingHandCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_hand2); - break; - case Qt::SizeBDiagCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_top_right_corner); - break; - case Qt::SizeFDiagCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_bottom_right_corner); - break; - case Qt::SizeVerCursor: - case Qt::SplitVCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_sb_v_double_arrow); - break; - case Qt::SizeHorCursor: - case Qt::SplitHCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_sb_h_double_arrow); - break; - case Qt::WhatsThisCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_question_arrow); - break; - case Qt::ForbiddenCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_circle); - break; - case Qt::BusyCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_watch); - break; - - default: //default cursor for all the rest - break; - } - return cursor; -} - -QXlibScreen * QXlibCursor::testLiteScreen() const -{ - return static_cast<QXlibScreen *>(screen); -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/xlib/qtestlitecursor.h b/src/plugins/platforms/xlib/qtestlitecursor.h deleted file mode 100644 index db9f9e2..0000000 --- a/src/plugins/platforms/xlib/qtestlitecursor.h +++ /dev/null @@ -1,68 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QTESTLITECURSOR_H -#define QTESTLITECURSOR_H - -#include <QtGui/QPlatformCursor> - -#include "qtestliteintegration.h" - -QT_BEGIN_NAMESPACE - -class QXlibCursor : QPlatformCursor -{ -public: - QXlibCursor(QXlibScreen *screen); - - void changeCursor(QCursor * cursor, QWidget * widget); -private: - - Cursor createCursorBitmap(QCursor * cursor); - Cursor createCursorShape(int cshape); - - QXlibScreen *testLiteScreen() const; - QMap<int, Cursor> cursorMap; -}; - -QT_END_NAMESPACE - -#endif // QTESTLITECURSOR_H diff --git a/src/plugins/platforms/xlib/qtestliteeglintegration.cpp b/src/plugins/platforms/xlib/qtestliteeglintegration.cpp deleted file mode 100644 index 9bbe0ca..0000000 --- a/src/plugins/platforms/xlib/qtestliteeglintegration.cpp +++ /dev/null @@ -1,186 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qtestliteeglintegration.h" - -static int countBits(unsigned long mask) -{ - int count = 0; - while (mask != 0) { - if (mask & 1) - ++count; - mask >>= 1; - } - return count; -} - -VisualID QXlibEglIntegration::getCompatibleVisualId(Display *display, EGLConfig config) -{ - VisualID visualId = 0; - EGLint eglValue = 0; - - EGLDisplay eglDisplay = eglGetDisplay(display); - - EGLint configRedSize = 0; - eglGetConfigAttrib(eglDisplay, config, EGL_RED_SIZE, &configRedSize); - - EGLint configGreenSize = 0; - eglGetConfigAttrib(eglDisplay, config, EGL_GREEN_SIZE, &configGreenSize); - - EGLint configBlueSize = 0; - eglGetConfigAttrib(eglDisplay, config, EGL_BLUE_SIZE, &configBlueSize); - - EGLint configAlphaSize = 0; - eglGetConfigAttrib(eglDisplay, config, EGL_ALPHA_SIZE, &configAlphaSize); - - eglGetConfigAttrib(eglDisplay, config, EGL_CONFIG_ID, &eglValue); - int configId = eglValue; - - // See if EGL provided a valid VisualID: - eglGetConfigAttrib(eglDisplay, config, EGL_NATIVE_VISUAL_ID, &eglValue); - visualId = (VisualID)eglValue; - if (visualId) { - // EGL has suggested a visual id, so get the rest of the visual info for that id: - XVisualInfo visualInfoTemplate; - memset(&visualInfoTemplate, 0, sizeof(XVisualInfo)); - visualInfoTemplate.visualid = visualId; - - XVisualInfo *chosenVisualInfo; - int matchingCount = 0; - chosenVisualInfo = XGetVisualInfo(display, VisualIDMask, &visualInfoTemplate, &matchingCount); - if (chosenVisualInfo) { - // Skip size checks if implementation supports non-matching visual - // and config (http://bugreports.qt.nokia.com/browse/QTBUG-9444). - if (q_hasEglExtension(eglDisplay,"EGL_NV_post_convert_rounding")) { - XFree(chosenVisualInfo); - return visualId; - } - - int visualRedSize = countBits(chosenVisualInfo->red_mask); - int visualGreenSize = countBits(chosenVisualInfo->green_mask); - int visualBlueSize = countBits(chosenVisualInfo->blue_mask); - int visualAlphaSize = -1; // Need XRender to tell us the alpha channel size - - bool visualMatchesConfig = false; - if ( visualRedSize == configRedSize && - visualGreenSize == configGreenSize && - visualBlueSize == configBlueSize ) - { - // We need XRender to check the alpha channel size of the visual. If we don't have - // the alpha size, we don't check it against the EGL config's alpha size. - if (visualAlphaSize >= 0) - visualMatchesConfig = visualAlphaSize == configAlphaSize; - else - visualMatchesConfig = true; - } - - if (!visualMatchesConfig) { - if (visualAlphaSize >= 0) { - qWarning("Warning: EGL suggested using X Visual ID %d (ARGB%d%d%d%d) for EGL config %d (ARGB%d%d%d%d), but this is incompatable", - (int)visualId, visualAlphaSize, visualRedSize, visualGreenSize, visualBlueSize, - configId, configAlphaSize, configRedSize, configGreenSize, configBlueSize); - } else { - qWarning("Warning: EGL suggested using X Visual ID %d (RGB%d%d%d) for EGL config %d (RGB%d%d%d), but this is incompatable", - (int)visualId, visualRedSize, visualGreenSize, visualBlueSize, - configId, configRedSize, configGreenSize, configBlueSize); - } - visualId = 0; - } - } else { - qWarning("Warning: EGL suggested using X Visual ID %d for EGL config %d, but that isn't a valid ID", - (int)visualId, configId); - visualId = 0; - } - XFree(chosenVisualInfo); - } -#ifdef QT_DEBUG_X11_VISUAL_SELECTION - else - qDebug("EGL did not suggest a VisualID (EGL_NATIVE_VISUAL_ID was zero) for EGLConfig %d", configId); -#endif - - if (visualId) { -#ifdef QT_DEBUG_X11_VISUAL_SELECTION - if (configAlphaSize > 0) - qDebug("Using ARGB Visual ID %d provided by EGL for config %d", (int)visualId, configId); - else - qDebug("Using Opaque Visual ID %d provided by EGL for config %d", (int)visualId, configId); -#endif - return visualId; - } - - // Finally, try to - // use XGetVisualInfo and only use the bit depths to match on: - if (!visualId) { - XVisualInfo visualInfoTemplate; - memset(&visualInfoTemplate, 0, sizeof(XVisualInfo)); - XVisualInfo *matchingVisuals; - int matchingCount = 0; - - visualInfoTemplate.depth = configRedSize + configGreenSize + configBlueSize + configAlphaSize; - matchingVisuals = XGetVisualInfo(display, - VisualDepthMask, - &visualInfoTemplate, - &matchingCount); - if (!matchingVisuals) { - // Try again without taking the alpha channel into account: - visualInfoTemplate.depth = configRedSize + configGreenSize + configBlueSize; - matchingVisuals = XGetVisualInfo(display, - VisualDepthMask, - &visualInfoTemplate, - &matchingCount); - } - - if (matchingVisuals) { - visualId = matchingVisuals[0].visualid; - XFree(matchingVisuals); - } - } - - if (visualId) { -#ifdef QT_DEBUG_X11_VISUAL_SELECTION - qDebug("Using Visual ID %d provided by XGetVisualInfo for EGL config %d", (int)visualId, configId); -#endif - return visualId; - } - - qWarning("Unable to find an X11 visual which matches EGL config %d", configId); - return (VisualID)0; -} diff --git a/src/plugins/platforms/xlib/qtestliteeglintegration.h b/src/plugins/platforms/xlib/qtestliteeglintegration.h deleted file mode 100644 index 4c2e50d..0000000 --- a/src/plugins/platforms/xlib/qtestliteeglintegration.h +++ /dev/null @@ -1,54 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QTESTLITEEGLINTEGRATION_H -#define QTESTLITEEGLINTEGRATION_H - -#include "qtestlitestaticinfo.h" -#include "../eglconvenience/qeglconvenience.h" - -class QXlibEglIntegration -{ -public: - static VisualID getCompatibleVisualId(Display *display, EGLConfig config); -}; - -#endif // QTESTLITEEGLINTEGRATION_H diff --git a/src/plugins/platforms/xlib/qtestliteintegration.cpp b/src/plugins/platforms/xlib/qtestliteintegration.cpp deleted file mode 100644 index cdc5c29..0000000 --- a/src/plugins/platforms/xlib/qtestliteintegration.cpp +++ /dev/null @@ -1,156 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qtestliteintegration.h" -#include "qtestlitewindowsurface.h" -#include <QtGui/private/qpixmap_raster_p.h> -#include <QtCore/qdebug.h> - -#include "qtestlitewindow.h" -#include "qgenericunixfontdatabase.h" -#include "qtestlitescreen.h" -#include "qtestliteclipboard.h" - -#if !defined(QT_NO_OPENGL) -#if !defined(QT_OPENGL_ES_2) -#include <GL/glx.h> -#else -#include <EGL/egl.h> -#endif //!defined(QT_OPENGL_ES_2) -#include <private/qwindowsurface_gl_p.h> -#include <private/qpixmapdata_gl_p.h> -#endif //QT_NO_OPENGL - -QT_BEGIN_NAMESPACE - -QXlibIntegration::QXlibIntegration(bool useOpenGL) - : mUseOpenGL(useOpenGL) - , mFontDb(new QGenericUnixFontDatabase()) - , mClipboard(0) -{ - mPrimaryScreen = new QXlibScreen(); - mScreens.append(mPrimaryScreen); -} - -QPixmapData *QXlibIntegration::createPixmapData(QPixmapData::PixelType type) const -{ -#ifndef QT_NO_OPENGL - if (mUseOpenGL) - return new QGLPixmapData(type); -#endif - return new QRasterPixmapData(type); -} - -QWindowSurface *QXlibIntegration::createWindowSurface(QWidget *widget, WId) const -{ -#ifndef QT_NO_OPENGL - if (mUseOpenGL) - return new QGLWindowSurface(widget); -#endif - return new QXlibWindowSurface(widget); -} - - -QPlatformWindow *QXlibIntegration::createPlatformWindow(QWidget *widget, WId /*winId*/) const -{ - return new QXlibWindow(widget); -} - - - -QPixmap QXlibIntegration::grabWindow(WId window, int x, int y, int width, int height) const -{ - QImage image; - QWidget *widget = QWidget::find(window); - if (widget) { - QXlibScreen *screen = QXlibScreen::testLiteScreenForWidget(widget); - image = screen->grabWindow(window,x,y,width,height); - } else { - for (int i = 0; i < mScreens.size(); i++) { - QXlibScreen *screen = static_cast<QXlibScreen *>(mScreens[i]); - if (screen->rootWindow() == window) { - image = screen->grabWindow(window,x,y,width,height); - } - } - } - return QPixmap::fromImage(image); -} - -QPlatformFontDatabase *QXlibIntegration::fontDatabase() const -{ - return mFontDb; -} - -QPlatformClipboard * QXlibIntegration::clipboard() const -{ - //Use lazy init since clipboard needs QTestliteScreen - if (!mClipboard) { - QXlibIntegration *that = const_cast<QXlibIntegration *>(this); - that->mClipboard = new QXlibClipboard(mPrimaryScreen); - } - return mClipboard; -} - -bool QXlibIntegration::hasOpenGL() const -{ -#if !defined(QT_NO_OPENGL) -#if !defined(QT_OPENGL_ES_2) - QXlibScreen *screen = static_cast<const QXlibScreen *>(mScreens.at(0)); - return glXQueryExtension(screen->display(), 0, 0) != 0; -#else - static bool eglHasbeenInitialized = false; - static bool wasEglInitialized = false; - if (!eglHasbeenInitialized) { - eglHasbeenInitialized = true; - const QXlibScreen *screen = static_cast<const QXlibScreen *>(mScreens.at(0)); - EGLint major, minor; - eglBindAPI(EGL_OPENGL_ES_API); - EGLDisplay disp = eglGetDisplay(screen->display()); - wasEglInitialized = eglInitialize(disp,&major,&minor); - } - return wasEglInitialized; -#endif -#endif - return false; -} - - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/xlib/qtestliteintegration.h b/src/plugins/platforms/xlib/qtestliteintegration.h deleted file mode 100644 index c3125b8..0000000 --- a/src/plugins/platforms/xlib/qtestliteintegration.h +++ /dev/null @@ -1,85 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QGRAPHICSSYSTEM_TESTLITE_H -#define QGRAPHICSSYSTEM_TESTLITE_H - -//make sure textstream is included before any X11 headers -#include <QtCore/QTextStream> - -#include <QtGui/QPlatformIntegration> -#include <QtGui/QPlatformScreen> - -#include "qtestlitestaticinfo.h" - -QT_BEGIN_NAMESPACE - -class QXlibScreen; - -class QXlibIntegration : public QPlatformIntegration -{ -public: - QXlibIntegration(bool useOpenGL = false); - - QPixmapData *createPixmapData(QPixmapData::PixelType type) const; - QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId) const; - QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const; - - QPixmap grabWindow(WId window, int x, int y, int width, int height) const; - - QList<QPlatformScreen *> screens() const { return mScreens; } - - QPlatformFontDatabase *fontDatabase() const; - QPlatformClipboard *clipboard() const; - - bool hasOpenGL() const; - -private: - bool mUseOpenGL; - QXlibScreen *mPrimaryScreen; - QList<QPlatformScreen *> mScreens; - QPlatformFontDatabase *mFontDb; - QPlatformClipboard *mClipboard; -}; - -QT_END_NAMESPACE - -#endif diff --git a/src/plugins/platforms/xlib/qtestlitekeyboard.cpp b/src/plugins/platforms/xlib/qtestlitekeyboard.cpp deleted file mode 100644 index fb0cf2e..0000000 --- a/src/plugins/platforms/xlib/qtestlitekeyboard.cpp +++ /dev/null @@ -1,1000 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qtestlitekeyboard.h" - -#include "qtestlitescreen.h" - -#include <QtGui/QWindowSystemInterface> - -#include <QtCore/QTextCodec> - -#ifndef XK_ISO_Left_Tab -#define XK_ISO_Left_Tab 0xFE20 -#endif - -#ifndef XK_dead_hook -#define XK_dead_hook 0xFE61 -#endif - -#ifndef XK_dead_horn -#define XK_dead_horn 0xFE62 -#endif - -#ifndef XK_Codeinput -#define XK_Codeinput 0xFF37 -#endif - -#ifndef XK_Kanji_Bangou -#define XK_Kanji_Bangou 0xFF37 /* same as codeinput */ -#endif - -// Fix old X libraries -#ifndef XK_KP_Home -#define XK_KP_Home 0xFF95 -#endif -#ifndef XK_KP_Left -#define XK_KP_Left 0xFF96 -#endif -#ifndef XK_KP_Up -#define XK_KP_Up 0xFF97 -#endif -#ifndef XK_KP_Right -#define XK_KP_Right 0xFF98 -#endif -#ifndef XK_KP_Down -#define XK_KP_Down 0xFF99 -#endif -#ifndef XK_KP_Prior -#define XK_KP_Prior 0xFF9A -#endif -#ifndef XK_KP_Next -#define XK_KP_Next 0xFF9B -#endif -#ifndef XK_KP_End -#define XK_KP_End 0xFF9C -#endif -#ifndef XK_KP_Insert -#define XK_KP_Insert 0xFF9E -#endif -#ifndef XK_KP_Delete -#define XK_KP_Delete 0xFF9F -#endif - -// the next lines are taken on 10/2009 from X.org (X11/XF86keysym.h), defining some special -// multimedia keys. They are included here as not every system has them. -#define XF86XK_MonBrightnessUp 0x1008FF02 -#define XF86XK_MonBrightnessDown 0x1008FF03 -#define XF86XK_KbdLightOnOff 0x1008FF04 -#define XF86XK_KbdBrightnessUp 0x1008FF05 -#define XF86XK_KbdBrightnessDown 0x1008FF06 -#define XF86XK_Standby 0x1008FF10 -#define XF86XK_AudioLowerVolume 0x1008FF11 -#define XF86XK_AudioMute 0x1008FF12 -#define XF86XK_AudioRaiseVolume 0x1008FF13 -#define XF86XK_AudioPlay 0x1008FF14 -#define XF86XK_AudioStop 0x1008FF15 -#define XF86XK_AudioPrev 0x1008FF16 -#define XF86XK_AudioNext 0x1008FF17 -#define XF86XK_HomePage 0x1008FF18 -#define XF86XK_Mail 0x1008FF19 -#define XF86XK_Start 0x1008FF1A -#define XF86XK_Search 0x1008FF1B -#define XF86XK_AudioRecord 0x1008FF1C -#define XF86XK_Calculator 0x1008FF1D -#define XF86XK_Memo 0x1008FF1E -#define XF86XK_ToDoList 0x1008FF1F -#define XF86XK_Calendar 0x1008FF20 -#define XF86XK_PowerDown 0x1008FF21 -#define XF86XK_ContrastAdjust 0x1008FF22 -#define XF86XK_Back 0x1008FF26 -#define XF86XK_Forward 0x1008FF27 -#define XF86XK_Stop 0x1008FF28 -#define XF86XK_Refresh 0x1008FF29 -#define XF86XK_PowerOff 0x1008FF2A -#define XF86XK_WakeUp 0x1008FF2B -#define XF86XK_Eject 0x1008FF2C -#define XF86XK_ScreenSaver 0x1008FF2D -#define XF86XK_WWW 0x1008FF2E -#define XF86XK_Sleep 0x1008FF2F -#define XF86XK_Favorites 0x1008FF30 -#define XF86XK_AudioPause 0x1008FF31 -#define XF86XK_AudioMedia 0x1008FF32 -#define XF86XK_MyComputer 0x1008FF33 -#define XF86XK_LightBulb 0x1008FF35 -#define XF86XK_Shop 0x1008FF36 -#define XF86XK_History 0x1008FF37 -#define XF86XK_OpenURL 0x1008FF38 -#define XF86XK_AddFavorite 0x1008FF39 -#define XF86XK_HotLinks 0x1008FF3A -#define XF86XK_BrightnessAdjust 0x1008FF3B -#define XF86XK_Finance 0x1008FF3C -#define XF86XK_Community 0x1008FF3D -#define XF86XK_AudioRewind 0x1008FF3E -#define XF86XK_BackForward 0x1008FF3F -#define XF86XK_Launch0 0x1008FF40 -#define XF86XK_Launch1 0x1008FF41 -#define XF86XK_Launch2 0x1008FF42 -#define XF86XK_Launch3 0x1008FF43 -#define XF86XK_Launch4 0x1008FF44 -#define XF86XK_Launch5 0x1008FF45 -#define XF86XK_Launch6 0x1008FF46 -#define XF86XK_Launch7 0x1008FF47 -#define XF86XK_Launch8 0x1008FF48 -#define XF86XK_Launch9 0x1008FF49 -#define XF86XK_LaunchA 0x1008FF4A -#define XF86XK_LaunchB 0x1008FF4B -#define XF86XK_LaunchC 0x1008FF4C -#define XF86XK_LaunchD 0x1008FF4D -#define XF86XK_LaunchE 0x1008FF4E -#define XF86XK_LaunchF 0x1008FF4F -#define XF86XK_ApplicationLeft 0x1008FF50 -#define XF86XK_ApplicationRight 0x1008FF51 -#define XF86XK_Book 0x1008FF52 -#define XF86XK_CD 0x1008FF53 -#define XF86XK_Calculater 0x1008FF54 -#define XF86XK_Clear 0x1008FF55 -#define XF86XK_ClearGrab 0x1008FE21 -#define XF86XK_Close 0x1008FF56 -#define XF86XK_Copy 0x1008FF57 -#define XF86XK_Cut 0x1008FF58 -#define XF86XK_Display 0x1008FF59 -#define XF86XK_DOS 0x1008FF5A -#define XF86XK_Documents 0x1008FF5B -#define XF86XK_Excel 0x1008FF5C -#define XF86XK_Explorer 0x1008FF5D -#define XF86XK_Game 0x1008FF5E -#define XF86XK_Go 0x1008FF5F -#define XF86XK_iTouch 0x1008FF60 -#define XF86XK_LogOff 0x1008FF61 -#define XF86XK_Market 0x1008FF62 -#define XF86XK_Meeting 0x1008FF63 -#define XF86XK_MenuKB 0x1008FF65 -#define XF86XK_MenuPB 0x1008FF66 -#define XF86XK_MySites 0x1008FF67 -#define XF86XK_News 0x1008FF69 -#define XF86XK_OfficeHome 0x1008FF6A -#define XF86XK_Option 0x1008FF6C -#define XF86XK_Paste 0x1008FF6D -#define XF86XK_Phone 0x1008FF6E -#define XF86XK_Reply 0x1008FF72 -#define XF86XK_Reload 0x1008FF73 -#define XF86XK_RotateWindows 0x1008FF74 -#define XF86XK_RotationPB 0x1008FF75 -#define XF86XK_RotationKB 0x1008FF76 -#define XF86XK_Save 0x1008FF77 -#define XF86XK_Send 0x1008FF7B -#define XF86XK_Spell 0x1008FF7C -#define XF86XK_SplitScreen 0x1008FF7D -#define XF86XK_Support 0x1008FF7E -#define XF86XK_TaskPane 0x1008FF7F -#define XF86XK_Terminal 0x1008FF80 -#define XF86XK_Tools 0x1008FF81 -#define XF86XK_Travel 0x1008FF82 -#define XF86XK_Video 0x1008FF87 -#define XF86XK_Word 0x1008FF89 -#define XF86XK_Xfer 0x1008FF8A -#define XF86XK_ZoomIn 0x1008FF8B -#define XF86XK_ZoomOut 0x1008FF8C -#define XF86XK_Away 0x1008FF8D -#define XF86XK_Messenger 0x1008FF8E -#define XF86XK_WebCam 0x1008FF8F -#define XF86XK_MailForward 0x1008FF90 -#define XF86XK_Pictures 0x1008FF91 -#define XF86XK_Music 0x1008FF92 -#define XF86XK_Battery 0x1008FF93 -#define XF86XK_Bluetooth 0x1008FF94 -#define XF86XK_WLAN 0x1008FF95 -#define XF86XK_UWB 0x1008FF96 -#define XF86XK_AudioForward 0x1008FF97 -#define XF86XK_AudioRepeat 0x1008FF98 -#define XF86XK_AudioRandomPlay 0x1008FF99 -#define XF86XK_Subtitle 0x1008FF9A -#define XF86XK_AudioCycleTrack 0x1008FF9B -#define XF86XK_Time 0x1008FF9F -#define XF86XK_Select 0x1008FFA0 -#define XF86XK_View 0x1008FFA1 -#define XF86XK_TopMenu 0x1008FFA2 -#define XF86XK_Suspend 0x1008FFA7 -#define XF86XK_Hibernate 0x1008FFA8 - - -// end of XF86keysyms.h - -// Special keys used by Qtopia, mapped into the X11 private keypad range. -#define QTOPIAXK_Select 0x11000601 -#define QTOPIAXK_Yes 0x11000602 -#define QTOPIAXK_No 0x11000603 -#define QTOPIAXK_Cancel 0x11000604 -#define QTOPIAXK_Printer 0x11000605 -#define QTOPIAXK_Execute 0x11000606 -#define QTOPIAXK_Sleep 0x11000607 -#define QTOPIAXK_Play 0x11000608 -#define QTOPIAXK_Zoom 0x11000609 -#define QTOPIAXK_Context1 0x1100060A -#define QTOPIAXK_Context2 0x1100060B -#define QTOPIAXK_Context3 0x1100060C -#define QTOPIAXK_Context4 0x1100060D -#define QTOPIAXK_Call 0x1100060E -#define QTOPIAXK_Hangup 0x1100060F -#define QTOPIAXK_Flip 0x11000610 - -// keyboard mapping table -static const unsigned int KeyTbl[] = { - - // misc keys - - XK_Escape, Qt::Key_Escape, - XK_Tab, Qt::Key_Tab, - XK_ISO_Left_Tab, Qt::Key_Backtab, - XK_BackSpace, Qt::Key_Backspace, - XK_Return, Qt::Key_Return, - XK_Insert, Qt::Key_Insert, - XK_Delete, Qt::Key_Delete, - XK_Clear, Qt::Key_Delete, - XK_Pause, Qt::Key_Pause, - XK_Print, Qt::Key_Print, - 0x1005FF60, Qt::Key_SysReq, // hardcoded Sun SysReq - 0x1007ff00, Qt::Key_SysReq, // hardcoded X386 SysReq - - // cursor movement - - XK_Home, Qt::Key_Home, - XK_End, Qt::Key_End, - XK_Left, Qt::Key_Left, - XK_Up, Qt::Key_Up, - XK_Right, Qt::Key_Right, - XK_Down, Qt::Key_Down, - XK_Prior, Qt::Key_PageUp, - XK_Next, Qt::Key_PageDown, - - // modifiers - - XK_Shift_L, Qt::Key_Shift, - XK_Shift_R, Qt::Key_Shift, - XK_Shift_Lock, Qt::Key_Shift, - XK_Control_L, Qt::Key_Control, - XK_Control_R, Qt::Key_Control, - XK_Meta_L, Qt::Key_Meta, - XK_Meta_R, Qt::Key_Meta, - XK_Alt_L, Qt::Key_Alt, - XK_Alt_R, Qt::Key_Alt, - XK_Caps_Lock, Qt::Key_CapsLock, - XK_Num_Lock, Qt::Key_NumLock, - XK_Scroll_Lock, Qt::Key_ScrollLock, - XK_Super_L, Qt::Key_Super_L, - XK_Super_R, Qt::Key_Super_R, - XK_Menu, Qt::Key_Menu, - XK_Hyper_L, Qt::Key_Hyper_L, - XK_Hyper_R, Qt::Key_Hyper_R, - XK_Help, Qt::Key_Help, - 0x1000FF74, Qt::Key_Backtab, // hardcoded HP backtab - 0x1005FF10, Qt::Key_F11, // hardcoded Sun F36 (labeled F11) - 0x1005FF11, Qt::Key_F12, // hardcoded Sun F37 (labeled F12) - - // numeric and function keypad keys - - XK_KP_Space, Qt::Key_Space, - XK_KP_Tab, Qt::Key_Tab, - XK_KP_Enter, Qt::Key_Enter, - //XK_KP_F1, Qt::Key_F1, - //XK_KP_F2, Qt::Key_F2, - //XK_KP_F3, Qt::Key_F3, - //XK_KP_F4, Qt::Key_F4, - XK_KP_Home, Qt::Key_Home, - XK_KP_Left, Qt::Key_Left, - XK_KP_Up, Qt::Key_Up, - XK_KP_Right, Qt::Key_Right, - XK_KP_Down, Qt::Key_Down, - XK_KP_Prior, Qt::Key_PageUp, - XK_KP_Next, Qt::Key_PageDown, - XK_KP_End, Qt::Key_End, - XK_KP_Begin, Qt::Key_Clear, - XK_KP_Insert, Qt::Key_Insert, - XK_KP_Delete, Qt::Key_Delete, - XK_KP_Equal, Qt::Key_Equal, - XK_KP_Multiply, Qt::Key_Asterisk, - XK_KP_Add, Qt::Key_Plus, - XK_KP_Separator, Qt::Key_Comma, - XK_KP_Subtract, Qt::Key_Minus, - XK_KP_Decimal, Qt::Key_Period, - XK_KP_Divide, Qt::Key_Slash, - - // International input method support keys - - // International & multi-key character composition - XK_ISO_Level3_Shift, Qt::Key_AltGr, - XK_Multi_key, Qt::Key_Multi_key, - XK_Codeinput, Qt::Key_Codeinput, - XK_SingleCandidate, Qt::Key_SingleCandidate, - XK_MultipleCandidate, Qt::Key_MultipleCandidate, - XK_PreviousCandidate, Qt::Key_PreviousCandidate, - - // Misc Functions - XK_Mode_switch, Qt::Key_Mode_switch, - XK_script_switch, Qt::Key_Mode_switch, - - // Japanese keyboard support - XK_Kanji, Qt::Key_Kanji, - XK_Muhenkan, Qt::Key_Muhenkan, - //XK_Henkan_Mode, Qt::Key_Henkan_Mode, - XK_Henkan_Mode, Qt::Key_Henkan, - XK_Henkan, Qt::Key_Henkan, - XK_Romaji, Qt::Key_Romaji, - XK_Hiragana, Qt::Key_Hiragana, - XK_Katakana, Qt::Key_Katakana, - XK_Hiragana_Katakana, Qt::Key_Hiragana_Katakana, - XK_Zenkaku, Qt::Key_Zenkaku, - XK_Hankaku, Qt::Key_Hankaku, - XK_Zenkaku_Hankaku, Qt::Key_Zenkaku_Hankaku, - XK_Touroku, Qt::Key_Touroku, - XK_Massyo, Qt::Key_Massyo, - XK_Kana_Lock, Qt::Key_Kana_Lock, - XK_Kana_Shift, Qt::Key_Kana_Shift, - XK_Eisu_Shift, Qt::Key_Eisu_Shift, - XK_Eisu_toggle, Qt::Key_Eisu_toggle, - //XK_Kanji_Bangou, Qt::Key_Kanji_Bangou, - //XK_Zen_Koho, Qt::Key_Zen_Koho, - //XK_Mae_Koho, Qt::Key_Mae_Koho, - XK_Kanji_Bangou, Qt::Key_Codeinput, - XK_Zen_Koho, Qt::Key_MultipleCandidate, - XK_Mae_Koho, Qt::Key_PreviousCandidate, - -#ifdef XK_KOREAN - // Korean keyboard support - XK_Hangul, Qt::Key_Hangul, - XK_Hangul_Start, Qt::Key_Hangul_Start, - XK_Hangul_End, Qt::Key_Hangul_End, - XK_Hangul_Hanja, Qt::Key_Hangul_Hanja, - XK_Hangul_Jamo, Qt::Key_Hangul_Jamo, - XK_Hangul_Romaja, Qt::Key_Hangul_Romaja, - //XK_Hangul_Codeinput, Qt::Key_Hangul_Codeinput, - XK_Hangul_Codeinput, Qt::Key_Codeinput, - XK_Hangul_Jeonja, Qt::Key_Hangul_Jeonja, - XK_Hangul_Banja, Qt::Key_Hangul_Banja, - XK_Hangul_PreHanja, Qt::Key_Hangul_PreHanja, - XK_Hangul_PostHanja, Qt::Key_Hangul_PostHanja, - //XK_Hangul_SingleCandidate,Qt::Key_Hangul_SingleCandidate, - //XK_Hangul_MultipleCandidate,Qt::Key_Hangul_MultipleCandidate, - //XK_Hangul_PreviousCandidate,Qt::Key_Hangul_PreviousCandidate, - XK_Hangul_SingleCandidate, Qt::Key_SingleCandidate, - XK_Hangul_MultipleCandidate,Qt::Key_MultipleCandidate, - XK_Hangul_PreviousCandidate,Qt::Key_PreviousCandidate, - XK_Hangul_Special, Qt::Key_Hangul_Special, - //XK_Hangul_switch, Qt::Key_Hangul_switch, - XK_Hangul_switch, Qt::Key_Mode_switch, -#endif // XK_KOREAN - - // dead keys - XK_dead_grave, Qt::Key_Dead_Grave, - XK_dead_acute, Qt::Key_Dead_Acute, - XK_dead_circumflex, Qt::Key_Dead_Circumflex, - XK_dead_tilde, Qt::Key_Dead_Tilde, - XK_dead_macron, Qt::Key_Dead_Macron, - XK_dead_breve, Qt::Key_Dead_Breve, - XK_dead_abovedot, Qt::Key_Dead_Abovedot, - XK_dead_diaeresis, Qt::Key_Dead_Diaeresis, - XK_dead_abovering, Qt::Key_Dead_Abovering, - XK_dead_doubleacute, Qt::Key_Dead_Doubleacute, - XK_dead_caron, Qt::Key_Dead_Caron, - XK_dead_cedilla, Qt::Key_Dead_Cedilla, - XK_dead_ogonek, Qt::Key_Dead_Ogonek, - XK_dead_iota, Qt::Key_Dead_Iota, - XK_dead_voiced_sound, Qt::Key_Dead_Voiced_Sound, - XK_dead_semivoiced_sound, Qt::Key_Dead_Semivoiced_Sound, - XK_dead_belowdot, Qt::Key_Dead_Belowdot, - XK_dead_hook, Qt::Key_Dead_Hook, - XK_dead_horn, Qt::Key_Dead_Horn, - - // Special keys from X.org - This include multimedia keys, - // wireless/bluetooth/uwb keys, special launcher keys, etc. - XF86XK_Back, Qt::Key_Back, - XF86XK_Forward, Qt::Key_Forward, - XF86XK_Stop, Qt::Key_Stop, - XF86XK_Refresh, Qt::Key_Refresh, - XF86XK_Favorites, Qt::Key_Favorites, - XF86XK_AudioMedia, Qt::Key_LaunchMedia, - XF86XK_OpenURL, Qt::Key_OpenUrl, - XF86XK_HomePage, Qt::Key_HomePage, - XF86XK_Search, Qt::Key_Search, - XF86XK_AudioLowerVolume, Qt::Key_VolumeDown, - XF86XK_AudioMute, Qt::Key_VolumeMute, - XF86XK_AudioRaiseVolume, Qt::Key_VolumeUp, - XF86XK_AudioPlay, Qt::Key_MediaPlay, - XF86XK_AudioStop, Qt::Key_MediaStop, - XF86XK_AudioPrev, Qt::Key_MediaPrevious, - XF86XK_AudioNext, Qt::Key_MediaNext, - XF86XK_AudioRecord, Qt::Key_MediaRecord, - XF86XK_Mail, Qt::Key_LaunchMail, - XF86XK_MyComputer, Qt::Key_Launch0, // ### Qt 5: remap properly - XF86XK_Calculator, Qt::Key_Launch1, - XF86XK_Memo, Qt::Key_Memo, - XF86XK_ToDoList, Qt::Key_ToDoList, - XF86XK_Calendar, Qt::Key_Calendar, - XF86XK_PowerDown, Qt::Key_PowerDown, - XF86XK_ContrastAdjust, Qt::Key_ContrastAdjust, - XF86XK_Standby, Qt::Key_Standby, - XF86XK_MonBrightnessUp, Qt::Key_MonBrightnessUp, - XF86XK_MonBrightnessDown, Qt::Key_MonBrightnessDown, - XF86XK_KbdLightOnOff, Qt::Key_KeyboardLightOnOff, - XF86XK_KbdBrightnessUp, Qt::Key_KeyboardBrightnessUp, - XF86XK_KbdBrightnessDown, Qt::Key_KeyboardBrightnessDown, - XF86XK_PowerOff, Qt::Key_PowerOff, - XF86XK_WakeUp, Qt::Key_WakeUp, - XF86XK_Eject, Qt::Key_Eject, - XF86XK_ScreenSaver, Qt::Key_ScreenSaver, - XF86XK_WWW, Qt::Key_WWW, - XF86XK_Sleep, Qt::Key_Sleep, - XF86XK_LightBulb, Qt::Key_LightBulb, - XF86XK_Shop, Qt::Key_Shop, - XF86XK_History, Qt::Key_History, - XF86XK_AddFavorite, Qt::Key_AddFavorite, - XF86XK_HotLinks, Qt::Key_HotLinks, - XF86XK_BrightnessAdjust, Qt::Key_BrightnessAdjust, - XF86XK_Finance, Qt::Key_Finance, - XF86XK_Community, Qt::Key_Community, - XF86XK_AudioRewind, Qt::Key_AudioRewind, - XF86XK_BackForward, Qt::Key_BackForward, - XF86XK_ApplicationLeft, Qt::Key_ApplicationLeft, - XF86XK_ApplicationRight, Qt::Key_ApplicationRight, - XF86XK_Book, Qt::Key_Book, - XF86XK_CD, Qt::Key_CD, - XF86XK_Calculater, Qt::Key_Calculator, - XF86XK_Clear, Qt::Key_Clear, - XF86XK_ClearGrab, Qt::Key_ClearGrab, - XF86XK_Close, Qt::Key_Close, - XF86XK_Copy, Qt::Key_Copy, - XF86XK_Cut, Qt::Key_Cut, - XF86XK_Display, Qt::Key_Display, - XF86XK_DOS, Qt::Key_DOS, - XF86XK_Documents, Qt::Key_Documents, - XF86XK_Excel, Qt::Key_Excel, - XF86XK_Explorer, Qt::Key_Explorer, - XF86XK_Game, Qt::Key_Game, - XF86XK_Go, Qt::Key_Go, - XF86XK_iTouch, Qt::Key_iTouch, - XF86XK_LogOff, Qt::Key_LogOff, - XF86XK_Market, Qt::Key_Market, - XF86XK_Meeting, Qt::Key_Meeting, - XF86XK_MenuKB, Qt::Key_MenuKB, - XF86XK_MenuPB, Qt::Key_MenuPB, - XF86XK_MySites, Qt::Key_MySites, - XF86XK_News, Qt::Key_News, - XF86XK_OfficeHome, Qt::Key_OfficeHome, - XF86XK_Option, Qt::Key_Option, - XF86XK_Paste, Qt::Key_Paste, - XF86XK_Phone, Qt::Key_Phone, - XF86XK_Reply, Qt::Key_Reply, - XF86XK_Reload, Qt::Key_Reload, - XF86XK_RotateWindows, Qt::Key_RotateWindows, - XF86XK_RotationPB, Qt::Key_RotationPB, - XF86XK_RotationKB, Qt::Key_RotationKB, - XF86XK_Save, Qt::Key_Save, - XF86XK_Send, Qt::Key_Send, - XF86XK_Spell, Qt::Key_Spell, - XF86XK_SplitScreen, Qt::Key_SplitScreen, - XF86XK_Support, Qt::Key_Support, - XF86XK_TaskPane, Qt::Key_TaskPane, - XF86XK_Terminal, Qt::Key_Terminal, - XF86XK_Tools, Qt::Key_Tools, - XF86XK_Travel, Qt::Key_Travel, - XF86XK_Video, Qt::Key_Video, - XF86XK_Word, Qt::Key_Word, - XF86XK_Xfer, Qt::Key_Xfer, - XF86XK_ZoomIn, Qt::Key_ZoomIn, - XF86XK_ZoomOut, Qt::Key_ZoomOut, - XF86XK_Away, Qt::Key_Away, - XF86XK_Messenger, Qt::Key_Messenger, - XF86XK_WebCam, Qt::Key_WebCam, - XF86XK_MailForward, Qt::Key_MailForward, - XF86XK_Pictures, Qt::Key_Pictures, - XF86XK_Music, Qt::Key_Music, - XF86XK_Battery, Qt::Key_Battery, - XF86XK_Bluetooth, Qt::Key_Bluetooth, - XF86XK_WLAN, Qt::Key_WLAN, - XF86XK_UWB, Qt::Key_UWB, - XF86XK_AudioForward, Qt::Key_AudioForward, - XF86XK_AudioRepeat, Qt::Key_AudioRepeat, - XF86XK_AudioRandomPlay, Qt::Key_AudioRandomPlay, - XF86XK_Subtitle, Qt::Key_Subtitle, - XF86XK_AudioCycleTrack, Qt::Key_AudioCycleTrack, - XF86XK_Time, Qt::Key_Time, - XF86XK_Select, Qt::Key_Select, - XF86XK_View, Qt::Key_View, - XF86XK_TopMenu, Qt::Key_TopMenu, - XF86XK_Bluetooth, Qt::Key_Bluetooth, - XF86XK_Suspend, Qt::Key_Suspend, - XF86XK_Hibernate, Qt::Key_Hibernate, - XF86XK_Launch0, Qt::Key_Launch2, // ### Qt 5: remap properly - XF86XK_Launch1, Qt::Key_Launch3, - XF86XK_Launch2, Qt::Key_Launch4, - XF86XK_Launch3, Qt::Key_Launch5, - XF86XK_Launch4, Qt::Key_Launch6, - XF86XK_Launch5, Qt::Key_Launch7, - XF86XK_Launch6, Qt::Key_Launch8, - XF86XK_Launch7, Qt::Key_Launch9, - XF86XK_Launch8, Qt::Key_LaunchA, - XF86XK_Launch9, Qt::Key_LaunchB, - XF86XK_LaunchA, Qt::Key_LaunchC, - XF86XK_LaunchB, Qt::Key_LaunchD, - XF86XK_LaunchC, Qt::Key_LaunchE, - XF86XK_LaunchD, Qt::Key_LaunchF, - XF86XK_LaunchE, Qt::Key_LaunchG, - XF86XK_LaunchF, Qt::Key_LaunchH, - - // Qtopia keys - QTOPIAXK_Select, Qt::Key_Select, - QTOPIAXK_Yes, Qt::Key_Yes, - QTOPIAXK_No, Qt::Key_No, - QTOPIAXK_Cancel, Qt::Key_Cancel, - QTOPIAXK_Printer, Qt::Key_Printer, - QTOPIAXK_Execute, Qt::Key_Execute, - QTOPIAXK_Sleep, Qt::Key_Sleep, - QTOPIAXK_Play, Qt::Key_Play, - QTOPIAXK_Zoom, Qt::Key_Zoom, - QTOPIAXK_Context1, Qt::Key_Context1, - QTOPIAXK_Context2, Qt::Key_Context2, - QTOPIAXK_Context3, Qt::Key_Context3, - QTOPIAXK_Context4, Qt::Key_Context4, - QTOPIAXK_Call, Qt::Key_Call, - QTOPIAXK_Hangup, Qt::Key_Hangup, - QTOPIAXK_Flip, Qt::Key_Flip, - - 0, 0 -}; - -static const unsigned short katakanaKeysymsToUnicode[] = { - 0x0000, 0x3002, 0x300C, 0x300D, 0x3001, 0x30FB, 0x30F2, 0x30A1, - 0x30A3, 0x30A5, 0x30A7, 0x30A9, 0x30E3, 0x30E5, 0x30E7, 0x30C3, - 0x30FC, 0x30A2, 0x30A4, 0x30A6, 0x30A8, 0x30AA, 0x30AB, 0x30AD, - 0x30AF, 0x30B1, 0x30B3, 0x30B5, 0x30B7, 0x30B9, 0x30BB, 0x30BD, - 0x30BF, 0x30C1, 0x30C4, 0x30C6, 0x30C8, 0x30CA, 0x30CB, 0x30CC, - 0x30CD, 0x30CE, 0x30CF, 0x30D2, 0x30D5, 0x30D8, 0x30DB, 0x30DE, - 0x30DF, 0x30E0, 0x30E1, 0x30E2, 0x30E4, 0x30E6, 0x30E8, 0x30E9, - 0x30EA, 0x30EB, 0x30EC, 0x30ED, 0x30EF, 0x30F3, 0x309B, 0x309C -}; - -static const unsigned short cyrillicKeysymsToUnicode[] = { - 0x0000, 0x0452, 0x0453, 0x0451, 0x0454, 0x0455, 0x0456, 0x0457, - 0x0458, 0x0459, 0x045a, 0x045b, 0x045c, 0x0000, 0x045e, 0x045f, - 0x2116, 0x0402, 0x0403, 0x0401, 0x0404, 0x0405, 0x0406, 0x0407, - 0x0408, 0x0409, 0x040a, 0x040b, 0x040c, 0x0000, 0x040e, 0x040f, - 0x044e, 0x0430, 0x0431, 0x0446, 0x0434, 0x0435, 0x0444, 0x0433, - 0x0445, 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, - 0x043f, 0x044f, 0x0440, 0x0441, 0x0442, 0x0443, 0x0436, 0x0432, - 0x044c, 0x044b, 0x0437, 0x0448, 0x044d, 0x0449, 0x0447, 0x044a, - 0x042e, 0x0410, 0x0411, 0x0426, 0x0414, 0x0415, 0x0424, 0x0413, - 0x0425, 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, - 0x041f, 0x042f, 0x0420, 0x0421, 0x0422, 0x0423, 0x0416, 0x0412, - 0x042c, 0x042b, 0x0417, 0x0428, 0x042d, 0x0429, 0x0427, 0x042a -}; - -static const unsigned short greekKeysymsToUnicode[] = { - 0x0000, 0x0386, 0x0388, 0x0389, 0x038a, 0x03aa, 0x0000, 0x038c, - 0x038e, 0x03ab, 0x0000, 0x038f, 0x0000, 0x0000, 0x0385, 0x2015, - 0x0000, 0x03ac, 0x03ad, 0x03ae, 0x03af, 0x03ca, 0x0390, 0x03cc, - 0x03cd, 0x03cb, 0x03b0, 0x03ce, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, - 0x0398, 0x0399, 0x039a, 0x039b, 0x039c, 0x039d, 0x039e, 0x039f, - 0x03a0, 0x03a1, 0x03a3, 0x0000, 0x03a4, 0x03a5, 0x03a6, 0x03a7, - 0x03a8, 0x03a9, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x03b1, 0x03b2, 0x03b3, 0x03b4, 0x03b5, 0x03b6, 0x03b7, - 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bc, 0x03bd, 0x03be, 0x03bf, - 0x03c0, 0x03c1, 0x03c3, 0x03c2, 0x03c4, 0x03c5, 0x03c6, 0x03c7, - 0x03c8, 0x03c9, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 -}; - -static const unsigned short technicalKeysymsToUnicode[] = { - 0x0000, 0x23B7, 0x250C, 0x2500, 0x2320, 0x2321, 0x2502, 0x23A1, - 0x23A3, 0x23A4, 0x23A6, 0x239B, 0x239D, 0x239E, 0x23A0, 0x23A8, - 0x23AC, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x2264, 0x2260, 0x2265, 0x222B, - 0x2234, 0x221D, 0x221E, 0x0000, 0x0000, 0x2207, 0x0000, 0x0000, - 0x223C, 0x2243, 0x0000, 0x0000, 0x0000, 0x21D4, 0x21D2, 0x2261, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x221A, 0x0000, - 0x0000, 0x0000, 0x2282, 0x2283, 0x2229, 0x222A, 0x2227, 0x2228, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2202, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0192, 0x0000, - 0x0000, 0x0000, 0x0000, 0x2190, 0x2191, 0x2192, 0x2193, 0x0000 -}; - -static const unsigned short specialKeysymsToUnicode[] = { - 0x25C6, 0x2592, 0x2409, 0x240C, 0x240D, 0x240A, 0x0000, 0x0000, - 0x2424, 0x240B, 0x2518, 0x2510, 0x250C, 0x2514, 0x253C, 0x23BA, - 0x23BB, 0x2500, 0x23BC, 0x23BD, 0x251C, 0x2524, 0x2534, 0x252C, - 0x2502, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 -}; - -static const unsigned short publishingKeysymsToUnicode[] = { - 0x0000, 0x2003, 0x2002, 0x2004, 0x2005, 0x2007, 0x2008, 0x2009, - 0x200a, 0x2014, 0x2013, 0x0000, 0x0000, 0x0000, 0x2026, 0x2025, - 0x2153, 0x2154, 0x2155, 0x2156, 0x2157, 0x2158, 0x2159, 0x215a, - 0x2105, 0x0000, 0x0000, 0x2012, 0x2329, 0x0000, 0x232a, 0x0000, - 0x0000, 0x0000, 0x0000, 0x215b, 0x215c, 0x215d, 0x215e, 0x0000, - 0x0000, 0x2122, 0x2613, 0x0000, 0x25c1, 0x25b7, 0x25cb, 0x25af, - 0x2018, 0x2019, 0x201c, 0x201d, 0x211e, 0x0000, 0x2032, 0x2033, - 0x0000, 0x271d, 0x0000, 0x25ac, 0x25c0, 0x25b6, 0x25cf, 0x25ae, - 0x25e6, 0x25ab, 0x25ad, 0x25b3, 0x25bd, 0x2606, 0x2022, 0x25aa, - 0x25b2, 0x25bc, 0x261c, 0x261e, 0x2663, 0x2666, 0x2665, 0x0000, - 0x2720, 0x2020, 0x2021, 0x2713, 0x2717, 0x266f, 0x266d, 0x2642, - 0x2640, 0x260e, 0x2315, 0x2117, 0x2038, 0x201a, 0x201e, 0x0000 -}; - -static const unsigned short aplKeysymsToUnicode[] = { - 0x0000, 0x0000, 0x0000, 0x003c, 0x0000, 0x0000, 0x003e, 0x0000, - 0x2228, 0x2227, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x00af, 0x0000, 0x22a5, 0x2229, 0x230a, 0x0000, 0x005f, 0x0000, - 0x0000, 0x0000, 0x2218, 0x0000, 0x2395, 0x0000, 0x22a4, 0x25cb, - 0x0000, 0x0000, 0x0000, 0x2308, 0x0000, 0x0000, 0x222a, 0x0000, - 0x2283, 0x0000, 0x2282, 0x0000, 0x22a2, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x22a3, 0x0000, 0x0000, 0x0000 -}; - -static const unsigned short koreanKeysymsToUnicode[] = { - 0x0000, 0x3131, 0x3132, 0x3133, 0x3134, 0x3135, 0x3136, 0x3137, - 0x3138, 0x3139, 0x313a, 0x313b, 0x313c, 0x313d, 0x313e, 0x313f, - 0x3140, 0x3141, 0x3142, 0x3143, 0x3144, 0x3145, 0x3146, 0x3147, - 0x3148, 0x3149, 0x314a, 0x314b, 0x314c, 0x314d, 0x314e, 0x314f, - 0x3150, 0x3151, 0x3152, 0x3153, 0x3154, 0x3155, 0x3156, 0x3157, - 0x3158, 0x3159, 0x315a, 0x315b, 0x315c, 0x315d, 0x315e, 0x315f, - 0x3160, 0x3161, 0x3162, 0x3163, 0x11a8, 0x11a9, 0x11aa, 0x11ab, - 0x11ac, 0x11ad, 0x11ae, 0x11af, 0x11b0, 0x11b1, 0x11b2, 0x11b3, - 0x11b4, 0x11b5, 0x11b6, 0x11b7, 0x11b8, 0x11b9, 0x11ba, 0x11bb, - 0x11bc, 0x11bd, 0x11be, 0x11bf, 0x11c0, 0x11c1, 0x11c2, 0x316d, - 0x3171, 0x3178, 0x317f, 0x3181, 0x3184, 0x3186, 0x318d, 0x318e, - 0x11eb, 0x11f0, 0x11f9, 0x0000, 0x0000, 0x0000, 0x0000, 0x20a9 -}; - -static QChar keysymToUnicode(unsigned char byte3, unsigned char byte4) -{ - switch (byte3) { - case 0x04: - // katakana - if (byte4 > 0xa0 && byte4 < 0xe0) - return QChar(katakanaKeysymsToUnicode[byte4 - 0xa0]); - else if (byte4 == 0x7e) - return QChar(0x203e); // Overline - break; - case 0x06: - // russian, use lookup table - if (byte4 > 0xa0) - return QChar(cyrillicKeysymsToUnicode[byte4 - 0xa0]); - break; - case 0x07: - // greek - if (byte4 > 0xa0) - return QChar(greekKeysymsToUnicode[byte4 - 0xa0]); - break; - case 0x08: - // technical - if (byte4 > 0xa0) - return QChar(technicalKeysymsToUnicode[byte4 - 0xa0]); - break; - case 0x09: - // special - if (byte4 >= 0xe0) - return QChar(specialKeysymsToUnicode[byte4 - 0xe0]); - break; - case 0x0a: - // publishing - if (byte4 > 0xa0) - return QChar(publishingKeysymsToUnicode[byte4 - 0xa0]); - break; - case 0x0b: - // APL - if (byte4 > 0xa0) - return QChar(aplKeysymsToUnicode[byte4 - 0xa0]); - break; - case 0x0e: - // Korean - if (byte4 > 0xa0) - return QChar(koreanKeysymsToUnicode[byte4 - 0xa0]); - break; - default: - break; - } - return QChar(0x0); -} - -Qt::KeyboardModifiers QXlibKeyboard::translateModifiers(int s) -{ - Qt::KeyboardModifiers ret = 0; - if (s & ShiftMask) - ret |= Qt::ShiftModifier; - if (s & ControlMask) - ret |= Qt::ControlModifier; - if (s & m_alt_mask) - ret |= Qt::AltModifier; - if (s & m_meta_mask) - ret |= Qt::MetaModifier; -// if (s & m_mode_switch_mask) //doesn't seem to work correctly -// ret |= Qt::GroupSwitchModifier; - return ret; -} - -void QXlibKeyboard::setMask(KeySym sym, uint mask) -{ - if (m_alt_mask == 0 - && m_meta_mask != mask - && m_super_mask != mask - && m_hyper_mask != mask - && (sym == XK_Alt_L || sym == XK_Alt_R)) { - m_alt_mask = mask; - } - if (m_meta_mask == 0 - && m_alt_mask != mask - && m_super_mask != mask - && m_hyper_mask != mask - && (sym == XK_Meta_L || sym == XK_Meta_R)) { - m_meta_mask = mask; - } - if (m_super_mask == 0 - && m_alt_mask != mask - && m_meta_mask != mask - && m_hyper_mask != mask - && (sym == XK_Super_L || sym == XK_Super_R)) { - m_super_mask = mask; - } - if (m_hyper_mask == 0 - && m_alt_mask != mask - && m_meta_mask != mask - && m_super_mask != mask - && (sym == XK_Hyper_L || sym == XK_Hyper_R)) { - m_hyper_mask = mask; - } - if (m_mode_switch_mask == 0 - && m_alt_mask != mask - && m_meta_mask != mask - && m_super_mask != mask - && m_hyper_mask != mask - && sym == XK_Mode_switch) { - m_mode_switch_mask = mask; - } - if (m_num_lock_mask == 0 - && sym == XK_Num_Lock) { - m_num_lock_mask = mask; - } -} - -int QXlibKeyboard::translateKeySym(uint key) const -{ - int code = -1; - int i = 0; // any other keys - while (KeyTbl[i]) { - if (key == KeyTbl[i]) { - code = (int)KeyTbl[i+1]; - break; - } - i += 2; - } - if (m_meta_mask) { - // translate Super/Hyper keys to Meta if we're using them as the MetaModifier - if (m_meta_mask == m_super_mask && (code == Qt::Key_Super_L || code == Qt::Key_Super_R)) { - code = Qt::Key_Meta; - } else if (m_meta_mask == m_hyper_mask && (code == Qt::Key_Hyper_L || code == Qt::Key_Hyper_R)) { - code = Qt::Key_Meta; - } - } - return code; -} - -QString QXlibKeyboard::translateKeySym(KeySym keysym, uint xmodifiers, - int &code, Qt::KeyboardModifiers &modifiers, - QByteArray &chars, int &count) -{ - // all keysyms smaller than 0xff00 are actally keys that can be mapped to unicode chars - - QTextCodec *mapper = QTextCodec::codecForLocale(); - QChar converted; - - if (/*count == 0 &&*/ keysym < 0xff00) { - unsigned char byte3 = (unsigned char)(keysym >> 8); - int mib = -1; - switch(byte3) { - case 0: // Latin 1 - case 1: // Latin 2 - case 2: //latin 3 - case 3: // latin4 - mib = byte3 + 4; break; - case 5: // arabic - mib = 82; break; - case 12: // Hebrew - mib = 85; break; - case 13: // Thai - mib = 2259; break; - case 4: // kana - case 6: // cyrillic - case 7: // greek - case 8: // technical, no mapping here at the moment - case 9: // Special - case 10: // Publishing - case 11: // APL - case 14: // Korean, no mapping - mib = -1; // manual conversion - mapper= 0; -#if !defined(QT_NO_XIM) - converted = keysymToUnicode(byte3, keysym & 0xff); -#endif - case 0x20: - // currency symbols - if (keysym >= 0x20a0 && keysym <= 0x20ac) { - mib = -1; // manual conversion - mapper = 0; - converted = (uint)keysym; - } - break; - default: - break; - } - if (mib != -1) { - mapper = QTextCodec::codecForMib(mib); - if (chars.isEmpty()) - chars.resize(1); - chars[0] = (unsigned char) (keysym & 0xff); // get only the fourth bit for conversion later - count = 1; - } - } else if (keysym >= 0x1000000 && keysym <= 0x100ffff) { - converted = (ushort) (keysym - 0x1000000); - mapper = 0; - } - if (count < (int)chars.size()-1) - chars[count] = '\0'; - - QString text; - if (!mapper && converted.unicode() != 0x0) { - text = converted; - } else if (!chars.isEmpty()) { - // convert chars (8bit) to text (unicode). - if (mapper) - text = mapper->toUnicode(chars.data(), count, 0); - if (text.isEmpty()) { - // no mapper, or codec couldn't convert to unicode (this - // can happen when running in the C locale or with no LANG - // set). try converting from latin-1 - text = QString::fromLatin1(chars); - } - } - - modifiers = translateModifiers(xmodifiers); - - // Commentary in X11/keysymdef says that X codes match ASCII, so it - // is safe to use the locale functions to process X codes in ISO8859-1. - // - // This is mainly for compatibility - applications should not use the - // Qt keycodes between 128 and 255, but should rather use the - // QKeyEvent::text(). - // - if (keysym < 128 || (keysym < 256 && (!mapper || mapper->mibEnum()==4))) { - // upper-case key, if known - code = isprint((int)keysym) ? toupper((int)keysym) : 0; - } else if (keysym >= XK_F1 && keysym <= XK_F35) { - // function keys - code = Qt::Key_F1 + ((int)keysym - XK_F1); - } else if (keysym >= XK_KP_Space && keysym <= XK_KP_9) { - if (keysym >= XK_KP_0) { - // numeric keypad keys - code = Qt::Key_0 + ((int)keysym - XK_KP_0); - } else { - code = translateKeySym(keysym); - } - modifiers |= Qt::KeypadModifier; - } else if (text.length() == 1 && text.unicode()->unicode() > 0x1f && text.unicode()->unicode() != 0x7f && !(keysym >= XK_dead_grave && keysym <= XK_dead_horn)) { - code = text.unicode()->toUpper().unicode(); - } else { - // any other keys - code = translateKeySym(keysym); - - if (code == Qt::Key_Tab && (modifiers & Qt::ShiftModifier)) { - // map shift+tab to shift+backtab, QShortcutMap knows about it - // and will handle it. - code = Qt::Key_Backtab; - text = QString(); - } - } - - return text; -} - -QXlibKeyboard::QXlibKeyboard(QXlibScreen *screen) - : m_screen(screen) - , m_alt_mask(0) - , m_super_mask(0) - , m_hyper_mask(0) - , m_meta_mask(0) -{ - changeLayout(); -} - -void QXlibKeyboard::changeLayout() -{ - XkbDescPtr xkbDesc = XkbGetMap(m_screen->display(), XkbAllClientInfoMask, XkbUseCoreKbd); - for (int i = xkbDesc->min_key_code; i < xkbDesc->max_key_code; ++i) { - const uint mask = xkbDesc->map->modmap ? xkbDesc->map->modmap[i] : 0; - if (mask == 0) { - // key is not bound to a modifier - continue; - } - - for (int j = 0; j < XkbKeyGroupsWidth(xkbDesc, i); ++j) { - KeySym keySym = XkbKeySym(xkbDesc, i, j); - if (keySym == NoSymbol) - continue; - setMask(keySym, mask); - } - } - XkbFreeKeyboard(xkbDesc, XkbAllComponentsMask, true); - -} - -static Qt::KeyboardModifiers modifierFromKeyCode(int qtcode) -{ - switch (qtcode) { - case Qt::Key_Control: - return Qt::ControlModifier; - case Qt::Key_Alt: - return Qt::AltModifier; - case Qt::Key_Shift: - return Qt::ShiftModifier; - case Qt::Key_Meta: - return Qt::MetaModifier; - default: - return Qt::NoModifier; - } -} - -void QXlibKeyboard::handleKeyEvent(QWidget *widget, QEvent::Type type, XKeyEvent *ev) -{ - int qtcode = 0; - Qt::KeyboardModifiers modifiers = translateModifiers(ev->state); - QByteArray chars; - chars.resize(513); - int count = 0; - KeySym keySym; - count = XLookupString(ev,chars.data(),chars.size(),&keySym,0); - QString text = translateKeySym(keySym,ev->state,qtcode,modifiers,chars,count); - QWindowSystemInterface::handleKeyEvent(widget,ev->time,type,qtcode,modifiers,text.left(count)); -} diff --git a/src/plugins/platforms/xlib/qtestlitekeyboard.h b/src/plugins/platforms/xlib/qtestlitekeyboard.h deleted file mode 100644 index 98df4e1..0000000 --- a/src/plugins/platforms/xlib/qtestlitekeyboard.h +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QTESTLITEKEYBOARD_H -#define QTESTLITEKEYBOARD_H - -#include "qtestliteintegration.h" - -class QXlibKeyboard -{ -public: - QXlibKeyboard(QXlibScreen *screen); - - void changeLayout(); - - void handleKeyEvent(QWidget *widget, QEvent::Type type, XKeyEvent *ev); - - Qt::KeyboardModifiers translateModifiers(int s); - -private: - - void setMask(KeySym sym, uint mask); - int translateKeySym(uint key) const; - QString translateKeySym(KeySym keysym, uint xmodifiers, - int &code, Qt::KeyboardModifiers &modifiers, - QByteArray &chars, int &count); - - QXlibScreen *m_screen; - - uint m_alt_mask; - uint m_super_mask; - uint m_hyper_mask; - uint m_meta_mask; - uint m_mode_switch_mask; - uint m_num_lock_mask; -}; - -#endif // QTESTLITEKEYBOARD_H diff --git a/src/plugins/platforms/xlib/qtestlitemime.cpp b/src/plugins/platforms/xlib/qtestlitemime.cpp deleted file mode 100644 index 5335ae9..0000000 --- a/src/plugins/platforms/xlib/qtestlitemime.cpp +++ /dev/null @@ -1,322 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qtestlitemime.h" - -#include "qtestlitestaticinfo.h" -#include "qtestlitescreen.h" - -#include <QtCore/QTextCodec> -#include <QtGui/QImageWriter> -#include <QtCore/QBuffer> - -QXlibMime::QXlibMime() - : QInternalMimeData() -{ } - -QXlibMime::~QXlibMime() -{} - - - - - -QString QXlibMime::mimeAtomToString(Display *display, Atom a) -{ - if (!a) return 0; - - if (a == XA_STRING || a == QXlibStatic::atom(QXlibStatic::UTF8_STRING)) { - return "text/plain"; // some Xdnd clients are dumb - } - char *atom = XGetAtomName(display, a); - QString result = QString::fromLatin1(atom); - XFree(atom); - return result; -} - -Atom QXlibMime::mimeStringToAtom(Display *display, const QString &mimeType) -{ - if (mimeType.isEmpty()) - return 0; - return XInternAtom(display, mimeType.toLatin1().constData(), False); -} - -QStringList QXlibMime::mimeFormatsForAtom(Display *display, Atom a) -{ - QStringList formats; - if (a) { - QString atomName = mimeAtomToString(display, a); - formats.append(atomName); - - // special cases for string type - if (a == QXlibStatic::atom(QXlibStatic::UTF8_STRING) - || a == XA_STRING - || a == QXlibStatic::atom(QXlibStatic::TEXT) - || a == QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT)) - formats.append(QLatin1String("text/plain")); - - // special cases for uris - if (atomName == QLatin1String("text/x-moz-url")) - formats.append(QLatin1String("text/uri-list")); - - // special case for images - if (a == XA_PIXMAP) - formats.append(QLatin1String("image/ppm")); - } - return formats; -} - -bool QXlibMime::mimeDataForAtom(Display *display, Atom a, QMimeData *mimeData, QByteArray *data, Atom *atomFormat, int *dataFormat) -{ - bool ret = false; - *atomFormat = a; - *dataFormat = 8; - QString atomName = mimeAtomToString(display, a); - if (QInternalMimeData::hasFormatHelper(atomName, mimeData)) { - *data = QInternalMimeData::renderDataHelper(atomName, mimeData); - if (atomName == QLatin1String("application/x-color")) - *dataFormat = 16; - ret = true; - } else { - if ((a == QXlibStatic::atom(QXlibStatic::UTF8_STRING) - || a == XA_STRING - || a == QXlibStatic::atom(QXlibStatic::TEXT) - || a == QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT)) - && QInternalMimeData::hasFormatHelper(QLatin1String("text/plain"), mimeData)) { - if (a == QXlibStatic::atom(QXlibStatic::UTF8_STRING)){ - *data = QInternalMimeData::renderDataHelper(QLatin1String("text/plain"), mimeData); - ret = true; - } else if (a == XA_STRING) { - *data = QString::fromUtf8(QInternalMimeData::renderDataHelper( - QLatin1String("text/plain"), mimeData)).toLocal8Bit(); - ret = true; - } else if (a == QXlibStatic::atom(QXlibStatic::TEXT) - || a == QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT)) { - // the ICCCM states that TEXT and COMPOUND_TEXT are in the - // encoding of choice, so we choose the encoding of the locale - QByteArray strData = QString::fromUtf8(QInternalMimeData::renderDataHelper( - QLatin1String("text/plain"), mimeData)).toLocal8Bit(); - char *list[] = { strData.data(), NULL }; - - XICCEncodingStyle style = (a == QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT)) - ? XCompoundTextStyle : XStdICCTextStyle; - XTextProperty textprop; - if (list[0] != NULL - && XmbTextListToTextProperty(display, list, 1, style, - &textprop) == Success) { - *atomFormat = textprop.encoding; - *dataFormat = textprop.format; - *data = QByteArray((const char *) textprop.value, textprop.nitems * textprop.format / 8); - ret = true; - - XFree(textprop.value); - } - } - } else if (atomName == QLatin1String("text/x-moz-url") && - QInternalMimeData::hasFormatHelper(QLatin1String("text/uri-list"), mimeData)) { - QByteArray uri = QInternalMimeData::renderDataHelper( - QLatin1String("text/uri-list"), mimeData).split('\n').first(); - QString mozUri = QString::fromLatin1(uri, uri.size()); - mozUri += QLatin1Char('\n'); - *data = QByteArray(reinterpret_cast<const char *>(mozUri.utf16()), mozUri.length() * 2); - ret = true; - } else if ((a == XA_PIXMAP || a == XA_BITMAP) && mimeData->hasImage()) { - ret = true; - } - } - return ret && data != 0; -} - -QList<Atom> QXlibMime::mimeAtomsForFormat(Display *display, const QString &format) -{ - QList<Atom> atoms; - atoms.append(mimeStringToAtom(display, format)); - - // special cases for strings - if (format == QLatin1String("text/plain")) { - atoms.append(QXlibStatic::atom(QXlibStatic::UTF8_STRING)); - atoms.append(XA_STRING); - atoms.append(QXlibStatic::atom(QXlibStatic::TEXT)); - atoms.append(QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT)); - } - - // special cases for uris - if (format == QLatin1String("text/uri-list")) { - atoms.append(mimeStringToAtom(display,QLatin1String("text/x-moz-url"))); - } - - //special cases for images - if (format == QLatin1String("image/ppm")) - atoms.append(XA_PIXMAP); - if (format == QLatin1String("image/pbm")) - atoms.append(XA_BITMAP); - - return atoms; -} - -QVariant QXlibMime::mimeConvertToFormat(Display *display, Atom a, const QByteArray &data, const QString &format, QVariant::Type requestedType, const QByteArray &encoding) -{ - QString atomName = mimeAtomToString(display,a); - if (atomName == format) - return data; - - if (!encoding.isEmpty() - && atomName == format + QLatin1String(";charset=") + QString::fromLatin1(encoding)) { - - if (requestedType == QVariant::String) { - QTextCodec *codec = QTextCodec::codecForName(encoding); - if (codec) - return codec->toUnicode(data); - } - - return data; - } - - // special cases for string types - if (format == QLatin1String("text/plain")) { - if (a == QXlibStatic::atom(QXlibStatic::UTF8_STRING)) - return QString::fromUtf8(data); - if (a == XA_STRING) - return QString::fromLatin1(data); - if (a == QXlibStatic::atom(QXlibStatic::TEXT) - || a == QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT)) - // #### might be wrong for COMPUND_TEXT - return QString::fromLocal8Bit(data, data.size()); - } - - // special case for uri types - if (format == QLatin1String("text/uri-list")) { - if (atomName == QLatin1String("text/x-moz-url")) { - // we expect this as utf16 <url><space><title> - // the first part is a url that should only contain ascci char - // so it should be safe to check that the second char is 0 - // to verify that it is utf16 - if (data.size() > 1 && data.at(1) == 0) - return QString::fromRawData((const QChar *)data.constData(), - data.size() / 2).split(QLatin1Char('\n')).first().toLatin1(); - } - } - - // special cas for images - if (format == QLatin1String("image/ppm")) { - if (a == XA_PIXMAP && data.size() == sizeof(Pixmap)) { - Pixmap xpm = *((Pixmap*)data.data()); - if (!xpm) - return QByteArray(); - Window root; - int x; - int y; - uint width; - uint height; - uint border_width; - uint depth; - - XGetGeometry(display, xpm, &root, &x, &y, &width, &height, &border_width, &depth); - XImage *ximg = XGetImage(display,xpm,x,y,width,height,AllPlanes,depth==1 ? XYPixmap : ZPixmap); - QImage qimg = QXlibStatic::qimageFromXImage(ximg); - XDestroyImage(ximg); - - QImageWriter imageWriter; - imageWriter.setFormat("PPMRAW"); - QBuffer buf; - buf.open(QIODevice::WriteOnly); - imageWriter.setDevice(&buf); - imageWriter.write(qimg); - return buf.buffer(); - } - } - return QVariant(); -} - -Atom QXlibMime::mimeAtomForFormat(Display *display, const QString &format, QVariant::Type requestedType, const QList<Atom> &atoms, QByteArray *requestedEncoding) -{ - requestedEncoding->clear(); - - // find matches for string types - if (format == QLatin1String("text/plain")) { - if (atoms.contains(QXlibStatic::atom(QXlibStatic::UTF8_STRING))) - return QXlibStatic::atom(QXlibStatic::UTF8_STRING); - if (atoms.contains(QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT))) - return QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT); - if (atoms.contains(QXlibStatic::atom(QXlibStatic::TEXT))) - return QXlibStatic::atom(QXlibStatic::TEXT); - if (atoms.contains(XA_STRING)) - return XA_STRING; - } - - // find matches for uri types - if (format == QLatin1String("text/uri-list")) { - Atom a = mimeStringToAtom(display,format); - if (a && atoms.contains(a)) - return a; - a = mimeStringToAtom(display,QLatin1String("text/x-moz-url")); - if (a && atoms.contains(a)) - return a; - } - - // find match for image - if (format == QLatin1String("image/ppm")) { - if (atoms.contains(XA_PIXMAP)) - return XA_PIXMAP; - } - - // for string/text requests try to use a format with a well-defined charset - // first to avoid encoding problems - if (requestedType == QVariant::String - && format.startsWith(QLatin1String("text/")) - && !format.contains(QLatin1String("charset="))) { - - QString formatWithCharset = format; - formatWithCharset.append(QLatin1String(";charset=utf-8")); - - Atom a = mimeStringToAtom(display,formatWithCharset); - if (a && atoms.contains(a)) { - *requestedEncoding = "utf-8"; - return a; - } - } - - Atom a = mimeStringToAtom(display,format); - if (a && atoms.contains(a)) - return a; - - return 0; -} diff --git a/src/plugins/platforms/xlib/qtestlitemime.h b/src/plugins/platforms/xlib/qtestlitemime.h deleted file mode 100644 index 6a70ea4..0000000 --- a/src/plugins/platforms/xlib/qtestlitemime.h +++ /dev/null @@ -1,67 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QTESTLITEMIME_H -#define QTESTLITEMIME_H - -#include <private/qdnd_p.h> - -#include <QtGui/QClipboard> - -#include "qtestliteintegration.h" -#include "qtestliteclipboard.h" - -class QXlibMime : public QInternalMimeData { - Q_OBJECT -public: - QXlibMime(); - ~QXlibMime(); - - static QList<Atom> mimeAtomsForFormat(Display *display, const QString &format); - static QString mimeAtomToString(Display *display, Atom a); - static bool mimeDataForAtom(Display *display, Atom a, QMimeData *mimeData, QByteArray *data, Atom *atomFormat, int *dataFormat); - static QStringList mimeFormatsForAtom(Display *display, Atom a); - static Atom mimeStringToAtom(Display *display, const QString &mimeType); - static QVariant mimeConvertToFormat(Display *display, Atom a, const QByteArray &data, const QString &format, QVariant::Type requestedType, const QByteArray &encoding); - static Atom mimeAtomForFormat(Display *display, const QString &format, QVariant::Type requestedType, const QList<Atom> &atoms, QByteArray *requestedEncoding); -}; - -#endif // QTESTLITEMIME_H diff --git a/src/plugins/platforms/xlib/qtestlitescreen.cpp b/src/plugins/platforms/xlib/qtestlitescreen.cpp deleted file mode 100644 index 714c17b..0000000 --- a/src/plugins/platforms/xlib/qtestlitescreen.cpp +++ /dev/null @@ -1,468 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qtestlitescreen.h" - -#include "qtestlitecursor.h" -#include "qtestlitewindow.h" -#include "qtestlitekeyboard.h" -#include "qtestlitestaticinfo.h" -#include "qtestliteclipboard.h" - -#include <QtCore/QDebug> -#include <QtCore/QSocketNotifier> -#include <QtCore/QElapsedTimer> - -#include <private/qapplication_p.h> - -#include <X11/extensions/Xfixes.h> - -QT_BEGIN_NAMESPACE - -static int (*original_x_errhandler)(Display *dpy, XErrorEvent *); -static bool seen_badwindow; - -static int qt_x_errhandler(Display *dpy, XErrorEvent *err) -{ - -qDebug() << "qt_x_errhandler" << err->error_code; - - switch (err->error_code) { - case BadAtom: -#if 0 - if (err->request_code == 20 /* X_GetProperty */ - && (err->resourceid == XA_RESOURCE_MANAGER - || err->resourceid == XA_RGB_DEFAULT_MAP - || err->resourceid == ATOM(_NET_SUPPORTED) - || err->resourceid == ATOM(_NET_SUPPORTING_WM_CHECK) - || err->resourceid == ATOM(KDE_FULL_SESSION) - || err->resourceid == ATOM(KWIN_RUNNING) - || err->resourceid == ATOM(XdndProxy) - || err->resourceid == ATOM(XdndAware)) - - - ) { - // Perhaps we're running under SECURITY reduction? :/ - return 0; - } -#endif - qDebug() << "BadAtom"; - break; - - case BadWindow: - if (err->request_code == 2 /* X_ChangeWindowAttributes */ - || err->request_code == 38 /* X_QueryPointer */) { - for (int i = 0; i < ScreenCount(dpy); ++i) { - if (err->resourceid == RootWindow(dpy, i)) { - // Perhaps we're running under SECURITY reduction? :/ - return 0; - } - } - } - seen_badwindow = true; - if (err->request_code == 25 /* X_SendEvent */) { - for (int i = 0; i < ScreenCount(dpy); ++i) { - if (err->resourceid == RootWindow(dpy, i)) { - // Perhaps we're running under SECURITY reduction? :/ - return 0; - } - } -#if 0 - if (X11->xdndHandleBadwindow()) { - qDebug("xdndHandleBadwindow returned true"); - return 0; - } -#endif - } -#if 0 - if (X11->ignore_badwindow) - return 0; -#endif - break; - - case BadMatch: - if (err->request_code == 42 /* X_SetInputFocus */) - return 0; - break; - - default: -#if 0 //!defined(QT_NO_XINPUT) - if (err->request_code == X11->xinput_major - && err->error_code == (X11->xinput_errorbase + XI_BadDevice) - && err->minor_code == 3 /* X_OpenDevice */) { - return 0; - } -#endif - break; - } - - char errstr[256]; - XGetErrorText( dpy, err->error_code, errstr, 256 ); - char buffer[256]; - char request_str[256]; - qsnprintf(buffer, 256, "%d", err->request_code); - XGetErrorDatabaseText(dpy, "XRequest", buffer, "", request_str, 256); - if (err->request_code < 128) { - // X error for a normal protocol request - qWarning( "X Error: %s %d\n" - " Major opcode: %d (%s)\n" - " Resource id: 0x%lx", - errstr, err->error_code, - err->request_code, - request_str, - err->resourceid ); - } else { - // X error for an extension request - const char *extensionName = 0; -#if 0 - if (err->request_code == X11->xrender_major) - extensionName = "RENDER"; - else if (err->request_code == X11->xrandr_major) - extensionName = "RANDR"; - else if (err->request_code == X11->xinput_major) - extensionName = "XInputExtension"; - else if (err->request_code == X11->mitshm_major) - extensionName = "MIT-SHM"; -#endif - char minor_str[256]; - if (extensionName) { - qsnprintf(buffer, 256, "%s.%d", extensionName, err->minor_code); - XGetErrorDatabaseText(dpy, "XRequest", buffer, "", minor_str, 256); - } else { - extensionName = "Uknown extension"; - qsnprintf(minor_str, 256, "Unknown request"); - } - qWarning( "X Error: %s %d\n" - " Extension: %d (%s)\n" - " Minor opcode: %d (%s)\n" - " Resource id: 0x%lx", - errstr, err->error_code, - err->request_code, - extensionName, - err->minor_code, - minor_str, - err->resourceid ); - } - - // ### we really should distinguish between severe, non-severe and - // ### application specific errors - - return 0; -} - -QXlibScreen::QXlibScreen() - : mFormat(QImage::Format_RGB32) -{ - char *display_name = getenv("DISPLAY"); - mDisplay = XOpenDisplay(display_name); - mDisplayName = QString::fromLocal8Bit(display_name); - if (!mDisplay) { - fprintf(stderr, "Cannot connect to X server: %s\n", - display_name); - exit(1); - } - -#ifndef DONT_USE_MIT_SHM - Status MIT_SHM_extension_supported = XShmQueryExtension (mDisplay); - Q_ASSERT(MIT_SHM_extension_supported == True); -#endif - original_x_errhandler = XSetErrorHandler(qt_x_errhandler); - - if (qgetenv("DO_X_SYNCHRONIZE").toInt()) - XSynchronize(mDisplay, true); - - mScreen = DefaultScreen(mDisplay); - XSelectInput(mDisplay,rootWindow(), KeymapStateMask | EnterWindowMask | LeaveWindowMask | PropertyChangeMask); - int width = DisplayWidth(mDisplay, mScreen); - int height = DisplayHeight(mDisplay, mScreen); - mGeometry = QRect(0,0,width,height); - - int physicalWidth = DisplayWidthMM(mDisplay, mScreen); - int physicalHeight = DisplayHeightMM(mDisplay, mScreen); - mPhysicalSize = QSize(physicalWidth,physicalHeight); - - int xSocketNumber = XConnectionNumber(mDisplay); - - mDepth = DefaultDepth(mDisplay,mScreen); -#ifdef MYX11_DEBUG - qDebug() << "X socket:"<< xSocketNumber; -#endif - QSocketNotifier *sock = new QSocketNotifier(xSocketNumber, QSocketNotifier::Read, this); - connect(sock, SIGNAL(activated(int)), this, SLOT(eventDispatcher())); - - mCursor = new QXlibCursor(this); - mKeyboard = new QXlibKeyboard(this); -} - -QXlibScreen::~QXlibScreen() -{ - delete mCursor; - XCloseDisplay(mDisplay); -} - -#ifdef KeyPress -#undef KeyPress -#endif -#ifdef KeyRelease -#undef KeyRelease -#endif - -bool QXlibScreen::handleEvent(XEvent *xe) -{ - int quit = false; - QXlibWindow *platformWindow = 0; - QWidget *widget = QWidget::find(xe->xany.window); - if (widget) { - platformWindow = static_cast<QXlibWindow *>(widget->platformWindow()); - } - - Atom wmProtocolsAtom = QXlibStatic::atom(QXlibStatic::WM_PROTOCOLS); - Atom wmDeleteWindowAtom = QXlibStatic::atom(QXlibStatic::WM_DELETE_WINDOW); - switch (xe->type) { - - case ClientMessage: - if (xe->xclient.format == 32 && xe->xclient.message_type == wmProtocolsAtom) { - Atom a = xe->xclient.data.l[0]; - if (a == wmDeleteWindowAtom) - platformWindow->handleCloseEvent(); - } - break; - - case Expose: - if (platformWindow) - if (xe->xexpose.count == 0) - platformWindow->paintEvent(); - break; - case ConfigureNotify: - if (platformWindow) - platformWindow->resizeEvent(&xe->xconfigure); - break; - - case ButtonPress: - if (platformWindow) - platformWindow->mousePressEvent(&xe->xbutton); - break; - - case ButtonRelease: - if (platformWindow) - platformWindow->handleMouseEvent(QEvent::MouseButtonRelease, &xe->xbutton); - break; - - case MotionNotify: - if (platformWindow) - platformWindow->handleMouseEvent(QEvent::MouseMove, &xe->xbutton); - break; - - case XKeyPress: - mKeyboard->handleKeyEvent(widget,QEvent::KeyPress, &xe->xkey); - break; - - case XKeyRelease: - mKeyboard->handleKeyEvent(widget,QEvent::KeyRelease, &xe->xkey); - break; - - case EnterNotify: - if (platformWindow) - platformWindow->handleEnterEvent(); - break; - - case LeaveNotify: - if (platformWindow) - platformWindow->handleLeaveEvent(); - break; - - case XFocusIn: - if (platformWindow) - platformWindow->handleFocusInEvent(); - break; - - case XFocusOut: - if (platformWindow) - platformWindow->handleFocusOutEvent(); - break; - - case PropertyNotify: - break; - - case SelectionClear: - qDebug() << "Selection Clear!!!"; - break; - case SelectionRequest: - handleSelectionRequest(xe); - break; - case SelectionNotify: - qDebug() << "Selection Notify!!!!"; - - break; - - - default: -#ifdef MYX11_DEBUG - qDebug() << hex << xe->xany.window << "Other X event" << xe->type; -#endif - break; - } - - return quit; -} - -static Bool checkForClipboardEvents(Display *, XEvent *e, XPointer) -{ - Atom clipboard = QXlibStatic::atom(QXlibStatic::CLIPBOARD); - return ((e->type == SelectionRequest && (e->xselectionrequest.selection == XA_PRIMARY - || e->xselectionrequest.selection == clipboard)) - || (e->type == SelectionClear && (e->xselectionclear.selection == XA_PRIMARY - || e->xselectionclear.selection == clipboard))); -} - -bool QXlibScreen::waitForClipboardEvent(Window win, int type, XEvent *event, int timeout) -{ - QElapsedTimer timer; - timer.start(); - do { - if (XCheckTypedWindowEvent(mDisplay,win,type,event)) - return true; - - // process other clipboard events, since someone is probably requesting data from us - XEvent e; - if (XCheckIfEvent(mDisplay, &e, checkForClipboardEvents, 0)) - handleEvent(&e); - - XFlush(mDisplay); - - // sleep 50 ms, so we don't use up CPU cycles all the time. - struct timeval usleep_tv; - usleep_tv.tv_sec = 0; - usleep_tv.tv_usec = 50000; - select(0, 0, 0, 0, &usleep_tv); - } while (timer.elapsed() < timeout); - return false; -} - -void QXlibScreen::eventDispatcher() -{ - ulong marker = XNextRequest(mDisplay); - // int i = 0; - while (XPending(mDisplay)) { - XEvent event; - XNextEvent(mDisplay, &event); - /* done = */ - handleEvent(&event); - - if (event.xany.serial >= marker) { - #ifdef MYX11_DEBUG - qDebug() << "potential livelock averted"; - #endif - #if 0 - if (XEventsQueued(mDisplay, QueuedAfterFlush)) { - qDebug() << " with events queued"; - QTimer::singleShot(0, this, SLOT(eventDispatcher())); - } - #endif - break; - } - } -} - -QImage QXlibScreen::grabWindow(Window window, int x, int y, int w, int h) -{ - if (w == 0 || h ==0) - return QImage(); - - //WinId 0 means the desktop widget - if (!window) - window = rootWindow(); - - XWindowAttributes window_attr; - if (!XGetWindowAttributes(mDisplay, window, &window_attr)) - return QImage(); - - if (w < 0) - w = window_attr.width - x; - if (h < 0) - h = window_attr.height - y; - - // Ideally, we should also limit ourselves to the screen area, but the Qt docs say - // that it's "unsafe" to go outside the screen, so we can ignore that problem. - - //We're definitely not optimizing for speed... - XImage *xi = XGetImage(mDisplay, window, x, y, w, h, AllPlanes, ZPixmap); - - if (!xi) - return QImage(); - - //taking a copy to make sure we have ownership -- not fast - QImage result = QImage( (uchar*) xi->data, xi->width, xi->height, xi->bytes_per_line, QImage::Format_RGB32 ).copy(); - - XDestroyImage(xi); - - return result; -} - -QXlibScreen * QXlibScreen::testLiteScreenForWidget(QWidget *widget) -{ - QPlatformScreen *platformScreen = platformScreenForWidget(widget); - return static_cast<QXlibScreen *>(platformScreen); -} - -Display * QXlibScreen::display() const -{ - return mDisplay; -} - -int QXlibScreen::xScreenNumber() const -{ - return mScreen; -} - -QXlibKeyboard * QXlibScreen::keyboard() const -{ - return mKeyboard; -} - -void QXlibScreen::handleSelectionRequest(XEvent *event) -{ - QPlatformIntegration *integration = QApplicationPrivate::platformIntegration(); - QXlibClipboard *clipboard = static_cast<QXlibClipboard *>(integration->clipboard()); - clipboard->handleSelectionRequest(event); -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/xlib/qtestlitescreen.h b/src/plugins/platforms/xlib/qtestlitescreen.h deleted file mode 100644 index 7e59a59..0000000 --- a/src/plugins/platforms/xlib/qtestlitescreen.h +++ /dev/null @@ -1,104 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QTESTLITESCREEN_H -#define QTESTLITESCREEN_H - -#include <QtGui/QPlatformScreen> -#include "qtestliteintegration.h" - -QT_BEGIN_NAMESPACE - -class QXlibCursor; -class QXlibKeyboard; - -class QXlibScreen : public QPlatformScreen -{ - Q_OBJECT -public: - QXlibScreen(); - - ~QXlibScreen(); - - QString displayName() const { return mDisplayName; } - - QRect geometry() const { return mGeometry; } - int depth() const { return mDepth; } - QImage::Format format() const { return mFormat; } - QSize physicalSize() const { return mPhysicalSize; } - - Window rootWindow() { return RootWindow(mDisplay, mScreen); } - unsigned long blackPixel() { return BlackPixel(mDisplay, mScreen); } - unsigned long whitePixel() { return WhitePixel(mDisplay, mScreen); } - - bool handleEvent(XEvent *xe); - bool waitForClipboardEvent(Window win, int type, XEvent *event, int timeout); - - QImage grabWindow(Window window, int x, int y, int w, int h); - - static QXlibScreen *testLiteScreenForWidget(QWidget *widget); - - Display *display() const; - int xScreenNumber() const; - - QXlibKeyboard *keyboard() const; - -public slots: - void eventDispatcher(); - -private: - - void handleSelectionRequest(XEvent *event); - QString mDisplayName; - QRect mGeometry; - QSize mPhysicalSize; - int mDepth; - QImage::Format mFormat; - QXlibCursor *mCursor; - QXlibKeyboard *mKeyboard; - - Display * mDisplay; - int mScreen; -}; - -QT_END_NAMESPACE - -#endif // QTESTLITESCREEN_H diff --git a/src/plugins/platforms/xlib/qtestlitestaticinfo.cpp b/src/plugins/platforms/xlib/qtestlitestaticinfo.cpp deleted file mode 100644 index 837636c..0000000 --- a/src/plugins/platforms/xlib/qtestlitestaticinfo.cpp +++ /dev/null @@ -1,511 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qtestlitestaticinfo.h" -#include "qtestlitescreen.h" - -#include <qplatformdefs.h> - -#include <QtGui/private/qapplication_p.h> -#include <QtCore/QBuffer> -#include <QtCore/QLibrary> - -#include <QDebug> - -#ifndef QT_NO_XFIXES -#include <X11/extensions/Xfixes.h> -#endif // QT_NO_XFIXES - -static const char * x11_atomnames = { - // window-manager <-> client protocols - "WM_PROTOCOLS\0" - "WM_DELETE_WINDOW\0" - "WM_TAKE_FOCUS\0" - "_NET_WM_PING\0" - "_NET_WM_CONTEXT_HELP\0" - "_NET_WM_SYNC_REQUEST\0" - "_NET_WM_SYNC_REQUEST_COUNTER\0" - - // ICCCM window state - "WM_STATE\0" - "WM_CHANGE_STATE\0" - - // Session management - "WM_CLIENT_LEADER\0" - "WM_WINDOW_ROLE\0" - "SM_CLIENT_ID\0" - - // Clipboard - "CLIPBOARD\0" - "INCR\0" - "TARGETS\0" - "MULTIPLE\0" - "TIMESTAMP\0" - "SAVE_TARGETS\0" - "CLIP_TEMPORARY\0" - "_QT_SELECTION\0" - "_QT_CLIPBOARD_SENTINEL\0" - "_QT_SELECTION_SENTINEL\0" - "CLIPBOARD_MANAGER\0" - - "RESOURCE_MANAGER\0" - - "_XSETROOT_ID\0" - - "_QT_SCROLL_DONE\0" - "_QT_INPUT_ENCODING\0" - - "_MOTIF_WM_HINTS\0" - - "DTWM_IS_RUNNING\0" - "ENLIGHTENMENT_DESKTOP\0" - "_DT_SAVE_MODE\0" - "_SGI_DESKS_MANAGER\0" - - // EWMH (aka NETWM) - "_NET_SUPPORTED\0" - "_NET_VIRTUAL_ROOTS\0" - "_NET_WORKAREA\0" - - "_NET_MOVERESIZE_WINDOW\0" - "_NET_WM_MOVERESIZE\0" - - "_NET_WM_NAME\0" - "_NET_WM_ICON_NAME\0" - "_NET_WM_ICON\0" - - "_NET_WM_PID\0" - - "_NET_WM_WINDOW_OPACITY\0" - - "_NET_WM_STATE\0" - "_NET_WM_STATE_ABOVE\0" - "_NET_WM_STATE_BELOW\0" - "_NET_WM_STATE_FULLSCREEN\0" - "_NET_WM_STATE_MAXIMIZED_HORZ\0" - "_NET_WM_STATE_MAXIMIZED_VERT\0" - "_NET_WM_STATE_MODAL\0" - "_NET_WM_STATE_STAYS_ON_TOP\0" - "_NET_WM_STATE_DEMANDS_ATTENTION\0" - - "_NET_WM_USER_TIME\0" - "_NET_WM_USER_TIME_WINDOW\0" - "_NET_WM_FULL_PLACEMENT\0" - - "_NET_WM_WINDOW_TYPE\0" - "_NET_WM_WINDOW_TYPE_DESKTOP\0" - "_NET_WM_WINDOW_TYPE_DOCK\0" - "_NET_WM_WINDOW_TYPE_TOOLBAR\0" - "_NET_WM_WINDOW_TYPE_MENU\0" - "_NET_WM_WINDOW_TYPE_UTILITY\0" - "_NET_WM_WINDOW_TYPE_SPLASH\0" - "_NET_WM_WINDOW_TYPE_DIALOG\0" - "_NET_WM_WINDOW_TYPE_DROPDOWN_MENU\0" - "_NET_WM_WINDOW_TYPE_POPUP_MENU\0" - "_NET_WM_WINDOW_TYPE_TOOLTIP\0" - "_NET_WM_WINDOW_TYPE_NOTIFICATION\0" - "_NET_WM_WINDOW_TYPE_COMBO\0" - "_NET_WM_WINDOW_TYPE_DND\0" - "_NET_WM_WINDOW_TYPE_NORMAL\0" - "_KDE_NET_WM_WINDOW_TYPE_OVERRIDE\0" - - "_KDE_NET_WM_FRAME_STRUT\0" - - "_NET_STARTUP_INFO\0" - "_NET_STARTUP_INFO_BEGIN\0" - - "_NET_SUPPORTING_WM_CHECK\0" - - "_NET_WM_CM_S0\0" - - "_NET_SYSTEM_TRAY_VISUAL\0" - - "_NET_ACTIVE_WINDOW\0" - - // Property formats - "COMPOUND_TEXT\0" - "TEXT\0" - "UTF8_STRING\0" - - // xdnd - "XdndEnter\0" - "XdndPosition\0" - "XdndStatus\0" - "XdndLeave\0" - "XdndDrop\0" - "XdndFinished\0" - "XdndTypeList\0" - "XdndActionList\0" - - "XdndSelection\0" - - "XdndAware\0" - "XdndProxy\0" - - "XdndActionCopy\0" - "XdndActionLink\0" - "XdndActionMove\0" - "XdndActionPrivate\0" - - // Motif DND - "_MOTIF_DRAG_AND_DROP_MESSAGE\0" - "_MOTIF_DRAG_INITIATOR_INFO\0" - "_MOTIF_DRAG_RECEIVER_INFO\0" - "_MOTIF_DRAG_WINDOW\0" - "_MOTIF_DRAG_TARGETS\0" - - "XmTRANSFER_SUCCESS\0" - "XmTRANSFER_FAILURE\0" - - // Xkb - "_XKB_RULES_NAMES\0" - - // XEMBED - "_XEMBED\0" - "_XEMBED_INFO\0" - - // Wacom old. (before version 0.10) - "Wacom Stylus\0" - "Wacom Cursor\0" - "Wacom Eraser\0" - - // Tablet - "STYLUS\0" - "ERASER\0" -}; - -/*! - \internal - Try to resolve a \a symbol from \a library with the version specified - by \a vernum. - - Note that, in the case of the Xfixes library, \a vernum is not the same as - \c XFIXES_MAJOR - it is a part of soname and may differ from the Xfixes - version. -*/ -static void* qt_load_library_runtime(const char *library, int vernum, - int highestVernum, const char *symbol) -{ - QList<int> versions; - // we try to load in the following order: - // explicit version -> the default one -> (from the highest (highestVernum) to the lowest (vernum) ) - if (vernum != -1) - versions << vernum; - versions << -1; - if (vernum != -1) { - for(int i = highestVernum; i > vernum; --i) - versions << i; - } - Q_FOREACH(int version, versions) { - QLatin1String libName(library); - QLibrary xfixesLib(libName, version); - void *ptr = xfixesLib.resolve(symbol); - if (ptr) - return ptr; - } - return 0; -} - -# define XFIXES_LOAD_RUNTIME(vernum, symbol, symbol_type) \ - (symbol_type)qt_load_library_runtime("libXfixes", vernum, 4, #symbol); -# define XFIXES_LOAD_V1(symbol) \ - XFIXES_LOAD_RUNTIME(1, symbol, Ptr##symbol) -# define XFIXES_LOAD_V2(symbol) \ - XFIXES_LOAD_RUNTIME(2, symbol, Ptr##symbol) - - -class QTestLiteStaticInfoPrivate -{ -public: - QTestLiteStaticInfoPrivate() - : use_xfixes(false) - , xfixes_major(0) - , xfixes_eventbase(0) - , xfixes_errorbase(0) - { - QXlibScreen *screen = qobject_cast<QXlibScreen *> (QApplicationPrivate::platformIntegration()->screens().at(0)); - Q_ASSERT(screen); - - initializeAllAtoms(screen); - initializeSupportedAtoms(screen); - - resolveXFixes(screen); - } - - bool isSupportedByWM(Atom atom) - { - if (!m_supportedAtoms) - return false; - - bool supported = false; - int i = 0; - while (m_supportedAtoms[i] != 0) { - if (m_supportedAtoms[i++] == atom) { - supported = true; - break; - } - } - - return supported; - } - - Atom atom(QXlibStatic::X11Atom atom) - { - return m_allAtoms[atom]; - } - - bool useXFixes() const { return use_xfixes; } - - int xFixesEventBase() const {return xfixes_eventbase; } - - PtrXFixesSelectSelectionInput xFixesSelectSelectionInput() const - { - return ptrXFixesSelectSelectionInput; - } - - QImage qimageFromXImage(XImage *xi) - { - QImage::Format format = QImage::Format_ARGB32_Premultiplied; - if (xi->depth == 24) - format = QImage::Format_RGB32; - else if (xi->depth == 16) - format = QImage::Format_RGB16; - - QImage image = QImage((uchar *)xi->data, xi->width, xi->height, xi->bytes_per_line, format).copy(); - - // we may have to swap the byte order - if ((QSysInfo::ByteOrder == QSysInfo::LittleEndian && xi->byte_order == MSBFirst) - || (QSysInfo::ByteOrder == QSysInfo::BigEndian && xi->byte_order == LSBFirst)) - { - for (int i=0; i < image.height(); i++) { - if (xi->depth == 16) { - ushort *p = (ushort*)image.scanLine(i); - ushort *end = p + image.width(); - while (p < end) { - *p = ((*p << 8) & 0xff00) | ((*p >> 8) & 0x00ff); - p++; - } - } else { - uint *p = (uint*)image.scanLine(i); - uint *end = p + image.width(); - while (p < end) { - *p = ((*p << 24) & 0xff000000) | ((*p << 8) & 0x00ff0000) - | ((*p >> 8) & 0x0000ff00) | ((*p >> 24) & 0x000000ff); - p++; - } - } - } - } - - // fix-up alpha channel - if (format == QImage::Format_RGB32) { - QRgb *p = (QRgb *)image.bits(); - for (int y = 0; y < xi->height; ++y) { - for (int x = 0; x < xi->width; ++x) - p[x] |= 0xff000000; - p += xi->bytes_per_line / 4; - } - } - - return image; - } - - -private: - - void initializeAllAtoms(QXlibScreen *screen) { - const char *names[QXlibStatic::NAtoms]; - const char *ptr = x11_atomnames; - - int i = 0; - while (*ptr) { - names[i++] = ptr; - while (*ptr) - ++ptr; - ++ptr; - } - - Q_ASSERT(i == QXlibStatic::NPredefinedAtoms); - - QByteArray settings_atom_name("_QT_SETTINGS_TIMESTAMP_"); - settings_atom_name += XDisplayName(qPrintable(screen->displayName())); - names[i++] = settings_atom_name; - - Q_ASSERT(i == QXlibStatic::NAtoms); - #if 0//defined(XlibSpecificationRelease) && (XlibSpecificationRelease >= 6) - XInternAtoms(screen->display(), (char **)names, i, False, m_allAtoms); - #else - for (i = 0; i < QXlibStatic::NAtoms; ++i) - m_allAtoms[i] = XInternAtom(screen->display(), (char *)names[i], False); - #endif - } - - void initializeSupportedAtoms(QXlibScreen *screen) - { - Atom type; - int format; - long offset = 0; - unsigned long nitems, after; - unsigned char *data = 0; - - int e = XGetWindowProperty(screen->display(), screen->rootWindow(), - this->atom(QXlibStatic::_NET_SUPPORTED), 0, 0, - False, XA_ATOM, &type, &format, &nitems, &after, &data); - if (data) - XFree(data); - - if (e == Success && type == XA_ATOM && format == 32) { - QBuffer ts; - ts.open(QIODevice::WriteOnly); - - while (after > 0) { - XGetWindowProperty(screen->display(), screen->rootWindow(), - this->atom(QXlibStatic::_NET_SUPPORTED), offset, 1024, - False, XA_ATOM, &type, &format, &nitems, &after, &data); - - if (type == XA_ATOM && format == 32) { - ts.write(reinterpret_cast<char *>(data), nitems * sizeof(long)); - offset += nitems; - } else - after = 0; - if (data) - XFree(data); - } - - // compute nitems - QByteArray buffer(ts.buffer()); - nitems = buffer.size() / sizeof(Atom); - m_supportedAtoms = new Atom[nitems + 1]; - Atom *a = (Atom *) buffer.data(); - uint i; - for (i = 0; i < nitems; i++) - m_supportedAtoms[i] = a[i]; - m_supportedAtoms[nitems] = 0; - - } - } - - void resolveXFixes(QXlibScreen *screen) - { -#ifndef QT_NO_XFIXES - // See if Xfixes is supported on the connected display - if (XQueryExtension(screen->display(), "XFIXES", &xfixes_major, - &xfixes_eventbase, &xfixes_errorbase)) { - ptrXFixesQueryExtension = XFIXES_LOAD_V1(XFixesQueryExtension); - ptrXFixesQueryVersion = XFIXES_LOAD_V1(XFixesQueryVersion); - ptrXFixesSetCursorName = XFIXES_LOAD_V2(XFixesSetCursorName); - ptrXFixesSelectSelectionInput = XFIXES_LOAD_V2(XFixesSelectSelectionInput); - - if(ptrXFixesQueryExtension && ptrXFixesQueryVersion - && ptrXFixesQueryExtension(screen->display(), &xfixes_eventbase, - &xfixes_errorbase)) { - // Xfixes is supported. - // Note: the XFixes protocol version is negotiated using QueryVersion. - // We supply the highest version we support, the X server replies with - // the highest version it supports, but no higher than the version we - // asked for. The version sent back is the protocol version the X server - // will use to talk us. If this call is removed, the behavior of the - // X server when it receives an XFixes request is undefined. - int major = 3; - int minor = 0; - ptrXFixesQueryVersion(screen->display(), &major, &minor); - use_xfixes = (major >= 1); - xfixes_major = major; - } - } -#endif // QT_NO_XFIXES - - } - - Atom *m_supportedAtoms; - Atom m_allAtoms[QXlibStatic::NAtoms]; - -#ifndef QT_NO_XFIXES - PtrXFixesQueryExtension ptrXFixesQueryExtension; - PtrXFixesQueryVersion ptrXFixesQueryVersion; - PtrXFixesSetCursorName ptrXFixesSetCursorName; - PtrXFixesSelectSelectionInput ptrXFixesSelectSelectionInput; -#endif - - bool use_xfixes; - int xfixes_major; - int xfixes_eventbase; - int xfixes_errorbase; - -}; -Q_GLOBAL_STATIC(QTestLiteStaticInfoPrivate, qTestLiteStaticInfoPrivate); - - -Atom QXlibStatic::atom(QXlibStatic::X11Atom atom) -{ - return qTestLiteStaticInfoPrivate()->atom(atom); -} - -bool QXlibStatic::isSupportedByWM(Atom atom) -{ - return qTestLiteStaticInfoPrivate()->isSupportedByWM(atom); -} - -bool QXlibStatic::useXFixes() -{ - return qTestLiteStaticInfoPrivate()->useXFixes(); -} - -int QXlibStatic::xFixesEventBase() -{ - return qTestLiteStaticInfoPrivate()->xFixesEventBase(); -} - -#ifndef QT_NO_XFIXES -PtrXFixesSelectSelectionInput QXlibStatic::xFixesSelectSelectionInput() -{ - qDebug() << qTestLiteStaticInfoPrivate()->useXFixes(); - if (!qTestLiteStaticInfoPrivate()->useXFixes()) - return 0; - - return qTestLiteStaticInfoPrivate()->xFixesSelectSelectionInput(); -} - -QImage QXlibStatic::qimageFromXImage(XImage *xi) -{ - return qTestLiteStaticInfoPrivate()->qimageFromXImage(xi); -} -#endif //QT_NO_XFIXES diff --git a/src/plugins/platforms/xlib/qtestlitestaticinfo.h b/src/plugins/platforms/xlib/qtestlitestaticinfo.h deleted file mode 100644 index 8473ee9..0000000 --- a/src/plugins/platforms/xlib/qtestlitestaticinfo.h +++ /dev/null @@ -1,413 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QTESTLITESTATICINFO_H -#define QTESTLITESTATICINFO_H - -#include <QtCore/QTextStream> -#include <QtCore/QDataStream> -#include <QtCore/QMetaType> -#include <QtCore/QVariant> - -#if defined(_XLIB_H_) // crude hack, but... -#error "cannot include <X11/Xlib.h> before this file" -#endif -#define XRegisterIMInstantiateCallback qt_XRegisterIMInstantiateCallback -#define XUnregisterIMInstantiateCallback qt_XUnregisterIMInstantiateCallback -#define XSetIMValues qt_XSetIMValues -#include <X11/Xlib.h> -#undef XRegisterIMInstantiateCallback -#undef XUnregisterIMInstantiateCallback -#undef XSetIMValues - -#include <X11/Xutil.h> -#include <X11/Xos.h> -#ifdef index -# undef index -#endif -#ifdef rindex -# undef rindex -#endif -#ifdef Q_OS_VXWORS -# ifdef open -# undef open -# endif -# ifdef getpid -# undef getpid -# endif -#endif // Q_OS_VXWORKS -#include <X11/Xatom.h> - -//#define QT_NO_SHAPE -#ifdef QT_NO_SHAPE -# define XShapeCombineRegion(a,b,c,d,e,f,g) -# define XShapeCombineMask(a,b,c,d,e,f,g) -#else -# include <X11/extensions/shape.h> -#endif // QT_NO_SHAPE - - -#if !defined (QT_NO_TABLET) -# include <X11/extensions/XInput.h> -#if defined (Q_OS_IRIX) -# include <X11/extensions/SGIMisc.h> -# include <wacom.h> -#endif -#endif // QT_NO_TABLET - - -// #define QT_NO_XINERAMA -#ifndef QT_NO_XINERAMA -// XFree86 does not C++ify Xinerama (at least up to XFree86 4.0.3). -extern "C" { -# include <X11/extensions/Xinerama.h> -} -#endif // QT_NO_XINERAMA - -// #define QT_NO_XRANDR -#ifndef QT_NO_XRANDR -# include <X11/extensions/Xrandr.h> -#endif // QT_NO_XRANDR - -// #define QT_NO_XRENDER -#ifndef QT_NO_XRENDER -# include <X11/extensions/Xrender.h> -#endif // QT_NO_XRENDER - -#ifndef QT_NO_XSYNC -extern "C" { -# include "X11/extensions/sync.h" -} -#endif - -// #define QT_NO_XKB -#ifndef QT_NO_XKB -# include <X11/XKBlib.h> -#endif // QT_NO_XKB - - -#if !defined(XlibSpecificationRelease) -# define X11R4 -typedef char *XPointer; -#else -# undef X11R4 -#endif - -#ifndef QT_NO_XFIXES -typedef Bool (*PtrXFixesQueryExtension)(Display *, int *, int *); -typedef Status (*PtrXFixesQueryVersion)(Display *, int *, int *); -typedef void (*PtrXFixesSetCursorName)(Display *dpy, Cursor cursor, const char *name); -typedef void (*PtrXFixesSelectSelectionInput)(Display *dpy, Window win, Atom selection, unsigned long eventMask); -#endif // QT_NO_XFIXES - -#ifndef QT_NO_XCURSOR -#include <X11/Xcursor/Xcursor.h> -typedef Cursor (*PtrXcursorLibraryLoadCursor)(Display *, const char *); -#endif // QT_NO_XCURSOR - -#ifndef QT_NO_XINERAMA -typedef Bool (*PtrXineramaQueryExtension)(Display *dpy, int *event_base, int *error_base); -typedef Bool (*PtrXineramaIsActive)(Display *dpy); -typedef XineramaScreenInfo *(*PtrXineramaQueryScreens)(Display *dpy, int *number); -#endif // QT_NO_XINERAMA - -#ifndef QT_NO_XRANDR -typedef void (*PtrXRRSelectInput)(Display *, Window, int); -typedef int (*PtrXRRUpdateConfiguration)(XEvent *); -typedef int (*PtrXRRRootToScreen)(Display *, Window); -typedef Bool (*PtrXRRQueryExtension)(Display *, int *, int *); -#endif // QT_NO_XRANDR - -#ifndef QT_NO_XINPUT -typedef int (*PtrXCloseDevice)(Display *, XDevice *); -typedef XDeviceInfo* (*PtrXListInputDevices)(Display *, int *); -typedef XDevice* (*PtrXOpenDevice)(Display *, XID); -typedef void (*PtrXFreeDeviceList)(XDeviceInfo *); -typedef int (*PtrXSelectExtensionEvent)(Display *, Window, XEventClass *, int); -#endif // QT_NO_XINPUT - -/* - * Solaris patch 108652-47 and higher fixes crases in - * XRegisterIMInstantiateCallback, but the function doesn't seem to - * work. - * - * Instead, we disabled R6 input, and open the input method - * immediately at application start. - */ - -//######### XFree86 has wrong declarations for XRegisterIMInstantiateCallback -//######### and XUnregisterIMInstantiateCallback in at least version 3.3.2. -//######### Many old X11R6 header files lack XSetIMValues. -//######### Therefore, we have to declare these functions ourselves. - -extern "C" Bool XRegisterIMInstantiateCallback( - Display*, - struct _XrmHashBucketRec*, - char*, - char*, - XIMProc, //XFree86 has XIDProc, which has to be wrong - XPointer -); - -extern "C" Bool XUnregisterIMInstantiateCallback( - Display*, - struct _XrmHashBucketRec*, - char*, - char*, - XIMProc, //XFree86 has XIDProc, which has to be wrong - XPointer -); - -#ifndef X11R4 -# include <X11/Xlocale.h> -#endif // X11R4 - - -#ifndef QT_NO_MITSHM -# include <X11/extensions/XShm.h> -#endif // QT_NO_MITSHM - -// rename a couple of X defines to get rid of name clashes -// resolve the conflict between X11's FocusIn and QEvent::FocusIn -enum { - XFocusOut = FocusOut, - XFocusIn = FocusIn, - XKeyPress = KeyPress, - XKeyRelease = KeyRelease, - XNone = None, - XRevertToParent = RevertToParent, - XGrayScale = GrayScale, - XCursorShape = CursorShape -}; -#undef FocusOut -#undef FocusIn -#undef KeyPress -#undef KeyRelease -#undef None -#undef RevertToParent -#undef GrayScale -#undef CursorShape - -#ifdef FontChange -#undef FontChange -#endif - - -class QXlibStatic -{ -public: - enum X11Atom { - // window-manager <-> client protocols - WM_PROTOCOLS, - WM_DELETE_WINDOW, - WM_TAKE_FOCUS, - _NET_WM_PING, - _NET_WM_CONTEXT_HELP, - _NET_WM_SYNC_REQUEST, - _NET_WM_SYNC_REQUEST_COUNTER, - - // ICCCM window state - WM_STATE, - WM_CHANGE_STATE, - - // Session management - WM_CLIENT_LEADER, - WM_WINDOW_ROLE, - SM_CLIENT_ID, - - // Clipboard - CLIPBOARD, - INCR, - TARGETS, - MULTIPLE, - TIMESTAMP, - SAVE_TARGETS, - CLIP_TEMPORARY, - _QT_SELECTION, - _QT_CLIPBOARD_SENTINEL, - _QT_SELECTION_SENTINEL, - CLIPBOARD_MANAGER, - - RESOURCE_MANAGER, - - _XSETROOT_ID, - - _QT_SCROLL_DONE, - _QT_INPUT_ENCODING, - - _MOTIF_WM_HINTS, - - DTWM_IS_RUNNING, - ENLIGHTENMENT_DESKTOP, - _DT_SAVE_MODE, - _SGI_DESKS_MANAGER, - - // EWMH (aka NETWM) - _NET_SUPPORTED, - _NET_VIRTUAL_ROOTS, - _NET_WORKAREA, - - _NET_MOVERESIZE_WINDOW, - _NET_WM_MOVERESIZE, - - _NET_WM_NAME, - _NET_WM_ICON_NAME, - _NET_WM_ICON, - - _NET_WM_PID, - - _NET_WM_WINDOW_OPACITY, - - _NET_WM_STATE, - _NET_WM_STATE_ABOVE, - _NET_WM_STATE_BELOW, - _NET_WM_STATE_FULLSCREEN, - _NET_WM_STATE_MAXIMIZED_HORZ, - _NET_WM_STATE_MAXIMIZED_VERT, - _NET_WM_STATE_MODAL, - _NET_WM_STATE_STAYS_ON_TOP, - _NET_WM_STATE_DEMANDS_ATTENTION, - - _NET_WM_USER_TIME, - _NET_WM_USER_TIME_WINDOW, - _NET_WM_FULL_PLACEMENT, - - _NET_WM_WINDOW_TYPE, - _NET_WM_WINDOW_TYPE_DESKTOP, - _NET_WM_WINDOW_TYPE_DOCK, - _NET_WM_WINDOW_TYPE_TOOLBAR, - _NET_WM_WINDOW_TYPE_MENU, - _NET_WM_WINDOW_TYPE_UTILITY, - _NET_WM_WINDOW_TYPE_SPLASH, - _NET_WM_WINDOW_TYPE_DIALOG, - _NET_WM_WINDOW_TYPE_DROPDOWN_MENU, - _NET_WM_WINDOW_TYPE_POPUP_MENU, - _NET_WM_WINDOW_TYPE_TOOLTIP, - _NET_WM_WINDOW_TYPE_NOTIFICATION, - _NET_WM_WINDOW_TYPE_COMBO, - _NET_WM_WINDOW_TYPE_DND, - _NET_WM_WINDOW_TYPE_NORMAL, - _KDE_NET_WM_WINDOW_TYPE_OVERRIDE, - - _KDE_NET_WM_FRAME_STRUT, - - _NET_STARTUP_INFO, - _NET_STARTUP_INFO_BEGIN, - - _NET_SUPPORTING_WM_CHECK, - - _NET_WM_CM_S0, - - _NET_SYSTEM_TRAY_VISUAL, - - _NET_ACTIVE_WINDOW, - - // Property formats - COMPOUND_TEXT, - TEXT, - UTF8_STRING, - - // Xdnd - XdndEnter, - XdndPosition, - XdndStatus, - XdndLeave, - XdndDrop, - XdndFinished, - XdndTypelist, - XdndActionList, - - XdndSelection, - - XdndAware, - XdndProxy, - - XdndActionCopy, - XdndActionLink, - XdndActionMove, - XdndActionPrivate, - - // Motif DND - _MOTIF_DRAG_AND_DROP_MESSAGE, - _MOTIF_DRAG_INITIATOR_INFO, - _MOTIF_DRAG_RECEIVER_INFO, - _MOTIF_DRAG_WINDOW, - _MOTIF_DRAG_TARGETS, - - XmTRANSFER_SUCCESS, - XmTRANSFER_FAILURE, - - // Xkb - _XKB_RULES_NAMES, - - // XEMBED - _XEMBED, - _XEMBED_INFO, - - XWacomStylus, - XWacomCursor, - XWacomEraser, - - XTabletStylus, - XTabletEraser, - - NPredefinedAtoms, - - _QT_SETTINGS_TIMESTAMP = NPredefinedAtoms, - NAtoms - }; - - static Atom atom(X11Atom atom); - static bool isSupportedByWM(Atom atom); - - static bool useXFixes(); - static int xFixesEventBase(); - - #ifndef QT_NO_XFIXES - static PtrXFixesSelectSelectionInput xFixesSelectSelectionInput(); - #endif //QT_NO_XFIXES - - static QImage qimageFromXImage(XImage *xi); - - -}; - -#endif // QTESTLITESTATICINFO_H diff --git a/src/plugins/platforms/xlib/qtestlitewindow.cpp b/src/plugins/platforms/xlib/qtestlitewindow.cpp deleted file mode 100644 index 0f11a81..0000000 --- a/src/plugins/platforms/xlib/qtestlitewindow.cpp +++ /dev/null @@ -1,735 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qtestlitewindow.h" - -#include "qtestliteintegration.h" -#include "qtestlitescreen.h" -#include "qtestlitekeyboard.h" -#include "qtestlitestaticinfo.h" - -#include <QtGui/QWindowSystemInterface> -#include <QSocketNotifier> -#include <QApplication> -#include <QDebug> - -#include <QtGui/private/qwindowsurface_p.h> -#include <QtGui/private/qapplication_p.h> - -#if !defined(QT_NO_OPENGL) -#if !defined(QT_OPENGL_ES_2) -#include "qglxintegration.h" -#else -#include "../eglconvenience/qeglconvenience.h" -#include "../eglconvenience/qeglplatformcontext.h" -#include "qtestliteeglintegration.h" -#endif //QT_OPENGL_ES_2 -#endif //QT_NO_OPENGL - -//#define MYX11_DEBUG - -QT_BEGIN_NAMESPACE - -QXlibWindow::QXlibWindow(QWidget *window) - : QPlatformWindow(window) - , mGLContext(0) - , mScreen(QXlibScreen::testLiteScreenForWidget(window)) -{ - int x = window->x(); - int y = window->y(); - int w = window->width(); - int h = window->height(); - - if(window->platformWindowFormat().windowApi() == QPlatformWindowFormat::OpenGL - && QApplicationPrivate::platformIntegration()->hasOpenGL() ) { -#if !defined(QT_NO_OPENGL) -#if !defined(QT_OPENGL_ES_2) - XVisualInfo *visualInfo = QGLXContext::findVisualInfo(mScreen,window->platformWindowFormat()); -#else - QPlatformWindowFormat windowFormat = correctColorBuffers(window->platformWindowFormat()); - - EGLDisplay eglDisplay = eglGetDisplay(mScreen->display()); - EGLConfig eglConfig = q_configFromQPlatformWindowFormat(eglDisplay,windowFormat); - VisualID id = QXlibEglIntegration::getCompatibleVisualId(mScreen->display(),eglConfig); - - XVisualInfo visualInfoTemplate; - memset(&visualInfoTemplate, 0, sizeof(XVisualInfo)); - visualInfoTemplate.visualid = id; - - XVisualInfo *visualInfo; - int matchingCount = 0; - visualInfo = XGetVisualInfo(mScreen->display(), VisualIDMask, &visualInfoTemplate, &matchingCount); -#endif //!defined(QT_OPENGL_ES_2) - if (visualInfo) { - Colormap cmap = XCreateColormap(mScreen->display(),mScreen->rootWindow(),visualInfo->visual,AllocNone); - - XSetWindowAttributes a; - a.colormap = cmap; - x_window = XCreateWindow(mScreen->display(), mScreen->rootWindow(),x, y, w, h, - 0, visualInfo->depth, InputOutput, visualInfo->visual, - CWColormap, &a); - } else { - qFatal("no window!"); - } -#endif //!defined(QT_NO_OPENGL) - } else { - x_window = XCreateSimpleWindow(mScreen->display(), mScreen->rootWindow(), - x, y, w, h, 0 /*border_width*/, - mScreen->blackPixel(), mScreen->whitePixel()); - } - -#ifdef MYX11_DEBUG - qDebug() << "QTestLiteWindow::QTestLiteWindow creating" << hex << x_window << window; -#endif - - XSetWindowBackgroundPixmap(mScreen->display(), x_window, XNone); - - XSelectInput(mScreen->display(), x_window, - ExposureMask | KeyPressMask | KeyReleaseMask | - EnterWindowMask | LeaveWindowMask | FocusChangeMask | - PointerMotionMask | ButtonPressMask | ButtonReleaseMask | - ButtonMotionMask | PropertyChangeMask | - StructureNotifyMask); - - gc = createGC(); - - Atom protocols[5]; - int n = 0; - protocols[n++] = QXlibStatic::atom(QXlibStatic::WM_DELETE_WINDOW); // support del window protocol - protocols[n++] = QXlibStatic::atom(QXlibStatic::WM_TAKE_FOCUS); // support take focus window protocol - protocols[n++] = QXlibStatic::atom(QXlibStatic::_NET_WM_PING); // support _NET_WM_PING protocol -#ifndef QT_NO_XSYNC - protocols[n++] = QXlibStatic::atom(QXlibStatic::_NET_WM_SYNC_REQUEST); // support _NET_WM_SYNC_REQUEST protocol -#endif // QT_NO_XSYNC - if (window->windowFlags() & Qt::WindowContextHelpButtonHint) - protocols[n++] = QXlibStatic::atom(QXlibStatic::_NET_WM_CONTEXT_HELP); - XSetWMProtocols(mScreen->display(), x_window, protocols, n); -} - - - -QXlibWindow::~QXlibWindow() -{ -#ifdef MYX11_DEBUG - qDebug() << "~QTestLiteWindow" << hex << x_window; -#endif - delete mGLContext; - XFreeGC(mScreen->display(), gc); - XDestroyWindow(mScreen->display(), x_window); -} - -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// Mouse event stuff -static Qt::MouseButtons translateMouseButtons(int s) -{ - Qt::MouseButtons ret = 0; - if (s & Button1Mask) - ret |= Qt::LeftButton; - if (s & Button2Mask) - ret |= Qt::MidButton; - if (s & Button3Mask) - ret |= Qt::RightButton; - return ret; -} - - - -void QXlibWindow::handleMouseEvent(QEvent::Type type, XButtonEvent *e) -{ - static QPoint mousePoint; - - Qt::MouseButton button = Qt::NoButton; - Qt::MouseButtons buttons = translateMouseButtons(e->state); - Qt::KeyboardModifiers modifiers = mScreen->keyboard()->translateModifiers(e->state); - if (type != QEvent::MouseMove) { - switch (e->button) { - case Button1: button = Qt::LeftButton; break; - case Button2: button = Qt::MidButton; break; - case Button3: button = Qt::RightButton; break; - case Button4: - case Button5: - case 6: - case 7: { - //mouse wheel - if (type == QEvent::MouseButtonPress) { - //logic borrowed from qapplication_x11.cpp - int delta = 120 * ((e->button == Button4 || e->button == 6) ? 1 : -1); - bool hor = (((e->button == Button4 || e->button == Button5) - && (modifiers & Qt::AltModifier)) - || (e->button == 6 || e->button == 7)); - QWindowSystemInterface::handleWheelEvent(widget(), e->time, - QPoint(e->x, e->y), - QPoint(e->x_root, e->y_root), - delta, hor ? Qt::Horizontal : Qt::Vertical); - } - return; - } - default: break; - } - } - - buttons ^= button; // X event uses state *before*, Qt uses state *after* - - QWindowSystemInterface::handleMouseEvent(widget(), e->time, QPoint(e->x, e->y), - QPoint(e->x_root, e->y_root), - buttons); - - mousePoint = QPoint(e->x_root, e->y_root); -} - -void QXlibWindow::handleCloseEvent() -{ - QWindowSystemInterface::handleCloseEvent(widget()); -} - - -void QXlibWindow::handleEnterEvent() -{ - QWindowSystemInterface::handleEnterEvent(widget()); -} - -void QXlibWindow::handleLeaveEvent() -{ - QWindowSystemInterface::handleLeaveEvent(widget()); -} - -void QXlibWindow::handleFocusInEvent() -{ - QWindowSystemInterface::handleWindowActivated(widget()); -} - -void QXlibWindow::handleFocusOutEvent() -{ - QWindowSystemInterface::handleWindowActivated(0); -} - - - -void QXlibWindow::setGeometry(const QRect &rect) -{ - XMoveResizeWindow(mScreen->display(), x_window, rect.x(), rect.y(), rect.width(), rect.height()); - QPlatformWindow::setGeometry(rect); -} - - -Qt::WindowFlags QXlibWindow::windowFlags() const -{ - return mWindowFlags; -} - -WId QXlibWindow::winId() const -{ - return x_window; -} - -void QXlibWindow::setParent(const QPlatformWindow *window) -{ - QPoint topLeft = geometry().topLeft(); - XReparentWindow(mScreen->display(),x_window,window->winId(),topLeft.x(),topLeft.y()); -} - -void QXlibWindow::raise() -{ - XRaiseWindow(mScreen->display(), x_window); -} - -void QXlibWindow::lower() -{ - XLowerWindow(mScreen->display(), x_window); -} - -void QXlibWindow::setWindowTitle(const QString &title) -{ - QByteArray ba = title.toLatin1(); //We're not making a general solution here... - XTextProperty windowName; - windowName.value = (unsigned char *)ba.constData(); - windowName.encoding = XA_STRING; - windowName.format = 8; - windowName.nitems = ba.length(); - - XSetWMName(mScreen->display(), x_window, &windowName); -} - -GC QXlibWindow::createGC() -{ - GC gc; - - gc = XCreateGC(mScreen->display(), x_window, 0, 0); - if (gc < 0) { - qWarning("QTestLiteWindow::createGC() could not create GC"); - } - return gc; -} - -void QXlibWindow::paintEvent() -{ -#ifdef MYX11_DEBUG -// qDebug() << "QTestLiteWindow::paintEvent" << shm_img.size() << painted; -#endif - - if (QWindowSurface *surface = widget()->windowSurface()) - surface->flush(widget(), widget()->geometry(), QPoint()); -} - -void QXlibWindow::requestActivateWindow() -{ - XSetInputFocus(mScreen->display(), x_window, XRevertToParent, CurrentTime); -} - -void QXlibWindow::resizeEvent(XConfigureEvent *e) -{ - int xpos = geometry().x(); - int ypos = geometry().y(); - if ((e->width != geometry().width() || e->height != geometry().height()) && e->x == 0 && e->y == 0) { - //qDebug() << "resize with bogus pos" << e->x << e->y << e->width << e->height << "window"<< hex << window; - } else { - //qDebug() << "geometry change" << e->x << e->y << e->width << e->height << "window"<< hex << window; - xpos = e->x; - ypos = e->y; - } -#ifdef MYX11_DEBUG - qDebug() << hex << x_window << dec << "ConfigureNotify" << e->x << e->y << e->width << e->height << "geometry" << xpos << ypos << width << height; -#endif - - QRect newRect(xpos, ypos, e->width, e->height); - QWindowSystemInterface::handleGeometryChange(widget(), newRect); -} - -void QXlibWindow::mousePressEvent(XButtonEvent *e) -{ - static long prevTime = 0; - static Window prevWindow; - static int prevX = -999; - static int prevY = -999; - - QEvent::Type type = QEvent::MouseButtonPress; - - if (e->window == prevWindow && long(e->time) - prevTime < QApplication::doubleClickInterval() - && qAbs(e->x - prevX) < 5 && qAbs(e->y - prevY) < 5) { - type = QEvent::MouseButtonDblClick; - prevTime = e->time - QApplication::doubleClickInterval(); //no double click next time - } else { - prevTime = e->time; - } - prevWindow = e->window; - prevX = e->x; - prevY = e->y; - - handleMouseEvent(type, e); -} - -QXlibMWMHints QXlibWindow::getMWMHints() const -{ - QXlibMWMHints mwmhints; - - Atom type; - int format; - ulong nitems, bytesLeft; - uchar *data = 0; - Atom atomForMotifWmHints = QXlibStatic::atom(QXlibStatic::_MOTIF_WM_HINTS); - if ((XGetWindowProperty(mScreen->display(), x_window, atomForMotifWmHints, 0, 5, false, - atomForMotifWmHints, &type, &format, &nitems, &bytesLeft, - &data) == Success) - && (type == atomForMotifWmHints - && format == 32 - && nitems >= 5)) { - mwmhints = *(reinterpret_cast<QXlibMWMHints *>(data)); - } else { - mwmhints.flags = 0L; - mwmhints.functions = MWM_FUNC_ALL; - mwmhints.decorations = MWM_DECOR_ALL; - mwmhints.input_mode = 0L; - mwmhints.status = 0L; - } - - if (data) - XFree(data); - - return mwmhints; -} - -void QXlibWindow::setMWMHints(const QXlibMWMHints &mwmhints) -{ - Atom atomForMotifWmHints = QXlibStatic::atom(QXlibStatic::_MOTIF_WM_HINTS); - if (mwmhints.flags != 0l) { - XChangeProperty(mScreen->display(), x_window, - atomForMotifWmHints, atomForMotifWmHints, 32, - PropModeReplace, (unsigned char *) &mwmhints, 5); - } else { - XDeleteProperty(mScreen->display(), x_window, atomForMotifWmHints); - } -} - -// Returns true if we should set WM_TRANSIENT_FOR on \a w -static inline bool isTransient(const QWidget *w) -{ - return ((w->windowType() == Qt::Dialog - || w->windowType() == Qt::Sheet - || w->windowType() == Qt::Tool - || w->windowType() == Qt::SplashScreen - || w->windowType() == Qt::ToolTip - || w->windowType() == Qt::Drawer - || w->windowType() == Qt::Popup) - && !w->testAttribute(Qt::WA_X11BypassTransientForHint)); -} - -QVector<Atom> QXlibWindow::getNetWmState() const -{ - QVector<Atom> returnValue; - - // Don't read anything, just get the size of the property data - Atom actualType; - int actualFormat; - ulong propertyLength; - ulong bytesLeft; - uchar *propertyData = 0; - if (XGetWindowProperty(mScreen->display(), x_window, QXlibStatic::atom(QXlibStatic::_NET_WM_STATE), 0, 0, - False, XA_ATOM, &actualType, &actualFormat, - &propertyLength, &bytesLeft, &propertyData) == Success - && actualType == XA_ATOM && actualFormat == 32) { - returnValue.resize(bytesLeft / 4); - XFree((char*) propertyData); - - // fetch all data - if (XGetWindowProperty(mScreen->display(), x_window, QXlibStatic::atom(QXlibStatic::_NET_WM_STATE), 0, - returnValue.size(), False, XA_ATOM, &actualType, &actualFormat, - &propertyLength, &bytesLeft, &propertyData) != Success) { - returnValue.clear(); - } else if (propertyLength != (ulong)returnValue.size()) { - returnValue.resize(propertyLength); - } - - // put it into netWmState - if (!returnValue.isEmpty()) { - memcpy(returnValue.data(), propertyData, returnValue.size() * sizeof(Atom)); - } - XFree((char*) propertyData); - } - - return returnValue; -} - -Qt::WindowFlags QXlibWindow::setWindowFlags(Qt::WindowFlags flags) -{ -// Q_ASSERT(flags & Qt::Window); - mWindowFlags = flags; - -#ifdef MYX11_DEBUG - qDebug() << "QTestLiteWindow::setWindowFlags" << hex << x_window << "flags" << flags; -#endif - Qt::WindowType type = static_cast<Qt::WindowType>(int(flags & Qt::WindowType_Mask)); - - if (type == Qt::ToolTip) - flags |= Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint; - if (type == Qt::Popup) - flags |= Qt::X11BypassWindowManagerHint; - - bool topLevel = (flags & Qt::Window); - bool popup = (type == Qt::Popup); - bool dialog = (type == Qt::Dialog - || type == Qt::Sheet); - bool desktop = (type == Qt::Desktop); - bool tool = (type == Qt::Tool || type == Qt::SplashScreen - || type == Qt::ToolTip || type == Qt::Drawer); - - Q_UNUSED(topLevel); - Q_UNUSED(dialog); - Q_UNUSED(desktop); - - bool tooltip = (type == Qt::ToolTip); - - XSetWindowAttributes wsa; - - QXlibMWMHints mwmhints; - mwmhints.flags = 0L; - mwmhints.functions = 0L; - mwmhints.decorations = 0; - mwmhints.input_mode = 0L; - mwmhints.status = 0L; - - - ulong wsa_mask = 0; - if (type != Qt::SplashScreen) { // && customize) { - mwmhints.flags |= MWM_HINTS_DECORATIONS; - - bool customize = flags & Qt::CustomizeWindowHint; - if (!(flags & Qt::FramelessWindowHint) && !(customize && !(flags & Qt::WindowTitleHint))) { - mwmhints.decorations |= MWM_DECOR_BORDER; - mwmhints.decorations |= MWM_DECOR_RESIZEH; - - if (flags & Qt::WindowTitleHint) - mwmhints.decorations |= MWM_DECOR_TITLE; - - if (flags & Qt::WindowSystemMenuHint) - mwmhints.decorations |= MWM_DECOR_MENU; - - if (flags & Qt::WindowMinimizeButtonHint) { - mwmhints.decorations |= MWM_DECOR_MINIMIZE; - mwmhints.functions |= MWM_FUNC_MINIMIZE; - } - - if (flags & Qt::WindowMaximizeButtonHint) { - mwmhints.decorations |= MWM_DECOR_MAXIMIZE; - mwmhints.functions |= MWM_FUNC_MAXIMIZE; - } - - if (flags & Qt::WindowCloseButtonHint) - mwmhints.functions |= MWM_FUNC_CLOSE; - } - } else { - // if type == Qt::SplashScreen - mwmhints.decorations = MWM_DECOR_ALL; - } - - if (tool) { - wsa.save_under = True; - wsa_mask |= CWSaveUnder; - } - - if (flags & Qt::X11BypassWindowManagerHint) { - wsa.override_redirect = True; - wsa_mask |= CWOverrideRedirect; - } -#if 0 - if (wsa_mask && initializeWindow) { - Q_ASSERT(id); - XChangeWindowAttributes(dpy, id, wsa_mask, &wsa); - } -#endif - if (mwmhints.functions != 0) { - mwmhints.flags |= MWM_HINTS_FUNCTIONS; - mwmhints.functions |= MWM_FUNC_MOVE | MWM_FUNC_RESIZE; - } else { - mwmhints.functions = MWM_FUNC_ALL; - } - - if (!(flags & Qt::FramelessWindowHint) - && flags & Qt::CustomizeWindowHint - && flags & Qt::WindowTitleHint - && !(flags & - (Qt::WindowMinimizeButtonHint - | Qt::WindowMaximizeButtonHint - | Qt::WindowCloseButtonHint))) { - // a special case - only the titlebar without any button - mwmhints.flags = MWM_HINTS_FUNCTIONS; - mwmhints.functions = MWM_FUNC_MOVE | MWM_FUNC_RESIZE; - mwmhints.decorations = 0; - } - - if (widget()->windowModality() == Qt::WindowModal) { - mwmhints.input_mode = MWM_INPUT_PRIMARY_APPLICATION_MODAL; - } else if (widget()->windowModality() == Qt::ApplicationModal) { - mwmhints.input_mode = MWM_INPUT_FULL_APPLICATION_MODAL; - } - - setMWMHints(mwmhints); - - QVector<Atom> netWmState = getNetWmState(); - - if (flags & Qt::WindowStaysOnTopHint) { - if (flags & Qt::WindowStaysOnBottomHint) - qWarning() << "QWidget: Incompatible window flags: the window can't be on top and on bottom at the same time"; - if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_ABOVE))) - netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_ABOVE)); - if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_STAYS_ON_TOP))) - netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_STAYS_ON_TOP)); - } else if (flags & Qt::WindowStaysOnBottomHint) { - if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_BELOW))) - netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_BELOW)); - } - if (widget()->isFullScreen()) { - if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_FULLSCREEN))) - netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_FULLSCREEN)); - } - if (widget()->isMaximized()) { - if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_MAXIMIZED_HORZ))) - netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_MAXIMIZED_HORZ)); - if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_MAXIMIZED_VERT))) - netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_MAXIMIZED_VERT)); - } - if (widget()->windowModality() != Qt::NonModal) { - if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_MODAL))) - netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_MODAL)); - } - - if (!netWmState.isEmpty()) { - XChangeProperty(mScreen->display(), x_window, - QXlibStatic::atom(QXlibStatic::_NET_WM_STATE), XA_ATOM, 32, PropModeReplace, - (unsigned char *) netWmState.data(), netWmState.size()); - } else { - XDeleteProperty(mScreen->display(), x_window, QXlibStatic::atom(QXlibStatic::_NET_WM_STATE)); - } - -//##### only if initializeWindow??? - - if (popup || tooltip) { // popup widget -#ifdef MYX11_DEBUG - qDebug() << "Doing XChangeWindowAttributes for popup" << wsa.override_redirect; -#endif - // set EWMH window types - // setNetWmWindowTypes(); - - wsa.override_redirect = True; - wsa.save_under = True; - XChangeWindowAttributes(mScreen->display(), x_window, CWOverrideRedirect | CWSaveUnder, - &wsa); - } else { -#ifdef MYX11_DEBUG - qDebug() << "Doing XChangeWindowAttributes for non-popup"; -#endif - } - - return flags; -} - -void QXlibWindow::setVisible(bool visible) -{ -#ifdef MYX11_DEBUG - qDebug() << "QTestLiteWindow::setVisible" << visible << hex << x_window; -#endif - if (isTransient(widget())) { - Window parentXWindow = x_window; - if (widget()->parentWidget()) { - QWidget *widgetParent = widget()->parentWidget()->window(); - if (widgetParent && widgetParent->platformWindow()) { - QXlibWindow *parentWidnow = static_cast<QXlibWindow *>(widgetParent->platformWindow()); - parentXWindow = parentWidnow->x_window; - } - } - XSetTransientForHint(mScreen->display(),x_window,parentXWindow); - } - - if (visible) { - //ensure that the window is viewed in correct position. - doSizeHints(); - XMapWindow(mScreen->display(), x_window); - } else { - XUnmapWindow(mScreen->display(), x_window); - } -} - -void QXlibWindow::setCursor(const Cursor &cursor) -{ - XDefineCursor(mScreen->display(), x_window, cursor); - XFlush(mScreen->display()); -} - -QPlatformGLContext *QXlibWindow::glContext() const -{ - if (!QApplicationPrivate::platformIntegration()->hasOpenGL()) - return 0; - if (!mGLContext) { - QXlibWindow *that = const_cast<QXlibWindow *>(this); -#if !defined(QT_NO_OPENGL) -#if !defined(QT_OPENGL_ES_2) - that->mGLContext = new QGLXContext(x_window, mScreen,widget()->platformWindowFormat()); -#else - EGLDisplay display = eglGetDisplay(mScreen->display()); - - QPlatformWindowFormat windowFormat = correctColorBuffers(widget()->platformWindowFormat()); - - EGLConfig config = q_configFromQPlatformWindowFormat(display,windowFormat); - QVector<EGLint> eglContextAttrs; - eglContextAttrs.append(EGL_CONTEXT_CLIENT_VERSION); - eglContextAttrs.append(2); - eglContextAttrs.append(EGL_NONE); - - EGLSurface eglSurface = eglCreateWindowSurface(display,config,(EGLNativeWindowType)x_window,0); - that->mGLContext = new QEGLPlatformContext(display, config, eglContextAttrs.data(), eglSurface, EGL_OPENGL_ES_API); -#endif -#endif - } - return mGLContext; -} - -Window QXlibWindow::xWindow() const -{ - return x_window; -} - -GC QXlibWindow::graphicsContext() const -{ - return gc; -} - -void QXlibWindow::doSizeHints() -{ - Q_ASSERT(widget()->testAttribute(Qt::WA_WState_Created)); - XSizeHints s; - s.flags = 0; - QRect g = geometry(); - s.x = g.x(); - s.y = g.y(); - s.width = g.width(); - s.height = g.height(); - s.flags |= USPosition; - s.flags |= PPosition; - s.flags |= USSize; - s.flags |= PSize; - s.flags |= PWinGravity; - s.win_gravity = QApplication::isRightToLeft() ? NorthEastGravity : NorthWestGravity; - XSetWMNormalHints(mScreen->display(), x_window, &s); -} - -QPlatformWindowFormat QXlibWindow::correctColorBuffers(const QPlatformWindowFormat &platformWindowFormat) const -{ - // I have only tested this setup on a dodgy intel setup, where I didn't use standard libs, - // so this might be not what we want to do :) - if ( !(platformWindowFormat.redBufferSize() == -1 && - platformWindowFormat.greenBufferSize() == -1 && - platformWindowFormat.blueBufferSize() == -1)) - return platformWindowFormat; - - QPlatformWindowFormat windowFormat = platformWindowFormat; - if (mScreen->depth() == 16) { - windowFormat.setRedBufferSize(5); - windowFormat.setGreenBufferSize(6); - windowFormat.setBlueBufferSize(5); - } else { - windowFormat.setRedBufferSize(8); - windowFormat.setGreenBufferSize(8); - windowFormat.setBlueBufferSize(8); - } - - return windowFormat; -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/xlib/qtestlitewindow.h b/src/plugins/platforms/xlib/qtestlitewindow.h deleted file mode 100644 index ccf6867..0000000 --- a/src/plugins/platforms/xlib/qtestlitewindow.h +++ /dev/null @@ -1,145 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QTESTLITEWINDOW_H -#define QTESTLITEWINDOW_H - -#include "qtestliteintegration.h" - -#include <QPlatformWindow> -#include <QEvent> - -#include <QObject> -#include <QImage> - -struct QXlibMWMHints { - ulong flags, functions, decorations; - long input_mode; - ulong status; -}; - -enum { - MWM_HINTS_FUNCTIONS = (1L << 0), - - MWM_FUNC_ALL = (1L << 0), - MWM_FUNC_RESIZE = (1L << 1), - MWM_FUNC_MOVE = (1L << 2), - MWM_FUNC_MINIMIZE = (1L << 3), - MWM_FUNC_MAXIMIZE = (1L << 4), - MWM_FUNC_CLOSE = (1L << 5), - - MWM_HINTS_DECORATIONS = (1L << 1), - - MWM_DECOR_ALL = (1L << 0), - MWM_DECOR_BORDER = (1L << 1), - MWM_DECOR_RESIZEH = (1L << 2), - MWM_DECOR_TITLE = (1L << 3), - MWM_DECOR_MENU = (1L << 4), - MWM_DECOR_MINIMIZE = (1L << 5), - MWM_DECOR_MAXIMIZE = (1L << 6), - - MWM_HINTS_INPUT_MODE = (1L << 2), - - MWM_INPUT_MODELESS = 0L, - MWM_INPUT_PRIMARY_APPLICATION_MODAL = 1L, - MWM_INPUT_FULL_APPLICATION_MODAL = 3L -}; - -class QXlibWindow : public QPlatformWindow -{ -public: - QXlibWindow(QWidget *window); - ~QXlibWindow(); - - - void mousePressEvent(XButtonEvent*); - void handleMouseEvent(QEvent::Type, XButtonEvent *ev); - - void handleCloseEvent(); - void handleEnterEvent(); - void handleLeaveEvent(); - void handleFocusInEvent(); - void handleFocusOutEvent(); - - void resizeEvent(XConfigureEvent *configure_event); - void paintEvent(); - - void requestActivateWindow(); - - void setGeometry(const QRect &rect); - - Qt::WindowFlags setWindowFlags(Qt::WindowFlags type); - Qt::WindowFlags windowFlags() const; - void setVisible(bool visible); - WId winId() const; - void setParent(const QPlatformWindow *window); - void raise(); - void lower(); - void setWindowTitle(const QString &title); - - void setCursor(const Cursor &cursor); - - QPlatformGLContext *glContext() const; - - Window xWindow() const; - GC graphicsContext() const; - -protected: - QVector<Atom> getNetWmState() const; - void setMWMHints(const QXlibMWMHints &mwmhints); - QXlibMWMHints getMWMHints() const; - - void doSizeHints(); - -private: - QPlatformWindowFormat correctColorBuffers(const QPlatformWindowFormat &windowFormat)const; - - Window x_window; - GC gc; - - GC createGC(); - - QPlatformGLContext *mGLContext; - QXlibScreen *mScreen; - Qt::WindowFlags mWindowFlags; -}; - -#endif diff --git a/src/plugins/platforms/xlib/qtestlitewindowsurface.cpp b/src/plugins/platforms/xlib/qtestlitewindowsurface.cpp deleted file mode 100644 index 088730d..0000000 --- a/src/plugins/platforms/xlib/qtestlitewindowsurface.cpp +++ /dev/null @@ -1,224 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qtestlitewindowsurface.h" -#include "qtestliteintegration.h" - -#include <QtCore/qdebug.h> -#include <QWindowSystemInterface> - -#include "qtestlitewindow.h" -#include "qtestlitescreen.h" - -# include <sys/ipc.h> -# include <sys/shm.h> -# include <X11/extensions/XShm.h> - -QT_BEGIN_NAMESPACE - - -struct QXlibShmImageInfo { - QXlibShmImageInfo(Display *xdisplay) : image(0), display(xdisplay) {} - ~QXlibShmImageInfo() { destroy(); } - - void destroy(); - - XShmSegmentInfo shminfo; - XImage *image; - Display *display; -}; - - -#ifndef DONT_USE_MIT_SHM -void QXlibShmImageInfo::destroy() -{ - XShmDetach (display, &shminfo); - XDestroyImage (image); - shmdt (shminfo.shmaddr); - shmctl (shminfo.shmid, IPC_RMID, 0); -} -#endif - -void QXlibWindowSurface::resizeShmImage(int width, int height) -{ - -#ifdef DONT_USE_MIT_SHM - shm_img = QImage(width, height, QImage::Format_RGB32); -#else - - QXlibScreen *screen = QXlibScreen::testLiteScreenForWidget(window()); - if (image_info) - image_info->destroy(); - else - image_info = new QXlibShmImageInfo(screen->display()); - - Visual *visual = DefaultVisual(screen->display(), screen->xScreenNumber()); - - - XImage *image = XShmCreateImage (screen->display(), visual, 24, ZPixmap, 0, - &image_info->shminfo, width, height); - - - image_info->shminfo.shmid = shmget (IPC_PRIVATE, - image->bytes_per_line * image->height, IPC_CREAT|0777); - - image_info->shminfo.shmaddr = image->data = (char*)shmat (image_info->shminfo.shmid, 0, 0); - image_info->shminfo.readOnly = False; - - image_info->image = image; - - Status shm_attach_status = XShmAttach(screen->display(), &image_info->shminfo); - - Q_ASSERT(shm_attach_status == True); - - shm_img = QImage( (uchar*) image->data, image->width, image->height, image->bytes_per_line, QImage::Format_RGB32 ); -#endif - painted = false; -} - - -void QXlibWindowSurface::resizeBuffer(QSize s) -{ - if (shm_img.size() != s) - resizeShmImage(s.width(), s.height()); -} - -QSize QXlibWindowSurface::bufferSize() const -{ - return shm_img.size(); -} - -QXlibWindowSurface::QXlibWindowSurface (QWidget *window) - : QWindowSurface(window), - painted(false), image_info(0) -{ - xw = static_cast<QXlibWindow*>(window->platformWindow()); -// qDebug() << "QTestLiteWindowSurface::QTestLiteWindowSurface:" << xw->window; -} - -QXlibWindowSurface::~QXlibWindowSurface() -{ - delete image_info; -} - -QPaintDevice *QXlibWindowSurface::paintDevice() -{ - return &shm_img; -} - - -void QXlibWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) -{ - Q_UNUSED(widget); - Q_UNUSED(region); - Q_UNUSED(offset); - - if (!painted) - return; - - QXlibScreen *screen = QXlibScreen::testLiteScreenForWidget(widget); - GC gc = xw->graphicsContext(); - Window window = xw->xWindow(); -#ifdef DONT_USE_MIT_SHM - // just convert the image every time... - if (!shm_img.isNull()) { - Visual *visual = DefaultVisual(screen->display(), screen->xScreenNumber()); - - QImage image = shm_img; - //img.convertToFormat( - XImage *xi = XCreateImage(screen->display(), visual, 24, ZPixmap, - 0, (char *) image.scanLine(0), image.width(), image.height(), - 32, image.bytesPerLine()); - - int x = 0; - int y = 0; - - /*int r =*/ XPutImage(screen->display(), window, gc, xi, 0, 0, x, y, image.width(), image.height()); - - xi->data = 0; // QImage owns these bits - XDestroyImage(xi); - } -#else - // Use MIT_SHM - if (image_info && image_info->image) { - //qDebug() << "Here we go" << image_info->image->width << image_info->image->height; - int x = 0; - int y = 0; - - // We could set send_event to true, and then use the ShmCompletion to synchronize, - // but let's do like Qt/11 and just use XSync - XShmPutImage (screen->display(), window, gc, image_info->image, 0, 0, - x, y, image_info->image->width, image_info->image->height, - /*send_event*/ False); - - XSync(screen->display(), False); - } -#endif -} - -// from qwindowsurface.cpp -extern void qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &offset); - -bool QXlibWindowSurface::scroll(const QRegion &area, int dx, int dy) -{ - if (shm_img.isNull()) - return false; - - const QVector<QRect> rects = area.rects(); - for (int i = 0; i < rects.size(); ++i) - qt_scrollRectInImage(shm_img, rects.at(i), QPoint(dx, dy)); - - return true; -} - - -void QXlibWindowSurface::beginPaint(const QRegion ®ion) -{ - Q_UNUSED(region); - resizeBuffer(size()); -} - -void QXlibWindowSurface::endPaint(const QRegion ®ion) -{ - Q_UNUSED(region); - painted = true; //there is content in the buffer -} -QT_END_NAMESPACE diff --git a/src/plugins/platforms/xlib/qtestlitewindowsurface.h b/src/plugins/platforms/xlib/qtestlitewindowsurface.h deleted file mode 100644 index 12b4c60..0000000 --- a/src/plugins/platforms/xlib/qtestlitewindowsurface.h +++ /dev/null @@ -1,86 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWINDOWSURFACE_TESTLITE_H -#define QWINDOWSURFACE_TESTLITE_H - -#include <QtGui/private/qwindowsurface_p.h> - - -QT_BEGIN_NAMESPACE - -class QXlibWindow; -class QXlibIntegration; -class QXlibScreen; -class QXlibShmImageInfo; - -class QXlibWindowSurface : public QWindowSurface -{ -public: - QXlibWindowSurface (QWidget *window); - ~QXlibWindowSurface(); - - QPaintDevice *paintDevice(); - void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); - bool scroll(const QRegion &area, int dx, int dy); - - void beginPaint(const QRegion ®ion); - void endPaint(const QRegion ®ion); - -private: - bool painted; - void resizeBuffer(QSize); - QSize bufferSize() const; - - - void resizeShmImage(int width, int height); - - QImage shm_img; - QXlibShmImageInfo *image_info; - - QXlibWindow *xw; - -}; - - -QT_END_NAMESPACE - -#endif diff --git a/src/plugins/platforms/xlib/qxlibclipboard.cpp b/src/plugins/platforms/xlib/qxlibclipboard.cpp new file mode 100644 index 0000000..1264b5a --- /dev/null +++ b/src/plugins/platforms/xlib/qxlibclipboard.cpp @@ -0,0 +1,676 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qtestliteclipboard.h" + +#include "qtestlitescreen.h" +#include "qtestlitemime.h" + +#include <private/qapplication_p.h> + +#include <QtCore/QDebug> + +class QXlibClipboardMime : public QXlibMime +{ + Q_OBJECT +public: + QXlibClipboardMime(QClipboard::Mode mode, QXlibClipboard *clipboard) + : QXlibMime() + , m_clipboard(clipboard) + { + switch (mode) { + case QClipboard::Selection: + modeAtom = XA_PRIMARY; + break; + + case QClipboard::Clipboard: + modeAtom = QXlibStatic::atom(QXlibStatic::CLIPBOARD); + break; + + default: + qWarning("QTestLiteMime: Internal error: Unsupported clipboard mode"); + break; + } + } + +protected: + QStringList formats_sys() const + { + if (empty()) + return QStringList(); + + if (!formatList.count()) { + QXlibClipboardMime *that = const_cast<QXlibClipboardMime *>(this); + // get the list of targets from the current clipboard owner - we do this + // once so that multiple calls to this function don't require multiple + // server round trips... + that->format_atoms = m_clipboard->getDataInFormat(modeAtom,QXlibStatic::atom(QXlibStatic::TARGETS)); + + if (format_atoms.size() > 0) { + Atom *targets = (Atom *) format_atoms.data(); + int size = format_atoms.size() / sizeof(Atom); + + for (int i = 0; i < size; ++i) { + if (targets[i] == 0) + continue; + + QStringList formatsForAtom = mimeFormatsForAtom(m_clipboard->screen()->display(),targets[i]); + for (int j = 0; j < formatsForAtom.size(); ++j) { + if (!formatList.contains(formatsForAtom.at(j))) + that->formatList.append(formatsForAtom.at(j)); + } + } + } + } + + return formatList; + } + + bool hasFormat_sys(const QString &format) const + { + QStringList list = formats(); + return list.contains(format); + } + + QVariant retrieveData_sys(const QString &fmt, QVariant::Type requestedType) const + { + if (fmt.isEmpty() || empty()) + return QByteArray(); + + (void)formats(); // trigger update of format list + + QList<Atom> atoms; + Atom *targets = (Atom *) format_atoms.data(); + int size = format_atoms.size() / sizeof(Atom); + for (int i = 0; i < size; ++i) + atoms.append(targets[i]); + + QByteArray encoding; + Atom fmtatom = mimeAtomForFormat(m_clipboard->screen()->display(),fmt, requestedType, atoms, &encoding); + + if (fmtatom == 0) + return QVariant(); + + return mimeConvertToFormat(m_clipboard->screen()->display(),fmtatom, m_clipboard->getDataInFormat(modeAtom,fmtatom), fmt, requestedType, encoding); + } +private: + bool empty() const + { + Window win = XGetSelectionOwner(m_clipboard->screen()->display(), modeAtom); + + return win == XNone; + } + + + Atom modeAtom; + QXlibClipboard *m_clipboard; + QStringList formatList; + QByteArray format_atoms; +}; + +const int QXlibClipboard::clipboard_timeout = 5000; + +QXlibClipboard::QXlibClipboard(QXlibScreen *screen) + : QPlatformClipboard() + , m_screen(screen) + , m_xClipboard(0) + , m_clientClipboard(0) + , m_xSelection(0) + , m_clientSelection(0) + , m_requestor(XNone) + , m_owner(XNone) +{ +} + +const QMimeData * QXlibClipboard::mimeData(QClipboard::Mode mode) const +{ + if (mode == QClipboard::Clipboard) { + if (!m_xClipboard) { + QXlibClipboard *that = const_cast<QXlibClipboard *>(this); + that->m_xClipboard = new QXlibClipboardMime(mode,that); + } + Window clipboardOwner = XGetSelectionOwner(screen()->display(),QXlibStatic::atom(QXlibStatic::CLIPBOARD)); + if (clipboardOwner == owner()) { + return m_clientClipboard; + } else { + return m_xClipboard; + } + } else if (mode == QClipboard::Selection) { + if (!m_xSelection) { + QXlibClipboard *that = const_cast<QXlibClipboard *>(this); + that->m_xSelection = new QXlibClipboardMime(mode,that); + } + Window clipboardOwner = XGetSelectionOwner(screen()->display(),XA_PRIMARY); + if (clipboardOwner == owner()) { + return m_clientSelection; + } else { + return m_xSelection; + } + } + return 0; +} + +void QXlibClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode) +{ + Atom modeAtom; + QMimeData **d; + switch (mode) { + case QClipboard::Selection: + modeAtom = XA_PRIMARY; + d = &m_clientSelection; + break; + + case QClipboard::Clipboard: + modeAtom = QXlibStatic::atom(QXlibStatic::CLIPBOARD); + d = &m_clientClipboard; + break; + + default: + qWarning("QClipboard::setMimeData: unsupported mode '%d'", mode); + return; + } + + Window newOwner; + + if (! data) { // no data, clear clipboard contents + newOwner = XNone; + } else { + newOwner = owner(); + + *d = data; + } + + XSetSelectionOwner(m_screen->display(), modeAtom, newOwner, CurrentTime); + + if (XGetSelectionOwner(m_screen->display(), modeAtom) != newOwner) { + qWarning("QClipboard::setData: Cannot set X11 selection owner"); + } + +} + +bool QXlibClipboard::supportsMode(QClipboard::Mode mode) const +{ + if (mode == QClipboard::Clipboard || mode == QClipboard::Selection) + return true; + return false; +} + + +QXlibScreen * QXlibClipboard::screen() const +{ + return m_screen; +} + +Window QXlibClipboard::requestor() const +{ + if (!m_requestor) { + int x = 0, y = 0, w = 3, h = 3; + QXlibClipboard *that = const_cast<QXlibClipboard *>(this); + Window window = XCreateSimpleWindow(m_screen->display(), m_screen->rootWindow(), + x, y, w, h, 0 /*border_width*/, + m_screen->blackPixel(), m_screen->whitePixel()); + that->setRequestor(window); + } + return m_requestor; +} + +void QXlibClipboard::setRequestor(Window window) +{ + if (m_requestor != XNone) { + XDestroyWindow(m_screen->display(),m_requestor); + } + m_requestor = window; +} + +Window QXlibClipboard::owner() const +{ + if (!m_owner) { + int x = 0, y = 0, w = 3, h = 3; + QXlibClipboard *that = const_cast<QXlibClipboard *>(this); + Window window = XCreateSimpleWindow(m_screen->display(), m_screen->rootWindow(), + x, y, w, h, 0 /*border_width*/, + m_screen->blackPixel(), m_screen->whitePixel()); + that->setOwner(window); + } + return m_owner; +} + +void QXlibClipboard::setOwner(Window window) +{ + if (m_owner != XNone){ + XDestroyWindow(m_screen->display(),m_owner); + } + m_owner = window; +} + +Atom QXlibClipboard::sendTargetsSelection(QMimeData *d, Window window, Atom property) +{ + QVector<Atom> types; + QStringList formats = QInternalMimeData::formatsHelper(d); + for (int i = 0; i < formats.size(); ++i) { + QList<Atom> atoms = QXlibMime::mimeAtomsForFormat(screen()->display(),formats.at(i)); + for (int j = 0; j < atoms.size(); ++j) { + if (!types.contains(atoms.at(j))) + types.append(atoms.at(j)); + } + } + types.append(QXlibStatic::atom(QXlibStatic::TARGETS)); + types.append(QXlibStatic::atom(QXlibStatic::MULTIPLE)); + types.append(QXlibStatic::atom(QXlibStatic::TIMESTAMP)); + types.append(QXlibStatic::atom(QXlibStatic::SAVE_TARGETS)); + + XChangeProperty(screen()->display(), window, property, XA_ATOM, 32, + PropModeReplace, (uchar *) types.data(), types.size()); + return property; +} + +Atom QXlibClipboard::sendSelection(QMimeData *d, Atom target, Window window, Atom property) +{ + Atom atomFormat = target; + int dataFormat = 0; + QByteArray data; + + QString fmt = QXlibMime::mimeAtomToString(screen()->display(), target); + if (fmt.isEmpty()) { // Not a MIME type we have + qDebug() << "QClipboard: send_selection(): converting to type '%s' is not supported" << fmt.data(); + return XNone; + } + qDebug() << "QClipboard: send_selection(): converting to type '%s'" << fmt.data(); + + if (QXlibMime::mimeDataForAtom(screen()->display(),target, d, &data, &atomFormat, &dataFormat)) { + + // don't allow INCR transfers when using MULTIPLE or to + // Motif clients (since Motif doesn't support INCR) + static Atom motif_clip_temporary = QXlibStatic::atom(QXlibStatic::CLIP_TEMPORARY); + bool allow_incr = property != motif_clip_temporary; + + // X_ChangeProperty protocol request is 24 bytes + const int increment = (XMaxRequestSize(screen()->display()) * 4) - 24; + if (data.size() > increment && allow_incr) { + long bytes = data.size(); + XChangeProperty(screen()->display(), window, property, + QXlibStatic::atom(QXlibStatic::INCR), 32, PropModeReplace, (uchar *) &bytes, 1); + +// (void)new QClipboardINCRTransaction(window, property, atomFormat, dataFormat, data, increment); + qDebug() << "not implemented INCRT just YET!"; + return property; + } + + // make sure we can perform the XChangeProperty in a single request + if (data.size() > increment) + return XNone; // ### perhaps use several XChangeProperty calls w/ PropModeAppend? + int dataSize = data.size() / (dataFormat / 8); + // use a single request to transfer data + XChangeProperty(screen()->display(), window, property, atomFormat, + dataFormat, PropModeReplace, (uchar *) data.data(), + dataSize); + } + return property; +} + +void QXlibClipboard::handleSelectionRequest(XEvent *xevent) +{ + XSelectionRequestEvent *req = &xevent->xselectionrequest; + + if (requestor() && req->requestor == requestor()) { + qDebug() << "This should be caught before"; + return; + } + + XEvent event; + event.xselection.type = SelectionNotify; + event.xselection.display = req->display; + event.xselection.requestor = req->requestor; + event.xselection.selection = req->selection; + event.xselection.target = req->target; + event.xselection.property = XNone; + event.xselection.time = req->time; + + QMimeData *d; + if (req->selection == XA_PRIMARY) { + d = m_clientSelection; + } else if (req->selection == QXlibStatic::atom(QXlibStatic::CLIPBOARD)) { + d = m_clientClipboard; + } else { + qWarning("QClipboard: Unknown selection '%lx'", req->selection); + XSendEvent(screen()->display(), req->requestor, False, NoEventMask, &event); + return; + } + + if (!d) { + qWarning("QClipboard: Cannot transfer data, no data available"); + XSendEvent(screen()->display(), req->requestor, False, NoEventMask, &event); + return; + } + + Atom xa_targets = QXlibStatic::atom(QXlibStatic::TARGETS); + Atom xa_multiple = QXlibStatic::atom(QXlibStatic::MULTIPLE); + Atom xa_timestamp = QXlibStatic::atom(QXlibStatic::TIMESTAMP); + + struct AtomPair { Atom target; Atom property; } *multi = 0; + Atom multi_type = XNone; + int multi_format = 0; + int nmulti = 0; + int imulti = -1; + bool multi_writeback = false; + + if (req->target == xa_multiple) { + QByteArray multi_data; + if (req->property == XNone + || !clipboardReadProperty(req->requestor, req->property, false, &multi_data, + 0, &multi_type, &multi_format) + || multi_format != 32) { + // MULTIPLE property not formatted correctly + XSendEvent(screen()->display(), req->requestor, False, NoEventMask, &event); + return; + } + nmulti = multi_data.size()/sizeof(*multi); + multi = new AtomPair[nmulti]; + memcpy(multi,multi_data.data(),multi_data.size()); + imulti = 0; + } + + for (; imulti < nmulti; ++imulti) { + Atom target; + Atom property; + + if (multi) { + target = multi[imulti].target; + property = multi[imulti].property; + } else { + target = req->target; + property = req->property; + if (property == XNone) // obsolete client + property = target; + } + + Atom ret = XNone; + if (target == XNone || property == XNone) { + ; + } else if (target == xa_timestamp) { +// if (d->timestamp != CurrentTime) { +// XChangeProperty(screen()->display(), req->requestor, property, XA_INTEGER, 32, +// PropModeReplace, CurrentTime, 1); +// ret = property; +// } else { +// qWarning("QClipboard: Invalid data timestamp"); +// } + } else if (target == xa_targets) { + ret = sendTargetsSelection(d, req->requestor, property); + } else { + ret = sendSelection(d, target, req->requestor, property); + } + + if (nmulti > 0) { + if (ret == XNone) { + multi[imulti].property = XNone; + multi_writeback = true; + } + } else { + event.xselection.property = ret; + break; + } + } + + if (nmulti > 0) { + if (multi_writeback) { + // according to ICCCM 2.6.2 says to put None back + // into the original property on the requestor window + XChangeProperty(screen()->display(), req->requestor, req->property, multi_type, 32, + PropModeReplace, (uchar *) multi, nmulti * 2); + } + + delete [] multi; + event.xselection.property = req->property; + } + + // send selection notify to requestor + XSendEvent(screen()->display(), req->requestor, False, NoEventMask, &event); +} + +static inline int maxSelectionIncr(Display *dpy) +{ return XMaxRequestSize(dpy) > 65536 ? 65536*4 : XMaxRequestSize(dpy)*4 - 100; } + +bool QXlibClipboard::clipboardReadProperty(Window win, Atom property, bool deleteProperty, QByteArray *buffer, int *size, Atom *type, int *format) const +{ + int maxsize = maxSelectionIncr(screen()->display()); + ulong bytes_left; // bytes_after + ulong length; // nitems + uchar *data; + Atom dummy_type; + int dummy_format; + int r; + + if (!type) // allow null args + type = &dummy_type; + if (!format) + format = &dummy_format; + + // Don't read anything, just get the size of the property data + r = XGetWindowProperty(screen()->display(), win, property, 0, 0, False, + AnyPropertyType, type, format, + &length, &bytes_left, &data); + if (r != Success || (type && *type == XNone)) { + buffer->resize(0); + return false; + } + XFree((char*)data); + + int offset = 0, buffer_offset = 0, format_inc = 1, proplen = bytes_left; + + switch (*format) { + case 8: + default: + format_inc = sizeof(char) / 1; + break; + + case 16: + format_inc = sizeof(short) / 2; + proplen *= sizeof(short) / 2; + break; + + case 32: + format_inc = sizeof(long) / 4; + proplen *= sizeof(long) / 4; + break; + } + + int newSize = proplen; + buffer->resize(newSize); + + bool ok = (buffer->size() == newSize); + + if (ok && newSize) { + // could allocate buffer + + while (bytes_left) { + // more to read... + + r = XGetWindowProperty(screen()->display(), win, property, offset, maxsize/4, + False, AnyPropertyType, type, format, + &length, &bytes_left, &data); + if (r != Success || (type && *type == XNone)) + break; + + offset += length / (32 / *format); + length *= format_inc * (*format) / 8; + + // Here we check if we get a buffer overflow and tries to + // recover -- this shouldn't normally happen, but it doesn't + // hurt to be defensive + if ((int)(buffer_offset + length) > buffer->size()) { + length = buffer->size() - buffer_offset; + + // escape loop + bytes_left = 0; + } + + memcpy(buffer->data() + buffer_offset, data, length); + buffer_offset += length; + + XFree((char*)data); + } + + if (*format == 8 && *type == QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT)) { + // convert COMPOUND_TEXT to a multibyte string + XTextProperty textprop; + textprop.encoding = *type; + textprop.format = *format; + textprop.nitems = buffer_offset; + textprop.value = (unsigned char *) buffer->data(); + + char **list_ret = 0; + int count; + if (XmbTextPropertyToTextList(screen()->display(), &textprop, &list_ret, + &count) == Success && count && list_ret) { + offset = buffer_offset = strlen(list_ret[0]); + buffer->resize(offset); + memcpy(buffer->data(), list_ret[0], offset); + } + if (list_ret) XFreeStringList(list_ret); + } + } + + // correct size, not 0-term. + if (size) + *size = buffer_offset; + + if (deleteProperty) + XDeleteProperty(screen()->display(), win, property); + + XFlush(screen()->display()); + + return ok; +} + +QByteArray QXlibClipboard::clipboardReadIncrementalProperty(Window win, Atom property, int nbytes, bool nullterm) +{ + XEvent event; + + QByteArray buf; + QByteArray tmp_buf; + bool alloc_error = false; + int length; + int offset = 0; + + if (nbytes > 0) { + // Reserve buffer + zero-terminator (for text data) + // We want to complete the INCR transfer even if we cannot + // allocate more memory + buf.resize(nbytes+1); + alloc_error = buf.size() != nbytes+1; + } + + for (;;) { + XFlush(screen()->display()); + if (!screen()->waitForClipboardEvent(win,PropertyNotify,&event,clipboard_timeout)) + break; + if (event.xproperty.atom != property || + event.xproperty.state != PropertyNewValue) + continue; + if (clipboardReadProperty(win, property, true, &tmp_buf, &length, 0, 0)) { + if (length == 0) { // no more data, we're done + if (nullterm) { + buf.resize(offset+1); + buf[offset] = '\0'; + } else { + buf.resize(offset); + } + return buf; + } else if (!alloc_error) { + if (offset+length > (int)buf.size()) { + buf.resize(offset+length+65535); + if (buf.size() != offset+length+65535) { + alloc_error = true; + length = buf.size() - offset; + } + } + memcpy(buf.data()+offset, tmp_buf.constData(), length); + tmp_buf.resize(0); + offset += length; + } + } else { + break; + } + } + + // timed out ... create a new requestor window, otherwise the requestor + // could consider next request to be still part of this timed out request + setRequestor(0); + + return QByteArray(); +} + +QByteArray QXlibClipboard::getDataInFormat(Atom modeAtom, Atom fmtatom) +{ + QByteArray buf; + + Window win = requestor(); + + XSelectInput(screen()->display(), win, NoEventMask); // don't listen for any events + + XDeleteProperty(screen()->display(), win, QXlibStatic::atom(QXlibStatic::_QT_SELECTION)); + XConvertSelection(screen()->display(), modeAtom, fmtatom, QXlibStatic::atom(QXlibStatic::_QT_SELECTION), win, CurrentTime); + XSync(screen()->display(), false); + + XEvent xevent; + if (!screen()->waitForClipboardEvent(win,SelectionNotify,&xevent,clipboard_timeout) || + xevent.xselection.property == XNone) { + return buf; + } + + Atom type; + XSelectInput(screen()->display(), win, PropertyChangeMask); + + if (clipboardReadProperty(win, QXlibStatic::atom(QXlibStatic::_QT_SELECTION), true, &buf, 0, &type, 0)) { + if (type == QXlibStatic::atom(QXlibStatic::INCR)) { + int nbytes = buf.size() >= 4 ? *((int*)buf.data()) : 0; + buf = clipboardReadIncrementalProperty(win, QXlibStatic::atom(QXlibStatic::_QT_SELECTION), nbytes, false); + } + } + + XSelectInput(screen()->display(), win, NoEventMask); + + + return buf; +} + +#include "qtestliteclipboard.moc" diff --git a/src/plugins/platforms/xlib/qxlibclipboard.h b/src/plugins/platforms/xlib/qxlibclipboard.h new file mode 100644 index 0000000..109714c --- /dev/null +++ b/src/plugins/platforms/xlib/qxlibclipboard.h @@ -0,0 +1,94 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTESTLITECLIPBOARD_H +#define QTESTLITECLIPBOARD_H + +#include <QPlatformClipboard> +#include "qtestlitestaticinfo.h" + +class QXlibScreen; +class QXlibClipboard : public QPlatformClipboard +{ +public: + QXlibClipboard(QXlibScreen *screen); + + const QMimeData *mimeData(QClipboard::Mode mode) const; + void setMimeData(QMimeData *data, QClipboard::Mode mode); + + bool supportsMode(QClipboard::Mode mode) const; + + QXlibScreen *screen() const; + + Window requestor() const; + void setRequestor(Window window); + + Window owner() const; + + void handleSelectionRequest(XEvent *event); + + bool clipboardReadProperty(Window win, Atom property, bool deleteProperty, QByteArray *buffer, int *size, Atom *type, int *format) const; + QByteArray clipboardReadIncrementalProperty(Window win, Atom property, int nbytes, bool nullterm); + + QByteArray getDataInFormat(Atom modeAtom, Atom fmtatom); + +private: + void setOwner(Window window); + + Atom sendTargetsSelection(QMimeData *d, Window window, Atom property); + Atom sendSelection(QMimeData *d, Atom target, Window window, Atom property); + + QXlibScreen *m_screen; + + QMimeData *m_xClipboard; + QMimeData *m_clientClipboard; + + QMimeData *m_xSelection; + QMimeData *m_clientSelection; + + Window m_requestor; + Window m_owner; + + static const int clipboard_timeout; + +}; + +#endif // QTESTLITECLIPBOARD_H diff --git a/src/plugins/platforms/xlib/qxlibcursor.cpp b/src/plugins/platforms/xlib/qxlibcursor.cpp new file mode 100644 index 0000000..2f7cfbf --- /dev/null +++ b/src/plugins/platforms/xlib/qxlibcursor.cpp @@ -0,0 +1,199 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qtestlitecursor.h" + +#include "qtestliteintegration.h" +#include "qtestlitescreen.h" +#include "qtestlitewindow.h" + +#include <QtGui/QBitmap> + +#include <X11/cursorfont.h> + +QT_BEGIN_NAMESPACE + +QXlibCursor::QXlibCursor(QXlibScreen *screen) + : QPlatformCursor(screen) +{ +} + +void QXlibCursor::changeCursor(QCursor *cursor, QWidget *widget) +{ + QXlibWindow *w = 0; + if (widget) { + QWidget *window = widget->window(); + w = static_cast<QXlibWindow*>(window->platformWindow()); + } else { + // No X11 cursor control when there is no widget under the cursor + return; + } + + if (!w) + return; + + int id = cursor->handle(); + + Cursor c; + if (!cursorMap.contains(id)) { + if (cursor->shape() == Qt::BitmapCursor) + c = createCursorBitmap(cursor); + else + c = createCursorShape(cursor->shape()); + if (!c) { + return; + } + cursorMap.insert(id, c); + } else { + c = cursorMap.value(id); + } + + w->setCursor(c); +} + +Cursor QXlibCursor::createCursorBitmap(QCursor * cursor) +{ + XColor bg, fg; + bg.red = 255 << 8; + bg.green = 255 << 8; + bg.blue = 255 << 8; + fg.red = 0; + fg.green = 0; + fg.blue = 0; + QPoint spot = cursor->hotSpot(); + Window rootwin = testLiteScreen()->rootWindow(); + + QImage mapImage = cursor->bitmap()->toImage().convertToFormat(QImage::Format_MonoLSB); + QImage maskImage = cursor->mask()->toImage().convertToFormat(QImage::Format_MonoLSB); + + int width = cursor->bitmap()->width(); + int height = cursor->bitmap()->height(); + int bytesPerLine = mapImage.bytesPerLine(); + int destLineSize = width / 8; + if (width % 8) + destLineSize++; + + const uchar * map = mapImage.bits(); + const uchar * mask = maskImage.bits(); + + char * mapBits = new char[height * destLineSize]; + char * maskBits = new char[height * destLineSize]; + for (int i = 0; i < height; i++) { + memcpy(mapBits + (destLineSize * i),map + (bytesPerLine * i), destLineSize); + memcpy(maskBits + (destLineSize * i),mask + (bytesPerLine * i), destLineSize); + } + + Pixmap cp = XCreateBitmapFromData(testLiteScreen()->display(), rootwin, mapBits, width, height); + Pixmap mp = XCreateBitmapFromData(testLiteScreen()->display(), rootwin, maskBits, width, height); + Cursor c = XCreatePixmapCursor(testLiteScreen()->display(), cp, mp, &fg, &bg, spot.x(), spot.y()); + XFreePixmap(testLiteScreen()->display(), cp); + XFreePixmap(testLiteScreen()->display(), mp); + delete[] mapBits; + delete[] maskBits; + + return c; +} + +Cursor QXlibCursor::createCursorShape(int cshape) +{ + Cursor cursor = 0; + + if (cshape < 0 || cshape > Qt::LastCursor) + return 0; + + switch (cshape) { + case Qt::ArrowCursor: + cursor = XCreateFontCursor(testLiteScreen()->display(), XC_left_ptr); + break; + case Qt::UpArrowCursor: + cursor = XCreateFontCursor(testLiteScreen()->display(), XC_center_ptr); + break; + case Qt::CrossCursor: + cursor = XCreateFontCursor(testLiteScreen()->display(), XC_crosshair); + break; + case Qt::WaitCursor: + cursor = XCreateFontCursor(testLiteScreen()->display(), XC_watch); + break; + case Qt::IBeamCursor: + cursor = XCreateFontCursor(testLiteScreen()->display(), XC_xterm); + break; + case Qt::SizeAllCursor: + cursor = XCreateFontCursor(testLiteScreen()->display(), XC_fleur); + break; + case Qt::PointingHandCursor: + cursor = XCreateFontCursor(testLiteScreen()->display(), XC_hand2); + break; + case Qt::SizeBDiagCursor: + cursor = XCreateFontCursor(testLiteScreen()->display(), XC_top_right_corner); + break; + case Qt::SizeFDiagCursor: + cursor = XCreateFontCursor(testLiteScreen()->display(), XC_bottom_right_corner); + break; + case Qt::SizeVerCursor: + case Qt::SplitVCursor: + cursor = XCreateFontCursor(testLiteScreen()->display(), XC_sb_v_double_arrow); + break; + case Qt::SizeHorCursor: + case Qt::SplitHCursor: + cursor = XCreateFontCursor(testLiteScreen()->display(), XC_sb_h_double_arrow); + break; + case Qt::WhatsThisCursor: + cursor = XCreateFontCursor(testLiteScreen()->display(), XC_question_arrow); + break; + case Qt::ForbiddenCursor: + cursor = XCreateFontCursor(testLiteScreen()->display(), XC_circle); + break; + case Qt::BusyCursor: + cursor = XCreateFontCursor(testLiteScreen()->display(), XC_watch); + break; + + default: //default cursor for all the rest + break; + } + return cursor; +} + +QXlibScreen * QXlibCursor::testLiteScreen() const +{ + return static_cast<QXlibScreen *>(screen); +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/xlib/qxlibcursor.h b/src/plugins/platforms/xlib/qxlibcursor.h new file mode 100644 index 0000000..db9f9e2 --- /dev/null +++ b/src/plugins/platforms/xlib/qxlibcursor.h @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTESTLITECURSOR_H +#define QTESTLITECURSOR_H + +#include <QtGui/QPlatformCursor> + +#include "qtestliteintegration.h" + +QT_BEGIN_NAMESPACE + +class QXlibCursor : QPlatformCursor +{ +public: + QXlibCursor(QXlibScreen *screen); + + void changeCursor(QCursor * cursor, QWidget * widget); +private: + + Cursor createCursorBitmap(QCursor * cursor); + Cursor createCursorShape(int cshape); + + QXlibScreen *testLiteScreen() const; + QMap<int, Cursor> cursorMap; +}; + +QT_END_NAMESPACE + +#endif // QTESTLITECURSOR_H diff --git a/src/plugins/platforms/xlib/qxlibeglintegration.cpp b/src/plugins/platforms/xlib/qxlibeglintegration.cpp new file mode 100644 index 0000000..9bbe0ca --- /dev/null +++ b/src/plugins/platforms/xlib/qxlibeglintegration.cpp @@ -0,0 +1,186 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qtestliteeglintegration.h" + +static int countBits(unsigned long mask) +{ + int count = 0; + while (mask != 0) { + if (mask & 1) + ++count; + mask >>= 1; + } + return count; +} + +VisualID QXlibEglIntegration::getCompatibleVisualId(Display *display, EGLConfig config) +{ + VisualID visualId = 0; + EGLint eglValue = 0; + + EGLDisplay eglDisplay = eglGetDisplay(display); + + EGLint configRedSize = 0; + eglGetConfigAttrib(eglDisplay, config, EGL_RED_SIZE, &configRedSize); + + EGLint configGreenSize = 0; + eglGetConfigAttrib(eglDisplay, config, EGL_GREEN_SIZE, &configGreenSize); + + EGLint configBlueSize = 0; + eglGetConfigAttrib(eglDisplay, config, EGL_BLUE_SIZE, &configBlueSize); + + EGLint configAlphaSize = 0; + eglGetConfigAttrib(eglDisplay, config, EGL_ALPHA_SIZE, &configAlphaSize); + + eglGetConfigAttrib(eglDisplay, config, EGL_CONFIG_ID, &eglValue); + int configId = eglValue; + + // See if EGL provided a valid VisualID: + eglGetConfigAttrib(eglDisplay, config, EGL_NATIVE_VISUAL_ID, &eglValue); + visualId = (VisualID)eglValue; + if (visualId) { + // EGL has suggested a visual id, so get the rest of the visual info for that id: + XVisualInfo visualInfoTemplate; + memset(&visualInfoTemplate, 0, sizeof(XVisualInfo)); + visualInfoTemplate.visualid = visualId; + + XVisualInfo *chosenVisualInfo; + int matchingCount = 0; + chosenVisualInfo = XGetVisualInfo(display, VisualIDMask, &visualInfoTemplate, &matchingCount); + if (chosenVisualInfo) { + // Skip size checks if implementation supports non-matching visual + // and config (http://bugreports.qt.nokia.com/browse/QTBUG-9444). + if (q_hasEglExtension(eglDisplay,"EGL_NV_post_convert_rounding")) { + XFree(chosenVisualInfo); + return visualId; + } + + int visualRedSize = countBits(chosenVisualInfo->red_mask); + int visualGreenSize = countBits(chosenVisualInfo->green_mask); + int visualBlueSize = countBits(chosenVisualInfo->blue_mask); + int visualAlphaSize = -1; // Need XRender to tell us the alpha channel size + + bool visualMatchesConfig = false; + if ( visualRedSize == configRedSize && + visualGreenSize == configGreenSize && + visualBlueSize == configBlueSize ) + { + // We need XRender to check the alpha channel size of the visual. If we don't have + // the alpha size, we don't check it against the EGL config's alpha size. + if (visualAlphaSize >= 0) + visualMatchesConfig = visualAlphaSize == configAlphaSize; + else + visualMatchesConfig = true; + } + + if (!visualMatchesConfig) { + if (visualAlphaSize >= 0) { + qWarning("Warning: EGL suggested using X Visual ID %d (ARGB%d%d%d%d) for EGL config %d (ARGB%d%d%d%d), but this is incompatable", + (int)visualId, visualAlphaSize, visualRedSize, visualGreenSize, visualBlueSize, + configId, configAlphaSize, configRedSize, configGreenSize, configBlueSize); + } else { + qWarning("Warning: EGL suggested using X Visual ID %d (RGB%d%d%d) for EGL config %d (RGB%d%d%d), but this is incompatable", + (int)visualId, visualRedSize, visualGreenSize, visualBlueSize, + configId, configRedSize, configGreenSize, configBlueSize); + } + visualId = 0; + } + } else { + qWarning("Warning: EGL suggested using X Visual ID %d for EGL config %d, but that isn't a valid ID", + (int)visualId, configId); + visualId = 0; + } + XFree(chosenVisualInfo); + } +#ifdef QT_DEBUG_X11_VISUAL_SELECTION + else + qDebug("EGL did not suggest a VisualID (EGL_NATIVE_VISUAL_ID was zero) for EGLConfig %d", configId); +#endif + + if (visualId) { +#ifdef QT_DEBUG_X11_VISUAL_SELECTION + if (configAlphaSize > 0) + qDebug("Using ARGB Visual ID %d provided by EGL for config %d", (int)visualId, configId); + else + qDebug("Using Opaque Visual ID %d provided by EGL for config %d", (int)visualId, configId); +#endif + return visualId; + } + + // Finally, try to + // use XGetVisualInfo and only use the bit depths to match on: + if (!visualId) { + XVisualInfo visualInfoTemplate; + memset(&visualInfoTemplate, 0, sizeof(XVisualInfo)); + XVisualInfo *matchingVisuals; + int matchingCount = 0; + + visualInfoTemplate.depth = configRedSize + configGreenSize + configBlueSize + configAlphaSize; + matchingVisuals = XGetVisualInfo(display, + VisualDepthMask, + &visualInfoTemplate, + &matchingCount); + if (!matchingVisuals) { + // Try again without taking the alpha channel into account: + visualInfoTemplate.depth = configRedSize + configGreenSize + configBlueSize; + matchingVisuals = XGetVisualInfo(display, + VisualDepthMask, + &visualInfoTemplate, + &matchingCount); + } + + if (matchingVisuals) { + visualId = matchingVisuals[0].visualid; + XFree(matchingVisuals); + } + } + + if (visualId) { +#ifdef QT_DEBUG_X11_VISUAL_SELECTION + qDebug("Using Visual ID %d provided by XGetVisualInfo for EGL config %d", (int)visualId, configId); +#endif + return visualId; + } + + qWarning("Unable to find an X11 visual which matches EGL config %d", configId); + return (VisualID)0; +} diff --git a/src/plugins/platforms/xlib/qxlibeglintegration.h b/src/plugins/platforms/xlib/qxlibeglintegration.h new file mode 100644 index 0000000..4c2e50d --- /dev/null +++ b/src/plugins/platforms/xlib/qxlibeglintegration.h @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTESTLITEEGLINTEGRATION_H +#define QTESTLITEEGLINTEGRATION_H + +#include "qtestlitestaticinfo.h" +#include "../eglconvenience/qeglconvenience.h" + +class QXlibEglIntegration +{ +public: + static VisualID getCompatibleVisualId(Display *display, EGLConfig config); +}; + +#endif // QTESTLITEEGLINTEGRATION_H diff --git a/src/plugins/platforms/xlib/qxlibintegration.cpp b/src/plugins/platforms/xlib/qxlibintegration.cpp new file mode 100644 index 0000000..cdc5c29 --- /dev/null +++ b/src/plugins/platforms/xlib/qxlibintegration.cpp @@ -0,0 +1,156 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qtestliteintegration.h" +#include "qtestlitewindowsurface.h" +#include <QtGui/private/qpixmap_raster_p.h> +#include <QtCore/qdebug.h> + +#include "qtestlitewindow.h" +#include "qgenericunixfontdatabase.h" +#include "qtestlitescreen.h" +#include "qtestliteclipboard.h" + +#if !defined(QT_NO_OPENGL) +#if !defined(QT_OPENGL_ES_2) +#include <GL/glx.h> +#else +#include <EGL/egl.h> +#endif //!defined(QT_OPENGL_ES_2) +#include <private/qwindowsurface_gl_p.h> +#include <private/qpixmapdata_gl_p.h> +#endif //QT_NO_OPENGL + +QT_BEGIN_NAMESPACE + +QXlibIntegration::QXlibIntegration(bool useOpenGL) + : mUseOpenGL(useOpenGL) + , mFontDb(new QGenericUnixFontDatabase()) + , mClipboard(0) +{ + mPrimaryScreen = new QXlibScreen(); + mScreens.append(mPrimaryScreen); +} + +QPixmapData *QXlibIntegration::createPixmapData(QPixmapData::PixelType type) const +{ +#ifndef QT_NO_OPENGL + if (mUseOpenGL) + return new QGLPixmapData(type); +#endif + return new QRasterPixmapData(type); +} + +QWindowSurface *QXlibIntegration::createWindowSurface(QWidget *widget, WId) const +{ +#ifndef QT_NO_OPENGL + if (mUseOpenGL) + return new QGLWindowSurface(widget); +#endif + return new QXlibWindowSurface(widget); +} + + +QPlatformWindow *QXlibIntegration::createPlatformWindow(QWidget *widget, WId /*winId*/) const +{ + return new QXlibWindow(widget); +} + + + +QPixmap QXlibIntegration::grabWindow(WId window, int x, int y, int width, int height) const +{ + QImage image; + QWidget *widget = QWidget::find(window); + if (widget) { + QXlibScreen *screen = QXlibScreen::testLiteScreenForWidget(widget); + image = screen->grabWindow(window,x,y,width,height); + } else { + for (int i = 0; i < mScreens.size(); i++) { + QXlibScreen *screen = static_cast<QXlibScreen *>(mScreens[i]); + if (screen->rootWindow() == window) { + image = screen->grabWindow(window,x,y,width,height); + } + } + } + return QPixmap::fromImage(image); +} + +QPlatformFontDatabase *QXlibIntegration::fontDatabase() const +{ + return mFontDb; +} + +QPlatformClipboard * QXlibIntegration::clipboard() const +{ + //Use lazy init since clipboard needs QTestliteScreen + if (!mClipboard) { + QXlibIntegration *that = const_cast<QXlibIntegration *>(this); + that->mClipboard = new QXlibClipboard(mPrimaryScreen); + } + return mClipboard; +} + +bool QXlibIntegration::hasOpenGL() const +{ +#if !defined(QT_NO_OPENGL) +#if !defined(QT_OPENGL_ES_2) + QXlibScreen *screen = static_cast<const QXlibScreen *>(mScreens.at(0)); + return glXQueryExtension(screen->display(), 0, 0) != 0; +#else + static bool eglHasbeenInitialized = false; + static bool wasEglInitialized = false; + if (!eglHasbeenInitialized) { + eglHasbeenInitialized = true; + const QXlibScreen *screen = static_cast<const QXlibScreen *>(mScreens.at(0)); + EGLint major, minor; + eglBindAPI(EGL_OPENGL_ES_API); + EGLDisplay disp = eglGetDisplay(screen->display()); + wasEglInitialized = eglInitialize(disp,&major,&minor); + } + return wasEglInitialized; +#endif +#endif + return false; +} + + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/xlib/qxlibintegration.h b/src/plugins/platforms/xlib/qxlibintegration.h new file mode 100644 index 0000000..c3125b8 --- /dev/null +++ b/src/plugins/platforms/xlib/qxlibintegration.h @@ -0,0 +1,85 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QGRAPHICSSYSTEM_TESTLITE_H +#define QGRAPHICSSYSTEM_TESTLITE_H + +//make sure textstream is included before any X11 headers +#include <QtCore/QTextStream> + +#include <QtGui/QPlatformIntegration> +#include <QtGui/QPlatformScreen> + +#include "qtestlitestaticinfo.h" + +QT_BEGIN_NAMESPACE + +class QXlibScreen; + +class QXlibIntegration : public QPlatformIntegration +{ +public: + QXlibIntegration(bool useOpenGL = false); + + QPixmapData *createPixmapData(QPixmapData::PixelType type) const; + QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId) const; + QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const; + + QPixmap grabWindow(WId window, int x, int y, int width, int height) const; + + QList<QPlatformScreen *> screens() const { return mScreens; } + + QPlatformFontDatabase *fontDatabase() const; + QPlatformClipboard *clipboard() const; + + bool hasOpenGL() const; + +private: + bool mUseOpenGL; + QXlibScreen *mPrimaryScreen; + QList<QPlatformScreen *> mScreens; + QPlatformFontDatabase *mFontDb; + QPlatformClipboard *mClipboard; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/platforms/xlib/qxlibkeyboard.cpp b/src/plugins/platforms/xlib/qxlibkeyboard.cpp new file mode 100644 index 0000000..fb0cf2e --- /dev/null +++ b/src/plugins/platforms/xlib/qxlibkeyboard.cpp @@ -0,0 +1,1000 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qtestlitekeyboard.h" + +#include "qtestlitescreen.h" + +#include <QtGui/QWindowSystemInterface> + +#include <QtCore/QTextCodec> + +#ifndef XK_ISO_Left_Tab +#define XK_ISO_Left_Tab 0xFE20 +#endif + +#ifndef XK_dead_hook +#define XK_dead_hook 0xFE61 +#endif + +#ifndef XK_dead_horn +#define XK_dead_horn 0xFE62 +#endif + +#ifndef XK_Codeinput +#define XK_Codeinput 0xFF37 +#endif + +#ifndef XK_Kanji_Bangou +#define XK_Kanji_Bangou 0xFF37 /* same as codeinput */ +#endif + +// Fix old X libraries +#ifndef XK_KP_Home +#define XK_KP_Home 0xFF95 +#endif +#ifndef XK_KP_Left +#define XK_KP_Left 0xFF96 +#endif +#ifndef XK_KP_Up +#define XK_KP_Up 0xFF97 +#endif +#ifndef XK_KP_Right +#define XK_KP_Right 0xFF98 +#endif +#ifndef XK_KP_Down +#define XK_KP_Down 0xFF99 +#endif +#ifndef XK_KP_Prior +#define XK_KP_Prior 0xFF9A +#endif +#ifndef XK_KP_Next +#define XK_KP_Next 0xFF9B +#endif +#ifndef XK_KP_End +#define XK_KP_End 0xFF9C +#endif +#ifndef XK_KP_Insert +#define XK_KP_Insert 0xFF9E +#endif +#ifndef XK_KP_Delete +#define XK_KP_Delete 0xFF9F +#endif + +// the next lines are taken on 10/2009 from X.org (X11/XF86keysym.h), defining some special +// multimedia keys. They are included here as not every system has them. +#define XF86XK_MonBrightnessUp 0x1008FF02 +#define XF86XK_MonBrightnessDown 0x1008FF03 +#define XF86XK_KbdLightOnOff 0x1008FF04 +#define XF86XK_KbdBrightnessUp 0x1008FF05 +#define XF86XK_KbdBrightnessDown 0x1008FF06 +#define XF86XK_Standby 0x1008FF10 +#define XF86XK_AudioLowerVolume 0x1008FF11 +#define XF86XK_AudioMute 0x1008FF12 +#define XF86XK_AudioRaiseVolume 0x1008FF13 +#define XF86XK_AudioPlay 0x1008FF14 +#define XF86XK_AudioStop 0x1008FF15 +#define XF86XK_AudioPrev 0x1008FF16 +#define XF86XK_AudioNext 0x1008FF17 +#define XF86XK_HomePage 0x1008FF18 +#define XF86XK_Mail 0x1008FF19 +#define XF86XK_Start 0x1008FF1A +#define XF86XK_Search 0x1008FF1B +#define XF86XK_AudioRecord 0x1008FF1C +#define XF86XK_Calculator 0x1008FF1D +#define XF86XK_Memo 0x1008FF1E +#define XF86XK_ToDoList 0x1008FF1F +#define XF86XK_Calendar 0x1008FF20 +#define XF86XK_PowerDown 0x1008FF21 +#define XF86XK_ContrastAdjust 0x1008FF22 +#define XF86XK_Back 0x1008FF26 +#define XF86XK_Forward 0x1008FF27 +#define XF86XK_Stop 0x1008FF28 +#define XF86XK_Refresh 0x1008FF29 +#define XF86XK_PowerOff 0x1008FF2A +#define XF86XK_WakeUp 0x1008FF2B +#define XF86XK_Eject 0x1008FF2C +#define XF86XK_ScreenSaver 0x1008FF2D +#define XF86XK_WWW 0x1008FF2E +#define XF86XK_Sleep 0x1008FF2F +#define XF86XK_Favorites 0x1008FF30 +#define XF86XK_AudioPause 0x1008FF31 +#define XF86XK_AudioMedia 0x1008FF32 +#define XF86XK_MyComputer 0x1008FF33 +#define XF86XK_LightBulb 0x1008FF35 +#define XF86XK_Shop 0x1008FF36 +#define XF86XK_History 0x1008FF37 +#define XF86XK_OpenURL 0x1008FF38 +#define XF86XK_AddFavorite 0x1008FF39 +#define XF86XK_HotLinks 0x1008FF3A +#define XF86XK_BrightnessAdjust 0x1008FF3B +#define XF86XK_Finance 0x1008FF3C +#define XF86XK_Community 0x1008FF3D +#define XF86XK_AudioRewind 0x1008FF3E +#define XF86XK_BackForward 0x1008FF3F +#define XF86XK_Launch0 0x1008FF40 +#define XF86XK_Launch1 0x1008FF41 +#define XF86XK_Launch2 0x1008FF42 +#define XF86XK_Launch3 0x1008FF43 +#define XF86XK_Launch4 0x1008FF44 +#define XF86XK_Launch5 0x1008FF45 +#define XF86XK_Launch6 0x1008FF46 +#define XF86XK_Launch7 0x1008FF47 +#define XF86XK_Launch8 0x1008FF48 +#define XF86XK_Launch9 0x1008FF49 +#define XF86XK_LaunchA 0x1008FF4A +#define XF86XK_LaunchB 0x1008FF4B +#define XF86XK_LaunchC 0x1008FF4C +#define XF86XK_LaunchD 0x1008FF4D +#define XF86XK_LaunchE 0x1008FF4E +#define XF86XK_LaunchF 0x1008FF4F +#define XF86XK_ApplicationLeft 0x1008FF50 +#define XF86XK_ApplicationRight 0x1008FF51 +#define XF86XK_Book 0x1008FF52 +#define XF86XK_CD 0x1008FF53 +#define XF86XK_Calculater 0x1008FF54 +#define XF86XK_Clear 0x1008FF55 +#define XF86XK_ClearGrab 0x1008FE21 +#define XF86XK_Close 0x1008FF56 +#define XF86XK_Copy 0x1008FF57 +#define XF86XK_Cut 0x1008FF58 +#define XF86XK_Display 0x1008FF59 +#define XF86XK_DOS 0x1008FF5A +#define XF86XK_Documents 0x1008FF5B +#define XF86XK_Excel 0x1008FF5C +#define XF86XK_Explorer 0x1008FF5D +#define XF86XK_Game 0x1008FF5E +#define XF86XK_Go 0x1008FF5F +#define XF86XK_iTouch 0x1008FF60 +#define XF86XK_LogOff 0x1008FF61 +#define XF86XK_Market 0x1008FF62 +#define XF86XK_Meeting 0x1008FF63 +#define XF86XK_MenuKB 0x1008FF65 +#define XF86XK_MenuPB 0x1008FF66 +#define XF86XK_MySites 0x1008FF67 +#define XF86XK_News 0x1008FF69 +#define XF86XK_OfficeHome 0x1008FF6A +#define XF86XK_Option 0x1008FF6C +#define XF86XK_Paste 0x1008FF6D +#define XF86XK_Phone 0x1008FF6E +#define XF86XK_Reply 0x1008FF72 +#define XF86XK_Reload 0x1008FF73 +#define XF86XK_RotateWindows 0x1008FF74 +#define XF86XK_RotationPB 0x1008FF75 +#define XF86XK_RotationKB 0x1008FF76 +#define XF86XK_Save 0x1008FF77 +#define XF86XK_Send 0x1008FF7B +#define XF86XK_Spell 0x1008FF7C +#define XF86XK_SplitScreen 0x1008FF7D +#define XF86XK_Support 0x1008FF7E +#define XF86XK_TaskPane 0x1008FF7F +#define XF86XK_Terminal 0x1008FF80 +#define XF86XK_Tools 0x1008FF81 +#define XF86XK_Travel 0x1008FF82 +#define XF86XK_Video 0x1008FF87 +#define XF86XK_Word 0x1008FF89 +#define XF86XK_Xfer 0x1008FF8A +#define XF86XK_ZoomIn 0x1008FF8B +#define XF86XK_ZoomOut 0x1008FF8C +#define XF86XK_Away 0x1008FF8D +#define XF86XK_Messenger 0x1008FF8E +#define XF86XK_WebCam 0x1008FF8F +#define XF86XK_MailForward 0x1008FF90 +#define XF86XK_Pictures 0x1008FF91 +#define XF86XK_Music 0x1008FF92 +#define XF86XK_Battery 0x1008FF93 +#define XF86XK_Bluetooth 0x1008FF94 +#define XF86XK_WLAN 0x1008FF95 +#define XF86XK_UWB 0x1008FF96 +#define XF86XK_AudioForward 0x1008FF97 +#define XF86XK_AudioRepeat 0x1008FF98 +#define XF86XK_AudioRandomPlay 0x1008FF99 +#define XF86XK_Subtitle 0x1008FF9A +#define XF86XK_AudioCycleTrack 0x1008FF9B +#define XF86XK_Time 0x1008FF9F +#define XF86XK_Select 0x1008FFA0 +#define XF86XK_View 0x1008FFA1 +#define XF86XK_TopMenu 0x1008FFA2 +#define XF86XK_Suspend 0x1008FFA7 +#define XF86XK_Hibernate 0x1008FFA8 + + +// end of XF86keysyms.h + +// Special keys used by Qtopia, mapped into the X11 private keypad range. +#define QTOPIAXK_Select 0x11000601 +#define QTOPIAXK_Yes 0x11000602 +#define QTOPIAXK_No 0x11000603 +#define QTOPIAXK_Cancel 0x11000604 +#define QTOPIAXK_Printer 0x11000605 +#define QTOPIAXK_Execute 0x11000606 +#define QTOPIAXK_Sleep 0x11000607 +#define QTOPIAXK_Play 0x11000608 +#define QTOPIAXK_Zoom 0x11000609 +#define QTOPIAXK_Context1 0x1100060A +#define QTOPIAXK_Context2 0x1100060B +#define QTOPIAXK_Context3 0x1100060C +#define QTOPIAXK_Context4 0x1100060D +#define QTOPIAXK_Call 0x1100060E +#define QTOPIAXK_Hangup 0x1100060F +#define QTOPIAXK_Flip 0x11000610 + +// keyboard mapping table +static const unsigned int KeyTbl[] = { + + // misc keys + + XK_Escape, Qt::Key_Escape, + XK_Tab, Qt::Key_Tab, + XK_ISO_Left_Tab, Qt::Key_Backtab, + XK_BackSpace, Qt::Key_Backspace, + XK_Return, Qt::Key_Return, + XK_Insert, Qt::Key_Insert, + XK_Delete, Qt::Key_Delete, + XK_Clear, Qt::Key_Delete, + XK_Pause, Qt::Key_Pause, + XK_Print, Qt::Key_Print, + 0x1005FF60, Qt::Key_SysReq, // hardcoded Sun SysReq + 0x1007ff00, Qt::Key_SysReq, // hardcoded X386 SysReq + + // cursor movement + + XK_Home, Qt::Key_Home, + XK_End, Qt::Key_End, + XK_Left, Qt::Key_Left, + XK_Up, Qt::Key_Up, + XK_Right, Qt::Key_Right, + XK_Down, Qt::Key_Down, + XK_Prior, Qt::Key_PageUp, + XK_Next, Qt::Key_PageDown, + + // modifiers + + XK_Shift_L, Qt::Key_Shift, + XK_Shift_R, Qt::Key_Shift, + XK_Shift_Lock, Qt::Key_Shift, + XK_Control_L, Qt::Key_Control, + XK_Control_R, Qt::Key_Control, + XK_Meta_L, Qt::Key_Meta, + XK_Meta_R, Qt::Key_Meta, + XK_Alt_L, Qt::Key_Alt, + XK_Alt_R, Qt::Key_Alt, + XK_Caps_Lock, Qt::Key_CapsLock, + XK_Num_Lock, Qt::Key_NumLock, + XK_Scroll_Lock, Qt::Key_ScrollLock, + XK_Super_L, Qt::Key_Super_L, + XK_Super_R, Qt::Key_Super_R, + XK_Menu, Qt::Key_Menu, + XK_Hyper_L, Qt::Key_Hyper_L, + XK_Hyper_R, Qt::Key_Hyper_R, + XK_Help, Qt::Key_Help, + 0x1000FF74, Qt::Key_Backtab, // hardcoded HP backtab + 0x1005FF10, Qt::Key_F11, // hardcoded Sun F36 (labeled F11) + 0x1005FF11, Qt::Key_F12, // hardcoded Sun F37 (labeled F12) + + // numeric and function keypad keys + + XK_KP_Space, Qt::Key_Space, + XK_KP_Tab, Qt::Key_Tab, + XK_KP_Enter, Qt::Key_Enter, + //XK_KP_F1, Qt::Key_F1, + //XK_KP_F2, Qt::Key_F2, + //XK_KP_F3, Qt::Key_F3, + //XK_KP_F4, Qt::Key_F4, + XK_KP_Home, Qt::Key_Home, + XK_KP_Left, Qt::Key_Left, + XK_KP_Up, Qt::Key_Up, + XK_KP_Right, Qt::Key_Right, + XK_KP_Down, Qt::Key_Down, + XK_KP_Prior, Qt::Key_PageUp, + XK_KP_Next, Qt::Key_PageDown, + XK_KP_End, Qt::Key_End, + XK_KP_Begin, Qt::Key_Clear, + XK_KP_Insert, Qt::Key_Insert, + XK_KP_Delete, Qt::Key_Delete, + XK_KP_Equal, Qt::Key_Equal, + XK_KP_Multiply, Qt::Key_Asterisk, + XK_KP_Add, Qt::Key_Plus, + XK_KP_Separator, Qt::Key_Comma, + XK_KP_Subtract, Qt::Key_Minus, + XK_KP_Decimal, Qt::Key_Period, + XK_KP_Divide, Qt::Key_Slash, + + // International input method support keys + + // International & multi-key character composition + XK_ISO_Level3_Shift, Qt::Key_AltGr, + XK_Multi_key, Qt::Key_Multi_key, + XK_Codeinput, Qt::Key_Codeinput, + XK_SingleCandidate, Qt::Key_SingleCandidate, + XK_MultipleCandidate, Qt::Key_MultipleCandidate, + XK_PreviousCandidate, Qt::Key_PreviousCandidate, + + // Misc Functions + XK_Mode_switch, Qt::Key_Mode_switch, + XK_script_switch, Qt::Key_Mode_switch, + + // Japanese keyboard support + XK_Kanji, Qt::Key_Kanji, + XK_Muhenkan, Qt::Key_Muhenkan, + //XK_Henkan_Mode, Qt::Key_Henkan_Mode, + XK_Henkan_Mode, Qt::Key_Henkan, + XK_Henkan, Qt::Key_Henkan, + XK_Romaji, Qt::Key_Romaji, + XK_Hiragana, Qt::Key_Hiragana, + XK_Katakana, Qt::Key_Katakana, + XK_Hiragana_Katakana, Qt::Key_Hiragana_Katakana, + XK_Zenkaku, Qt::Key_Zenkaku, + XK_Hankaku, Qt::Key_Hankaku, + XK_Zenkaku_Hankaku, Qt::Key_Zenkaku_Hankaku, + XK_Touroku, Qt::Key_Touroku, + XK_Massyo, Qt::Key_Massyo, + XK_Kana_Lock, Qt::Key_Kana_Lock, + XK_Kana_Shift, Qt::Key_Kana_Shift, + XK_Eisu_Shift, Qt::Key_Eisu_Shift, + XK_Eisu_toggle, Qt::Key_Eisu_toggle, + //XK_Kanji_Bangou, Qt::Key_Kanji_Bangou, + //XK_Zen_Koho, Qt::Key_Zen_Koho, + //XK_Mae_Koho, Qt::Key_Mae_Koho, + XK_Kanji_Bangou, Qt::Key_Codeinput, + XK_Zen_Koho, Qt::Key_MultipleCandidate, + XK_Mae_Koho, Qt::Key_PreviousCandidate, + +#ifdef XK_KOREAN + // Korean keyboard support + XK_Hangul, Qt::Key_Hangul, + XK_Hangul_Start, Qt::Key_Hangul_Start, + XK_Hangul_End, Qt::Key_Hangul_End, + XK_Hangul_Hanja, Qt::Key_Hangul_Hanja, + XK_Hangul_Jamo, Qt::Key_Hangul_Jamo, + XK_Hangul_Romaja, Qt::Key_Hangul_Romaja, + //XK_Hangul_Codeinput, Qt::Key_Hangul_Codeinput, + XK_Hangul_Codeinput, Qt::Key_Codeinput, + XK_Hangul_Jeonja, Qt::Key_Hangul_Jeonja, + XK_Hangul_Banja, Qt::Key_Hangul_Banja, + XK_Hangul_PreHanja, Qt::Key_Hangul_PreHanja, + XK_Hangul_PostHanja, Qt::Key_Hangul_PostHanja, + //XK_Hangul_SingleCandidate,Qt::Key_Hangul_SingleCandidate, + //XK_Hangul_MultipleCandidate,Qt::Key_Hangul_MultipleCandidate, + //XK_Hangul_PreviousCandidate,Qt::Key_Hangul_PreviousCandidate, + XK_Hangul_SingleCandidate, Qt::Key_SingleCandidate, + XK_Hangul_MultipleCandidate,Qt::Key_MultipleCandidate, + XK_Hangul_PreviousCandidate,Qt::Key_PreviousCandidate, + XK_Hangul_Special, Qt::Key_Hangul_Special, + //XK_Hangul_switch, Qt::Key_Hangul_switch, + XK_Hangul_switch, Qt::Key_Mode_switch, +#endif // XK_KOREAN + + // dead keys + XK_dead_grave, Qt::Key_Dead_Grave, + XK_dead_acute, Qt::Key_Dead_Acute, + XK_dead_circumflex, Qt::Key_Dead_Circumflex, + XK_dead_tilde, Qt::Key_Dead_Tilde, + XK_dead_macron, Qt::Key_Dead_Macron, + XK_dead_breve, Qt::Key_Dead_Breve, + XK_dead_abovedot, Qt::Key_Dead_Abovedot, + XK_dead_diaeresis, Qt::Key_Dead_Diaeresis, + XK_dead_abovering, Qt::Key_Dead_Abovering, + XK_dead_doubleacute, Qt::Key_Dead_Doubleacute, + XK_dead_caron, Qt::Key_Dead_Caron, + XK_dead_cedilla, Qt::Key_Dead_Cedilla, + XK_dead_ogonek, Qt::Key_Dead_Ogonek, + XK_dead_iota, Qt::Key_Dead_Iota, + XK_dead_voiced_sound, Qt::Key_Dead_Voiced_Sound, + XK_dead_semivoiced_sound, Qt::Key_Dead_Semivoiced_Sound, + XK_dead_belowdot, Qt::Key_Dead_Belowdot, + XK_dead_hook, Qt::Key_Dead_Hook, + XK_dead_horn, Qt::Key_Dead_Horn, + + // Special keys from X.org - This include multimedia keys, + // wireless/bluetooth/uwb keys, special launcher keys, etc. + XF86XK_Back, Qt::Key_Back, + XF86XK_Forward, Qt::Key_Forward, + XF86XK_Stop, Qt::Key_Stop, + XF86XK_Refresh, Qt::Key_Refresh, + XF86XK_Favorites, Qt::Key_Favorites, + XF86XK_AudioMedia, Qt::Key_LaunchMedia, + XF86XK_OpenURL, Qt::Key_OpenUrl, + XF86XK_HomePage, Qt::Key_HomePage, + XF86XK_Search, Qt::Key_Search, + XF86XK_AudioLowerVolume, Qt::Key_VolumeDown, + XF86XK_AudioMute, Qt::Key_VolumeMute, + XF86XK_AudioRaiseVolume, Qt::Key_VolumeUp, + XF86XK_AudioPlay, Qt::Key_MediaPlay, + XF86XK_AudioStop, Qt::Key_MediaStop, + XF86XK_AudioPrev, Qt::Key_MediaPrevious, + XF86XK_AudioNext, Qt::Key_MediaNext, + XF86XK_AudioRecord, Qt::Key_MediaRecord, + XF86XK_Mail, Qt::Key_LaunchMail, + XF86XK_MyComputer, Qt::Key_Launch0, // ### Qt 5: remap properly + XF86XK_Calculator, Qt::Key_Launch1, + XF86XK_Memo, Qt::Key_Memo, + XF86XK_ToDoList, Qt::Key_ToDoList, + XF86XK_Calendar, Qt::Key_Calendar, + XF86XK_PowerDown, Qt::Key_PowerDown, + XF86XK_ContrastAdjust, Qt::Key_ContrastAdjust, + XF86XK_Standby, Qt::Key_Standby, + XF86XK_MonBrightnessUp, Qt::Key_MonBrightnessUp, + XF86XK_MonBrightnessDown, Qt::Key_MonBrightnessDown, + XF86XK_KbdLightOnOff, Qt::Key_KeyboardLightOnOff, + XF86XK_KbdBrightnessUp, Qt::Key_KeyboardBrightnessUp, + XF86XK_KbdBrightnessDown, Qt::Key_KeyboardBrightnessDown, + XF86XK_PowerOff, Qt::Key_PowerOff, + XF86XK_WakeUp, Qt::Key_WakeUp, + XF86XK_Eject, Qt::Key_Eject, + XF86XK_ScreenSaver, Qt::Key_ScreenSaver, + XF86XK_WWW, Qt::Key_WWW, + XF86XK_Sleep, Qt::Key_Sleep, + XF86XK_LightBulb, Qt::Key_LightBulb, + XF86XK_Shop, Qt::Key_Shop, + XF86XK_History, Qt::Key_History, + XF86XK_AddFavorite, Qt::Key_AddFavorite, + XF86XK_HotLinks, Qt::Key_HotLinks, + XF86XK_BrightnessAdjust, Qt::Key_BrightnessAdjust, + XF86XK_Finance, Qt::Key_Finance, + XF86XK_Community, Qt::Key_Community, + XF86XK_AudioRewind, Qt::Key_AudioRewind, + XF86XK_BackForward, Qt::Key_BackForward, + XF86XK_ApplicationLeft, Qt::Key_ApplicationLeft, + XF86XK_ApplicationRight, Qt::Key_ApplicationRight, + XF86XK_Book, Qt::Key_Book, + XF86XK_CD, Qt::Key_CD, + XF86XK_Calculater, Qt::Key_Calculator, + XF86XK_Clear, Qt::Key_Clear, + XF86XK_ClearGrab, Qt::Key_ClearGrab, + XF86XK_Close, Qt::Key_Close, + XF86XK_Copy, Qt::Key_Copy, + XF86XK_Cut, Qt::Key_Cut, + XF86XK_Display, Qt::Key_Display, + XF86XK_DOS, Qt::Key_DOS, + XF86XK_Documents, Qt::Key_Documents, + XF86XK_Excel, Qt::Key_Excel, + XF86XK_Explorer, Qt::Key_Explorer, + XF86XK_Game, Qt::Key_Game, + XF86XK_Go, Qt::Key_Go, + XF86XK_iTouch, Qt::Key_iTouch, + XF86XK_LogOff, Qt::Key_LogOff, + XF86XK_Market, Qt::Key_Market, + XF86XK_Meeting, Qt::Key_Meeting, + XF86XK_MenuKB, Qt::Key_MenuKB, + XF86XK_MenuPB, Qt::Key_MenuPB, + XF86XK_MySites, Qt::Key_MySites, + XF86XK_News, Qt::Key_News, + XF86XK_OfficeHome, Qt::Key_OfficeHome, + XF86XK_Option, Qt::Key_Option, + XF86XK_Paste, Qt::Key_Paste, + XF86XK_Phone, Qt::Key_Phone, + XF86XK_Reply, Qt::Key_Reply, + XF86XK_Reload, Qt::Key_Reload, + XF86XK_RotateWindows, Qt::Key_RotateWindows, + XF86XK_RotationPB, Qt::Key_RotationPB, + XF86XK_RotationKB, Qt::Key_RotationKB, + XF86XK_Save, Qt::Key_Save, + XF86XK_Send, Qt::Key_Send, + XF86XK_Spell, Qt::Key_Spell, + XF86XK_SplitScreen, Qt::Key_SplitScreen, + XF86XK_Support, Qt::Key_Support, + XF86XK_TaskPane, Qt::Key_TaskPane, + XF86XK_Terminal, Qt::Key_Terminal, + XF86XK_Tools, Qt::Key_Tools, + XF86XK_Travel, Qt::Key_Travel, + XF86XK_Video, Qt::Key_Video, + XF86XK_Word, Qt::Key_Word, + XF86XK_Xfer, Qt::Key_Xfer, + XF86XK_ZoomIn, Qt::Key_ZoomIn, + XF86XK_ZoomOut, Qt::Key_ZoomOut, + XF86XK_Away, Qt::Key_Away, + XF86XK_Messenger, Qt::Key_Messenger, + XF86XK_WebCam, Qt::Key_WebCam, + XF86XK_MailForward, Qt::Key_MailForward, + XF86XK_Pictures, Qt::Key_Pictures, + XF86XK_Music, Qt::Key_Music, + XF86XK_Battery, Qt::Key_Battery, + XF86XK_Bluetooth, Qt::Key_Bluetooth, + XF86XK_WLAN, Qt::Key_WLAN, + XF86XK_UWB, Qt::Key_UWB, + XF86XK_AudioForward, Qt::Key_AudioForward, + XF86XK_AudioRepeat, Qt::Key_AudioRepeat, + XF86XK_AudioRandomPlay, Qt::Key_AudioRandomPlay, + XF86XK_Subtitle, Qt::Key_Subtitle, + XF86XK_AudioCycleTrack, Qt::Key_AudioCycleTrack, + XF86XK_Time, Qt::Key_Time, + XF86XK_Select, Qt::Key_Select, + XF86XK_View, Qt::Key_View, + XF86XK_TopMenu, Qt::Key_TopMenu, + XF86XK_Bluetooth, Qt::Key_Bluetooth, + XF86XK_Suspend, Qt::Key_Suspend, + XF86XK_Hibernate, Qt::Key_Hibernate, + XF86XK_Launch0, Qt::Key_Launch2, // ### Qt 5: remap properly + XF86XK_Launch1, Qt::Key_Launch3, + XF86XK_Launch2, Qt::Key_Launch4, + XF86XK_Launch3, Qt::Key_Launch5, + XF86XK_Launch4, Qt::Key_Launch6, + XF86XK_Launch5, Qt::Key_Launch7, + XF86XK_Launch6, Qt::Key_Launch8, + XF86XK_Launch7, Qt::Key_Launch9, + XF86XK_Launch8, Qt::Key_LaunchA, + XF86XK_Launch9, Qt::Key_LaunchB, + XF86XK_LaunchA, Qt::Key_LaunchC, + XF86XK_LaunchB, Qt::Key_LaunchD, + XF86XK_LaunchC, Qt::Key_LaunchE, + XF86XK_LaunchD, Qt::Key_LaunchF, + XF86XK_LaunchE, Qt::Key_LaunchG, + XF86XK_LaunchF, Qt::Key_LaunchH, + + // Qtopia keys + QTOPIAXK_Select, Qt::Key_Select, + QTOPIAXK_Yes, Qt::Key_Yes, + QTOPIAXK_No, Qt::Key_No, + QTOPIAXK_Cancel, Qt::Key_Cancel, + QTOPIAXK_Printer, Qt::Key_Printer, + QTOPIAXK_Execute, Qt::Key_Execute, + QTOPIAXK_Sleep, Qt::Key_Sleep, + QTOPIAXK_Play, Qt::Key_Play, + QTOPIAXK_Zoom, Qt::Key_Zoom, + QTOPIAXK_Context1, Qt::Key_Context1, + QTOPIAXK_Context2, Qt::Key_Context2, + QTOPIAXK_Context3, Qt::Key_Context3, + QTOPIAXK_Context4, Qt::Key_Context4, + QTOPIAXK_Call, Qt::Key_Call, + QTOPIAXK_Hangup, Qt::Key_Hangup, + QTOPIAXK_Flip, Qt::Key_Flip, + + 0, 0 +}; + +static const unsigned short katakanaKeysymsToUnicode[] = { + 0x0000, 0x3002, 0x300C, 0x300D, 0x3001, 0x30FB, 0x30F2, 0x30A1, + 0x30A3, 0x30A5, 0x30A7, 0x30A9, 0x30E3, 0x30E5, 0x30E7, 0x30C3, + 0x30FC, 0x30A2, 0x30A4, 0x30A6, 0x30A8, 0x30AA, 0x30AB, 0x30AD, + 0x30AF, 0x30B1, 0x30B3, 0x30B5, 0x30B7, 0x30B9, 0x30BB, 0x30BD, + 0x30BF, 0x30C1, 0x30C4, 0x30C6, 0x30C8, 0x30CA, 0x30CB, 0x30CC, + 0x30CD, 0x30CE, 0x30CF, 0x30D2, 0x30D5, 0x30D8, 0x30DB, 0x30DE, + 0x30DF, 0x30E0, 0x30E1, 0x30E2, 0x30E4, 0x30E6, 0x30E8, 0x30E9, + 0x30EA, 0x30EB, 0x30EC, 0x30ED, 0x30EF, 0x30F3, 0x309B, 0x309C +}; + +static const unsigned short cyrillicKeysymsToUnicode[] = { + 0x0000, 0x0452, 0x0453, 0x0451, 0x0454, 0x0455, 0x0456, 0x0457, + 0x0458, 0x0459, 0x045a, 0x045b, 0x045c, 0x0000, 0x045e, 0x045f, + 0x2116, 0x0402, 0x0403, 0x0401, 0x0404, 0x0405, 0x0406, 0x0407, + 0x0408, 0x0409, 0x040a, 0x040b, 0x040c, 0x0000, 0x040e, 0x040f, + 0x044e, 0x0430, 0x0431, 0x0446, 0x0434, 0x0435, 0x0444, 0x0433, + 0x0445, 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, + 0x043f, 0x044f, 0x0440, 0x0441, 0x0442, 0x0443, 0x0436, 0x0432, + 0x044c, 0x044b, 0x0437, 0x0448, 0x044d, 0x0449, 0x0447, 0x044a, + 0x042e, 0x0410, 0x0411, 0x0426, 0x0414, 0x0415, 0x0424, 0x0413, + 0x0425, 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, + 0x041f, 0x042f, 0x0420, 0x0421, 0x0422, 0x0423, 0x0416, 0x0412, + 0x042c, 0x042b, 0x0417, 0x0428, 0x042d, 0x0429, 0x0427, 0x042a +}; + +static const unsigned short greekKeysymsToUnicode[] = { + 0x0000, 0x0386, 0x0388, 0x0389, 0x038a, 0x03aa, 0x0000, 0x038c, + 0x038e, 0x03ab, 0x0000, 0x038f, 0x0000, 0x0000, 0x0385, 0x2015, + 0x0000, 0x03ac, 0x03ad, 0x03ae, 0x03af, 0x03ca, 0x0390, 0x03cc, + 0x03cd, 0x03cb, 0x03b0, 0x03ce, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, + 0x0398, 0x0399, 0x039a, 0x039b, 0x039c, 0x039d, 0x039e, 0x039f, + 0x03a0, 0x03a1, 0x03a3, 0x0000, 0x03a4, 0x03a5, 0x03a6, 0x03a7, + 0x03a8, 0x03a9, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x03b1, 0x03b2, 0x03b3, 0x03b4, 0x03b5, 0x03b6, 0x03b7, + 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bc, 0x03bd, 0x03be, 0x03bf, + 0x03c0, 0x03c1, 0x03c3, 0x03c2, 0x03c4, 0x03c5, 0x03c6, 0x03c7, + 0x03c8, 0x03c9, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 +}; + +static const unsigned short technicalKeysymsToUnicode[] = { + 0x0000, 0x23B7, 0x250C, 0x2500, 0x2320, 0x2321, 0x2502, 0x23A1, + 0x23A3, 0x23A4, 0x23A6, 0x239B, 0x239D, 0x239E, 0x23A0, 0x23A8, + 0x23AC, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x2264, 0x2260, 0x2265, 0x222B, + 0x2234, 0x221D, 0x221E, 0x0000, 0x0000, 0x2207, 0x0000, 0x0000, + 0x223C, 0x2243, 0x0000, 0x0000, 0x0000, 0x21D4, 0x21D2, 0x2261, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x221A, 0x0000, + 0x0000, 0x0000, 0x2282, 0x2283, 0x2229, 0x222A, 0x2227, 0x2228, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2202, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0192, 0x0000, + 0x0000, 0x0000, 0x0000, 0x2190, 0x2191, 0x2192, 0x2193, 0x0000 +}; + +static const unsigned short specialKeysymsToUnicode[] = { + 0x25C6, 0x2592, 0x2409, 0x240C, 0x240D, 0x240A, 0x0000, 0x0000, + 0x2424, 0x240B, 0x2518, 0x2510, 0x250C, 0x2514, 0x253C, 0x23BA, + 0x23BB, 0x2500, 0x23BC, 0x23BD, 0x251C, 0x2524, 0x2534, 0x252C, + 0x2502, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 +}; + +static const unsigned short publishingKeysymsToUnicode[] = { + 0x0000, 0x2003, 0x2002, 0x2004, 0x2005, 0x2007, 0x2008, 0x2009, + 0x200a, 0x2014, 0x2013, 0x0000, 0x0000, 0x0000, 0x2026, 0x2025, + 0x2153, 0x2154, 0x2155, 0x2156, 0x2157, 0x2158, 0x2159, 0x215a, + 0x2105, 0x0000, 0x0000, 0x2012, 0x2329, 0x0000, 0x232a, 0x0000, + 0x0000, 0x0000, 0x0000, 0x215b, 0x215c, 0x215d, 0x215e, 0x0000, + 0x0000, 0x2122, 0x2613, 0x0000, 0x25c1, 0x25b7, 0x25cb, 0x25af, + 0x2018, 0x2019, 0x201c, 0x201d, 0x211e, 0x0000, 0x2032, 0x2033, + 0x0000, 0x271d, 0x0000, 0x25ac, 0x25c0, 0x25b6, 0x25cf, 0x25ae, + 0x25e6, 0x25ab, 0x25ad, 0x25b3, 0x25bd, 0x2606, 0x2022, 0x25aa, + 0x25b2, 0x25bc, 0x261c, 0x261e, 0x2663, 0x2666, 0x2665, 0x0000, + 0x2720, 0x2020, 0x2021, 0x2713, 0x2717, 0x266f, 0x266d, 0x2642, + 0x2640, 0x260e, 0x2315, 0x2117, 0x2038, 0x201a, 0x201e, 0x0000 +}; + +static const unsigned short aplKeysymsToUnicode[] = { + 0x0000, 0x0000, 0x0000, 0x003c, 0x0000, 0x0000, 0x003e, 0x0000, + 0x2228, 0x2227, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x00af, 0x0000, 0x22a5, 0x2229, 0x230a, 0x0000, 0x005f, 0x0000, + 0x0000, 0x0000, 0x2218, 0x0000, 0x2395, 0x0000, 0x22a4, 0x25cb, + 0x0000, 0x0000, 0x0000, 0x2308, 0x0000, 0x0000, 0x222a, 0x0000, + 0x2283, 0x0000, 0x2282, 0x0000, 0x22a2, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x22a3, 0x0000, 0x0000, 0x0000 +}; + +static const unsigned short koreanKeysymsToUnicode[] = { + 0x0000, 0x3131, 0x3132, 0x3133, 0x3134, 0x3135, 0x3136, 0x3137, + 0x3138, 0x3139, 0x313a, 0x313b, 0x313c, 0x313d, 0x313e, 0x313f, + 0x3140, 0x3141, 0x3142, 0x3143, 0x3144, 0x3145, 0x3146, 0x3147, + 0x3148, 0x3149, 0x314a, 0x314b, 0x314c, 0x314d, 0x314e, 0x314f, + 0x3150, 0x3151, 0x3152, 0x3153, 0x3154, 0x3155, 0x3156, 0x3157, + 0x3158, 0x3159, 0x315a, 0x315b, 0x315c, 0x315d, 0x315e, 0x315f, + 0x3160, 0x3161, 0x3162, 0x3163, 0x11a8, 0x11a9, 0x11aa, 0x11ab, + 0x11ac, 0x11ad, 0x11ae, 0x11af, 0x11b0, 0x11b1, 0x11b2, 0x11b3, + 0x11b4, 0x11b5, 0x11b6, 0x11b7, 0x11b8, 0x11b9, 0x11ba, 0x11bb, + 0x11bc, 0x11bd, 0x11be, 0x11bf, 0x11c0, 0x11c1, 0x11c2, 0x316d, + 0x3171, 0x3178, 0x317f, 0x3181, 0x3184, 0x3186, 0x318d, 0x318e, + 0x11eb, 0x11f0, 0x11f9, 0x0000, 0x0000, 0x0000, 0x0000, 0x20a9 +}; + +static QChar keysymToUnicode(unsigned char byte3, unsigned char byte4) +{ + switch (byte3) { + case 0x04: + // katakana + if (byte4 > 0xa0 && byte4 < 0xe0) + return QChar(katakanaKeysymsToUnicode[byte4 - 0xa0]); + else if (byte4 == 0x7e) + return QChar(0x203e); // Overline + break; + case 0x06: + // russian, use lookup table + if (byte4 > 0xa0) + return QChar(cyrillicKeysymsToUnicode[byte4 - 0xa0]); + break; + case 0x07: + // greek + if (byte4 > 0xa0) + return QChar(greekKeysymsToUnicode[byte4 - 0xa0]); + break; + case 0x08: + // technical + if (byte4 > 0xa0) + return QChar(technicalKeysymsToUnicode[byte4 - 0xa0]); + break; + case 0x09: + // special + if (byte4 >= 0xe0) + return QChar(specialKeysymsToUnicode[byte4 - 0xe0]); + break; + case 0x0a: + // publishing + if (byte4 > 0xa0) + return QChar(publishingKeysymsToUnicode[byte4 - 0xa0]); + break; + case 0x0b: + // APL + if (byte4 > 0xa0) + return QChar(aplKeysymsToUnicode[byte4 - 0xa0]); + break; + case 0x0e: + // Korean + if (byte4 > 0xa0) + return QChar(koreanKeysymsToUnicode[byte4 - 0xa0]); + break; + default: + break; + } + return QChar(0x0); +} + +Qt::KeyboardModifiers QXlibKeyboard::translateModifiers(int s) +{ + Qt::KeyboardModifiers ret = 0; + if (s & ShiftMask) + ret |= Qt::ShiftModifier; + if (s & ControlMask) + ret |= Qt::ControlModifier; + if (s & m_alt_mask) + ret |= Qt::AltModifier; + if (s & m_meta_mask) + ret |= Qt::MetaModifier; +// if (s & m_mode_switch_mask) //doesn't seem to work correctly +// ret |= Qt::GroupSwitchModifier; + return ret; +} + +void QXlibKeyboard::setMask(KeySym sym, uint mask) +{ + if (m_alt_mask == 0 + && m_meta_mask != mask + && m_super_mask != mask + && m_hyper_mask != mask + && (sym == XK_Alt_L || sym == XK_Alt_R)) { + m_alt_mask = mask; + } + if (m_meta_mask == 0 + && m_alt_mask != mask + && m_super_mask != mask + && m_hyper_mask != mask + && (sym == XK_Meta_L || sym == XK_Meta_R)) { + m_meta_mask = mask; + } + if (m_super_mask == 0 + && m_alt_mask != mask + && m_meta_mask != mask + && m_hyper_mask != mask + && (sym == XK_Super_L || sym == XK_Super_R)) { + m_super_mask = mask; + } + if (m_hyper_mask == 0 + && m_alt_mask != mask + && m_meta_mask != mask + && m_super_mask != mask + && (sym == XK_Hyper_L || sym == XK_Hyper_R)) { + m_hyper_mask = mask; + } + if (m_mode_switch_mask == 0 + && m_alt_mask != mask + && m_meta_mask != mask + && m_super_mask != mask + && m_hyper_mask != mask + && sym == XK_Mode_switch) { + m_mode_switch_mask = mask; + } + if (m_num_lock_mask == 0 + && sym == XK_Num_Lock) { + m_num_lock_mask = mask; + } +} + +int QXlibKeyboard::translateKeySym(uint key) const +{ + int code = -1; + int i = 0; // any other keys + while (KeyTbl[i]) { + if (key == KeyTbl[i]) { + code = (int)KeyTbl[i+1]; + break; + } + i += 2; + } + if (m_meta_mask) { + // translate Super/Hyper keys to Meta if we're using them as the MetaModifier + if (m_meta_mask == m_super_mask && (code == Qt::Key_Super_L || code == Qt::Key_Super_R)) { + code = Qt::Key_Meta; + } else if (m_meta_mask == m_hyper_mask && (code == Qt::Key_Hyper_L || code == Qt::Key_Hyper_R)) { + code = Qt::Key_Meta; + } + } + return code; +} + +QString QXlibKeyboard::translateKeySym(KeySym keysym, uint xmodifiers, + int &code, Qt::KeyboardModifiers &modifiers, + QByteArray &chars, int &count) +{ + // all keysyms smaller than 0xff00 are actally keys that can be mapped to unicode chars + + QTextCodec *mapper = QTextCodec::codecForLocale(); + QChar converted; + + if (/*count == 0 &&*/ keysym < 0xff00) { + unsigned char byte3 = (unsigned char)(keysym >> 8); + int mib = -1; + switch(byte3) { + case 0: // Latin 1 + case 1: // Latin 2 + case 2: //latin 3 + case 3: // latin4 + mib = byte3 + 4; break; + case 5: // arabic + mib = 82; break; + case 12: // Hebrew + mib = 85; break; + case 13: // Thai + mib = 2259; break; + case 4: // kana + case 6: // cyrillic + case 7: // greek + case 8: // technical, no mapping here at the moment + case 9: // Special + case 10: // Publishing + case 11: // APL + case 14: // Korean, no mapping + mib = -1; // manual conversion + mapper= 0; +#if !defined(QT_NO_XIM) + converted = keysymToUnicode(byte3, keysym & 0xff); +#endif + case 0x20: + // currency symbols + if (keysym >= 0x20a0 && keysym <= 0x20ac) { + mib = -1; // manual conversion + mapper = 0; + converted = (uint)keysym; + } + break; + default: + break; + } + if (mib != -1) { + mapper = QTextCodec::codecForMib(mib); + if (chars.isEmpty()) + chars.resize(1); + chars[0] = (unsigned char) (keysym & 0xff); // get only the fourth bit for conversion later + count = 1; + } + } else if (keysym >= 0x1000000 && keysym <= 0x100ffff) { + converted = (ushort) (keysym - 0x1000000); + mapper = 0; + } + if (count < (int)chars.size()-1) + chars[count] = '\0'; + + QString text; + if (!mapper && converted.unicode() != 0x0) { + text = converted; + } else if (!chars.isEmpty()) { + // convert chars (8bit) to text (unicode). + if (mapper) + text = mapper->toUnicode(chars.data(), count, 0); + if (text.isEmpty()) { + // no mapper, or codec couldn't convert to unicode (this + // can happen when running in the C locale or with no LANG + // set). try converting from latin-1 + text = QString::fromLatin1(chars); + } + } + + modifiers = translateModifiers(xmodifiers); + + // Commentary in X11/keysymdef says that X codes match ASCII, so it + // is safe to use the locale functions to process X codes in ISO8859-1. + // + // This is mainly for compatibility - applications should not use the + // Qt keycodes between 128 and 255, but should rather use the + // QKeyEvent::text(). + // + if (keysym < 128 || (keysym < 256 && (!mapper || mapper->mibEnum()==4))) { + // upper-case key, if known + code = isprint((int)keysym) ? toupper((int)keysym) : 0; + } else if (keysym >= XK_F1 && keysym <= XK_F35) { + // function keys + code = Qt::Key_F1 + ((int)keysym - XK_F1); + } else if (keysym >= XK_KP_Space && keysym <= XK_KP_9) { + if (keysym >= XK_KP_0) { + // numeric keypad keys + code = Qt::Key_0 + ((int)keysym - XK_KP_0); + } else { + code = translateKeySym(keysym); + } + modifiers |= Qt::KeypadModifier; + } else if (text.length() == 1 && text.unicode()->unicode() > 0x1f && text.unicode()->unicode() != 0x7f && !(keysym >= XK_dead_grave && keysym <= XK_dead_horn)) { + code = text.unicode()->toUpper().unicode(); + } else { + // any other keys + code = translateKeySym(keysym); + + if (code == Qt::Key_Tab && (modifiers & Qt::ShiftModifier)) { + // map shift+tab to shift+backtab, QShortcutMap knows about it + // and will handle it. + code = Qt::Key_Backtab; + text = QString(); + } + } + + return text; +} + +QXlibKeyboard::QXlibKeyboard(QXlibScreen *screen) + : m_screen(screen) + , m_alt_mask(0) + , m_super_mask(0) + , m_hyper_mask(0) + , m_meta_mask(0) +{ + changeLayout(); +} + +void QXlibKeyboard::changeLayout() +{ + XkbDescPtr xkbDesc = XkbGetMap(m_screen->display(), XkbAllClientInfoMask, XkbUseCoreKbd); + for (int i = xkbDesc->min_key_code; i < xkbDesc->max_key_code; ++i) { + const uint mask = xkbDesc->map->modmap ? xkbDesc->map->modmap[i] : 0; + if (mask == 0) { + // key is not bound to a modifier + continue; + } + + for (int j = 0; j < XkbKeyGroupsWidth(xkbDesc, i); ++j) { + KeySym keySym = XkbKeySym(xkbDesc, i, j); + if (keySym == NoSymbol) + continue; + setMask(keySym, mask); + } + } + XkbFreeKeyboard(xkbDesc, XkbAllComponentsMask, true); + +} + +static Qt::KeyboardModifiers modifierFromKeyCode(int qtcode) +{ + switch (qtcode) { + case Qt::Key_Control: + return Qt::ControlModifier; + case Qt::Key_Alt: + return Qt::AltModifier; + case Qt::Key_Shift: + return Qt::ShiftModifier; + case Qt::Key_Meta: + return Qt::MetaModifier; + default: + return Qt::NoModifier; + } +} + +void QXlibKeyboard::handleKeyEvent(QWidget *widget, QEvent::Type type, XKeyEvent *ev) +{ + int qtcode = 0; + Qt::KeyboardModifiers modifiers = translateModifiers(ev->state); + QByteArray chars; + chars.resize(513); + int count = 0; + KeySym keySym; + count = XLookupString(ev,chars.data(),chars.size(),&keySym,0); + QString text = translateKeySym(keySym,ev->state,qtcode,modifiers,chars,count); + QWindowSystemInterface::handleKeyEvent(widget,ev->time,type,qtcode,modifiers,text.left(count)); +} diff --git a/src/plugins/platforms/xlib/qxlibkeyboard.h b/src/plugins/platforms/xlib/qxlibkeyboard.h new file mode 100644 index 0000000..98df4e1 --- /dev/null +++ b/src/plugins/platforms/xlib/qxlibkeyboard.h @@ -0,0 +1,76 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTESTLITEKEYBOARD_H +#define QTESTLITEKEYBOARD_H + +#include "qtestliteintegration.h" + +class QXlibKeyboard +{ +public: + QXlibKeyboard(QXlibScreen *screen); + + void changeLayout(); + + void handleKeyEvent(QWidget *widget, QEvent::Type type, XKeyEvent *ev); + + Qt::KeyboardModifiers translateModifiers(int s); + +private: + + void setMask(KeySym sym, uint mask); + int translateKeySym(uint key) const; + QString translateKeySym(KeySym keysym, uint xmodifiers, + int &code, Qt::KeyboardModifiers &modifiers, + QByteArray &chars, int &count); + + QXlibScreen *m_screen; + + uint m_alt_mask; + uint m_super_mask; + uint m_hyper_mask; + uint m_meta_mask; + uint m_mode_switch_mask; + uint m_num_lock_mask; +}; + +#endif // QTESTLITEKEYBOARD_H diff --git a/src/plugins/platforms/xlib/qxlibmime.cpp b/src/plugins/platforms/xlib/qxlibmime.cpp new file mode 100644 index 0000000..5335ae9 --- /dev/null +++ b/src/plugins/platforms/xlib/qxlibmime.cpp @@ -0,0 +1,322 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qtestlitemime.h" + +#include "qtestlitestaticinfo.h" +#include "qtestlitescreen.h" + +#include <QtCore/QTextCodec> +#include <QtGui/QImageWriter> +#include <QtCore/QBuffer> + +QXlibMime::QXlibMime() + : QInternalMimeData() +{ } + +QXlibMime::~QXlibMime() +{} + + + + + +QString QXlibMime::mimeAtomToString(Display *display, Atom a) +{ + if (!a) return 0; + + if (a == XA_STRING || a == QXlibStatic::atom(QXlibStatic::UTF8_STRING)) { + return "text/plain"; // some Xdnd clients are dumb + } + char *atom = XGetAtomName(display, a); + QString result = QString::fromLatin1(atom); + XFree(atom); + return result; +} + +Atom QXlibMime::mimeStringToAtom(Display *display, const QString &mimeType) +{ + if (mimeType.isEmpty()) + return 0; + return XInternAtom(display, mimeType.toLatin1().constData(), False); +} + +QStringList QXlibMime::mimeFormatsForAtom(Display *display, Atom a) +{ + QStringList formats; + if (a) { + QString atomName = mimeAtomToString(display, a); + formats.append(atomName); + + // special cases for string type + if (a == QXlibStatic::atom(QXlibStatic::UTF8_STRING) + || a == XA_STRING + || a == QXlibStatic::atom(QXlibStatic::TEXT) + || a == QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT)) + formats.append(QLatin1String("text/plain")); + + // special cases for uris + if (atomName == QLatin1String("text/x-moz-url")) + formats.append(QLatin1String("text/uri-list")); + + // special case for images + if (a == XA_PIXMAP) + formats.append(QLatin1String("image/ppm")); + } + return formats; +} + +bool QXlibMime::mimeDataForAtom(Display *display, Atom a, QMimeData *mimeData, QByteArray *data, Atom *atomFormat, int *dataFormat) +{ + bool ret = false; + *atomFormat = a; + *dataFormat = 8; + QString atomName = mimeAtomToString(display, a); + if (QInternalMimeData::hasFormatHelper(atomName, mimeData)) { + *data = QInternalMimeData::renderDataHelper(atomName, mimeData); + if (atomName == QLatin1String("application/x-color")) + *dataFormat = 16; + ret = true; + } else { + if ((a == QXlibStatic::atom(QXlibStatic::UTF8_STRING) + || a == XA_STRING + || a == QXlibStatic::atom(QXlibStatic::TEXT) + || a == QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT)) + && QInternalMimeData::hasFormatHelper(QLatin1String("text/plain"), mimeData)) { + if (a == QXlibStatic::atom(QXlibStatic::UTF8_STRING)){ + *data = QInternalMimeData::renderDataHelper(QLatin1String("text/plain"), mimeData); + ret = true; + } else if (a == XA_STRING) { + *data = QString::fromUtf8(QInternalMimeData::renderDataHelper( + QLatin1String("text/plain"), mimeData)).toLocal8Bit(); + ret = true; + } else if (a == QXlibStatic::atom(QXlibStatic::TEXT) + || a == QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT)) { + // the ICCCM states that TEXT and COMPOUND_TEXT are in the + // encoding of choice, so we choose the encoding of the locale + QByteArray strData = QString::fromUtf8(QInternalMimeData::renderDataHelper( + QLatin1String("text/plain"), mimeData)).toLocal8Bit(); + char *list[] = { strData.data(), NULL }; + + XICCEncodingStyle style = (a == QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT)) + ? XCompoundTextStyle : XStdICCTextStyle; + XTextProperty textprop; + if (list[0] != NULL + && XmbTextListToTextProperty(display, list, 1, style, + &textprop) == Success) { + *atomFormat = textprop.encoding; + *dataFormat = textprop.format; + *data = QByteArray((const char *) textprop.value, textprop.nitems * textprop.format / 8); + ret = true; + + XFree(textprop.value); + } + } + } else if (atomName == QLatin1String("text/x-moz-url") && + QInternalMimeData::hasFormatHelper(QLatin1String("text/uri-list"), mimeData)) { + QByteArray uri = QInternalMimeData::renderDataHelper( + QLatin1String("text/uri-list"), mimeData).split('\n').first(); + QString mozUri = QString::fromLatin1(uri, uri.size()); + mozUri += QLatin1Char('\n'); + *data = QByteArray(reinterpret_cast<const char *>(mozUri.utf16()), mozUri.length() * 2); + ret = true; + } else if ((a == XA_PIXMAP || a == XA_BITMAP) && mimeData->hasImage()) { + ret = true; + } + } + return ret && data != 0; +} + +QList<Atom> QXlibMime::mimeAtomsForFormat(Display *display, const QString &format) +{ + QList<Atom> atoms; + atoms.append(mimeStringToAtom(display, format)); + + // special cases for strings + if (format == QLatin1String("text/plain")) { + atoms.append(QXlibStatic::atom(QXlibStatic::UTF8_STRING)); + atoms.append(XA_STRING); + atoms.append(QXlibStatic::atom(QXlibStatic::TEXT)); + atoms.append(QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT)); + } + + // special cases for uris + if (format == QLatin1String("text/uri-list")) { + atoms.append(mimeStringToAtom(display,QLatin1String("text/x-moz-url"))); + } + + //special cases for images + if (format == QLatin1String("image/ppm")) + atoms.append(XA_PIXMAP); + if (format == QLatin1String("image/pbm")) + atoms.append(XA_BITMAP); + + return atoms; +} + +QVariant QXlibMime::mimeConvertToFormat(Display *display, Atom a, const QByteArray &data, const QString &format, QVariant::Type requestedType, const QByteArray &encoding) +{ + QString atomName = mimeAtomToString(display,a); + if (atomName == format) + return data; + + if (!encoding.isEmpty() + && atomName == format + QLatin1String(";charset=") + QString::fromLatin1(encoding)) { + + if (requestedType == QVariant::String) { + QTextCodec *codec = QTextCodec::codecForName(encoding); + if (codec) + return codec->toUnicode(data); + } + + return data; + } + + // special cases for string types + if (format == QLatin1String("text/plain")) { + if (a == QXlibStatic::atom(QXlibStatic::UTF8_STRING)) + return QString::fromUtf8(data); + if (a == XA_STRING) + return QString::fromLatin1(data); + if (a == QXlibStatic::atom(QXlibStatic::TEXT) + || a == QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT)) + // #### might be wrong for COMPUND_TEXT + return QString::fromLocal8Bit(data, data.size()); + } + + // special case for uri types + if (format == QLatin1String("text/uri-list")) { + if (atomName == QLatin1String("text/x-moz-url")) { + // we expect this as utf16 <url><space><title> + // the first part is a url that should only contain ascci char + // so it should be safe to check that the second char is 0 + // to verify that it is utf16 + if (data.size() > 1 && data.at(1) == 0) + return QString::fromRawData((const QChar *)data.constData(), + data.size() / 2).split(QLatin1Char('\n')).first().toLatin1(); + } + } + + // special cas for images + if (format == QLatin1String("image/ppm")) { + if (a == XA_PIXMAP && data.size() == sizeof(Pixmap)) { + Pixmap xpm = *((Pixmap*)data.data()); + if (!xpm) + return QByteArray(); + Window root; + int x; + int y; + uint width; + uint height; + uint border_width; + uint depth; + + XGetGeometry(display, xpm, &root, &x, &y, &width, &height, &border_width, &depth); + XImage *ximg = XGetImage(display,xpm,x,y,width,height,AllPlanes,depth==1 ? XYPixmap : ZPixmap); + QImage qimg = QXlibStatic::qimageFromXImage(ximg); + XDestroyImage(ximg); + + QImageWriter imageWriter; + imageWriter.setFormat("PPMRAW"); + QBuffer buf; + buf.open(QIODevice::WriteOnly); + imageWriter.setDevice(&buf); + imageWriter.write(qimg); + return buf.buffer(); + } + } + return QVariant(); +} + +Atom QXlibMime::mimeAtomForFormat(Display *display, const QString &format, QVariant::Type requestedType, const QList<Atom> &atoms, QByteArray *requestedEncoding) +{ + requestedEncoding->clear(); + + // find matches for string types + if (format == QLatin1String("text/plain")) { + if (atoms.contains(QXlibStatic::atom(QXlibStatic::UTF8_STRING))) + return QXlibStatic::atom(QXlibStatic::UTF8_STRING); + if (atoms.contains(QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT))) + return QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT); + if (atoms.contains(QXlibStatic::atom(QXlibStatic::TEXT))) + return QXlibStatic::atom(QXlibStatic::TEXT); + if (atoms.contains(XA_STRING)) + return XA_STRING; + } + + // find matches for uri types + if (format == QLatin1String("text/uri-list")) { + Atom a = mimeStringToAtom(display,format); + if (a && atoms.contains(a)) + return a; + a = mimeStringToAtom(display,QLatin1String("text/x-moz-url")); + if (a && atoms.contains(a)) + return a; + } + + // find match for image + if (format == QLatin1String("image/ppm")) { + if (atoms.contains(XA_PIXMAP)) + return XA_PIXMAP; + } + + // for string/text requests try to use a format with a well-defined charset + // first to avoid encoding problems + if (requestedType == QVariant::String + && format.startsWith(QLatin1String("text/")) + && !format.contains(QLatin1String("charset="))) { + + QString formatWithCharset = format; + formatWithCharset.append(QLatin1String(";charset=utf-8")); + + Atom a = mimeStringToAtom(display,formatWithCharset); + if (a && atoms.contains(a)) { + *requestedEncoding = "utf-8"; + return a; + } + } + + Atom a = mimeStringToAtom(display,format); + if (a && atoms.contains(a)) + return a; + + return 0; +} diff --git a/src/plugins/platforms/xlib/qxlibmime.h b/src/plugins/platforms/xlib/qxlibmime.h new file mode 100644 index 0000000..6a70ea4 --- /dev/null +++ b/src/plugins/platforms/xlib/qxlibmime.h @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTESTLITEMIME_H +#define QTESTLITEMIME_H + +#include <private/qdnd_p.h> + +#include <QtGui/QClipboard> + +#include "qtestliteintegration.h" +#include "qtestliteclipboard.h" + +class QXlibMime : public QInternalMimeData { + Q_OBJECT +public: + QXlibMime(); + ~QXlibMime(); + + static QList<Atom> mimeAtomsForFormat(Display *display, const QString &format); + static QString mimeAtomToString(Display *display, Atom a); + static bool mimeDataForAtom(Display *display, Atom a, QMimeData *mimeData, QByteArray *data, Atom *atomFormat, int *dataFormat); + static QStringList mimeFormatsForAtom(Display *display, Atom a); + static Atom mimeStringToAtom(Display *display, const QString &mimeType); + static QVariant mimeConvertToFormat(Display *display, Atom a, const QByteArray &data, const QString &format, QVariant::Type requestedType, const QByteArray &encoding); + static Atom mimeAtomForFormat(Display *display, const QString &format, QVariant::Type requestedType, const QList<Atom> &atoms, QByteArray *requestedEncoding); +}; + +#endif // QTESTLITEMIME_H diff --git a/src/plugins/platforms/xlib/qxlibscreen.cpp b/src/plugins/platforms/xlib/qxlibscreen.cpp new file mode 100644 index 0000000..714c17b --- /dev/null +++ b/src/plugins/platforms/xlib/qxlibscreen.cpp @@ -0,0 +1,468 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qtestlitescreen.h" + +#include "qtestlitecursor.h" +#include "qtestlitewindow.h" +#include "qtestlitekeyboard.h" +#include "qtestlitestaticinfo.h" +#include "qtestliteclipboard.h" + +#include <QtCore/QDebug> +#include <QtCore/QSocketNotifier> +#include <QtCore/QElapsedTimer> + +#include <private/qapplication_p.h> + +#include <X11/extensions/Xfixes.h> + +QT_BEGIN_NAMESPACE + +static int (*original_x_errhandler)(Display *dpy, XErrorEvent *); +static bool seen_badwindow; + +static int qt_x_errhandler(Display *dpy, XErrorEvent *err) +{ + +qDebug() << "qt_x_errhandler" << err->error_code; + + switch (err->error_code) { + case BadAtom: +#if 0 + if (err->request_code == 20 /* X_GetProperty */ + && (err->resourceid == XA_RESOURCE_MANAGER + || err->resourceid == XA_RGB_DEFAULT_MAP + || err->resourceid == ATOM(_NET_SUPPORTED) + || err->resourceid == ATOM(_NET_SUPPORTING_WM_CHECK) + || err->resourceid == ATOM(KDE_FULL_SESSION) + || err->resourceid == ATOM(KWIN_RUNNING) + || err->resourceid == ATOM(XdndProxy) + || err->resourceid == ATOM(XdndAware)) + + + ) { + // Perhaps we're running under SECURITY reduction? :/ + return 0; + } +#endif + qDebug() << "BadAtom"; + break; + + case BadWindow: + if (err->request_code == 2 /* X_ChangeWindowAttributes */ + || err->request_code == 38 /* X_QueryPointer */) { + for (int i = 0; i < ScreenCount(dpy); ++i) { + if (err->resourceid == RootWindow(dpy, i)) { + // Perhaps we're running under SECURITY reduction? :/ + return 0; + } + } + } + seen_badwindow = true; + if (err->request_code == 25 /* X_SendEvent */) { + for (int i = 0; i < ScreenCount(dpy); ++i) { + if (err->resourceid == RootWindow(dpy, i)) { + // Perhaps we're running under SECURITY reduction? :/ + return 0; + } + } +#if 0 + if (X11->xdndHandleBadwindow()) { + qDebug("xdndHandleBadwindow returned true"); + return 0; + } +#endif + } +#if 0 + if (X11->ignore_badwindow) + return 0; +#endif + break; + + case BadMatch: + if (err->request_code == 42 /* X_SetInputFocus */) + return 0; + break; + + default: +#if 0 //!defined(QT_NO_XINPUT) + if (err->request_code == X11->xinput_major + && err->error_code == (X11->xinput_errorbase + XI_BadDevice) + && err->minor_code == 3 /* X_OpenDevice */) { + return 0; + } +#endif + break; + } + + char errstr[256]; + XGetErrorText( dpy, err->error_code, errstr, 256 ); + char buffer[256]; + char request_str[256]; + qsnprintf(buffer, 256, "%d", err->request_code); + XGetErrorDatabaseText(dpy, "XRequest", buffer, "", request_str, 256); + if (err->request_code < 128) { + // X error for a normal protocol request + qWarning( "X Error: %s %d\n" + " Major opcode: %d (%s)\n" + " Resource id: 0x%lx", + errstr, err->error_code, + err->request_code, + request_str, + err->resourceid ); + } else { + // X error for an extension request + const char *extensionName = 0; +#if 0 + if (err->request_code == X11->xrender_major) + extensionName = "RENDER"; + else if (err->request_code == X11->xrandr_major) + extensionName = "RANDR"; + else if (err->request_code == X11->xinput_major) + extensionName = "XInputExtension"; + else if (err->request_code == X11->mitshm_major) + extensionName = "MIT-SHM"; +#endif + char minor_str[256]; + if (extensionName) { + qsnprintf(buffer, 256, "%s.%d", extensionName, err->minor_code); + XGetErrorDatabaseText(dpy, "XRequest", buffer, "", minor_str, 256); + } else { + extensionName = "Uknown extension"; + qsnprintf(minor_str, 256, "Unknown request"); + } + qWarning( "X Error: %s %d\n" + " Extension: %d (%s)\n" + " Minor opcode: %d (%s)\n" + " Resource id: 0x%lx", + errstr, err->error_code, + err->request_code, + extensionName, + err->minor_code, + minor_str, + err->resourceid ); + } + + // ### we really should distinguish between severe, non-severe and + // ### application specific errors + + return 0; +} + +QXlibScreen::QXlibScreen() + : mFormat(QImage::Format_RGB32) +{ + char *display_name = getenv("DISPLAY"); + mDisplay = XOpenDisplay(display_name); + mDisplayName = QString::fromLocal8Bit(display_name); + if (!mDisplay) { + fprintf(stderr, "Cannot connect to X server: %s\n", + display_name); + exit(1); + } + +#ifndef DONT_USE_MIT_SHM + Status MIT_SHM_extension_supported = XShmQueryExtension (mDisplay); + Q_ASSERT(MIT_SHM_extension_supported == True); +#endif + original_x_errhandler = XSetErrorHandler(qt_x_errhandler); + + if (qgetenv("DO_X_SYNCHRONIZE").toInt()) + XSynchronize(mDisplay, true); + + mScreen = DefaultScreen(mDisplay); + XSelectInput(mDisplay,rootWindow(), KeymapStateMask | EnterWindowMask | LeaveWindowMask | PropertyChangeMask); + int width = DisplayWidth(mDisplay, mScreen); + int height = DisplayHeight(mDisplay, mScreen); + mGeometry = QRect(0,0,width,height); + + int physicalWidth = DisplayWidthMM(mDisplay, mScreen); + int physicalHeight = DisplayHeightMM(mDisplay, mScreen); + mPhysicalSize = QSize(physicalWidth,physicalHeight); + + int xSocketNumber = XConnectionNumber(mDisplay); + + mDepth = DefaultDepth(mDisplay,mScreen); +#ifdef MYX11_DEBUG + qDebug() << "X socket:"<< xSocketNumber; +#endif + QSocketNotifier *sock = new QSocketNotifier(xSocketNumber, QSocketNotifier::Read, this); + connect(sock, SIGNAL(activated(int)), this, SLOT(eventDispatcher())); + + mCursor = new QXlibCursor(this); + mKeyboard = new QXlibKeyboard(this); +} + +QXlibScreen::~QXlibScreen() +{ + delete mCursor; + XCloseDisplay(mDisplay); +} + +#ifdef KeyPress +#undef KeyPress +#endif +#ifdef KeyRelease +#undef KeyRelease +#endif + +bool QXlibScreen::handleEvent(XEvent *xe) +{ + int quit = false; + QXlibWindow *platformWindow = 0; + QWidget *widget = QWidget::find(xe->xany.window); + if (widget) { + platformWindow = static_cast<QXlibWindow *>(widget->platformWindow()); + } + + Atom wmProtocolsAtom = QXlibStatic::atom(QXlibStatic::WM_PROTOCOLS); + Atom wmDeleteWindowAtom = QXlibStatic::atom(QXlibStatic::WM_DELETE_WINDOW); + switch (xe->type) { + + case ClientMessage: + if (xe->xclient.format == 32 && xe->xclient.message_type == wmProtocolsAtom) { + Atom a = xe->xclient.data.l[0]; + if (a == wmDeleteWindowAtom) + platformWindow->handleCloseEvent(); + } + break; + + case Expose: + if (platformWindow) + if (xe->xexpose.count == 0) + platformWindow->paintEvent(); + break; + case ConfigureNotify: + if (platformWindow) + platformWindow->resizeEvent(&xe->xconfigure); + break; + + case ButtonPress: + if (platformWindow) + platformWindow->mousePressEvent(&xe->xbutton); + break; + + case ButtonRelease: + if (platformWindow) + platformWindow->handleMouseEvent(QEvent::MouseButtonRelease, &xe->xbutton); + break; + + case MotionNotify: + if (platformWindow) + platformWindow->handleMouseEvent(QEvent::MouseMove, &xe->xbutton); + break; + + case XKeyPress: + mKeyboard->handleKeyEvent(widget,QEvent::KeyPress, &xe->xkey); + break; + + case XKeyRelease: + mKeyboard->handleKeyEvent(widget,QEvent::KeyRelease, &xe->xkey); + break; + + case EnterNotify: + if (platformWindow) + platformWindow->handleEnterEvent(); + break; + + case LeaveNotify: + if (platformWindow) + platformWindow->handleLeaveEvent(); + break; + + case XFocusIn: + if (platformWindow) + platformWindow->handleFocusInEvent(); + break; + + case XFocusOut: + if (platformWindow) + platformWindow->handleFocusOutEvent(); + break; + + case PropertyNotify: + break; + + case SelectionClear: + qDebug() << "Selection Clear!!!"; + break; + case SelectionRequest: + handleSelectionRequest(xe); + break; + case SelectionNotify: + qDebug() << "Selection Notify!!!!"; + + break; + + + default: +#ifdef MYX11_DEBUG + qDebug() << hex << xe->xany.window << "Other X event" << xe->type; +#endif + break; + } + + return quit; +} + +static Bool checkForClipboardEvents(Display *, XEvent *e, XPointer) +{ + Atom clipboard = QXlibStatic::atom(QXlibStatic::CLIPBOARD); + return ((e->type == SelectionRequest && (e->xselectionrequest.selection == XA_PRIMARY + || e->xselectionrequest.selection == clipboard)) + || (e->type == SelectionClear && (e->xselectionclear.selection == XA_PRIMARY + || e->xselectionclear.selection == clipboard))); +} + +bool QXlibScreen::waitForClipboardEvent(Window win, int type, XEvent *event, int timeout) +{ + QElapsedTimer timer; + timer.start(); + do { + if (XCheckTypedWindowEvent(mDisplay,win,type,event)) + return true; + + // process other clipboard events, since someone is probably requesting data from us + XEvent e; + if (XCheckIfEvent(mDisplay, &e, checkForClipboardEvents, 0)) + handleEvent(&e); + + XFlush(mDisplay); + + // sleep 50 ms, so we don't use up CPU cycles all the time. + struct timeval usleep_tv; + usleep_tv.tv_sec = 0; + usleep_tv.tv_usec = 50000; + select(0, 0, 0, 0, &usleep_tv); + } while (timer.elapsed() < timeout); + return false; +} + +void QXlibScreen::eventDispatcher() +{ + ulong marker = XNextRequest(mDisplay); + // int i = 0; + while (XPending(mDisplay)) { + XEvent event; + XNextEvent(mDisplay, &event); + /* done = */ + handleEvent(&event); + + if (event.xany.serial >= marker) { + #ifdef MYX11_DEBUG + qDebug() << "potential livelock averted"; + #endif + #if 0 + if (XEventsQueued(mDisplay, QueuedAfterFlush)) { + qDebug() << " with events queued"; + QTimer::singleShot(0, this, SLOT(eventDispatcher())); + } + #endif + break; + } + } +} + +QImage QXlibScreen::grabWindow(Window window, int x, int y, int w, int h) +{ + if (w == 0 || h ==0) + return QImage(); + + //WinId 0 means the desktop widget + if (!window) + window = rootWindow(); + + XWindowAttributes window_attr; + if (!XGetWindowAttributes(mDisplay, window, &window_attr)) + return QImage(); + + if (w < 0) + w = window_attr.width - x; + if (h < 0) + h = window_attr.height - y; + + // Ideally, we should also limit ourselves to the screen area, but the Qt docs say + // that it's "unsafe" to go outside the screen, so we can ignore that problem. + + //We're definitely not optimizing for speed... + XImage *xi = XGetImage(mDisplay, window, x, y, w, h, AllPlanes, ZPixmap); + + if (!xi) + return QImage(); + + //taking a copy to make sure we have ownership -- not fast + QImage result = QImage( (uchar*) xi->data, xi->width, xi->height, xi->bytes_per_line, QImage::Format_RGB32 ).copy(); + + XDestroyImage(xi); + + return result; +} + +QXlibScreen * QXlibScreen::testLiteScreenForWidget(QWidget *widget) +{ + QPlatformScreen *platformScreen = platformScreenForWidget(widget); + return static_cast<QXlibScreen *>(platformScreen); +} + +Display * QXlibScreen::display() const +{ + return mDisplay; +} + +int QXlibScreen::xScreenNumber() const +{ + return mScreen; +} + +QXlibKeyboard * QXlibScreen::keyboard() const +{ + return mKeyboard; +} + +void QXlibScreen::handleSelectionRequest(XEvent *event) +{ + QPlatformIntegration *integration = QApplicationPrivate::platformIntegration(); + QXlibClipboard *clipboard = static_cast<QXlibClipboard *>(integration->clipboard()); + clipboard->handleSelectionRequest(event); +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/xlib/qxlibscreen.h b/src/plugins/platforms/xlib/qxlibscreen.h new file mode 100644 index 0000000..7e59a59 --- /dev/null +++ b/src/plugins/platforms/xlib/qxlibscreen.h @@ -0,0 +1,104 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTESTLITESCREEN_H +#define QTESTLITESCREEN_H + +#include <QtGui/QPlatformScreen> +#include "qtestliteintegration.h" + +QT_BEGIN_NAMESPACE + +class QXlibCursor; +class QXlibKeyboard; + +class QXlibScreen : public QPlatformScreen +{ + Q_OBJECT +public: + QXlibScreen(); + + ~QXlibScreen(); + + QString displayName() const { return mDisplayName; } + + QRect geometry() const { return mGeometry; } + int depth() const { return mDepth; } + QImage::Format format() const { return mFormat; } + QSize physicalSize() const { return mPhysicalSize; } + + Window rootWindow() { return RootWindow(mDisplay, mScreen); } + unsigned long blackPixel() { return BlackPixel(mDisplay, mScreen); } + unsigned long whitePixel() { return WhitePixel(mDisplay, mScreen); } + + bool handleEvent(XEvent *xe); + bool waitForClipboardEvent(Window win, int type, XEvent *event, int timeout); + + QImage grabWindow(Window window, int x, int y, int w, int h); + + static QXlibScreen *testLiteScreenForWidget(QWidget *widget); + + Display *display() const; + int xScreenNumber() const; + + QXlibKeyboard *keyboard() const; + +public slots: + void eventDispatcher(); + +private: + + void handleSelectionRequest(XEvent *event); + QString mDisplayName; + QRect mGeometry; + QSize mPhysicalSize; + int mDepth; + QImage::Format mFormat; + QXlibCursor *mCursor; + QXlibKeyboard *mKeyboard; + + Display * mDisplay; + int mScreen; +}; + +QT_END_NAMESPACE + +#endif // QTESTLITESCREEN_H diff --git a/src/plugins/platforms/xlib/qxlibstatic.cpp b/src/plugins/platforms/xlib/qxlibstatic.cpp new file mode 100644 index 0000000..837636c --- /dev/null +++ b/src/plugins/platforms/xlib/qxlibstatic.cpp @@ -0,0 +1,511 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qtestlitestaticinfo.h" +#include "qtestlitescreen.h" + +#include <qplatformdefs.h> + +#include <QtGui/private/qapplication_p.h> +#include <QtCore/QBuffer> +#include <QtCore/QLibrary> + +#include <QDebug> + +#ifndef QT_NO_XFIXES +#include <X11/extensions/Xfixes.h> +#endif // QT_NO_XFIXES + +static const char * x11_atomnames = { + // window-manager <-> client protocols + "WM_PROTOCOLS\0" + "WM_DELETE_WINDOW\0" + "WM_TAKE_FOCUS\0" + "_NET_WM_PING\0" + "_NET_WM_CONTEXT_HELP\0" + "_NET_WM_SYNC_REQUEST\0" + "_NET_WM_SYNC_REQUEST_COUNTER\0" + + // ICCCM window state + "WM_STATE\0" + "WM_CHANGE_STATE\0" + + // Session management + "WM_CLIENT_LEADER\0" + "WM_WINDOW_ROLE\0" + "SM_CLIENT_ID\0" + + // Clipboard + "CLIPBOARD\0" + "INCR\0" + "TARGETS\0" + "MULTIPLE\0" + "TIMESTAMP\0" + "SAVE_TARGETS\0" + "CLIP_TEMPORARY\0" + "_QT_SELECTION\0" + "_QT_CLIPBOARD_SENTINEL\0" + "_QT_SELECTION_SENTINEL\0" + "CLIPBOARD_MANAGER\0" + + "RESOURCE_MANAGER\0" + + "_XSETROOT_ID\0" + + "_QT_SCROLL_DONE\0" + "_QT_INPUT_ENCODING\0" + + "_MOTIF_WM_HINTS\0" + + "DTWM_IS_RUNNING\0" + "ENLIGHTENMENT_DESKTOP\0" + "_DT_SAVE_MODE\0" + "_SGI_DESKS_MANAGER\0" + + // EWMH (aka NETWM) + "_NET_SUPPORTED\0" + "_NET_VIRTUAL_ROOTS\0" + "_NET_WORKAREA\0" + + "_NET_MOVERESIZE_WINDOW\0" + "_NET_WM_MOVERESIZE\0" + + "_NET_WM_NAME\0" + "_NET_WM_ICON_NAME\0" + "_NET_WM_ICON\0" + + "_NET_WM_PID\0" + + "_NET_WM_WINDOW_OPACITY\0" + + "_NET_WM_STATE\0" + "_NET_WM_STATE_ABOVE\0" + "_NET_WM_STATE_BELOW\0" + "_NET_WM_STATE_FULLSCREEN\0" + "_NET_WM_STATE_MAXIMIZED_HORZ\0" + "_NET_WM_STATE_MAXIMIZED_VERT\0" + "_NET_WM_STATE_MODAL\0" + "_NET_WM_STATE_STAYS_ON_TOP\0" + "_NET_WM_STATE_DEMANDS_ATTENTION\0" + + "_NET_WM_USER_TIME\0" + "_NET_WM_USER_TIME_WINDOW\0" + "_NET_WM_FULL_PLACEMENT\0" + + "_NET_WM_WINDOW_TYPE\0" + "_NET_WM_WINDOW_TYPE_DESKTOP\0" + "_NET_WM_WINDOW_TYPE_DOCK\0" + "_NET_WM_WINDOW_TYPE_TOOLBAR\0" + "_NET_WM_WINDOW_TYPE_MENU\0" + "_NET_WM_WINDOW_TYPE_UTILITY\0" + "_NET_WM_WINDOW_TYPE_SPLASH\0" + "_NET_WM_WINDOW_TYPE_DIALOG\0" + "_NET_WM_WINDOW_TYPE_DROPDOWN_MENU\0" + "_NET_WM_WINDOW_TYPE_POPUP_MENU\0" + "_NET_WM_WINDOW_TYPE_TOOLTIP\0" + "_NET_WM_WINDOW_TYPE_NOTIFICATION\0" + "_NET_WM_WINDOW_TYPE_COMBO\0" + "_NET_WM_WINDOW_TYPE_DND\0" + "_NET_WM_WINDOW_TYPE_NORMAL\0" + "_KDE_NET_WM_WINDOW_TYPE_OVERRIDE\0" + + "_KDE_NET_WM_FRAME_STRUT\0" + + "_NET_STARTUP_INFO\0" + "_NET_STARTUP_INFO_BEGIN\0" + + "_NET_SUPPORTING_WM_CHECK\0" + + "_NET_WM_CM_S0\0" + + "_NET_SYSTEM_TRAY_VISUAL\0" + + "_NET_ACTIVE_WINDOW\0" + + // Property formats + "COMPOUND_TEXT\0" + "TEXT\0" + "UTF8_STRING\0" + + // xdnd + "XdndEnter\0" + "XdndPosition\0" + "XdndStatus\0" + "XdndLeave\0" + "XdndDrop\0" + "XdndFinished\0" + "XdndTypeList\0" + "XdndActionList\0" + + "XdndSelection\0" + + "XdndAware\0" + "XdndProxy\0" + + "XdndActionCopy\0" + "XdndActionLink\0" + "XdndActionMove\0" + "XdndActionPrivate\0" + + // Motif DND + "_MOTIF_DRAG_AND_DROP_MESSAGE\0" + "_MOTIF_DRAG_INITIATOR_INFO\0" + "_MOTIF_DRAG_RECEIVER_INFO\0" + "_MOTIF_DRAG_WINDOW\0" + "_MOTIF_DRAG_TARGETS\0" + + "XmTRANSFER_SUCCESS\0" + "XmTRANSFER_FAILURE\0" + + // Xkb + "_XKB_RULES_NAMES\0" + + // XEMBED + "_XEMBED\0" + "_XEMBED_INFO\0" + + // Wacom old. (before version 0.10) + "Wacom Stylus\0" + "Wacom Cursor\0" + "Wacom Eraser\0" + + // Tablet + "STYLUS\0" + "ERASER\0" +}; + +/*! + \internal + Try to resolve a \a symbol from \a library with the version specified + by \a vernum. + + Note that, in the case of the Xfixes library, \a vernum is not the same as + \c XFIXES_MAJOR - it is a part of soname and may differ from the Xfixes + version. +*/ +static void* qt_load_library_runtime(const char *library, int vernum, + int highestVernum, const char *symbol) +{ + QList<int> versions; + // we try to load in the following order: + // explicit version -> the default one -> (from the highest (highestVernum) to the lowest (vernum) ) + if (vernum != -1) + versions << vernum; + versions << -1; + if (vernum != -1) { + for(int i = highestVernum; i > vernum; --i) + versions << i; + } + Q_FOREACH(int version, versions) { + QLatin1String libName(library); + QLibrary xfixesLib(libName, version); + void *ptr = xfixesLib.resolve(symbol); + if (ptr) + return ptr; + } + return 0; +} + +# define XFIXES_LOAD_RUNTIME(vernum, symbol, symbol_type) \ + (symbol_type)qt_load_library_runtime("libXfixes", vernum, 4, #symbol); +# define XFIXES_LOAD_V1(symbol) \ + XFIXES_LOAD_RUNTIME(1, symbol, Ptr##symbol) +# define XFIXES_LOAD_V2(symbol) \ + XFIXES_LOAD_RUNTIME(2, symbol, Ptr##symbol) + + +class QTestLiteStaticInfoPrivate +{ +public: + QTestLiteStaticInfoPrivate() + : use_xfixes(false) + , xfixes_major(0) + , xfixes_eventbase(0) + , xfixes_errorbase(0) + { + QXlibScreen *screen = qobject_cast<QXlibScreen *> (QApplicationPrivate::platformIntegration()->screens().at(0)); + Q_ASSERT(screen); + + initializeAllAtoms(screen); + initializeSupportedAtoms(screen); + + resolveXFixes(screen); + } + + bool isSupportedByWM(Atom atom) + { + if (!m_supportedAtoms) + return false; + + bool supported = false; + int i = 0; + while (m_supportedAtoms[i] != 0) { + if (m_supportedAtoms[i++] == atom) { + supported = true; + break; + } + } + + return supported; + } + + Atom atom(QXlibStatic::X11Atom atom) + { + return m_allAtoms[atom]; + } + + bool useXFixes() const { return use_xfixes; } + + int xFixesEventBase() const {return xfixes_eventbase; } + + PtrXFixesSelectSelectionInput xFixesSelectSelectionInput() const + { + return ptrXFixesSelectSelectionInput; + } + + QImage qimageFromXImage(XImage *xi) + { + QImage::Format format = QImage::Format_ARGB32_Premultiplied; + if (xi->depth == 24) + format = QImage::Format_RGB32; + else if (xi->depth == 16) + format = QImage::Format_RGB16; + + QImage image = QImage((uchar *)xi->data, xi->width, xi->height, xi->bytes_per_line, format).copy(); + + // we may have to swap the byte order + if ((QSysInfo::ByteOrder == QSysInfo::LittleEndian && xi->byte_order == MSBFirst) + || (QSysInfo::ByteOrder == QSysInfo::BigEndian && xi->byte_order == LSBFirst)) + { + for (int i=0; i < image.height(); i++) { + if (xi->depth == 16) { + ushort *p = (ushort*)image.scanLine(i); + ushort *end = p + image.width(); + while (p < end) { + *p = ((*p << 8) & 0xff00) | ((*p >> 8) & 0x00ff); + p++; + } + } else { + uint *p = (uint*)image.scanLine(i); + uint *end = p + image.width(); + while (p < end) { + *p = ((*p << 24) & 0xff000000) | ((*p << 8) & 0x00ff0000) + | ((*p >> 8) & 0x0000ff00) | ((*p >> 24) & 0x000000ff); + p++; + } + } + } + } + + // fix-up alpha channel + if (format == QImage::Format_RGB32) { + QRgb *p = (QRgb *)image.bits(); + for (int y = 0; y < xi->height; ++y) { + for (int x = 0; x < xi->width; ++x) + p[x] |= 0xff000000; + p += xi->bytes_per_line / 4; + } + } + + return image; + } + + +private: + + void initializeAllAtoms(QXlibScreen *screen) { + const char *names[QXlibStatic::NAtoms]; + const char *ptr = x11_atomnames; + + int i = 0; + while (*ptr) { + names[i++] = ptr; + while (*ptr) + ++ptr; + ++ptr; + } + + Q_ASSERT(i == QXlibStatic::NPredefinedAtoms); + + QByteArray settings_atom_name("_QT_SETTINGS_TIMESTAMP_"); + settings_atom_name += XDisplayName(qPrintable(screen->displayName())); + names[i++] = settings_atom_name; + + Q_ASSERT(i == QXlibStatic::NAtoms); + #if 0//defined(XlibSpecificationRelease) && (XlibSpecificationRelease >= 6) + XInternAtoms(screen->display(), (char **)names, i, False, m_allAtoms); + #else + for (i = 0; i < QXlibStatic::NAtoms; ++i) + m_allAtoms[i] = XInternAtom(screen->display(), (char *)names[i], False); + #endif + } + + void initializeSupportedAtoms(QXlibScreen *screen) + { + Atom type; + int format; + long offset = 0; + unsigned long nitems, after; + unsigned char *data = 0; + + int e = XGetWindowProperty(screen->display(), screen->rootWindow(), + this->atom(QXlibStatic::_NET_SUPPORTED), 0, 0, + False, XA_ATOM, &type, &format, &nitems, &after, &data); + if (data) + XFree(data); + + if (e == Success && type == XA_ATOM && format == 32) { + QBuffer ts; + ts.open(QIODevice::WriteOnly); + + while (after > 0) { + XGetWindowProperty(screen->display(), screen->rootWindow(), + this->atom(QXlibStatic::_NET_SUPPORTED), offset, 1024, + False, XA_ATOM, &type, &format, &nitems, &after, &data); + + if (type == XA_ATOM && format == 32) { + ts.write(reinterpret_cast<char *>(data), nitems * sizeof(long)); + offset += nitems; + } else + after = 0; + if (data) + XFree(data); + } + + // compute nitems + QByteArray buffer(ts.buffer()); + nitems = buffer.size() / sizeof(Atom); + m_supportedAtoms = new Atom[nitems + 1]; + Atom *a = (Atom *) buffer.data(); + uint i; + for (i = 0; i < nitems; i++) + m_supportedAtoms[i] = a[i]; + m_supportedAtoms[nitems] = 0; + + } + } + + void resolveXFixes(QXlibScreen *screen) + { +#ifndef QT_NO_XFIXES + // See if Xfixes is supported on the connected display + if (XQueryExtension(screen->display(), "XFIXES", &xfixes_major, + &xfixes_eventbase, &xfixes_errorbase)) { + ptrXFixesQueryExtension = XFIXES_LOAD_V1(XFixesQueryExtension); + ptrXFixesQueryVersion = XFIXES_LOAD_V1(XFixesQueryVersion); + ptrXFixesSetCursorName = XFIXES_LOAD_V2(XFixesSetCursorName); + ptrXFixesSelectSelectionInput = XFIXES_LOAD_V2(XFixesSelectSelectionInput); + + if(ptrXFixesQueryExtension && ptrXFixesQueryVersion + && ptrXFixesQueryExtension(screen->display(), &xfixes_eventbase, + &xfixes_errorbase)) { + // Xfixes is supported. + // Note: the XFixes protocol version is negotiated using QueryVersion. + // We supply the highest version we support, the X server replies with + // the highest version it supports, but no higher than the version we + // asked for. The version sent back is the protocol version the X server + // will use to talk us. If this call is removed, the behavior of the + // X server when it receives an XFixes request is undefined. + int major = 3; + int minor = 0; + ptrXFixesQueryVersion(screen->display(), &major, &minor); + use_xfixes = (major >= 1); + xfixes_major = major; + } + } +#endif // QT_NO_XFIXES + + } + + Atom *m_supportedAtoms; + Atom m_allAtoms[QXlibStatic::NAtoms]; + +#ifndef QT_NO_XFIXES + PtrXFixesQueryExtension ptrXFixesQueryExtension; + PtrXFixesQueryVersion ptrXFixesQueryVersion; + PtrXFixesSetCursorName ptrXFixesSetCursorName; + PtrXFixesSelectSelectionInput ptrXFixesSelectSelectionInput; +#endif + + bool use_xfixes; + int xfixes_major; + int xfixes_eventbase; + int xfixes_errorbase; + +}; +Q_GLOBAL_STATIC(QTestLiteStaticInfoPrivate, qTestLiteStaticInfoPrivate); + + +Atom QXlibStatic::atom(QXlibStatic::X11Atom atom) +{ + return qTestLiteStaticInfoPrivate()->atom(atom); +} + +bool QXlibStatic::isSupportedByWM(Atom atom) +{ + return qTestLiteStaticInfoPrivate()->isSupportedByWM(atom); +} + +bool QXlibStatic::useXFixes() +{ + return qTestLiteStaticInfoPrivate()->useXFixes(); +} + +int QXlibStatic::xFixesEventBase() +{ + return qTestLiteStaticInfoPrivate()->xFixesEventBase(); +} + +#ifndef QT_NO_XFIXES +PtrXFixesSelectSelectionInput QXlibStatic::xFixesSelectSelectionInput() +{ + qDebug() << qTestLiteStaticInfoPrivate()->useXFixes(); + if (!qTestLiteStaticInfoPrivate()->useXFixes()) + return 0; + + return qTestLiteStaticInfoPrivate()->xFixesSelectSelectionInput(); +} + +QImage QXlibStatic::qimageFromXImage(XImage *xi) +{ + return qTestLiteStaticInfoPrivate()->qimageFromXImage(xi); +} +#endif //QT_NO_XFIXES diff --git a/src/plugins/platforms/xlib/qxlibstatic.h b/src/plugins/platforms/xlib/qxlibstatic.h new file mode 100644 index 0000000..8473ee9 --- /dev/null +++ b/src/plugins/platforms/xlib/qxlibstatic.h @@ -0,0 +1,413 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTESTLITESTATICINFO_H +#define QTESTLITESTATICINFO_H + +#include <QtCore/QTextStream> +#include <QtCore/QDataStream> +#include <QtCore/QMetaType> +#include <QtCore/QVariant> + +#if defined(_XLIB_H_) // crude hack, but... +#error "cannot include <X11/Xlib.h> before this file" +#endif +#define XRegisterIMInstantiateCallback qt_XRegisterIMInstantiateCallback +#define XUnregisterIMInstantiateCallback qt_XUnregisterIMInstantiateCallback +#define XSetIMValues qt_XSetIMValues +#include <X11/Xlib.h> +#undef XRegisterIMInstantiateCallback +#undef XUnregisterIMInstantiateCallback +#undef XSetIMValues + +#include <X11/Xutil.h> +#include <X11/Xos.h> +#ifdef index +# undef index +#endif +#ifdef rindex +# undef rindex +#endif +#ifdef Q_OS_VXWORS +# ifdef open +# undef open +# endif +# ifdef getpid +# undef getpid +# endif +#endif // Q_OS_VXWORKS +#include <X11/Xatom.h> + +//#define QT_NO_SHAPE +#ifdef QT_NO_SHAPE +# define XShapeCombineRegion(a,b,c,d,e,f,g) +# define XShapeCombineMask(a,b,c,d,e,f,g) +#else +# include <X11/extensions/shape.h> +#endif // QT_NO_SHAPE + + +#if !defined (QT_NO_TABLET) +# include <X11/extensions/XInput.h> +#if defined (Q_OS_IRIX) +# include <X11/extensions/SGIMisc.h> +# include <wacom.h> +#endif +#endif // QT_NO_TABLET + + +// #define QT_NO_XINERAMA +#ifndef QT_NO_XINERAMA +// XFree86 does not C++ify Xinerama (at least up to XFree86 4.0.3). +extern "C" { +# include <X11/extensions/Xinerama.h> +} +#endif // QT_NO_XINERAMA + +// #define QT_NO_XRANDR +#ifndef QT_NO_XRANDR +# include <X11/extensions/Xrandr.h> +#endif // QT_NO_XRANDR + +// #define QT_NO_XRENDER +#ifndef QT_NO_XRENDER +# include <X11/extensions/Xrender.h> +#endif // QT_NO_XRENDER + +#ifndef QT_NO_XSYNC +extern "C" { +# include "X11/extensions/sync.h" +} +#endif + +// #define QT_NO_XKB +#ifndef QT_NO_XKB +# include <X11/XKBlib.h> +#endif // QT_NO_XKB + + +#if !defined(XlibSpecificationRelease) +# define X11R4 +typedef char *XPointer; +#else +# undef X11R4 +#endif + +#ifndef QT_NO_XFIXES +typedef Bool (*PtrXFixesQueryExtension)(Display *, int *, int *); +typedef Status (*PtrXFixesQueryVersion)(Display *, int *, int *); +typedef void (*PtrXFixesSetCursorName)(Display *dpy, Cursor cursor, const char *name); +typedef void (*PtrXFixesSelectSelectionInput)(Display *dpy, Window win, Atom selection, unsigned long eventMask); +#endif // QT_NO_XFIXES + +#ifndef QT_NO_XCURSOR +#include <X11/Xcursor/Xcursor.h> +typedef Cursor (*PtrXcursorLibraryLoadCursor)(Display *, const char *); +#endif // QT_NO_XCURSOR + +#ifndef QT_NO_XINERAMA +typedef Bool (*PtrXineramaQueryExtension)(Display *dpy, int *event_base, int *error_base); +typedef Bool (*PtrXineramaIsActive)(Display *dpy); +typedef XineramaScreenInfo *(*PtrXineramaQueryScreens)(Display *dpy, int *number); +#endif // QT_NO_XINERAMA + +#ifndef QT_NO_XRANDR +typedef void (*PtrXRRSelectInput)(Display *, Window, int); +typedef int (*PtrXRRUpdateConfiguration)(XEvent *); +typedef int (*PtrXRRRootToScreen)(Display *, Window); +typedef Bool (*PtrXRRQueryExtension)(Display *, int *, int *); +#endif // QT_NO_XRANDR + +#ifndef QT_NO_XINPUT +typedef int (*PtrXCloseDevice)(Display *, XDevice *); +typedef XDeviceInfo* (*PtrXListInputDevices)(Display *, int *); +typedef XDevice* (*PtrXOpenDevice)(Display *, XID); +typedef void (*PtrXFreeDeviceList)(XDeviceInfo *); +typedef int (*PtrXSelectExtensionEvent)(Display *, Window, XEventClass *, int); +#endif // QT_NO_XINPUT + +/* + * Solaris patch 108652-47 and higher fixes crases in + * XRegisterIMInstantiateCallback, but the function doesn't seem to + * work. + * + * Instead, we disabled R6 input, and open the input method + * immediately at application start. + */ + +//######### XFree86 has wrong declarations for XRegisterIMInstantiateCallback +//######### and XUnregisterIMInstantiateCallback in at least version 3.3.2. +//######### Many old X11R6 header files lack XSetIMValues. +//######### Therefore, we have to declare these functions ourselves. + +extern "C" Bool XRegisterIMInstantiateCallback( + Display*, + struct _XrmHashBucketRec*, + char*, + char*, + XIMProc, //XFree86 has XIDProc, which has to be wrong + XPointer +); + +extern "C" Bool XUnregisterIMInstantiateCallback( + Display*, + struct _XrmHashBucketRec*, + char*, + char*, + XIMProc, //XFree86 has XIDProc, which has to be wrong + XPointer +); + +#ifndef X11R4 +# include <X11/Xlocale.h> +#endif // X11R4 + + +#ifndef QT_NO_MITSHM +# include <X11/extensions/XShm.h> +#endif // QT_NO_MITSHM + +// rename a couple of X defines to get rid of name clashes +// resolve the conflict between X11's FocusIn and QEvent::FocusIn +enum { + XFocusOut = FocusOut, + XFocusIn = FocusIn, + XKeyPress = KeyPress, + XKeyRelease = KeyRelease, + XNone = None, + XRevertToParent = RevertToParent, + XGrayScale = GrayScale, + XCursorShape = CursorShape +}; +#undef FocusOut +#undef FocusIn +#undef KeyPress +#undef KeyRelease +#undef None +#undef RevertToParent +#undef GrayScale +#undef CursorShape + +#ifdef FontChange +#undef FontChange +#endif + + +class QXlibStatic +{ +public: + enum X11Atom { + // window-manager <-> client protocols + WM_PROTOCOLS, + WM_DELETE_WINDOW, + WM_TAKE_FOCUS, + _NET_WM_PING, + _NET_WM_CONTEXT_HELP, + _NET_WM_SYNC_REQUEST, + _NET_WM_SYNC_REQUEST_COUNTER, + + // ICCCM window state + WM_STATE, + WM_CHANGE_STATE, + + // Session management + WM_CLIENT_LEADER, + WM_WINDOW_ROLE, + SM_CLIENT_ID, + + // Clipboard + CLIPBOARD, + INCR, + TARGETS, + MULTIPLE, + TIMESTAMP, + SAVE_TARGETS, + CLIP_TEMPORARY, + _QT_SELECTION, + _QT_CLIPBOARD_SENTINEL, + _QT_SELECTION_SENTINEL, + CLIPBOARD_MANAGER, + + RESOURCE_MANAGER, + + _XSETROOT_ID, + + _QT_SCROLL_DONE, + _QT_INPUT_ENCODING, + + _MOTIF_WM_HINTS, + + DTWM_IS_RUNNING, + ENLIGHTENMENT_DESKTOP, + _DT_SAVE_MODE, + _SGI_DESKS_MANAGER, + + // EWMH (aka NETWM) + _NET_SUPPORTED, + _NET_VIRTUAL_ROOTS, + _NET_WORKAREA, + + _NET_MOVERESIZE_WINDOW, + _NET_WM_MOVERESIZE, + + _NET_WM_NAME, + _NET_WM_ICON_NAME, + _NET_WM_ICON, + + _NET_WM_PID, + + _NET_WM_WINDOW_OPACITY, + + _NET_WM_STATE, + _NET_WM_STATE_ABOVE, + _NET_WM_STATE_BELOW, + _NET_WM_STATE_FULLSCREEN, + _NET_WM_STATE_MAXIMIZED_HORZ, + _NET_WM_STATE_MAXIMIZED_VERT, + _NET_WM_STATE_MODAL, + _NET_WM_STATE_STAYS_ON_TOP, + _NET_WM_STATE_DEMANDS_ATTENTION, + + _NET_WM_USER_TIME, + _NET_WM_USER_TIME_WINDOW, + _NET_WM_FULL_PLACEMENT, + + _NET_WM_WINDOW_TYPE, + _NET_WM_WINDOW_TYPE_DESKTOP, + _NET_WM_WINDOW_TYPE_DOCK, + _NET_WM_WINDOW_TYPE_TOOLBAR, + _NET_WM_WINDOW_TYPE_MENU, + _NET_WM_WINDOW_TYPE_UTILITY, + _NET_WM_WINDOW_TYPE_SPLASH, + _NET_WM_WINDOW_TYPE_DIALOG, + _NET_WM_WINDOW_TYPE_DROPDOWN_MENU, + _NET_WM_WINDOW_TYPE_POPUP_MENU, + _NET_WM_WINDOW_TYPE_TOOLTIP, + _NET_WM_WINDOW_TYPE_NOTIFICATION, + _NET_WM_WINDOW_TYPE_COMBO, + _NET_WM_WINDOW_TYPE_DND, + _NET_WM_WINDOW_TYPE_NORMAL, + _KDE_NET_WM_WINDOW_TYPE_OVERRIDE, + + _KDE_NET_WM_FRAME_STRUT, + + _NET_STARTUP_INFO, + _NET_STARTUP_INFO_BEGIN, + + _NET_SUPPORTING_WM_CHECK, + + _NET_WM_CM_S0, + + _NET_SYSTEM_TRAY_VISUAL, + + _NET_ACTIVE_WINDOW, + + // Property formats + COMPOUND_TEXT, + TEXT, + UTF8_STRING, + + // Xdnd + XdndEnter, + XdndPosition, + XdndStatus, + XdndLeave, + XdndDrop, + XdndFinished, + XdndTypelist, + XdndActionList, + + XdndSelection, + + XdndAware, + XdndProxy, + + XdndActionCopy, + XdndActionLink, + XdndActionMove, + XdndActionPrivate, + + // Motif DND + _MOTIF_DRAG_AND_DROP_MESSAGE, + _MOTIF_DRAG_INITIATOR_INFO, + _MOTIF_DRAG_RECEIVER_INFO, + _MOTIF_DRAG_WINDOW, + _MOTIF_DRAG_TARGETS, + + XmTRANSFER_SUCCESS, + XmTRANSFER_FAILURE, + + // Xkb + _XKB_RULES_NAMES, + + // XEMBED + _XEMBED, + _XEMBED_INFO, + + XWacomStylus, + XWacomCursor, + XWacomEraser, + + XTabletStylus, + XTabletEraser, + + NPredefinedAtoms, + + _QT_SETTINGS_TIMESTAMP = NPredefinedAtoms, + NAtoms + }; + + static Atom atom(X11Atom atom); + static bool isSupportedByWM(Atom atom); + + static bool useXFixes(); + static int xFixesEventBase(); + + #ifndef QT_NO_XFIXES + static PtrXFixesSelectSelectionInput xFixesSelectSelectionInput(); + #endif //QT_NO_XFIXES + + static QImage qimageFromXImage(XImage *xi); + + +}; + +#endif // QTESTLITESTATICINFO_H diff --git a/src/plugins/platforms/xlib/qxlibwindow.cpp b/src/plugins/platforms/xlib/qxlibwindow.cpp new file mode 100644 index 0000000..0f11a81 --- /dev/null +++ b/src/plugins/platforms/xlib/qxlibwindow.cpp @@ -0,0 +1,735 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qtestlitewindow.h" + +#include "qtestliteintegration.h" +#include "qtestlitescreen.h" +#include "qtestlitekeyboard.h" +#include "qtestlitestaticinfo.h" + +#include <QtGui/QWindowSystemInterface> +#include <QSocketNotifier> +#include <QApplication> +#include <QDebug> + +#include <QtGui/private/qwindowsurface_p.h> +#include <QtGui/private/qapplication_p.h> + +#if !defined(QT_NO_OPENGL) +#if !defined(QT_OPENGL_ES_2) +#include "qglxintegration.h" +#else +#include "../eglconvenience/qeglconvenience.h" +#include "../eglconvenience/qeglplatformcontext.h" +#include "qtestliteeglintegration.h" +#endif //QT_OPENGL_ES_2 +#endif //QT_NO_OPENGL + +//#define MYX11_DEBUG + +QT_BEGIN_NAMESPACE + +QXlibWindow::QXlibWindow(QWidget *window) + : QPlatformWindow(window) + , mGLContext(0) + , mScreen(QXlibScreen::testLiteScreenForWidget(window)) +{ + int x = window->x(); + int y = window->y(); + int w = window->width(); + int h = window->height(); + + if(window->platformWindowFormat().windowApi() == QPlatformWindowFormat::OpenGL + && QApplicationPrivate::platformIntegration()->hasOpenGL() ) { +#if !defined(QT_NO_OPENGL) +#if !defined(QT_OPENGL_ES_2) + XVisualInfo *visualInfo = QGLXContext::findVisualInfo(mScreen,window->platformWindowFormat()); +#else + QPlatformWindowFormat windowFormat = correctColorBuffers(window->platformWindowFormat()); + + EGLDisplay eglDisplay = eglGetDisplay(mScreen->display()); + EGLConfig eglConfig = q_configFromQPlatformWindowFormat(eglDisplay,windowFormat); + VisualID id = QXlibEglIntegration::getCompatibleVisualId(mScreen->display(),eglConfig); + + XVisualInfo visualInfoTemplate; + memset(&visualInfoTemplate, 0, sizeof(XVisualInfo)); + visualInfoTemplate.visualid = id; + + XVisualInfo *visualInfo; + int matchingCount = 0; + visualInfo = XGetVisualInfo(mScreen->display(), VisualIDMask, &visualInfoTemplate, &matchingCount); +#endif //!defined(QT_OPENGL_ES_2) + if (visualInfo) { + Colormap cmap = XCreateColormap(mScreen->display(),mScreen->rootWindow(),visualInfo->visual,AllocNone); + + XSetWindowAttributes a; + a.colormap = cmap; + x_window = XCreateWindow(mScreen->display(), mScreen->rootWindow(),x, y, w, h, + 0, visualInfo->depth, InputOutput, visualInfo->visual, + CWColormap, &a); + } else { + qFatal("no window!"); + } +#endif //!defined(QT_NO_OPENGL) + } else { + x_window = XCreateSimpleWindow(mScreen->display(), mScreen->rootWindow(), + x, y, w, h, 0 /*border_width*/, + mScreen->blackPixel(), mScreen->whitePixel()); + } + +#ifdef MYX11_DEBUG + qDebug() << "QTestLiteWindow::QTestLiteWindow creating" << hex << x_window << window; +#endif + + XSetWindowBackgroundPixmap(mScreen->display(), x_window, XNone); + + XSelectInput(mScreen->display(), x_window, + ExposureMask | KeyPressMask | KeyReleaseMask | + EnterWindowMask | LeaveWindowMask | FocusChangeMask | + PointerMotionMask | ButtonPressMask | ButtonReleaseMask | + ButtonMotionMask | PropertyChangeMask | + StructureNotifyMask); + + gc = createGC(); + + Atom protocols[5]; + int n = 0; + protocols[n++] = QXlibStatic::atom(QXlibStatic::WM_DELETE_WINDOW); // support del window protocol + protocols[n++] = QXlibStatic::atom(QXlibStatic::WM_TAKE_FOCUS); // support take focus window protocol + protocols[n++] = QXlibStatic::atom(QXlibStatic::_NET_WM_PING); // support _NET_WM_PING protocol +#ifndef QT_NO_XSYNC + protocols[n++] = QXlibStatic::atom(QXlibStatic::_NET_WM_SYNC_REQUEST); // support _NET_WM_SYNC_REQUEST protocol +#endif // QT_NO_XSYNC + if (window->windowFlags() & Qt::WindowContextHelpButtonHint) + protocols[n++] = QXlibStatic::atom(QXlibStatic::_NET_WM_CONTEXT_HELP); + XSetWMProtocols(mScreen->display(), x_window, protocols, n); +} + + + +QXlibWindow::~QXlibWindow() +{ +#ifdef MYX11_DEBUG + qDebug() << "~QTestLiteWindow" << hex << x_window; +#endif + delete mGLContext; + XFreeGC(mScreen->display(), gc); + XDestroyWindow(mScreen->display(), x_window); +} + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Mouse event stuff +static Qt::MouseButtons translateMouseButtons(int s) +{ + Qt::MouseButtons ret = 0; + if (s & Button1Mask) + ret |= Qt::LeftButton; + if (s & Button2Mask) + ret |= Qt::MidButton; + if (s & Button3Mask) + ret |= Qt::RightButton; + return ret; +} + + + +void QXlibWindow::handleMouseEvent(QEvent::Type type, XButtonEvent *e) +{ + static QPoint mousePoint; + + Qt::MouseButton button = Qt::NoButton; + Qt::MouseButtons buttons = translateMouseButtons(e->state); + Qt::KeyboardModifiers modifiers = mScreen->keyboard()->translateModifiers(e->state); + if (type != QEvent::MouseMove) { + switch (e->button) { + case Button1: button = Qt::LeftButton; break; + case Button2: button = Qt::MidButton; break; + case Button3: button = Qt::RightButton; break; + case Button4: + case Button5: + case 6: + case 7: { + //mouse wheel + if (type == QEvent::MouseButtonPress) { + //logic borrowed from qapplication_x11.cpp + int delta = 120 * ((e->button == Button4 || e->button == 6) ? 1 : -1); + bool hor = (((e->button == Button4 || e->button == Button5) + && (modifiers & Qt::AltModifier)) + || (e->button == 6 || e->button == 7)); + QWindowSystemInterface::handleWheelEvent(widget(), e->time, + QPoint(e->x, e->y), + QPoint(e->x_root, e->y_root), + delta, hor ? Qt::Horizontal : Qt::Vertical); + } + return; + } + default: break; + } + } + + buttons ^= button; // X event uses state *before*, Qt uses state *after* + + QWindowSystemInterface::handleMouseEvent(widget(), e->time, QPoint(e->x, e->y), + QPoint(e->x_root, e->y_root), + buttons); + + mousePoint = QPoint(e->x_root, e->y_root); +} + +void QXlibWindow::handleCloseEvent() +{ + QWindowSystemInterface::handleCloseEvent(widget()); +} + + +void QXlibWindow::handleEnterEvent() +{ + QWindowSystemInterface::handleEnterEvent(widget()); +} + +void QXlibWindow::handleLeaveEvent() +{ + QWindowSystemInterface::handleLeaveEvent(widget()); +} + +void QXlibWindow::handleFocusInEvent() +{ + QWindowSystemInterface::handleWindowActivated(widget()); +} + +void QXlibWindow::handleFocusOutEvent() +{ + QWindowSystemInterface::handleWindowActivated(0); +} + + + +void QXlibWindow::setGeometry(const QRect &rect) +{ + XMoveResizeWindow(mScreen->display(), x_window, rect.x(), rect.y(), rect.width(), rect.height()); + QPlatformWindow::setGeometry(rect); +} + + +Qt::WindowFlags QXlibWindow::windowFlags() const +{ + return mWindowFlags; +} + +WId QXlibWindow::winId() const +{ + return x_window; +} + +void QXlibWindow::setParent(const QPlatformWindow *window) +{ + QPoint topLeft = geometry().topLeft(); + XReparentWindow(mScreen->display(),x_window,window->winId(),topLeft.x(),topLeft.y()); +} + +void QXlibWindow::raise() +{ + XRaiseWindow(mScreen->display(), x_window); +} + +void QXlibWindow::lower() +{ + XLowerWindow(mScreen->display(), x_window); +} + +void QXlibWindow::setWindowTitle(const QString &title) +{ + QByteArray ba = title.toLatin1(); //We're not making a general solution here... + XTextProperty windowName; + windowName.value = (unsigned char *)ba.constData(); + windowName.encoding = XA_STRING; + windowName.format = 8; + windowName.nitems = ba.length(); + + XSetWMName(mScreen->display(), x_window, &windowName); +} + +GC QXlibWindow::createGC() +{ + GC gc; + + gc = XCreateGC(mScreen->display(), x_window, 0, 0); + if (gc < 0) { + qWarning("QTestLiteWindow::createGC() could not create GC"); + } + return gc; +} + +void QXlibWindow::paintEvent() +{ +#ifdef MYX11_DEBUG +// qDebug() << "QTestLiteWindow::paintEvent" << shm_img.size() << painted; +#endif + + if (QWindowSurface *surface = widget()->windowSurface()) + surface->flush(widget(), widget()->geometry(), QPoint()); +} + +void QXlibWindow::requestActivateWindow() +{ + XSetInputFocus(mScreen->display(), x_window, XRevertToParent, CurrentTime); +} + +void QXlibWindow::resizeEvent(XConfigureEvent *e) +{ + int xpos = geometry().x(); + int ypos = geometry().y(); + if ((e->width != geometry().width() || e->height != geometry().height()) && e->x == 0 && e->y == 0) { + //qDebug() << "resize with bogus pos" << e->x << e->y << e->width << e->height << "window"<< hex << window; + } else { + //qDebug() << "geometry change" << e->x << e->y << e->width << e->height << "window"<< hex << window; + xpos = e->x; + ypos = e->y; + } +#ifdef MYX11_DEBUG + qDebug() << hex << x_window << dec << "ConfigureNotify" << e->x << e->y << e->width << e->height << "geometry" << xpos << ypos << width << height; +#endif + + QRect newRect(xpos, ypos, e->width, e->height); + QWindowSystemInterface::handleGeometryChange(widget(), newRect); +} + +void QXlibWindow::mousePressEvent(XButtonEvent *e) +{ + static long prevTime = 0; + static Window prevWindow; + static int prevX = -999; + static int prevY = -999; + + QEvent::Type type = QEvent::MouseButtonPress; + + if (e->window == prevWindow && long(e->time) - prevTime < QApplication::doubleClickInterval() + && qAbs(e->x - prevX) < 5 && qAbs(e->y - prevY) < 5) { + type = QEvent::MouseButtonDblClick; + prevTime = e->time - QApplication::doubleClickInterval(); //no double click next time + } else { + prevTime = e->time; + } + prevWindow = e->window; + prevX = e->x; + prevY = e->y; + + handleMouseEvent(type, e); +} + +QXlibMWMHints QXlibWindow::getMWMHints() const +{ + QXlibMWMHints mwmhints; + + Atom type; + int format; + ulong nitems, bytesLeft; + uchar *data = 0; + Atom atomForMotifWmHints = QXlibStatic::atom(QXlibStatic::_MOTIF_WM_HINTS); + if ((XGetWindowProperty(mScreen->display(), x_window, atomForMotifWmHints, 0, 5, false, + atomForMotifWmHints, &type, &format, &nitems, &bytesLeft, + &data) == Success) + && (type == atomForMotifWmHints + && format == 32 + && nitems >= 5)) { + mwmhints = *(reinterpret_cast<QXlibMWMHints *>(data)); + } else { + mwmhints.flags = 0L; + mwmhints.functions = MWM_FUNC_ALL; + mwmhints.decorations = MWM_DECOR_ALL; + mwmhints.input_mode = 0L; + mwmhints.status = 0L; + } + + if (data) + XFree(data); + + return mwmhints; +} + +void QXlibWindow::setMWMHints(const QXlibMWMHints &mwmhints) +{ + Atom atomForMotifWmHints = QXlibStatic::atom(QXlibStatic::_MOTIF_WM_HINTS); + if (mwmhints.flags != 0l) { + XChangeProperty(mScreen->display(), x_window, + atomForMotifWmHints, atomForMotifWmHints, 32, + PropModeReplace, (unsigned char *) &mwmhints, 5); + } else { + XDeleteProperty(mScreen->display(), x_window, atomForMotifWmHints); + } +} + +// Returns true if we should set WM_TRANSIENT_FOR on \a w +static inline bool isTransient(const QWidget *w) +{ + return ((w->windowType() == Qt::Dialog + || w->windowType() == Qt::Sheet + || w->windowType() == Qt::Tool + || w->windowType() == Qt::SplashScreen + || w->windowType() == Qt::ToolTip + || w->windowType() == Qt::Drawer + || w->windowType() == Qt::Popup) + && !w->testAttribute(Qt::WA_X11BypassTransientForHint)); +} + +QVector<Atom> QXlibWindow::getNetWmState() const +{ + QVector<Atom> returnValue; + + // Don't read anything, just get the size of the property data + Atom actualType; + int actualFormat; + ulong propertyLength; + ulong bytesLeft; + uchar *propertyData = 0; + if (XGetWindowProperty(mScreen->display(), x_window, QXlibStatic::atom(QXlibStatic::_NET_WM_STATE), 0, 0, + False, XA_ATOM, &actualType, &actualFormat, + &propertyLength, &bytesLeft, &propertyData) == Success + && actualType == XA_ATOM && actualFormat == 32) { + returnValue.resize(bytesLeft / 4); + XFree((char*) propertyData); + + // fetch all data + if (XGetWindowProperty(mScreen->display(), x_window, QXlibStatic::atom(QXlibStatic::_NET_WM_STATE), 0, + returnValue.size(), False, XA_ATOM, &actualType, &actualFormat, + &propertyLength, &bytesLeft, &propertyData) != Success) { + returnValue.clear(); + } else if (propertyLength != (ulong)returnValue.size()) { + returnValue.resize(propertyLength); + } + + // put it into netWmState + if (!returnValue.isEmpty()) { + memcpy(returnValue.data(), propertyData, returnValue.size() * sizeof(Atom)); + } + XFree((char*) propertyData); + } + + return returnValue; +} + +Qt::WindowFlags QXlibWindow::setWindowFlags(Qt::WindowFlags flags) +{ +// Q_ASSERT(flags & Qt::Window); + mWindowFlags = flags; + +#ifdef MYX11_DEBUG + qDebug() << "QTestLiteWindow::setWindowFlags" << hex << x_window << "flags" << flags; +#endif + Qt::WindowType type = static_cast<Qt::WindowType>(int(flags & Qt::WindowType_Mask)); + + if (type == Qt::ToolTip) + flags |= Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint; + if (type == Qt::Popup) + flags |= Qt::X11BypassWindowManagerHint; + + bool topLevel = (flags & Qt::Window); + bool popup = (type == Qt::Popup); + bool dialog = (type == Qt::Dialog + || type == Qt::Sheet); + bool desktop = (type == Qt::Desktop); + bool tool = (type == Qt::Tool || type == Qt::SplashScreen + || type == Qt::ToolTip || type == Qt::Drawer); + + Q_UNUSED(topLevel); + Q_UNUSED(dialog); + Q_UNUSED(desktop); + + bool tooltip = (type == Qt::ToolTip); + + XSetWindowAttributes wsa; + + QXlibMWMHints mwmhints; + mwmhints.flags = 0L; + mwmhints.functions = 0L; + mwmhints.decorations = 0; + mwmhints.input_mode = 0L; + mwmhints.status = 0L; + + + ulong wsa_mask = 0; + if (type != Qt::SplashScreen) { // && customize) { + mwmhints.flags |= MWM_HINTS_DECORATIONS; + + bool customize = flags & Qt::CustomizeWindowHint; + if (!(flags & Qt::FramelessWindowHint) && !(customize && !(flags & Qt::WindowTitleHint))) { + mwmhints.decorations |= MWM_DECOR_BORDER; + mwmhints.decorations |= MWM_DECOR_RESIZEH; + + if (flags & Qt::WindowTitleHint) + mwmhints.decorations |= MWM_DECOR_TITLE; + + if (flags & Qt::WindowSystemMenuHint) + mwmhints.decorations |= MWM_DECOR_MENU; + + if (flags & Qt::WindowMinimizeButtonHint) { + mwmhints.decorations |= MWM_DECOR_MINIMIZE; + mwmhints.functions |= MWM_FUNC_MINIMIZE; + } + + if (flags & Qt::WindowMaximizeButtonHint) { + mwmhints.decorations |= MWM_DECOR_MAXIMIZE; + mwmhints.functions |= MWM_FUNC_MAXIMIZE; + } + + if (flags & Qt::WindowCloseButtonHint) + mwmhints.functions |= MWM_FUNC_CLOSE; + } + } else { + // if type == Qt::SplashScreen + mwmhints.decorations = MWM_DECOR_ALL; + } + + if (tool) { + wsa.save_under = True; + wsa_mask |= CWSaveUnder; + } + + if (flags & Qt::X11BypassWindowManagerHint) { + wsa.override_redirect = True; + wsa_mask |= CWOverrideRedirect; + } +#if 0 + if (wsa_mask && initializeWindow) { + Q_ASSERT(id); + XChangeWindowAttributes(dpy, id, wsa_mask, &wsa); + } +#endif + if (mwmhints.functions != 0) { + mwmhints.flags |= MWM_HINTS_FUNCTIONS; + mwmhints.functions |= MWM_FUNC_MOVE | MWM_FUNC_RESIZE; + } else { + mwmhints.functions = MWM_FUNC_ALL; + } + + if (!(flags & Qt::FramelessWindowHint) + && flags & Qt::CustomizeWindowHint + && flags & Qt::WindowTitleHint + && !(flags & + (Qt::WindowMinimizeButtonHint + | Qt::WindowMaximizeButtonHint + | Qt::WindowCloseButtonHint))) { + // a special case - only the titlebar without any button + mwmhints.flags = MWM_HINTS_FUNCTIONS; + mwmhints.functions = MWM_FUNC_MOVE | MWM_FUNC_RESIZE; + mwmhints.decorations = 0; + } + + if (widget()->windowModality() == Qt::WindowModal) { + mwmhints.input_mode = MWM_INPUT_PRIMARY_APPLICATION_MODAL; + } else if (widget()->windowModality() == Qt::ApplicationModal) { + mwmhints.input_mode = MWM_INPUT_FULL_APPLICATION_MODAL; + } + + setMWMHints(mwmhints); + + QVector<Atom> netWmState = getNetWmState(); + + if (flags & Qt::WindowStaysOnTopHint) { + if (flags & Qt::WindowStaysOnBottomHint) + qWarning() << "QWidget: Incompatible window flags: the window can't be on top and on bottom at the same time"; + if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_ABOVE))) + netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_ABOVE)); + if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_STAYS_ON_TOP))) + netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_STAYS_ON_TOP)); + } else if (flags & Qt::WindowStaysOnBottomHint) { + if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_BELOW))) + netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_BELOW)); + } + if (widget()->isFullScreen()) { + if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_FULLSCREEN))) + netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_FULLSCREEN)); + } + if (widget()->isMaximized()) { + if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_MAXIMIZED_HORZ))) + netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_MAXIMIZED_HORZ)); + if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_MAXIMIZED_VERT))) + netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_MAXIMIZED_VERT)); + } + if (widget()->windowModality() != Qt::NonModal) { + if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_MODAL))) + netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_MODAL)); + } + + if (!netWmState.isEmpty()) { + XChangeProperty(mScreen->display(), x_window, + QXlibStatic::atom(QXlibStatic::_NET_WM_STATE), XA_ATOM, 32, PropModeReplace, + (unsigned char *) netWmState.data(), netWmState.size()); + } else { + XDeleteProperty(mScreen->display(), x_window, QXlibStatic::atom(QXlibStatic::_NET_WM_STATE)); + } + +//##### only if initializeWindow??? + + if (popup || tooltip) { // popup widget +#ifdef MYX11_DEBUG + qDebug() << "Doing XChangeWindowAttributes for popup" << wsa.override_redirect; +#endif + // set EWMH window types + // setNetWmWindowTypes(); + + wsa.override_redirect = True; + wsa.save_under = True; + XChangeWindowAttributes(mScreen->display(), x_window, CWOverrideRedirect | CWSaveUnder, + &wsa); + } else { +#ifdef MYX11_DEBUG + qDebug() << "Doing XChangeWindowAttributes for non-popup"; +#endif + } + + return flags; +} + +void QXlibWindow::setVisible(bool visible) +{ +#ifdef MYX11_DEBUG + qDebug() << "QTestLiteWindow::setVisible" << visible << hex << x_window; +#endif + if (isTransient(widget())) { + Window parentXWindow = x_window; + if (widget()->parentWidget()) { + QWidget *widgetParent = widget()->parentWidget()->window(); + if (widgetParent && widgetParent->platformWindow()) { + QXlibWindow *parentWidnow = static_cast<QXlibWindow *>(widgetParent->platformWindow()); + parentXWindow = parentWidnow->x_window; + } + } + XSetTransientForHint(mScreen->display(),x_window,parentXWindow); + } + + if (visible) { + //ensure that the window is viewed in correct position. + doSizeHints(); + XMapWindow(mScreen->display(), x_window); + } else { + XUnmapWindow(mScreen->display(), x_window); + } +} + +void QXlibWindow::setCursor(const Cursor &cursor) +{ + XDefineCursor(mScreen->display(), x_window, cursor); + XFlush(mScreen->display()); +} + +QPlatformGLContext *QXlibWindow::glContext() const +{ + if (!QApplicationPrivate::platformIntegration()->hasOpenGL()) + return 0; + if (!mGLContext) { + QXlibWindow *that = const_cast<QXlibWindow *>(this); +#if !defined(QT_NO_OPENGL) +#if !defined(QT_OPENGL_ES_2) + that->mGLContext = new QGLXContext(x_window, mScreen,widget()->platformWindowFormat()); +#else + EGLDisplay display = eglGetDisplay(mScreen->display()); + + QPlatformWindowFormat windowFormat = correctColorBuffers(widget()->platformWindowFormat()); + + EGLConfig config = q_configFromQPlatformWindowFormat(display,windowFormat); + QVector<EGLint> eglContextAttrs; + eglContextAttrs.append(EGL_CONTEXT_CLIENT_VERSION); + eglContextAttrs.append(2); + eglContextAttrs.append(EGL_NONE); + + EGLSurface eglSurface = eglCreateWindowSurface(display,config,(EGLNativeWindowType)x_window,0); + that->mGLContext = new QEGLPlatformContext(display, config, eglContextAttrs.data(), eglSurface, EGL_OPENGL_ES_API); +#endif +#endif + } + return mGLContext; +} + +Window QXlibWindow::xWindow() const +{ + return x_window; +} + +GC QXlibWindow::graphicsContext() const +{ + return gc; +} + +void QXlibWindow::doSizeHints() +{ + Q_ASSERT(widget()->testAttribute(Qt::WA_WState_Created)); + XSizeHints s; + s.flags = 0; + QRect g = geometry(); + s.x = g.x(); + s.y = g.y(); + s.width = g.width(); + s.height = g.height(); + s.flags |= USPosition; + s.flags |= PPosition; + s.flags |= USSize; + s.flags |= PSize; + s.flags |= PWinGravity; + s.win_gravity = QApplication::isRightToLeft() ? NorthEastGravity : NorthWestGravity; + XSetWMNormalHints(mScreen->display(), x_window, &s); +} + +QPlatformWindowFormat QXlibWindow::correctColorBuffers(const QPlatformWindowFormat &platformWindowFormat) const +{ + // I have only tested this setup on a dodgy intel setup, where I didn't use standard libs, + // so this might be not what we want to do :) + if ( !(platformWindowFormat.redBufferSize() == -1 && + platformWindowFormat.greenBufferSize() == -1 && + platformWindowFormat.blueBufferSize() == -1)) + return platformWindowFormat; + + QPlatformWindowFormat windowFormat = platformWindowFormat; + if (mScreen->depth() == 16) { + windowFormat.setRedBufferSize(5); + windowFormat.setGreenBufferSize(6); + windowFormat.setBlueBufferSize(5); + } else { + windowFormat.setRedBufferSize(8); + windowFormat.setGreenBufferSize(8); + windowFormat.setBlueBufferSize(8); + } + + return windowFormat; +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/xlib/qxlibwindow.h b/src/plugins/platforms/xlib/qxlibwindow.h new file mode 100644 index 0000000..ccf6867 --- /dev/null +++ b/src/plugins/platforms/xlib/qxlibwindow.h @@ -0,0 +1,145 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTESTLITEWINDOW_H +#define QTESTLITEWINDOW_H + +#include "qtestliteintegration.h" + +#include <QPlatformWindow> +#include <QEvent> + +#include <QObject> +#include <QImage> + +struct QXlibMWMHints { + ulong flags, functions, decorations; + long input_mode; + ulong status; +}; + +enum { + MWM_HINTS_FUNCTIONS = (1L << 0), + + MWM_FUNC_ALL = (1L << 0), + MWM_FUNC_RESIZE = (1L << 1), + MWM_FUNC_MOVE = (1L << 2), + MWM_FUNC_MINIMIZE = (1L << 3), + MWM_FUNC_MAXIMIZE = (1L << 4), + MWM_FUNC_CLOSE = (1L << 5), + + MWM_HINTS_DECORATIONS = (1L << 1), + + MWM_DECOR_ALL = (1L << 0), + MWM_DECOR_BORDER = (1L << 1), + MWM_DECOR_RESIZEH = (1L << 2), + MWM_DECOR_TITLE = (1L << 3), + MWM_DECOR_MENU = (1L << 4), + MWM_DECOR_MINIMIZE = (1L << 5), + MWM_DECOR_MAXIMIZE = (1L << 6), + + MWM_HINTS_INPUT_MODE = (1L << 2), + + MWM_INPUT_MODELESS = 0L, + MWM_INPUT_PRIMARY_APPLICATION_MODAL = 1L, + MWM_INPUT_FULL_APPLICATION_MODAL = 3L +}; + +class QXlibWindow : public QPlatformWindow +{ +public: + QXlibWindow(QWidget *window); + ~QXlibWindow(); + + + void mousePressEvent(XButtonEvent*); + void handleMouseEvent(QEvent::Type, XButtonEvent *ev); + + void handleCloseEvent(); + void handleEnterEvent(); + void handleLeaveEvent(); + void handleFocusInEvent(); + void handleFocusOutEvent(); + + void resizeEvent(XConfigureEvent *configure_event); + void paintEvent(); + + void requestActivateWindow(); + + void setGeometry(const QRect &rect); + + Qt::WindowFlags setWindowFlags(Qt::WindowFlags type); + Qt::WindowFlags windowFlags() const; + void setVisible(bool visible); + WId winId() const; + void setParent(const QPlatformWindow *window); + void raise(); + void lower(); + void setWindowTitle(const QString &title); + + void setCursor(const Cursor &cursor); + + QPlatformGLContext *glContext() const; + + Window xWindow() const; + GC graphicsContext() const; + +protected: + QVector<Atom> getNetWmState() const; + void setMWMHints(const QXlibMWMHints &mwmhints); + QXlibMWMHints getMWMHints() const; + + void doSizeHints(); + +private: + QPlatformWindowFormat correctColorBuffers(const QPlatformWindowFormat &windowFormat)const; + + Window x_window; + GC gc; + + GC createGC(); + + QPlatformGLContext *mGLContext; + QXlibScreen *mScreen; + Qt::WindowFlags mWindowFlags; +}; + +#endif diff --git a/src/plugins/platforms/xlib/qxlibwindowsurface.cpp b/src/plugins/platforms/xlib/qxlibwindowsurface.cpp new file mode 100644 index 0000000..088730d --- /dev/null +++ b/src/plugins/platforms/xlib/qxlibwindowsurface.cpp @@ -0,0 +1,224 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qtestlitewindowsurface.h" +#include "qtestliteintegration.h" + +#include <QtCore/qdebug.h> +#include <QWindowSystemInterface> + +#include "qtestlitewindow.h" +#include "qtestlitescreen.h" + +# include <sys/ipc.h> +# include <sys/shm.h> +# include <X11/extensions/XShm.h> + +QT_BEGIN_NAMESPACE + + +struct QXlibShmImageInfo { + QXlibShmImageInfo(Display *xdisplay) : image(0), display(xdisplay) {} + ~QXlibShmImageInfo() { destroy(); } + + void destroy(); + + XShmSegmentInfo shminfo; + XImage *image; + Display *display; +}; + + +#ifndef DONT_USE_MIT_SHM +void QXlibShmImageInfo::destroy() +{ + XShmDetach (display, &shminfo); + XDestroyImage (image); + shmdt (shminfo.shmaddr); + shmctl (shminfo.shmid, IPC_RMID, 0); +} +#endif + +void QXlibWindowSurface::resizeShmImage(int width, int height) +{ + +#ifdef DONT_USE_MIT_SHM + shm_img = QImage(width, height, QImage::Format_RGB32); +#else + + QXlibScreen *screen = QXlibScreen::testLiteScreenForWidget(window()); + if (image_info) + image_info->destroy(); + else + image_info = new QXlibShmImageInfo(screen->display()); + + Visual *visual = DefaultVisual(screen->display(), screen->xScreenNumber()); + + + XImage *image = XShmCreateImage (screen->display(), visual, 24, ZPixmap, 0, + &image_info->shminfo, width, height); + + + image_info->shminfo.shmid = shmget (IPC_PRIVATE, + image->bytes_per_line * image->height, IPC_CREAT|0777); + + image_info->shminfo.shmaddr = image->data = (char*)shmat (image_info->shminfo.shmid, 0, 0); + image_info->shminfo.readOnly = False; + + image_info->image = image; + + Status shm_attach_status = XShmAttach(screen->display(), &image_info->shminfo); + + Q_ASSERT(shm_attach_status == True); + + shm_img = QImage( (uchar*) image->data, image->width, image->height, image->bytes_per_line, QImage::Format_RGB32 ); +#endif + painted = false; +} + + +void QXlibWindowSurface::resizeBuffer(QSize s) +{ + if (shm_img.size() != s) + resizeShmImage(s.width(), s.height()); +} + +QSize QXlibWindowSurface::bufferSize() const +{ + return shm_img.size(); +} + +QXlibWindowSurface::QXlibWindowSurface (QWidget *window) + : QWindowSurface(window), + painted(false), image_info(0) +{ + xw = static_cast<QXlibWindow*>(window->platformWindow()); +// qDebug() << "QTestLiteWindowSurface::QTestLiteWindowSurface:" << xw->window; +} + +QXlibWindowSurface::~QXlibWindowSurface() +{ + delete image_info; +} + +QPaintDevice *QXlibWindowSurface::paintDevice() +{ + return &shm_img; +} + + +void QXlibWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) +{ + Q_UNUSED(widget); + Q_UNUSED(region); + Q_UNUSED(offset); + + if (!painted) + return; + + QXlibScreen *screen = QXlibScreen::testLiteScreenForWidget(widget); + GC gc = xw->graphicsContext(); + Window window = xw->xWindow(); +#ifdef DONT_USE_MIT_SHM + // just convert the image every time... + if (!shm_img.isNull()) { + Visual *visual = DefaultVisual(screen->display(), screen->xScreenNumber()); + + QImage image = shm_img; + //img.convertToFormat( + XImage *xi = XCreateImage(screen->display(), visual, 24, ZPixmap, + 0, (char *) image.scanLine(0), image.width(), image.height(), + 32, image.bytesPerLine()); + + int x = 0; + int y = 0; + + /*int r =*/ XPutImage(screen->display(), window, gc, xi, 0, 0, x, y, image.width(), image.height()); + + xi->data = 0; // QImage owns these bits + XDestroyImage(xi); + } +#else + // Use MIT_SHM + if (image_info && image_info->image) { + //qDebug() << "Here we go" << image_info->image->width << image_info->image->height; + int x = 0; + int y = 0; + + // We could set send_event to true, and then use the ShmCompletion to synchronize, + // but let's do like Qt/11 and just use XSync + XShmPutImage (screen->display(), window, gc, image_info->image, 0, 0, + x, y, image_info->image->width, image_info->image->height, + /*send_event*/ False); + + XSync(screen->display(), False); + } +#endif +} + +// from qwindowsurface.cpp +extern void qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &offset); + +bool QXlibWindowSurface::scroll(const QRegion &area, int dx, int dy) +{ + if (shm_img.isNull()) + return false; + + const QVector<QRect> rects = area.rects(); + for (int i = 0; i < rects.size(); ++i) + qt_scrollRectInImage(shm_img, rects.at(i), QPoint(dx, dy)); + + return true; +} + + +void QXlibWindowSurface::beginPaint(const QRegion ®ion) +{ + Q_UNUSED(region); + resizeBuffer(size()); +} + +void QXlibWindowSurface::endPaint(const QRegion ®ion) +{ + Q_UNUSED(region); + painted = true; //there is content in the buffer +} +QT_END_NAMESPACE diff --git a/src/plugins/platforms/xlib/qxlibwindowsurface.h b/src/plugins/platforms/xlib/qxlibwindowsurface.h new file mode 100644 index 0000000..12b4c60 --- /dev/null +++ b/src/plugins/platforms/xlib/qxlibwindowsurface.h @@ -0,0 +1,86 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWINDOWSURFACE_TESTLITE_H +#define QWINDOWSURFACE_TESTLITE_H + +#include <QtGui/private/qwindowsurface_p.h> + + +QT_BEGIN_NAMESPACE + +class QXlibWindow; +class QXlibIntegration; +class QXlibScreen; +class QXlibShmImageInfo; + +class QXlibWindowSurface : public QWindowSurface +{ +public: + QXlibWindowSurface (QWidget *window); + ~QXlibWindowSurface(); + + QPaintDevice *paintDevice(); + void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); + bool scroll(const QRegion &area, int dx, int dy); + + void beginPaint(const QRegion ®ion); + void endPaint(const QRegion ®ion); + +private: + bool painted; + void resizeBuffer(QSize); + QSize bufferSize() const; + + + void resizeShmImage(int width, int height); + + QImage shm_img; + QXlibShmImageInfo *image_info; + + QXlibWindow *xw; + +}; + + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/platforms/xlib/testlite.pro b/src/plugins/platforms/xlib/testlite.pro deleted file mode 100644 index 7fb3304..0000000 --- a/src/plugins/platforms/xlib/testlite.pro +++ /dev/null @@ -1,57 +0,0 @@ -TARGET = qtestlite - -include(../../qpluginbase.pri) -QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforms - -SOURCES = \ - main.cpp \ - qtestliteintegration.cpp \ - qtestlitewindowsurface.cpp \ - qtestlitewindow.cpp \ - qtestlitecursor.cpp \ - qtestlitescreen.cpp \ - qtestlitekeyboard.cpp \ - qtestliteclipboard.cpp \ - qtestlitemime.cpp \ - qtestlitestaticinfo.cpp - -HEADERS = \ - qtestliteintegration.h \ - qtestlitewindowsurface.h \ - qtestlitewindow.h \ - qtestlitecursor.h \ - qtestlitescreen.h \ - qtestlitekeyboard.h \ - qtestliteclipboard.h \ - qtestlitemime.h \ - qtestlitestaticinfo.h - -LIBS += -lX11 -lXext - -mac { - LIBS += -L/usr/X11/lib -lz -framework Carbon -} - -include (../fontdatabases/genericunix/genericunix.pri) - -contains(QT_CONFIG, opengl) { - QT += opengl - !contains(QT_CONFIG, opengles2) { - HEADERS += qglxintegration.h - SOURCES += qglxintegration.cpp - } else { # There is no easy way to detect if we'r suppose to use glx or not - HEADERS += \ - ../eglconvenience/qeglplatformcontext.h \ - ../eglconvenience/qeglconvenience.h \ - qtestliteeglintegration.h - - SOURCES += \ - ../eglconvenience/qeglplatformcontext.cpp \ - ../eglconvenience/qeglconvenience.cpp \ - qtestliteeglintegration.cpp - LIBS += -lEGL - } -} - -target.path += $$[QT_INSTALL_PLUGINS]/platforms -INSTALLS += target diff --git a/src/plugins/platforms/xlib/xlib.pro b/src/plugins/platforms/xlib/xlib.pro new file mode 100644 index 0000000..7fb3304 --- /dev/null +++ b/src/plugins/platforms/xlib/xlib.pro @@ -0,0 +1,57 @@ +TARGET = qtestlite + +include(../../qpluginbase.pri) +QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforms + +SOURCES = \ + main.cpp \ + qtestliteintegration.cpp \ + qtestlitewindowsurface.cpp \ + qtestlitewindow.cpp \ + qtestlitecursor.cpp \ + qtestlitescreen.cpp \ + qtestlitekeyboard.cpp \ + qtestliteclipboard.cpp \ + qtestlitemime.cpp \ + qtestlitestaticinfo.cpp + +HEADERS = \ + qtestliteintegration.h \ + qtestlitewindowsurface.h \ + qtestlitewindow.h \ + qtestlitecursor.h \ + qtestlitescreen.h \ + qtestlitekeyboard.h \ + qtestliteclipboard.h \ + qtestlitemime.h \ + qtestlitestaticinfo.h + +LIBS += -lX11 -lXext + +mac { + LIBS += -L/usr/X11/lib -lz -framework Carbon +} + +include (../fontdatabases/genericunix/genericunix.pri) + +contains(QT_CONFIG, opengl) { + QT += opengl + !contains(QT_CONFIG, opengles2) { + HEADERS += qglxintegration.h + SOURCES += qglxintegration.cpp + } else { # There is no easy way to detect if we'r suppose to use glx or not + HEADERS += \ + ../eglconvenience/qeglplatformcontext.h \ + ../eglconvenience/qeglconvenience.h \ + qtestliteeglintegration.h + + SOURCES += \ + ../eglconvenience/qeglplatformcontext.cpp \ + ../eglconvenience/qeglconvenience.cpp \ + qtestliteeglintegration.cpp + LIBS += -lEGL + } +} + +target.path += $$[QT_INSTALL_PLUGINS]/platforms +INSTALLS += target -- cgit v0.12 From 5cda0ff17d82197de987b1c09959549995737b9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= <jorgen.lind@nokia.com> Date: Mon, 14 Feb 2011 14:00:14 +0100 Subject: Lighthouse: fix qxlib include files after file-rename --- src/plugins/platforms/xlib/main.cpp | 2 +- src/plugins/platforms/xlib/qglxintegration.cpp | 4 +-- src/plugins/platforms/xlib/qglxintegration.h | 2 +- src/plugins/platforms/xlib/qxlibclipboard.cpp | 8 ++--- src/plugins/platforms/xlib/qxlibclipboard.h | 2 +- src/plugins/platforms/xlib/qxlibcursor.cpp | 8 ++--- src/plugins/platforms/xlib/qxlibcursor.h | 2 +- src/plugins/platforms/xlib/qxlibeglintegration.cpp | 2 +- src/plugins/platforms/xlib/qxlibeglintegration.h | 2 +- src/plugins/platforms/xlib/qxlibintegration.cpp | 10 +++--- src/plugins/platforms/xlib/qxlibintegration.h | 2 +- src/plugins/platforms/xlib/qxlibkeyboard.cpp | 4 +-- src/plugins/platforms/xlib/qxlibkeyboard.h | 2 +- src/plugins/platforms/xlib/qxlibmime.cpp | 6 ++-- src/plugins/platforms/xlib/qxlibmime.h | 4 +-- src/plugins/platforms/xlib/qxlibscreen.cpp | 12 +++---- src/plugins/platforms/xlib/qxlibscreen.h | 2 +- src/plugins/platforms/xlib/qxlibstatic.cpp | 4 +-- src/plugins/platforms/xlib/qxlibwindow.cpp | 12 +++---- src/plugins/platforms/xlib/qxlibwindow.h | 2 +- src/plugins/platforms/xlib/qxlibwindowsurface.cpp | 8 ++--- src/plugins/platforms/xlib/xlib.pro | 42 +++++++++++----------- 22 files changed, 71 insertions(+), 71 deletions(-) diff --git a/src/plugins/platforms/xlib/main.cpp b/src/plugins/platforms/xlib/main.cpp index 131d399..3e2a6b9 100644 --- a/src/plugins/platforms/xlib/main.cpp +++ b/src/plugins/platforms/xlib/main.cpp @@ -40,7 +40,7 @@ ****************************************************************************/ #include <QtGui/QPlatformIntegrationPlugin> -#include "qtestliteintegration.h" +#include "qxlibintegration.h" QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/xlib/qglxintegration.cpp b/src/plugins/platforms/xlib/qglxintegration.cpp index 46dfef9..5ba4f0d 100644 --- a/src/plugins/platforms/xlib/qglxintegration.cpp +++ b/src/plugins/platforms/xlib/qglxintegration.cpp @@ -43,8 +43,8 @@ #include <QLibrary> #include <QGLFormat> -#include "qtestlitewindow.h" -#include "qtestlitescreen.h" +#include "qxlibwindow.h" +#include "qxlibscreen.h" #if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2) #include <X11/Xlib.h> diff --git a/src/plugins/platforms/xlib/qglxintegration.h b/src/plugins/platforms/xlib/qglxintegration.h index f982708..81b48c9 100644 --- a/src/plugins/platforms/xlib/qglxintegration.h +++ b/src/plugins/platforms/xlib/qglxintegration.h @@ -42,7 +42,7 @@ #ifndef Q_GLX_CONTEXT_H #define Q_GLX_CONTEXT_H -#include "qtestlitewindow.h" +#include "qxlibwindow.h" #include <QtGui/QPlatformGLContext> #include <QtGui/QPlatformWindowFormat> diff --git a/src/plugins/platforms/xlib/qxlibclipboard.cpp b/src/plugins/platforms/xlib/qxlibclipboard.cpp index 1264b5a..7930fcb 100644 --- a/src/plugins/platforms/xlib/qxlibclipboard.cpp +++ b/src/plugins/platforms/xlib/qxlibclipboard.cpp @@ -39,10 +39,10 @@ ** ****************************************************************************/ -#include "qtestliteclipboard.h" +#include "qxlibclipboard.h" -#include "qtestlitescreen.h" -#include "qtestlitemime.h" +#include "qxlibscreen.h" +#include "qxlibmime.h" #include <private/qapplication_p.h> @@ -673,4 +673,4 @@ QByteArray QXlibClipboard::getDataInFormat(Atom modeAtom, Atom fmtatom) return buf; } -#include "qtestliteclipboard.moc" +#include "qxlibclipboard.moc" diff --git a/src/plugins/platforms/xlib/qxlibclipboard.h b/src/plugins/platforms/xlib/qxlibclipboard.h index 109714c..ec1d728 100644 --- a/src/plugins/platforms/xlib/qxlibclipboard.h +++ b/src/plugins/platforms/xlib/qxlibclipboard.h @@ -43,7 +43,7 @@ #define QTESTLITECLIPBOARD_H #include <QPlatformClipboard> -#include "qtestlitestaticinfo.h" +#include "qxlibstatic.h" class QXlibScreen; class QXlibClipboard : public QPlatformClipboard diff --git a/src/plugins/platforms/xlib/qxlibcursor.cpp b/src/plugins/platforms/xlib/qxlibcursor.cpp index 2f7cfbf..e4d248c 100644 --- a/src/plugins/platforms/xlib/qxlibcursor.cpp +++ b/src/plugins/platforms/xlib/qxlibcursor.cpp @@ -39,11 +39,11 @@ ** ****************************************************************************/ -#include "qtestlitecursor.h" +#include "qxlibcursor.h" -#include "qtestliteintegration.h" -#include "qtestlitescreen.h" -#include "qtestlitewindow.h" +#include "qxlibintegration.h" +#include "qxlibscreen.h" +#include "qxlibwindow.h" #include <QtGui/QBitmap> diff --git a/src/plugins/platforms/xlib/qxlibcursor.h b/src/plugins/platforms/xlib/qxlibcursor.h index db9f9e2..77c66bf 100644 --- a/src/plugins/platforms/xlib/qxlibcursor.h +++ b/src/plugins/platforms/xlib/qxlibcursor.h @@ -44,7 +44,7 @@ #include <QtGui/QPlatformCursor> -#include "qtestliteintegration.h" +#include "qxlibintegration.h" QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/xlib/qxlibeglintegration.cpp b/src/plugins/platforms/xlib/qxlibeglintegration.cpp index 9bbe0ca..1135d2f 100644 --- a/src/plugins/platforms/xlib/qxlibeglintegration.cpp +++ b/src/plugins/platforms/xlib/qxlibeglintegration.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qtestliteeglintegration.h" +#include "qxlibeglintegration.h" static int countBits(unsigned long mask) { diff --git a/src/plugins/platforms/xlib/qxlibeglintegration.h b/src/plugins/platforms/xlib/qxlibeglintegration.h index 4c2e50d..6a94b8e 100644 --- a/src/plugins/platforms/xlib/qxlibeglintegration.h +++ b/src/plugins/platforms/xlib/qxlibeglintegration.h @@ -42,7 +42,7 @@ #ifndef QTESTLITEEGLINTEGRATION_H #define QTESTLITEEGLINTEGRATION_H -#include "qtestlitestaticinfo.h" +#include "qxlibstatic.h" #include "../eglconvenience/qeglconvenience.h" class QXlibEglIntegration diff --git a/src/plugins/platforms/xlib/qxlibintegration.cpp b/src/plugins/platforms/xlib/qxlibintegration.cpp index cdc5c29..46eabbf 100644 --- a/src/plugins/platforms/xlib/qxlibintegration.cpp +++ b/src/plugins/platforms/xlib/qxlibintegration.cpp @@ -39,15 +39,15 @@ ** ****************************************************************************/ -#include "qtestliteintegration.h" -#include "qtestlitewindowsurface.h" +#include "qxlibintegration.h" +#include "qxlibwindowsurface.h" #include <QtGui/private/qpixmap_raster_p.h> #include <QtCore/qdebug.h> -#include "qtestlitewindow.h" +#include "qxlibwindow.h" #include "qgenericunixfontdatabase.h" -#include "qtestlitescreen.h" -#include "qtestliteclipboard.h" +#include "qxlibscreen.h" +#include "qxlibclipboard.h" #if !defined(QT_NO_OPENGL) #if !defined(QT_OPENGL_ES_2) diff --git a/src/plugins/platforms/xlib/qxlibintegration.h b/src/plugins/platforms/xlib/qxlibintegration.h index c3125b8..dd8cdec 100644 --- a/src/plugins/platforms/xlib/qxlibintegration.h +++ b/src/plugins/platforms/xlib/qxlibintegration.h @@ -48,7 +48,7 @@ #include <QtGui/QPlatformIntegration> #include <QtGui/QPlatformScreen> -#include "qtestlitestaticinfo.h" +#include "qxlibstatic.h" QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/xlib/qxlibkeyboard.cpp b/src/plugins/platforms/xlib/qxlibkeyboard.cpp index fb0cf2e..65727a4 100644 --- a/src/plugins/platforms/xlib/qxlibkeyboard.cpp +++ b/src/plugins/platforms/xlib/qxlibkeyboard.cpp @@ -39,9 +39,9 @@ ** ****************************************************************************/ -#include "qtestlitekeyboard.h" +#include "qxlibkeyboard.h" -#include "qtestlitescreen.h" +#include "qxlibscreen.h" #include <QtGui/QWindowSystemInterface> diff --git a/src/plugins/platforms/xlib/qxlibkeyboard.h b/src/plugins/platforms/xlib/qxlibkeyboard.h index 98df4e1..02fc290 100644 --- a/src/plugins/platforms/xlib/qxlibkeyboard.h +++ b/src/plugins/platforms/xlib/qxlibkeyboard.h @@ -42,7 +42,7 @@ #ifndef QTESTLITEKEYBOARD_H #define QTESTLITEKEYBOARD_H -#include "qtestliteintegration.h" +#include "qxlibintegration.h" class QXlibKeyboard { diff --git a/src/plugins/platforms/xlib/qxlibmime.cpp b/src/plugins/platforms/xlib/qxlibmime.cpp index 5335ae9..61a0735 100644 --- a/src/plugins/platforms/xlib/qxlibmime.cpp +++ b/src/plugins/platforms/xlib/qxlibmime.cpp @@ -39,10 +39,10 @@ ** ****************************************************************************/ -#include "qtestlitemime.h" +#include "qxlibmime.h" -#include "qtestlitestaticinfo.h" -#include "qtestlitescreen.h" +#include "qxlibstatic.h" +#include "qxlibscreen.h" #include <QtCore/QTextCodec> #include <QtGui/QImageWriter> diff --git a/src/plugins/platforms/xlib/qxlibmime.h b/src/plugins/platforms/xlib/qxlibmime.h index 6a70ea4..316d423 100644 --- a/src/plugins/platforms/xlib/qxlibmime.h +++ b/src/plugins/platforms/xlib/qxlibmime.h @@ -46,8 +46,8 @@ #include <QtGui/QClipboard> -#include "qtestliteintegration.h" -#include "qtestliteclipboard.h" +#include "qxlibintegration.h" +#include "qxlibclipboard.h" class QXlibMime : public QInternalMimeData { Q_OBJECT diff --git a/src/plugins/platforms/xlib/qxlibscreen.cpp b/src/plugins/platforms/xlib/qxlibscreen.cpp index 714c17b..ef04fb2 100644 --- a/src/plugins/platforms/xlib/qxlibscreen.cpp +++ b/src/plugins/platforms/xlib/qxlibscreen.cpp @@ -39,13 +39,13 @@ ** ****************************************************************************/ -#include "qtestlitescreen.h" +#include "qxlibscreen.h" -#include "qtestlitecursor.h" -#include "qtestlitewindow.h" -#include "qtestlitekeyboard.h" -#include "qtestlitestaticinfo.h" -#include "qtestliteclipboard.h" +#include "qxlibcursor.h" +#include "qxlibwindow.h" +#include "qxlibkeyboard.h" +#include "qxlibstatic.h" +#include "qxlibclipboard.h" #include <QtCore/QDebug> #include <QtCore/QSocketNotifier> diff --git a/src/plugins/platforms/xlib/qxlibscreen.h b/src/plugins/platforms/xlib/qxlibscreen.h index 7e59a59..c8043fb 100644 --- a/src/plugins/platforms/xlib/qxlibscreen.h +++ b/src/plugins/platforms/xlib/qxlibscreen.h @@ -43,7 +43,7 @@ #define QTESTLITESCREEN_H #include <QtGui/QPlatformScreen> -#include "qtestliteintegration.h" +#include "qxlibintegration.h" QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/xlib/qxlibstatic.cpp b/src/plugins/platforms/xlib/qxlibstatic.cpp index 837636c..3ce5768 100644 --- a/src/plugins/platforms/xlib/qxlibstatic.cpp +++ b/src/plugins/platforms/xlib/qxlibstatic.cpp @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#include "qtestlitestaticinfo.h" -#include "qtestlitescreen.h" +#include "qxlibstatic.h" +#include "qxlibscreen.h" #include <qplatformdefs.h> diff --git a/src/plugins/platforms/xlib/qxlibwindow.cpp b/src/plugins/platforms/xlib/qxlibwindow.cpp index 0f11a81..ddd4002 100644 --- a/src/plugins/platforms/xlib/qxlibwindow.cpp +++ b/src/plugins/platforms/xlib/qxlibwindow.cpp @@ -39,12 +39,12 @@ ** ****************************************************************************/ -#include "qtestlitewindow.h" +#include "qxlibwindow.h" -#include "qtestliteintegration.h" -#include "qtestlitescreen.h" -#include "qtestlitekeyboard.h" -#include "qtestlitestaticinfo.h" +#include "qxlibintegration.h" +#include "qxlibscreen.h" +#include "qxlibkeyboard.h" +#include "qxlibstatic.h" #include <QtGui/QWindowSystemInterface> #include <QSocketNotifier> @@ -60,7 +60,7 @@ #else #include "../eglconvenience/qeglconvenience.h" #include "../eglconvenience/qeglplatformcontext.h" -#include "qtestliteeglintegration.h" +#include "qxlibeglintegration.h" #endif //QT_OPENGL_ES_2 #endif //QT_NO_OPENGL diff --git a/src/plugins/platforms/xlib/qxlibwindow.h b/src/plugins/platforms/xlib/qxlibwindow.h index ccf6867..be98032 100644 --- a/src/plugins/platforms/xlib/qxlibwindow.h +++ b/src/plugins/platforms/xlib/qxlibwindow.h @@ -42,7 +42,7 @@ #ifndef QTESTLITEWINDOW_H #define QTESTLITEWINDOW_H -#include "qtestliteintegration.h" +#include "qxlibintegration.h" #include <QPlatformWindow> #include <QEvent> diff --git a/src/plugins/platforms/xlib/qxlibwindowsurface.cpp b/src/plugins/platforms/xlib/qxlibwindowsurface.cpp index 088730d..92e1793 100644 --- a/src/plugins/platforms/xlib/qxlibwindowsurface.cpp +++ b/src/plugins/platforms/xlib/qxlibwindowsurface.cpp @@ -39,14 +39,14 @@ ** ****************************************************************************/ -#include "qtestlitewindowsurface.h" -#include "qtestliteintegration.h" +#include "qxlibwindowsurface.h" +#include "qxlibintegration.h" #include <QtCore/qdebug.h> #include <QWindowSystemInterface> -#include "qtestlitewindow.h" -#include "qtestlitescreen.h" +#include "qxlibwindow.h" +#include "qxlibscreen.h" # include <sys/ipc.h> # include <sys/shm.h> diff --git a/src/plugins/platforms/xlib/xlib.pro b/src/plugins/platforms/xlib/xlib.pro index 7fb3304..999621b 100644 --- a/src/plugins/platforms/xlib/xlib.pro +++ b/src/plugins/platforms/xlib/xlib.pro @@ -1,30 +1,30 @@ -TARGET = qtestlite +TARGET = qxlib include(../../qpluginbase.pri) QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforms SOURCES = \ main.cpp \ - qtestliteintegration.cpp \ - qtestlitewindowsurface.cpp \ - qtestlitewindow.cpp \ - qtestlitecursor.cpp \ - qtestlitescreen.cpp \ - qtestlitekeyboard.cpp \ - qtestliteclipboard.cpp \ - qtestlitemime.cpp \ - qtestlitestaticinfo.cpp + qxlibintegration.cpp \ + qxlibwindowsurface.cpp \ + qxlibwindow.cpp \ + qxlibcursor.cpp \ + qxlibscreen.cpp \ + qxlibkeyboard.cpp \ + qxlibclipboard.cpp \ + qxlibmime.cpp \ + qxlibstatic.cpp HEADERS = \ - qtestliteintegration.h \ - qtestlitewindowsurface.h \ - qtestlitewindow.h \ - qtestlitecursor.h \ - qtestlitescreen.h \ - qtestlitekeyboard.h \ - qtestliteclipboard.h \ - qtestlitemime.h \ - qtestlitestaticinfo.h + qxlibintegration.h \ + qxlibwindowsurface.h \ + qxlibwindow.h \ + qxlibcursor.h \ + qxlibscreen.h \ + qxlibkeyboard.h \ + qxlibclipboard.h \ + qxlibmime.h \ + qxlibstatic.h LIBS += -lX11 -lXext @@ -43,12 +43,12 @@ contains(QT_CONFIG, opengl) { HEADERS += \ ../eglconvenience/qeglplatformcontext.h \ ../eglconvenience/qeglconvenience.h \ - qtestliteeglintegration.h + qxlibeglintegration.h SOURCES += \ ../eglconvenience/qeglplatformcontext.cpp \ ../eglconvenience/qeglconvenience.cpp \ - qtestliteeglintegration.cpp + qxlibeglintegration.cpp LIBS += -lEGL } } -- cgit v0.12 From 623c13a70f646e8200900c01ce2e409fc0f2fdec Mon Sep 17 00:00:00 2001 From: axis <qt-info@nokia.com> Date: Fri, 18 Feb 2011 15:11:20 +0100 Subject: Renamed the symbian/linux-* mkspecs to symbian-*. This was done for a number of reasons: - In order to get better consistency with the other mkspecs, which have the target system name followed by a hyphen and the compiler name. - There is no real reason why we should have specific mkspecs for compiling Symbian under Linux, when it is equally likely to work under other operating systems. RevBy: Thomas Zander Conflicts: src/s60main/s60main.pro --- configure | 2 +- doc/src/snippets/code/doc_src_installation.qdoc | 4 +- mkspecs/features/symbian/do_not_build_as_thumb.prf | 2 +- mkspecs/features/symbian/symbian_building.prf | 18 ++--- mkspecs/symbian-armcc/features/default_post.prf | 5 ++ mkspecs/symbian-armcc/qmake.conf | 62 +++++++++++++++ mkspecs/symbian-armcc/qplatformdefs.h | 42 ++++++++++ mkspecs/symbian-gcce/features/default_post.prf | 5 ++ mkspecs/symbian-gcce/qmake.conf | 92 ++++++++++++++++++++++ mkspecs/symbian-gcce/qplatformdefs.h | 43 ++++++++++ .../symbian/linux-armcc/features/default_post.prf | 5 -- mkspecs/symbian/linux-armcc/qmake.conf | 62 --------------- mkspecs/symbian/linux-armcc/qplatformdefs.h | 42 ---------- .../symbian/linux-gcce/features/default_post.prf | 5 -- mkspecs/symbian/linux-gcce/qmake.conf | 92 ---------------------- mkspecs/symbian/linux-gcce/qplatformdefs.h | 43 ---------- src/corelib/global/global.pri | 2 +- src/s60main/s60main.pro | 2 +- 18 files changed, 264 insertions(+), 264 deletions(-) create mode 100644 mkspecs/symbian-armcc/features/default_post.prf create mode 100644 mkspecs/symbian-armcc/qmake.conf create mode 100644 mkspecs/symbian-armcc/qplatformdefs.h create mode 100644 mkspecs/symbian-gcce/features/default_post.prf create mode 100644 mkspecs/symbian-gcce/qmake.conf create mode 100644 mkspecs/symbian-gcce/qplatformdefs.h delete mode 100644 mkspecs/symbian/linux-armcc/features/default_post.prf delete mode 100644 mkspecs/symbian/linux-armcc/qmake.conf delete mode 100644 mkspecs/symbian/linux-armcc/qplatformdefs.h delete mode 100644 mkspecs/symbian/linux-gcce/features/default_post.prf delete mode 100644 mkspecs/symbian/linux-gcce/qmake.conf delete mode 100644 mkspecs/symbian/linux-gcce/qplatformdefs.h diff --git a/configure b/configure index dfbf9bd..6341dfb 100755 --- a/configure +++ b/configure @@ -761,7 +761,7 @@ L_FLAGS= RPATH_FLAGS= l_FLAGS= QCONFIG_FLAGS= -XPLATFORM= # This seems to be the QMAKESPEC, like "linux-g++" or "symbian/linux-gcce" +XPLATFORM= # This seems to be the QMAKESPEC, like "linux-g++" or "symbian-gcce" XPLATFORM_MINGW=no # Whether target platform is MinGW (win32-g++*) PLATFORM=$QMAKESPEC QT_CROSS_COMPILE=no diff --git a/doc/src/snippets/code/doc_src_installation.qdoc b/doc/src/snippets/code/doc_src_installation.qdoc index 1a87566..5aaa2b0 100644 --- a/doc/src/snippets/code/doc_src_installation.qdoc +++ b/doc/src/snippets/code/doc_src_installation.qdoc @@ -250,12 +250,12 @@ export PATH //! [38] cd /home/user/qt/%VERSION% -./configure -platform linux-g++ -xplatform symbian/linux-armcc +./configure -platform linux-g++ -xplatform symbian-armcc //! [38] //! [39] cd /home/user/qt/%VERSION% -./configure -platform linux-g++ -xplatform symbian/linux-gcce -no-webkit +./configure -platform linux-g++ -xplatform symbian-gcce -no-webkit //! [39] //! [40] diff --git a/mkspecs/features/symbian/do_not_build_as_thumb.prf b/mkspecs/features/symbian/do_not_build_as_thumb.prf index 60d9382..0f1fd9f 100644 --- a/mkspecs/features/symbian/do_not_build_as_thumb.prf +++ b/mkspecs/features/symbian/do_not_build_as_thumb.prf @@ -1,6 +1,6 @@ symbian-abld|symbian-sbsv2 { MMP_RULES += ALWAYS_BUILD_AS_ARM -} else:linux-armcc { +} else:symbian-armcc { QMAKE_CFLAGS -= --thumb QMAKE_CFLAGS += --arm QMAKE_CXXFLAGS -= --thumb diff --git a/mkspecs/features/symbian/symbian_building.prf b/mkspecs/features/symbian/symbian_building.prf index 0d2e053..248c83f 100644 --- a/mkspecs/features/symbian/symbian_building.prf +++ b/mkspecs/features/symbian/symbian_building.prf @@ -1,7 +1,7 @@ -linux-armcc { +symbian-armcc { QMAKE_CFLAGS += $$QMAKE_CFLAGS.ARMCC QMAKE_CXXFLAGS += $$QMAKE_CXXFLAGS.ARMCC -} else:linux-gcce { +} else:symbian-gcce { QMAKE_CFLAGS += $$QMAKE_CFLAGS.GCCE QMAKE_CXXFLAGS += $$QMAKE_CXXFLAGS.GCCE } @@ -16,7 +16,7 @@ else:clean_TARGET = $$TARGET !contains(clean_TARGET, ".*[ -/].*"):eval(TMPVAR = \$\$QMAKE_$${clean_TARGET}_LFLAGS) !isEmpty(TMPVAR) { QMAKE_LFLAGS += $$TMPVAR -} else :linux-gcce { # lets provide a simple default. Without elf2e32 complains +} else :symbian-gcce { # lets provide a simple default. Without elf2e32 complains QMAKE_LFLAGS += -Ttext 0x80000 -Tdata 0x400000 } @@ -62,7 +62,7 @@ for(libToProcess, libsToProcess) { } else { qt_newLib = $$processSymbianLibrary($$qt_library) contains(qt_newLib, ".*\\.dso$")|contains(qt_newLib, ".*\\.lib$"):PRE_TARGETDEPS += $$qt_newLib - linux-gcce:qt_newLib = "-l:$$qt_newLib" + symbian-gcce:qt_newLib = "-l:$$qt_newLib" eval($$libToProcess += \$\$qt_newLib) } } @@ -142,10 +142,10 @@ contains(TEMPLATE, lib):!contains(CONFIG, static):!contains(CONFIG, staticlib) { QMAKE_CLEAN += $${symbianObjdir}/$${baseTarget}.dso QMAKE_CLEAN += $${symbianObjdir}/$${baseTarget}.def - linux-armcc: { + symbian-armcc: { LIBS += usrt2_2.lib dfpaeabi.dso dfprvct2_2.dso drtaeabi.dso scppnwdl.dso drtrvct2_2.dso h_t__uf.l\\(switch8.o\\) LIBS += -ledllstub.lib -ledll.lib\\(uc_dll_.o\\) - } else :linux-gcce { + } else :symbian-gcce { LIBS += \ -l:edllstub.lib \ -l:edll.lib \ @@ -185,7 +185,7 @@ contains(TEMPLATE, app):!contains(QMAKE_LINK, "^@:.*") { QMAKE_DISTCLEAN += $${symbianDestdir}/$${baseTarget}.exe QMAKE_CLEAN += $${symbianDestdir}/$${baseTarget} - linux-armcc: { + symbian-armcc: { QMAKE_LIBS += usrt2_2.lib dfpaeabi.dso dfprvct2_2.dso drtaeabi.dso scppnwdl.dso drtrvct2_2.dso h_t__uf.l\\(switch8.o\\) QMAKE_LIBS += -leexe.lib\\(uc_exe_.o\\) contains(CONFIG, "qt") { @@ -195,7 +195,7 @@ contains(TEMPLATE, app):!contains(QMAKE_LINK, "^@:.*") { QMAKE_LIBS -= $$QMAKE_LIBS_NO_QT_ENTRY QMAKE_LIBS += $$QMAKE_LIBS_NO_QT_ENTRY } - } else :linux-gcce { + } else :symbian-gcce { # notice that we can't merge these as ordering of arguments is important. QMAKE_LIBS += \ -l:eexe.lib \ @@ -225,7 +225,7 @@ contains(TEMPLATE, app):!contains(QMAKE_LINK, "^@:.*") { } # Symbian resource files -linux-armcc: { +symbian-armcc: { SYMBIAN_RVCT22INC=$$(RVCT22INC) !isEmpty(SYMBIAN_RVCT22INC):symbian_resources_INCLUDES = -I$${SYMBIAN_RVCT22INC} } diff --git a/mkspecs/symbian-armcc/features/default_post.prf b/mkspecs/symbian-armcc/features/default_post.prf new file mode 100644 index 0000000..7aa1f4d --- /dev/null +++ b/mkspecs/symbian-armcc/features/default_post.prf @@ -0,0 +1,5 @@ +load(default_post.prf) + +# It is important that this config be executed last, +# and qmake does them in reverse order. +CONFIG = symbian_building $$CONFIG diff --git a/mkspecs/symbian-armcc/qmake.conf b/mkspecs/symbian-armcc/qmake.conf new file mode 100644 index 0000000..be6af39 --- /dev/null +++ b/mkspecs/symbian-armcc/qmake.conf @@ -0,0 +1,62 @@ +# +# qmake configuration for symbian-armcc +# + +include(../common/symbian/symbian-makefile.conf) + +include(../common/armcc.conf) + +QMAKE_RVCT_LINKSTYLE = 1 + +# notice that the middle part of the following set of vars matches the TARGET content of the libs + +#QMAKE_qtmain_CXXFLAGS = --arm +#QMAKE_QtCore_CXXFLAGS = +QMAKE_QtGui_LFLAGS = "--rw-base 0x800000" +#QMAKE_QtDBus_CXXFLAGS = +#QMAKE_QtDeclarative_CXXFLAGS = +#QMAKE_QtMultimedia_CXXFLAGS = +#QMAKE_QtNetwork_CXXFLAGS = +#QMAKE_QtOpenGL_CXXFLAGS = +#QMAKE_QtOpenVG_CXXFLAGS = +#QMAKE_phonon_CXXFLAGS = +#QMAKE_QtScript_CXXFLAGS = +#QMAKE_QtScriptTools_CXXFLAGS = +#QMAKE_QtSql_CXXFLAGS = +#QMAKE_QtSvg_CXXFLAGS = +#QMAKE_QtTest_CXXFLAGS = +#QMAKE_QtXmlPatterns_CXXFLAGS = +#QMAKE_QtXml_CXXFLAGS = +QMAKE_QtWebKit_CXXFLAGS = --arm +# Move RW-section base address to start from 0xE00000 instead of the toolchain default 0x400000. +QMAKE_QtWebKit_LFLAGS = --rw-base 0xE00000 + +QMAKE_CFLAGS += --dllimport_runtime --diag_suppress 186,611,654,1300 --thumb --fpu softvfp --cpu 5T --enum_is_int -Ono_known_library --fpmode ieee_no_fenv --no_vfe --apcs /inter +QMAKE_CXXFLAGS += $$QMAKE_CFLAGS +QMAKE_LFLAGS += --symver_soname --diag_suppress 6331,6780 --bpabi --reloc --datacompressor=off --split --dll --no_scanlib +QMAKE_LFLAGS_APP += --entry _E32Startup +QMAKE_LFLAGS_SHLIB += --entry _E32Dll +QMAKE_LFLAGS_PLUGIN += $$QMAKE_LFLAGS_SHLIB + +DEFINES += EKA2 \ + __ARMCC__ \ + __ARMcc_2__ \ + __ARMCC_2_2__ + +QMAKE_LIBDIR += $${EPOCROOT}epoc32/release/armv5/lib +QMAKE_LIBDIR *= $$(RVCT22LIB) + +INCLUDEPATH = $${EPOCROOT}epoc32/include \ + $${EPOCROOT}epoc32/include/variant \ + $${EPOCROOT}epoc32/include/stdapis \ + $$INCLUDEPATH + +exists($${EPOCROOT}epoc32/include/rvct2_2) { + INCLUDEPATH += $${EPOCROOT}epoc32/include/rvct2_2 + QMAKE_CFLAGS += --preinclude rvct2_2.h + QMAKE_CXXFLAGS += --preinclude rvct2_2.h +} else { + INCLUDEPATH += $${EPOCROOT}epoc32/include/rvct + QMAKE_CFLAGS += --preinclude rvct.h + QMAKE_CXXFLAGS += --preinclude rvct.h +} diff --git a/mkspecs/symbian-armcc/qplatformdefs.h b/mkspecs/symbian-armcc/qplatformdefs.h new file mode 100644 index 0000000..0eb74ca --- /dev/null +++ b/mkspecs/symbian-armcc/qplatformdefs.h @@ -0,0 +1,42 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the mkspecs of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "../common/symbian/qplatformdefs.h" diff --git a/mkspecs/symbian-gcce/features/default_post.prf b/mkspecs/symbian-gcce/features/default_post.prf new file mode 100644 index 0000000..7aa1f4d --- /dev/null +++ b/mkspecs/symbian-gcce/features/default_post.prf @@ -0,0 +1,5 @@ +load(default_post.prf) + +# It is important that this config be executed last, +# and qmake does them in reverse order. +CONFIG = symbian_building $$CONFIG diff --git a/mkspecs/symbian-gcce/qmake.conf b/mkspecs/symbian-gcce/qmake.conf new file mode 100644 index 0000000..8de9f26 --- /dev/null +++ b/mkspecs/symbian-gcce/qmake.conf @@ -0,0 +1,92 @@ +# +# qmake configuration for symbian-gcce +# + +include(../common/symbian/symbian-makefile.conf) + +include(../common/g++.conf) + +QMAKE_CC = arm-none-symbianelf-gcc +QMAKE_CXX = arm-none-symbianelf-g++ +QMAKE_LINK = arm-none-symbianelf-ld +QMAKE_LINK_SHLIB = arm-none-symbianelf-ld +QMAKE_LINK_C = arm-none-symbianelf-ld +QMAKE_LINK_C_SHLIB = arm-none-symbianelf-ld +QMAKE_AR = arm-none-symbianelf-ar cqs + +# gcce defaults to 'arm' instruction set. Lets use the better 'thumb' if possible +# notice that the middle part of the following set of vars matches the TARGET content of the libs + +QMAKE_qtmain_CXXFLAGS = -mthumb +QMAKE_QtCore_CXXFLAGS = -mthumb +QMAKE_QtGui_LFLAGS = -Ttext 0x8000 -Tdata 0xE00000 +QMAKE_QtDBus_CXXFLAGS = -mthumb +QMAKE_QtDeclarative_CXXFLAGS = -mthumb +QMAKE_QtMultimedia_CXXFLAGS = -mthumb +QMAKE_QtNetwork_CXXFLAGS = -mthumb +QMAKE_QtOpenGL_CXXFLAGS = -mthumb +QMAKE_QtOpenVG_CXXFLAGS = -mthumb +QMAKE_phonon_CXXFLAGS = -mthumb +QMAKE_QtScript_CXXFLAGS = -mthumb +QMAKE_QtScriptTools_CXXFLAGS = -mthumb +QMAKE_QtSql_CXXFLAGS = -mthumb +QMAKE_QtSvg_CXXFLAGS = -mthumb +QMAKE_QtTest_CXXFLAGS = -mthumb +QMAKE_QtXmlPatterns_CXXFLAGS = -mthumb +QMAKE_QtXml_CXXFLAGS = -mthumb +#TODO fails with; arm-none-symbianelf-ld: section .data loaded at [00e00000,00e05973] overlaps section .text loaded at [00008000,00fe748b] +QMAKE_QtWebKit_LFLAGS = -Ttext 0x8000 -Tdata 0xE00000 + +# never use -fPIC, gcce-linker doesn't like it. +# g++ conf above adds it if the host platform is 64 bit, so we remove it again +QMAKE_CFLAGS_SHLIB -= -fPIC +QMAKE_CFLAGS_STATIC_LIB -= -fPIC +QMAKE_CXXFLAGS_SHLIB -= -fPIC +QMAKE_CXXFLAGS_STATIC_LIB -= -fPIC + +QMAKE_LFLAGS_SONAME = +#QMAKE_LFLAGS_THREAD += +QMAKE_LFLAGS_NOUNDEF = +QMAKE_LFLAGS_RPATH = --rpath= + +DEFINES += __GCCE__ \ + UNICODE + +QMAKE_LFLAGS_APP += --entry=_E32Startup -u _E32Startup +QMAKE_LFLAGS_SHLIB += --default-symver --entry=_E32Dll -u _E32Dll +QMAKE_LFLAGS_PLUGIN += $$QMAKE_LFLAGS_SHLIB + +gcceExtraFlags = --include=${EPOCROOT}/epoc32/include/gcce/gcce.h -march=armv5t -mapcs -mthumb-interwork -nostdinc -c -msoft-float -T script +QMAKE_CFLAGS += $${gcceExtraFlags} +QMAKE_CXXFLAGS += $${gcceExtraFlags} -x c++ -fexceptions -fno-unit-at-a-time -fvisibility-inlines-hidden +#If we are not going to link to Qt or qtmain.lib, we need to include this at least once. +isEmpty(QT):contains(TEMPLATE, app) { + QMAKE_CXXFLAGS += --include=${EPOCROOT}/epoc32/include/stdapis/staticlibinit_gcce.h +} + +QMAKE_LFLAGS += --target1-abs \ + --no-undefined \ + --nostdlib + +QMAKE_LIBDIR += ${EPOCROOT}/epoc32/release/armv5/udeb/ + +# g++ knows the path to the gcc-shipped-libs, ld doesn't. So cache the full path in the generate Makefile +QMAKE_GCC_SEARCH_DIRS =$$system($$QMAKE_CXX -print-search-dirs) +for(line, QMAKE_GCC_SEARCH_DIRS) { + contains(line, "libraries:") { + foundIt="1" + } else { + contains(foundIt, "1") { + QMAKE_LFLAGS += $$replace(line, "[=:]", " -L") + } + } +} + +QMAKE_LIBDIR += $${EPOCROOT}/epoc32/release/armv5/lib + +INCLUDEPATH = ${EPOCROOT}/epoc32/include/ \ + $${EPOCROOT}/epoc32/include/variant \ + $${EPOCROOT}/epoc32/include/stdapis \ + $${EPOCROOT}/epoc32/include/gcce \ + $$INCLUDEPATH + diff --git a/mkspecs/symbian-gcce/qplatformdefs.h b/mkspecs/symbian-gcce/qplatformdefs.h new file mode 100644 index 0000000..9d95a37 --- /dev/null +++ b/mkspecs/symbian-gcce/qplatformdefs.h @@ -0,0 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the mkspecs of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "../common/symbian/qplatformdefs.h" + diff --git a/mkspecs/symbian/linux-armcc/features/default_post.prf b/mkspecs/symbian/linux-armcc/features/default_post.prf deleted file mode 100644 index 7aa1f4d..0000000 --- a/mkspecs/symbian/linux-armcc/features/default_post.prf +++ /dev/null @@ -1,5 +0,0 @@ -load(default_post.prf) - -# It is important that this config be executed last, -# and qmake does them in reverse order. -CONFIG = symbian_building $$CONFIG diff --git a/mkspecs/symbian/linux-armcc/qmake.conf b/mkspecs/symbian/linux-armcc/qmake.conf deleted file mode 100644 index f058421..0000000 --- a/mkspecs/symbian/linux-armcc/qmake.conf +++ /dev/null @@ -1,62 +0,0 @@ -# -# qmake configuration for symbian/linux-armcc -# - -include(../../common/symbian/symbian-makefile.conf) - -include(../../common/armcc.conf) - -QMAKE_RVCT_LINKSTYLE = 1 - -# notice that the middle part of the following set of vars matches the TARGET content of the libs - -#QMAKE_qtmain_CXXFLAGS = --arm -#QMAKE_QtCore_CXXFLAGS = -QMAKE_QtGui_LFLAGS = "--rw-base 0x800000" -#QMAKE_QtDBus_CXXFLAGS = -#QMAKE_QtDeclarative_CXXFLAGS = -#QMAKE_QtMultimedia_CXXFLAGS = -#QMAKE_QtNetwork_CXXFLAGS = -#QMAKE_QtOpenGL_CXXFLAGS = -#QMAKE_QtOpenVG_CXXFLAGS = -#QMAKE_phonon_CXXFLAGS = -#QMAKE_QtScript_CXXFLAGS = -#QMAKE_QtScriptTools_CXXFLAGS = -#QMAKE_QtSql_CXXFLAGS = -#QMAKE_QtSvg_CXXFLAGS = -#QMAKE_QtTest_CXXFLAGS = -#QMAKE_QtXmlPatterns_CXXFLAGS = -#QMAKE_QtXml_CXXFLAGS = -QMAKE_QtWebKit_CXXFLAGS = --arm -# Move RW-section base address to start from 0xE00000 instead of the toolchain default 0x400000. -QMAKE_QtWebKit_LFLAGS = --rw-base 0xE00000 - -QMAKE_CFLAGS += --dllimport_runtime --diag_suppress 186,611,654,1300 --thumb --fpu softvfp --cpu 5T --enum_is_int -Ono_known_library --fpmode ieee_no_fenv --no_vfe --apcs /inter -QMAKE_CXXFLAGS += $$QMAKE_CFLAGS -QMAKE_LFLAGS += --symver_soname --diag_suppress 6331,6780 --bpabi --reloc --datacompressor=off --split --dll --no_scanlib -QMAKE_LFLAGS_APP += --entry _E32Startup -QMAKE_LFLAGS_SHLIB += --entry _E32Dll -QMAKE_LFLAGS_PLUGIN += $$QMAKE_LFLAGS_SHLIB - -DEFINES += EKA2 \ - __ARMCC__ \ - __ARMcc_2__ \ - __ARMCC_2_2__ - -QMAKE_LIBDIR += $${EPOCROOT}epoc32/release/armv5/lib -QMAKE_LIBDIR *= $$(RVCT22LIB) - -INCLUDEPATH = $${EPOCROOT}epoc32/include \ - $${EPOCROOT}epoc32/include/variant \ - $${EPOCROOT}epoc32/include/stdapis \ - $$INCLUDEPATH - -exists($${EPOCROOT}epoc32/include/rvct2_2) { - INCLUDEPATH += $${EPOCROOT}epoc32/include/rvct2_2 - QMAKE_CFLAGS += --preinclude rvct2_2.h - QMAKE_CXXFLAGS += --preinclude rvct2_2.h -} else { - INCLUDEPATH += $${EPOCROOT}epoc32/include/rvct - QMAKE_CFLAGS += --preinclude rvct.h - QMAKE_CXXFLAGS += --preinclude rvct.h -} diff --git a/mkspecs/symbian/linux-armcc/qplatformdefs.h b/mkspecs/symbian/linux-armcc/qplatformdefs.h deleted file mode 100644 index 19c97ff..0000000 --- a/mkspecs/symbian/linux-armcc/qplatformdefs.h +++ /dev/null @@ -1,42 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the mkspecs of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "../../common/symbian/qplatformdefs.h" diff --git a/mkspecs/symbian/linux-gcce/features/default_post.prf b/mkspecs/symbian/linux-gcce/features/default_post.prf deleted file mode 100644 index 7aa1f4d..0000000 --- a/mkspecs/symbian/linux-gcce/features/default_post.prf +++ /dev/null @@ -1,5 +0,0 @@ -load(default_post.prf) - -# It is important that this config be executed last, -# and qmake does them in reverse order. -CONFIG = symbian_building $$CONFIG diff --git a/mkspecs/symbian/linux-gcce/qmake.conf b/mkspecs/symbian/linux-gcce/qmake.conf deleted file mode 100644 index 62cc9ae..0000000 --- a/mkspecs/symbian/linux-gcce/qmake.conf +++ /dev/null @@ -1,92 +0,0 @@ -# -# qmake configuration for symbian/linux-gcce -# - -include(../../common/symbian/symbian-makefile.conf) - -include(../../common/g++.conf) - -QMAKE_CC = arm-none-symbianelf-gcc -QMAKE_CXX = arm-none-symbianelf-g++ -QMAKE_LINK = arm-none-symbianelf-ld -QMAKE_LINK_SHLIB = arm-none-symbianelf-ld -QMAKE_LINK_C = arm-none-symbianelf-ld -QMAKE_LINK_C_SHLIB = arm-none-symbianelf-ld -QMAKE_AR = arm-none-symbianelf-ar cqs - -# gcce defaults to 'arm' instruction set. Lets use the better 'thumb' if possible -# notice that the middle part of the following set of vars matches the TARGET content of the libs - -QMAKE_qtmain_CXXFLAGS = -mthumb -QMAKE_QtCore_CXXFLAGS = -mthumb -QMAKE_QtGui_LFLAGS = -Ttext 0x8000 -Tdata 0xE00000 -QMAKE_QtDBus_CXXFLAGS = -mthumb -QMAKE_QtDeclarative_CXXFLAGS = -mthumb -QMAKE_QtMultimedia_CXXFLAGS = -mthumb -QMAKE_QtNetwork_CXXFLAGS = -mthumb -QMAKE_QtOpenGL_CXXFLAGS = -mthumb -QMAKE_QtOpenVG_CXXFLAGS = -mthumb -QMAKE_phonon_CXXFLAGS = -mthumb -QMAKE_QtScript_CXXFLAGS = -mthumb -QMAKE_QtScriptTools_CXXFLAGS = -mthumb -QMAKE_QtSql_CXXFLAGS = -mthumb -QMAKE_QtSvg_CXXFLAGS = -mthumb -QMAKE_QtTest_CXXFLAGS = -mthumb -QMAKE_QtXmlPatterns_CXXFLAGS = -mthumb -QMAKE_QtXml_CXXFLAGS = -mthumb -#TODO fails with; arm-none-symbianelf-ld: section .data loaded at [00e00000,00e05973] overlaps section .text loaded at [00008000,00fe748b] -QMAKE_QtWebKit_LFLAGS = -Ttext 0x8000 -Tdata 0xE00000 - -# never use -fPIC, gcce-linker doesn't like it. -# g++ conf above adds it if the host platform is 64 bit, so we remove it again -QMAKE_CFLAGS_SHLIB -= -fPIC -QMAKE_CFLAGS_STATIC_LIB -= -fPIC -QMAKE_CXXFLAGS_SHLIB -= -fPIC -QMAKE_CXXFLAGS_STATIC_LIB -= -fPIC - -QMAKE_LFLAGS_SONAME = -#QMAKE_LFLAGS_THREAD += -QMAKE_LFLAGS_NOUNDEF = -QMAKE_LFLAGS_RPATH = --rpath= - -DEFINES += __GCCE__ \ - UNICODE - -QMAKE_LFLAGS_APP += --entry=_E32Startup -u _E32Startup -QMAKE_LFLAGS_SHLIB += --default-symver --entry=_E32Dll -u _E32Dll -QMAKE_LFLAGS_PLUGIN += $$QMAKE_LFLAGS_SHLIB - -gcceExtraFlags = --include=${EPOCROOT}/epoc32/include/gcce/gcce.h -march=armv5t -mapcs -mthumb-interwork -nostdinc -c -msoft-float -T script -QMAKE_CFLAGS += $${gcceExtraFlags} -QMAKE_CXXFLAGS += $${gcceExtraFlags} -x c++ -fexceptions -fno-unit-at-a-time -fvisibility-inlines-hidden -#If we are not going to link to Qt or qtmain.lib, we need to include this at least once. -isEmpty(QT):contains(TEMPLATE, app) { - QMAKE_CXXFLAGS += --include=${EPOCROOT}/epoc32/include/stdapis/staticlibinit_gcce.h -} - -QMAKE_LFLAGS += --target1-abs \ - --no-undefined \ - --nostdlib - -QMAKE_LIBDIR += ${EPOCROOT}/epoc32/release/armv5/udeb/ - -# g++ knows the path to the gcc-shipped-libs, ld doesn't. So cache the full path in the generate Makefile -QMAKE_GCC_SEARCH_DIRS =$$system($$QMAKE_CXX -print-search-dirs) -for(line, QMAKE_GCC_SEARCH_DIRS) { - contains(line, "libraries:") { - foundIt="1" - } else { - contains(foundIt, "1") { - QMAKE_LFLAGS += $$replace(line, "[=:]", " -L") - } - } -} - -QMAKE_LIBDIR += $${EPOCROOT}/epoc32/release/armv5/lib - -INCLUDEPATH = ${EPOCROOT}/epoc32/include/ \ - $${EPOCROOT}/epoc32/include/variant \ - $${EPOCROOT}/epoc32/include/stdapis \ - $${EPOCROOT}/epoc32/include/gcce \ - $$INCLUDEPATH - diff --git a/mkspecs/symbian/linux-gcce/qplatformdefs.h b/mkspecs/symbian/linux-gcce/qplatformdefs.h deleted file mode 100644 index ae46e15..0000000 --- a/mkspecs/symbian/linux-gcce/qplatformdefs.h +++ /dev/null @@ -1,43 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the mkspecs of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "../../common/symbian/qplatformdefs.h" - diff --git a/src/corelib/global/global.pri b/src/corelib/global/global.pri index 86800ef..65de6e0 100644 --- a/src/corelib/global/global.pri +++ b/src/corelib/global/global.pri @@ -19,7 +19,7 @@ INCLUDEPATH += $$QT_BUILD_TREE/src/corelib/global # Only used on platforms with CONFIG += precompile_header PRECOMPILED_HEADER = global/qt_pch.h -linux*:!static:!linux-armcc:!linux-gcce { +linux*:!static:!symbian-armcc:!symbian-gcce { QMAKE_LFLAGS += -Wl,-e,qt_core_boilerplate prog=$$quote(if (/program interpreter: (.*)]/) { print $1; }) DEFINES += ELF_INTERPRETER=\\\"$$system(readelf -l /bin/ls | perl -n -e \'$$prog\')\\\" diff --git a/src/s60main/s60main.pro b/src/s60main/s60main.pro index 8ab3bd3..1e3e06a 100644 --- a/src/s60main/s60main.pro +++ b/src/s60main/s60main.pro @@ -30,7 +30,7 @@ symbian { # Having MMP_RULES_DONT_EXPORT_ALL_CLASS_IMPEDIMENTA will cause s60main.lib be unlinkable # against GCCE apps, so remove it MMP_RULES -= $$MMP_RULES_DONT_EXPORT_ALL_CLASS_IMPEDIMENTA - linux-armcc:QMAKE_CXXFLAGS *= --export_all_vtbl + symbian-armcc:QMAKE_CXXFLAGS *= --export_all_vtbl # Flag if exports are not frozen to avoid lookup of qtcore allocator creation function by ordinal contains(CONFIG, def_files_disabled): DEFINES += QT_EXPORTS_NOT_FROZEN -- cgit v0.12 From 342cd591f5a702b1bff2a72cf6894da191cd0f10 Mon Sep 17 00:00:00 2001 From: axis <qt-info@nokia.com> Date: Fri, 8 Oct 2010 15:38:10 +0200 Subject: Fixed various quotation problems when porting to Windows. These should work for both Windows and UNIX platforms. RevBy: Thomas Zander --- mkspecs/common/symbian/symbian-makefile.conf | 4 ++-- mkspecs/features/symbian/symbian_building.prf | 17 +++++++++++------ 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/mkspecs/common/symbian/symbian-makefile.conf b/mkspecs/common/symbian/symbian-makefile.conf index e51de1d..899f8c2 100644 --- a/mkspecs/common/symbian/symbian-makefile.conf +++ b/mkspecs/common/symbian/symbian-makefile.conf @@ -25,9 +25,9 @@ QMAKE_PREFIX_STATICLIB = QMAKE_SYMBIAN_SHLIB = 1 is_using_gnupoc { - DEFINES *= __PRODUCT_INCLUDE__=\\<$${EPOCROOT}epoc32/include/variant/symbian_os.hrh\\> + DEFINES *= __PRODUCT_INCLUDE__=\"<$${EPOCROOT}epoc32/include/variant/symbian_os.hrh>\" } else { - DEFINES *= __PRODUCT_INCLUDE__=\\<$${EPOCROOT}epoc32/include/variant/Symbian_OS.hrh\\> + DEFINES *= __PRODUCT_INCLUDE__=\"<$${EPOCROOT}epoc32/include/variant/Symbian_OS.hrh>\" } DEFINES *= \ __SYMBIAN32__ \ diff --git a/mkspecs/features/symbian/symbian_building.prf b/mkspecs/features/symbian/symbian_building.prf index 248c83f..f5df68b 100644 --- a/mkspecs/features/symbian/symbian_building.prf +++ b/mkspecs/features/symbian/symbian_building.prf @@ -129,7 +129,7 @@ contains(TEMPLATE, lib):!contains(CONFIG, static):!contains(CONFIG, staticlib) { --tmpdso=$${symbianObjdir}/$${baseTarget}.dso \ --dso=$${symbianDestdir}/$${baseTarget}.dso \ --defoutput=$$symbianObjdir/$${baseTarget}.def \ - --linkas=$${baseTarget}\\{$${hexVersion}\\}\\[$${intUid3}\\].dll \ + --linkas=\"$${baseTarget}{$${hexVersion}}[$${intUid3}].dll\" \ --heap=$$epoc_heap_size \ --stack=$$TARGET.EPOCSTACKSIZE \ $$elf2e32_LIBPATH \ @@ -143,8 +143,13 @@ contains(TEMPLATE, lib):!contains(CONFIG, static):!contains(CONFIG, staticlib) { QMAKE_CLEAN += $${symbianObjdir}/$${baseTarget}.def symbian-armcc: { - LIBS += usrt2_2.lib dfpaeabi.dso dfprvct2_2.dso drtaeabi.dso scppnwdl.dso drtrvct2_2.dso h_t__uf.l\\(switch8.o\\) - LIBS += -ledllstub.lib -ledll.lib\\(uc_dll_.o\\) + LIBS += usrt2_2.lib dfpaeabi.dso dfprvct2_2.dso drtaeabi.dso scppnwdl.dso drtrvct2_2.dso + # Quotation unfortunately is different on Windows and unix. + contains(QMAKE_HOST.os, Windows) { + LIBS += \"h_t__uf.l(switch8.o)\" edllstub.lib \"edll.lib(uc_dll_.o)\" + } else { + LIBS += h_t__uf.l\\(switch8.o\\) edllstub.lib edll.lib\\(uc_dll_.o\\) + } } else :symbian-gcce { LIBS += \ -l:edllstub.lib \ @@ -157,7 +162,7 @@ contains(TEMPLATE, lib):!contains(CONFIG, static):!contains(CONFIG, staticlib) { -lgcc } - QMAKE_LFLAGS += --soname $${baseTarget}\\{$${hexVersion}\\}\\[$${intUid3}\\].dll + QMAKE_LFLAGS += --soname \"$${baseTarget}{$${hexVersion}}[$${intUid3}].dll\" DEFINES += __DLL__ } @@ -172,7 +177,7 @@ contains(TEMPLATE, app):!contains(QMAKE_LINK, "^@:.*") { --targettype=EXE \ --elfinput=$${symbianDestdir}/$${baseTarget}.sym \ --output=$${symbianDestdir}/$${baseTarget}.exe \ - --linkas=$${baseTarget}\\{$${hexVersion}\\}\\[$${intUid3}\\].exe \ + --linkas=\"$${baseTarget}{$${hexVersion}}[$${intUid3}].exe\" \ --heap=$$epoc_heap_size \ --stack=$$TARGET.EPOCSTACKSIZE \ $$elf2e32_LIBPATH \ @@ -220,7 +225,7 @@ contains(TEMPLATE, app):!contains(QMAKE_LINK, "^@:.*") { QMAKE_LFLAGS += --shared } - QMAKE_LFLAGS += --soname $${baseTarget}\\{$${hexVersion}\\}\\[$${intUid3}\\].exe + QMAKE_LFLAGS += --soname \"$${baseTarget}{$${hexVersion}}[$${intUid3}].exe\" DEFINES += __EXE__ } -- cgit v0.12 From c2773ce6b4efb3f8f8d516c29750dd25c802f60b Mon Sep 17 00:00:00 2001 From: axis <qt-info@nokia.com> Date: Fri, 18 Feb 2011 15:20:00 +0100 Subject: Changed various qmake constructs to support Windows. RevBy: Thomas Zander Conflicts: mkspecs/features/symbian/symbian_building.prf --- mkspecs/features/symbian/def_files.prf | 18 ++++++++++++++++-- mkspecs/features/symbian/symbian_building.prf | 19 ++++++++++++------- .../sqldrivers/sqlite_symbian/sqlite_symbian.pri | 10 ++++++++-- 3 files changed, 36 insertions(+), 11 deletions(-) diff --git a/mkspecs/features/symbian/def_files.prf b/mkspecs/features/symbian/def_files.prf index 4a59116..746de6a 100644 --- a/mkspecs/features/symbian/def_files.prf +++ b/mkspecs/features/symbian/def_files.prf @@ -7,6 +7,18 @@ CONFIG -= def_files_disabled equals(QMAKE_TARGET_PRODUCT, Qt4)|equals(QMAKE_TARGET_PRODUCT, QTestLib):clean_TARGET = $$replace(TARGET, "$${QT_LIBINFIX}$", "") else:clean_TARGET = $$TARGET +defineTest(qtTestIfDirExists) { + contains(QMAKE_HOST.os,Windows) { + dirToTest = $$1 + $$dirToTest ~= s,/,\\, + # Windows trick. Test for existence of nul, which every directory has. + retValue = $$system("if exist $$dirToTest\\nul echo true") + contains(retValue, true):return(true)|return(false) + } else { + system("test -d $$1"):return(true)|return(false) + } +} + symbian-abld|symbian-sbsv2 { # Firstly, if the MMP_RULES already contain a defBlock variable, don't generate another one # (this bit is slightly magic, because it depends upon everyone creating their DEFFILE statements @@ -52,9 +64,11 @@ symbian-abld|symbian-sbsv2 { } else { defFile = . } - system("$$QMAKE_CHK_DIR_EXISTS $$_PRO_FILE_PWD_/$$defFile") { + qtTestIfDirExists($$_PRO_FILE_PWD_/$$defFile) { !exists("$$_PRO_FILE_PWD_/$$defFile/eabi") { - system("$$QMAKE_MKDIR $$_PRO_FILE_PWD_/$$defFile/eabi") + dirToCreate = $$_PRO_FILE_PWD_/$$defFile/eabi + contains(QMAKE_HOST.os,Windows):dirToCreate ~= s,/,\\, + system("$$QMAKE_MKDIR $$dirToCreate") } elf2e32FileToAdd = $$_PRO_FILE_PWD_/$$defFile/eabi/$$basename(clean_TARGET)u.def } else { diff --git a/mkspecs/features/symbian/symbian_building.prf b/mkspecs/features/symbian/symbian_building.prf index f5df68b..8a0cc9b 100644 --- a/mkspecs/features/symbian/symbian_building.prf +++ b/mkspecs/features/symbian/symbian_building.prf @@ -89,12 +89,13 @@ count(splitVersion, 0) { decVersion = "10.0" } else { count(splitVersion, 3) { - hexVersion = $$system("sh -c 'printf %02x $$member(splitVersion, 0)'") - hexPart2 = $$system("sh -c 'printf %02x $$member(splitVersion, 1)'") - hexPart2 = $$hexPart2$$system("sh -c 'printf %02x $$member(splitVersion, 2)'") - decVersion = $$system("sh -c 'printf %1d 0x$$hexVersion'"). + hexVersion = $$system("perl -e \"printf (\\\"%02x\\\", $$member(splitVersion, 0))\"") + hexPart2 = $$system("perl -e \"printf (\\\"%02x\\\", $$member(splitVersion, 1))\"") + hexPart2 = $$hexPart2$$system("perl -e \"printf (\\\"%02x\\\", $$member(splitVersion, 2))\"") + decVersion = $$system("perl -e \"printf (\\\"%1d\\\", 0x$$hexVersion)\""). hexVersion = $$hexVersion$$hexPart2 - decVersion = $$decVersion$$system("sh -c 'printf %d 0x$$hexPart2'") + decVersion = $$decVersion$$system("perl -e \"printf (\\\"%d\\\", 0x$$hexPart2)\"") + !contains(hexVersion, "[0-9a-f]{8}"):hexVersion = "00$${hexVersion}" } else { # app code may have different numbering... hexVersion = $$VERSION @@ -117,7 +118,9 @@ contains(TEMPLATE, lib):!contains(CONFIG, static):!contains(CONFIG, staticlib) { contains(CONFIG, plugin):QMAKE_ELF2E32_FLAGS += --definput=plugin_commonu.def !isEmpty(QMAKE_POST_LINK):QMAKE_POST_LINK = $$escape_expand(\\n\\t)$$QMAKE_POST_LINK - QMAKE_POST_LINK = $$QMAKE_MOVE $$symbianDestdir/$${baseTarget}.dll $$symbianDestdir/$${baseTarget}.sym \ + moveCmd = $$QMAKE_MOVE $$symbianDestdir/$${baseTarget}.dll $$symbianDestdir/$${baseTarget}.sym + contains(QMAKE_HOST.os,Windows):moveCmd = $$replace(moveCmd, /, \\) + QMAKE_POST_LINK = $$moveCmd \ && $$QMAKE_ELF2E32_WRAPPER --version=$$decVersion \ --sid=$$TARGET.SID \ --uid1=0x10000079 \ @@ -168,7 +171,9 @@ contains(TEMPLATE, lib):!contains(CONFIG, static):!contains(CONFIG, staticlib) { contains(TEMPLATE, app):!contains(QMAKE_LINK, "^@:.*") { !isEmpty(QMAKE_POST_LINK):QMAKE_POST_LINK = $$escape_expand(\\n\\t)$$QMAKE_POST_LINK - QMAKE_POST_LINK = $$QMAKE_MOVE $$symbianDestdir/$${baseTarget} $$symbianDestdir/$${baseTarget}.sym \ + moveCmd = $$QMAKE_MOVE $$symbianDestdir/$${baseTarget} $$symbianDestdir/$${baseTarget}.sym + contains(QMAKE_HOST.os,Windows):moveCmd = $$replace(moveCmd, /, \\) + QMAKE_POST_LINK = $$moveCmd \ && $$QMAKE_ELF2E32_WRAPPER --version $$decVersion \ --sid=$$TARGET.SID \ --uid1=0x1000007a \ diff --git a/src/plugins/sqldrivers/sqlite_symbian/sqlite_symbian.pri b/src/plugins/sqldrivers/sqlite_symbian/sqlite_symbian.pri index 494c64c..ebeccc9 100644 --- a/src/plugins/sqldrivers/sqlite_symbian/sqlite_symbian.pri +++ b/src/plugins/sqldrivers/sqlite_symbian/sqlite_symbian.pri @@ -1,6 +1,12 @@ # We just want to include the sqlite3 binaries for Symbian for platforms that do not have them. !symbian-abld:!symbian-sbsv2 { !symbian_no_export_sqlite:!exists($${EPOCROOT}epoc32/release/armv5/lib/sqlite3.dso) { + contains(QMAKE_HOST.os,Windows) { + # Trick on Windows to do a touch on the file, since copy keeps the timestamp. + copyWithTouch = copy /y /b NUL+ + } else { + copyWithTouch = "$$QMAKE_COPY " + } symbian_sqlite3_zip_file = $$PWD/SQLite3_v9.2.zip # The QMAKE_COPY section is to update timestamp on the file. @@ -10,7 +16,7 @@ symbian_sqlite3_header.CONFIG = combine no_link symbian_sqlite3_header.dependency_type = TYPE_C symbian_sqlite3_header.commands = $$QMAKE_UNZIP -j ${QMAKE_FILE_NAME} epoc32/include/stdapis/${QMAKE_FILE_OUT_BASE}.h \ - && $$QMAKE_COPY ${QMAKE_FILE_OUT_BASE}.h ${QMAKE_FILE_OUT}.tmp \ + && $${copyWithTouch}${QMAKE_FILE_OUT_BASE}.h ${QMAKE_FILE_OUT}.tmp \ && $$QMAKE_DEL_FILE ${QMAKE_FILE_OUT_BASE}.h \ && $$QMAKE_MOVE ${QMAKE_FILE_OUT}.tmp ${QMAKE_FILE_OUT} silent:symbian_sqlite3_header.commands = @echo unzipping $@ && $$symbian_sqlite3_header.commands @@ -22,7 +28,7 @@ !isEmpty(OBJECTS_DIR):symbian_sqlite3_dso.output = $$OBJECTS_DIR/$$symbian_sqlite3_dso.output symbian_sqlite3_dso.CONFIG = combine no_link target_predeps symbian_sqlite3_dso.commands = $$QMAKE_UNZIP -j ${QMAKE_FILE_NAME} epoc32/release/armv5/lib/${QMAKE_FILE_OUT_BASE}.dso \ - && $$QMAKE_COPY ${QMAKE_FILE_OUT_BASE}.dso ${QMAKE_FILE_OUT}.tmp \ + && $${copyWithTouch}${QMAKE_FILE_OUT_BASE}.dso ${QMAKE_FILE_OUT}.tmp \ && $$QMAKE_DEL_FILE ${QMAKE_FILE_OUT_BASE}.dso \ && $$QMAKE_MOVE ${QMAKE_FILE_OUT}.tmp ${QMAKE_FILE_OUT} silent:symbian_sqlite3_dso.commands = @echo unzipping $@ && $$symbian_sqlite3_dso.commands -- cgit v0.12 From bfc7893b55e83e174474809861fa53d77e5f3165 Mon Sep 17 00:00:00 2001 From: axis <qt-info@nokia.com> Date: Fri, 8 Oct 2010 15:57:30 +0200 Subject: Added wrapper for the elf2e32_qtwrapper script. This is needed to call the script on Windows. RevBy: Trust me --- bin/elf2e32_qtwrapper | 148 +--------------------------------------------- bin/elf2e32_qtwrapper.bat | 3 + bin/elf2e32_qtwrapper.pl | 145 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 151 insertions(+), 145 deletions(-) create mode 100644 bin/elf2e32_qtwrapper.bat create mode 100644 bin/elf2e32_qtwrapper.pl diff --git a/bin/elf2e32_qtwrapper b/bin/elf2e32_qtwrapper index 694d54a..a3a4065 100755 --- a/bin/elf2e32_qtwrapper +++ b/bin/elf2e32_qtwrapper @@ -1,145 +1,3 @@ -#!/usr/bin/perl -w - -# A script to get around some shortcomings in elf2e32, namely: -# - Returning 0 even when there are errors. -# - Excluding symbols from the dso file even when they are present in the ELF file. -# - Including symbols in the the dso file even when they are not present in the ELF file. -# - Overwriting the old dso file even when there are no changes (increases build time). - -use File::Copy; - -my @args = (); -my @definput; -my @defoutput; -my @dso; -my @tmpdso; -foreach (@ARGV) { - if (/^--definput/o) { - @definput = split('=', $_); - } elsif (/^--defoutput/o) { - @defoutput = split('=', $_); - } elsif (/^--dso/o) { - @dso = split('=', $_); - } elsif (/^--tmpdso/o) { - @tmpdso = split('=', $_); - $tmpdso[0] = "--dso"; - } else { - push(@args, $_); - } -} - -@definput = () if (!@definput || ! -e $definput[1]); - -if (@dso && !@tmpdso || !@dso && @tmpdso) { - print("--dso and --tmpdso must be used together.\n"); - exit 1; -} - -my $buildingLibrary = (@defoutput && @dso) ? 1 : 0; - -my $fixupFile = ""; -my $runCount = 0; -my $returnCode = 0; - -while (1) { - if (++$runCount > 2) { - print("Internal error in $0, link succeeded, but exports may be wrong.\n"); - last; - } - - my $elf2e32Pipe; - my $elf2e32Cmd = "elf2e32 @args" - . " " . join("=", @definput) - . " " . join("=", @defoutput) - . " " . join("=", @tmpdso); - open($elf2e32Pipe, "$elf2e32Cmd 2>&1 |") or die ("Could not run elf2e32"); - - my %fixupSymbols; - my $foundBrokenSymbols = 0; - my $errors = 0; - while (<$elf2e32Pipe>) { - print; - if (/Error:/io) { - $errors = 1; - } elsif (/symbol ([a-z0-9_]+) absent in the DEF file, but present in the ELF file/io) { - $fixupSymbols{$1} = 1; - $foundBrokenSymbols = 1; - } elsif (/[0-9]+ Frozen Export\(s\) missing from the ELF file/io) { - $foundBrokenSymbols = 1; - } - } - close($elf2e32Pipe); - - if ($errors) { - $returnCode = 1; - last; - } - - if ($buildingLibrary) { - my $tmpDefFile; - my $defFile; - open($defFile, "< $defoutput[1]") or die("Could not open $defoutput[1]"); - open($tmpDefFile, "> $defoutput[1].tmp") or die("Could not open $defoutput[1].tmp"); - $fixupFile = "$defoutput[1].tmp"; - while (<$defFile>) { - s/\r//; - s/\n//; - next if (/; NEW:/); - if (/([a-z0-9_]+) @/i) { - if (exists($fixupSymbols{$1})) { - s/ ABSENT//; - } elsif (s/; MISSING://) { - s/$/ ABSENT/; - } - } - print($tmpDefFile "$_\n"); - } - close($defFile); - close($tmpDefFile); - - $definput[1] = "$defoutput[1].tmp"; - - if (!$foundBrokenSymbols || $errors) { - last; - } - - print("Rerunning elf2e32 due to DEF file / ELF file mismatch\n"); - } else { - last; - } -}; - -if ($fixupFile) { - unlink($defoutput[1]); - move($fixupFile, $defoutput[1]); -} - -exit $returnCode if ($returnCode != 0); - -if ($buildingLibrary) { - my $differenceFound = 0; - - if (-e $dso[1]) { - my $dsoFile; - my $tmpdsoFile; - my $dsoBuf; - my $tmpdsoBuf; - open($dsoFile, "< $dso[1]") or die("Could not open $dso[1]"); - open($tmpdsoFile, "< $tmpdso[1]") or die("Could not open $tmpdso[1]"); - binmode($dsoFile); - binmode($tmpdsoFile); - while(read($dsoFile, $dsoBuf, 4096) && read($tmpdsoFile, $tmpdsoBuf, 4096)) { - if ($dsoBuf ne $tmpdsoBuf) { - $differenceFound = 1; - } - } - close($tmpdsoFile); - close($dsoFile); - } else { - $differenceFound = 1; - } - - if ($differenceFound) { - copy($tmpdso[1], $dso[1]); - } -} +#!/bin/sh +scriptpath=`dirname $0` +perl $scriptpath/elf2e32_qtwrapper.pl "$@" diff --git a/bin/elf2e32_qtwrapper.bat b/bin/elf2e32_qtwrapper.bat new file mode 100644 index 0000000..52910df --- /dev/null +++ b/bin/elf2e32_qtwrapper.bat @@ -0,0 +1,3 @@ +@echo off +set scriptpath=%~dp0 +perl %scriptpath%elf2e32_qtwrapper.pl %* diff --git a/bin/elf2e32_qtwrapper.pl b/bin/elf2e32_qtwrapper.pl new file mode 100644 index 0000000..694d54a --- /dev/null +++ b/bin/elf2e32_qtwrapper.pl @@ -0,0 +1,145 @@ +#!/usr/bin/perl -w + +# A script to get around some shortcomings in elf2e32, namely: +# - Returning 0 even when there are errors. +# - Excluding symbols from the dso file even when they are present in the ELF file. +# - Including symbols in the the dso file even when they are not present in the ELF file. +# - Overwriting the old dso file even when there are no changes (increases build time). + +use File::Copy; + +my @args = (); +my @definput; +my @defoutput; +my @dso; +my @tmpdso; +foreach (@ARGV) { + if (/^--definput/o) { + @definput = split('=', $_); + } elsif (/^--defoutput/o) { + @defoutput = split('=', $_); + } elsif (/^--dso/o) { + @dso = split('=', $_); + } elsif (/^--tmpdso/o) { + @tmpdso = split('=', $_); + $tmpdso[0] = "--dso"; + } else { + push(@args, $_); + } +} + +@definput = () if (!@definput || ! -e $definput[1]); + +if (@dso && !@tmpdso || !@dso && @tmpdso) { + print("--dso and --tmpdso must be used together.\n"); + exit 1; +} + +my $buildingLibrary = (@defoutput && @dso) ? 1 : 0; + +my $fixupFile = ""; +my $runCount = 0; +my $returnCode = 0; + +while (1) { + if (++$runCount > 2) { + print("Internal error in $0, link succeeded, but exports may be wrong.\n"); + last; + } + + my $elf2e32Pipe; + my $elf2e32Cmd = "elf2e32 @args" + . " " . join("=", @definput) + . " " . join("=", @defoutput) + . " " . join("=", @tmpdso); + open($elf2e32Pipe, "$elf2e32Cmd 2>&1 |") or die ("Could not run elf2e32"); + + my %fixupSymbols; + my $foundBrokenSymbols = 0; + my $errors = 0; + while (<$elf2e32Pipe>) { + print; + if (/Error:/io) { + $errors = 1; + } elsif (/symbol ([a-z0-9_]+) absent in the DEF file, but present in the ELF file/io) { + $fixupSymbols{$1} = 1; + $foundBrokenSymbols = 1; + } elsif (/[0-9]+ Frozen Export\(s\) missing from the ELF file/io) { + $foundBrokenSymbols = 1; + } + } + close($elf2e32Pipe); + + if ($errors) { + $returnCode = 1; + last; + } + + if ($buildingLibrary) { + my $tmpDefFile; + my $defFile; + open($defFile, "< $defoutput[1]") or die("Could not open $defoutput[1]"); + open($tmpDefFile, "> $defoutput[1].tmp") or die("Could not open $defoutput[1].tmp"); + $fixupFile = "$defoutput[1].tmp"; + while (<$defFile>) { + s/\r//; + s/\n//; + next if (/; NEW:/); + if (/([a-z0-9_]+) @/i) { + if (exists($fixupSymbols{$1})) { + s/ ABSENT//; + } elsif (s/; MISSING://) { + s/$/ ABSENT/; + } + } + print($tmpDefFile "$_\n"); + } + close($defFile); + close($tmpDefFile); + + $definput[1] = "$defoutput[1].tmp"; + + if (!$foundBrokenSymbols || $errors) { + last; + } + + print("Rerunning elf2e32 due to DEF file / ELF file mismatch\n"); + } else { + last; + } +}; + +if ($fixupFile) { + unlink($defoutput[1]); + move($fixupFile, $defoutput[1]); +} + +exit $returnCode if ($returnCode != 0); + +if ($buildingLibrary) { + my $differenceFound = 0; + + if (-e $dso[1]) { + my $dsoFile; + my $tmpdsoFile; + my $dsoBuf; + my $tmpdsoBuf; + open($dsoFile, "< $dso[1]") or die("Could not open $dso[1]"); + open($tmpdsoFile, "< $tmpdso[1]") or die("Could not open $tmpdso[1]"); + binmode($dsoFile); + binmode($tmpdsoFile); + while(read($dsoFile, $dsoBuf, 4096) && read($tmpdsoFile, $tmpdsoBuf, 4096)) { + if ($dsoBuf ne $tmpdsoBuf) { + $differenceFound = 1; + } + } + close($tmpdsoFile); + close($dsoFile); + } else { + $differenceFound = 1; + } + + if ($differenceFound) { + copy($tmpdso[1], $dso[1]); + } +} -- cgit v0.12 From 4ae3fa3f2a912343b50472c6085ba46b8c6d1e7b Mon Sep 17 00:00:00 2001 From: axis <qt-info@nokia.com> Date: Fri, 8 Oct 2010 16:08:09 +0200 Subject: Got rid of some "duplicate library" warnings. RevBy: Trust me --- mkspecs/features/symbian/symbian_building.prf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkspecs/features/symbian/symbian_building.prf b/mkspecs/features/symbian/symbian_building.prf index 8a0cc9b..7f8570e 100644 --- a/mkspecs/features/symbian/symbian_building.prf +++ b/mkspecs/features/symbian/symbian_building.prf @@ -63,7 +63,7 @@ for(libToProcess, libsToProcess) { qt_newLib = $$processSymbianLibrary($$qt_library) contains(qt_newLib, ".*\\.dso$")|contains(qt_newLib, ".*\\.lib$"):PRE_TARGETDEPS += $$qt_newLib symbian-gcce:qt_newLib = "-l:$$qt_newLib" - eval($$libToProcess += \$\$qt_newLib) + eval($$libToProcess *= \$\$qt_newLib) } } } -- cgit v0.12 From 553a35e8ec823da981faf5119a4305268839ecb2 Mon Sep 17 00:00:00 2001 From: axis <qt-info@nokia.com> Date: Mon, 21 Feb 2011 16:14:10 +0100 Subject: Support to build Qt for Symbian on Mac OS X with gcce compiler. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit RevBy: axis RevBy: Morten Johan Sørvig Conflicts: configure --- configure | 155 +++++++++++++++++++++---------------------- src/corelib/global/qglobal.h | 2 +- 2 files changed, 77 insertions(+), 80 deletions(-) diff --git a/configure b/configure index 6341dfb..fb1ee4c 100755 --- a/configure +++ b/configure @@ -763,6 +763,8 @@ l_FLAGS= QCONFIG_FLAGS= XPLATFORM= # This seems to be the QMAKESPEC, like "linux-g++" or "symbian-gcce" XPLATFORM_MINGW=no # Whether target platform is MinGW (win32-g++*) +XPLATFORM_SYMBIAN=no # Whether target platform is SYMBIAN (*symbian*) +XPLATFORM_SYMBIAN_SBSV2=no # Whether target platform is SYMBIAN_SBSV2 (symbian-sbsv2) PLATFORM=$QMAKESPEC QT_CROSS_COMPILE=no OPT_CONFIRM_LICENSE=no @@ -1458,6 +1460,8 @@ while [ "$#" -gt 0 ]; do xplatform) XPLATFORM="$VAL" case `basename "$XPLATFORM"` in win32-g++*) XPLATFORM_MINGW=yes;; esac + case "$XPLATFORM" in *symbian*) XPLATFORM_SYMBIAN=yes;; esac + case "$XPLATFORM" in symbian-sbsv2) XPLATFORM_SYMBIAN_SBSV2=yes;; esac ;; debug-and-release) if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then @@ -2735,6 +2739,8 @@ fi [ -z "$XPLATFORM" ] && XPLATFORM="$PLATFORM" case `basename "$XPLATFORM"` in win32-g++*) XPLATFORM_MINGW=yes;; esac +case "$XPLATFORM" in *symbian*) XPLATFORM_SYMBIAN=yes;; esac +case "$XPLATFORM" in symbian-sbsv2) XPLATFORM_SYMBIAN_SBSV2=yes;; esac if [ -d "$PLATFORM" ]; then QMAKESPEC="$PLATFORM" @@ -3010,7 +3016,7 @@ if [ "$PLATFORM" != "$XPLATFORM" -a "$CFG_EMBEDDED" != "no" ]; then esac elif [ "$XPLATFORM_MINGW" = "yes" ]; then [ -z "$CFG_ARCH" ] && CFG_ARCH="windows" -elif echo "$XPLATFORM" | grep symbian > /dev/null; then +elif [ "$XPLATFORM_SYMBIAN" = "yes" ]; then CFG_ARCH=symbian elif [ "$PLATFORM_MAC" = "yes" ] || [ -z "$CFG_ARCH" ]; then CFG_ARCH=$CFG_HOST_ARCH @@ -3138,7 +3144,7 @@ QMAKE_CONF_COMPILER=`getQMakeConf "$XQMAKESPEC" | grep "^QMAKE_CXX[^_A-Z0-9]" | TEST_COMPILER="$CXX" [ -z "$TEST_COMPILER" ] && TEST_COMPILER=$QMAKE_CONF_COMPILER -if [ "$XPLATFORM" != "symbian-sbsv2" ]; then +if [ "$XPLATFORM_SYMBIAN_SBSV2" = "no" ]; then #for Symbian we don't need this checking if [ -z "$TEST_COMPILER" ]; then echo "ERROR: Cannot set the compiler for the configuration tests" @@ -3305,16 +3311,18 @@ if [ -z "$QT_INSTALL_PREFIX" ]; then if [ "$PLATFORM" != "$XPLATFORM" ]; then QT_INSTALL_PREFIX="${QT_INSTALL_PREFIX}-${CFG_ARCH}" fi - elif [ -d "$EPOCROOT" ] && echo $XPLATFORM | grep symbian > /dev/null; then - QT_INSTALL_PREFIX="$EPOCROOT/epoc32/" - QT_INSTALL_LIBS="$EPOCROOT/epoc32/release/armv5/lib/" + elif [ -d "$EPOCROOT" ]; then + if [ "$XPLATFORM_SYMBIAN" = "yes" ]; then + QT_INSTALL_PREFIX="$EPOCROOT/epoc32/" + QT_INSTALL_LIBS="$EPOCROOT/epoc32/release/armv5/lib/" + fi else QT_INSTALL_PREFIX="/usr/local/Trolltech/Qt-${QT_VERSION}" # the default install prefix is /usr/local/Trolltech/Qt-$QT_VERSION fi fi QT_INSTALL_PREFIX=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_PREFIX"` -if echo $XPLATFORM | grep symbian > /dev/null; then +if [ "$XPLATFORM_SYMBIAN" = "yes" ]; then [ -z "$QT_HOST_PREFIX" ] && QT_HOST_PREFIX="$QT_INSTALL_PREFIX" [ -z "$QT_INSTALL_DOCS" ] && QT_INSTALL_DOCS= [ -z "$QT_INSTALL_HEADERS" ] && QT_INSTALL_HEADERS= @@ -4172,7 +4180,7 @@ if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_X11" = "yes" ]; then EOF fi -case "$XPLATFORM" in *symbian*) +if [ "$XPLATFORM_SYMBIAN" = "yes" ]; then cat << EOF Qt for Symbian only: @@ -4184,9 +4192,7 @@ Qt for Symbian only: -no-usedeffiles .... Disable the usage of DEF files. * -usedeffiles ....... Enable the usage of DEF files. EOF -;; -esac - +fi [ "x$ERROR" = "xyes" ] && exit 1 exit 0 fi # Help @@ -4198,10 +4204,10 @@ fi # Help if [ "$PLATFORM_QWS" = "yes" ]; then Platform="Qt for Embedded Linux" +elif [ "$XPLATFORM_SYMBIAN" = "yes" ]; then + Platform="Qt for Symbian" elif [ "$PLATFORM_MAC" = "yes" ]; then Platform="Qt for Mac OS X" -elif echo "$XPLATFORM" | grep "symbian" > /dev/null ; then - Platform="Qt for Symbian" elif [ "$XPLATFORM_MINGW" = "yes" ]; then Platform="Qt for Windows" elif [ '!' -z "`getQMakeConf \"$XQMAKESPEC\" | grep QMAKE_LIBS_X11 | awk '{print $3;}'`" ]; then @@ -4586,7 +4592,7 @@ if true; then ###[ '!' -f "$outpath/bin/qmake" ]; #mkspecs/default is used as a (gasp!) default mkspec so QMAKESPEC needn't be set once configured rm -rf mkspecs/default - if echo "$XPLATFORM" | grep "symbian-sbsv2" > /dev/null ; then + if [ "$XPLATFORM_SYMBIAN_SBSV2" = "yes" ]; then #Link is not supported for Symbian build system cp -a mkspecs/`echo $XQMAKESPEC | sed "s,^${relpath}/mkspecs/,,"` mkspecs/default else @@ -4838,33 +4844,12 @@ if ( [ "$CFG_ARCH" = "arm" ] || [ "$CFG_ARCH" = "armv6" ] ) && [ "${CFG_NEON}" = fi fi -# detect zlib -if [ "$CFG_ZLIB" = "no" ]; then - # Note: Qt no longer support builds without zlib - # So we force a "no" to be "auto" here. - # If you REALLY really need no zlib support, you can still disable - # it by doing the following: - # add "no-zlib" to mkspecs/qconfig.pri - # #define QT_NO_COMPRESS (probably by adding to src/corelib/global/qconfig.h) - # - # There's no guarantee that Qt will build under those conditions - - CFG_ZLIB=auto - ZLIB_FORCED=yes -fi -if [ "$CFG_ZLIB" = "auto" ]; then - if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/zlib "zlib" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then - CFG_ZLIB=system - else - CFG_ZLIB=yes - fi -fi - [ "$XPLATFORM_MINGW" = "yes" ] && QMakeVar add styles "windowsxp windowsvista" -case "$XPLATFORM" in *symbian*) +if [ "$XPLATFORM_SYMBIAN" = "yes" ]; then QMakeVar set styles "windows s60" #overwrite previous default CFG_LIBFREETYPE=no + CFG_ZLIB=yes if [ "$CFG_LARGEFILE" = auto ]; then CFG_LARGEFILE=no @@ -4882,7 +4867,7 @@ case "$XPLATFORM" in *symbian*) exit 1 fi - if ! echo $XPLATFORM | grep symbian-sbsv2 > /dev/null; then + if [ "$XPLATFORM_SYMBIAN_SBSV2" = "no" ]; then # Raptor does not support configure tests. # the main commands needed to compile; @@ -4906,8 +4891,29 @@ case "$XPLATFORM" in *symbian*) exit 1; fi fi - ;; -esac +fi + +# detect zlib +if [ "$CFG_ZLIB" = "no" ]; then + # Note: Qt no longer support builds without zlib + # So we force a "no" to be "auto" here. + # If you REALLY really need no zlib support, you can still disable + # it by doing the following: + # add "no-zlib" to mkspecs/qconfig.pri + # #define QT_NO_COMPRESS (probably by adding to src/corelib/global/qconfig.h) + # + # There's no guarantee that Qt will build under those conditions + + CFG_ZLIB=auto + ZLIB_FORCED=yes +fi +if [ "$CFG_ZLIB" = "auto" ]; then + if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/zlib "zlib" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then + CFG_ZLIB=system + else + CFG_ZLIB=yes + fi +fi if [ "$CFG_LARGEFILE" = "auto" ]; then #Large files should be enabled for all Linux systems @@ -4916,7 +4922,7 @@ fi if [ "$CFG_S60" = "auto" ]; then - if echo "$XPLATFORM" | grep symbian > /dev/null; then + if [ "$XPLATFORM_SYMBIAN" = "yes" ]; then CFG_S60=yes else CFG_S60=no @@ -4924,7 +4930,7 @@ if [ "$CFG_S60" = "auto" ]; then fi if [ "$CFG_QS60STYLE" = "auto" ]; then - if echo "$XPLATFORM" | grep symbian > /dev/null; then + if [ "$XPLATFORM_SYMBIAN" = "yes" ]; then CFG_QS60STYLE=qt else CFG_QS60STYLE=no @@ -4932,7 +4938,7 @@ if [ "$CFG_QS60STYLE" = "auto" ]; then fi if [ "$CFG_SYMBIAN_DEFFILES" = "auto" ]; then - if echo "$XPLATFORM" | grep symbian > /dev/null && [ "$CFG_DEV" = "no" ]; then + if [ "$XPLATFORM_SYMBIAN" = "yes" ] && [ "$CFG_DEV" = "no" ]; then CFG_SYMBIAN_DEFFILES=yes else CFG_SYMBIAN_DEFFILES=no @@ -5011,14 +5017,12 @@ fi # detect accessibility if [ "$CFG_ACCESSIBILITY" = "auto" ]; then - case "$XPLATFORM" in - symbian*) + if [ "$XPLATFORM_SYMBIAN" = "yes" ]; then # accessibility is currently unsupported CFG_ACCESSIBILITY=no - ;; - *) + else CFG_ACCESSIBILITY=yes - esac + fi fi # auto-detect SQL-modules support @@ -5230,15 +5234,13 @@ for _SQLDR in $CFG_SQL_AVAILABLE; do ;; sqlite) if [ "$CFG_SQL_sqlite" = "auto" ]; then # the default - case "$XPLATFORM" in - symbian*) + if [ "$XPLATFORM_SYMBIAN" = "yes" ]; then # sqlite on symbian is typically not build in Qt but deployed as a pre-existing sis file and should be marked as driver. # Configuration parameters should be set CFG_SQL_sqlite=qt QT_LFLAGS_SQLITE=-lsqlite3 QMAKE_CONFIG="$QMAKE_CONFIG system-sqlite" - ;; - esac + fi fi if [ "$CFG_SQL_sqlite" != "no" ]; then SQLITE_AUTODETECT_FAILED="no" @@ -6103,10 +6105,10 @@ fi if [ "$CFG_ENDIAN" = "auto" ]; then if [ "$XPLATFORM_MINGW" = "yes" ]; then CFG_ENDIAN="Q_LITTLE_ENDIAN" - elif [ "$PLATFORM_MAC" = "yes" ]; then - true #leave as auto - elif [ "$XPLATFORM" = "symbian-sbsv2" ]; then + elif [ "$XPLATFORM_SYMBIAN_SBSV2" = "yes" ]; then CFG_ENDIAN="Q_LITTLE_ENDIAN" + elif [ "$PLATFORM_MAC" = "yes" ] && [ "$XPLATFORM_SYMBIAN" = "no" ]; then + true #leave as auto else "$unixtests/endian.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath" F="$?" @@ -6192,7 +6194,7 @@ if [ "$CFG_DOUBLEFORMAT" = "auto" ]; then fi HAVE_STL=no -if echo "$XPLATFORM" | grep symbian > /dev/null || "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/stl "STL" $L_FLAGS $I_FLAGS $l_FLAGS; then +if [ "$XPLATFORM_SYMBIAN" = "yes" ] || "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/stl "STL" $L_FLAGS $I_FLAGS $l_FLAGS; then HAVE_STL=yes fi @@ -6219,7 +6221,7 @@ if [ "$CFG_IPV6" != "no" ]; then # Therefore for 4.7.1 and following we disable it until OpenC either supports it or we have the native Qt # symbian socket engine. # - if echo "$XPLATFORM" | grep symbian > /dev/null; then + if [ "$XPLATFORM_SYMBIAN" = "yes" ]; then CFG_IPV6=no elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/ipv6 "IPv6" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then CFG_IPV6=yes @@ -6334,7 +6336,7 @@ if [ "$CFG_GETIFADDRS" != "no" ]; then fi # detect OpenSSL -if [ "$CFG_OPENSSL" != "no" ] && [ "$XPLATFORM" != "symbian-sbsv2" ]; then +if [ "$CFG_OPENSSL" != "no" ] && [ "$XPLATFORM_SYMBIAN_SBSV2" = "no" ]; then if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/openssl "OpenSSL" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then if [ "$CFG_OPENSSL" = "auto" ]; then CFG_OPENSSL=yes @@ -6351,14 +6353,14 @@ if [ "$CFG_OPENSSL" != "no" ] && [ "$XPLATFORM" != "symbian-sbsv2" ]; then fi fi else - if [ "$CFG_OPENSSL" = "auto" ] && [ "$XPLATFORM" = "symbian-sbsv2" ]; then + if [ "$CFG_OPENSSL" = "auto" ] && [ "$XPLATFORM_SYMBIAN_SBSV2" = "yes" ]; then #OpenSSl should be enabled for Symbian release CFG_OPENSSL=yes fi fi # detect OpenVG support -if [ "$CFG_OPENVG" != "no" ] && [ "$XPLATFORM" != "symbian-sbsv2" ]; then +if [ "$CFG_OPENVG" != "no" ] && [ "$XPLATFORM_SYMBIAN_SBSV2" = "no" ]; then if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" "config.tests/unix/openvg" "OpenVG" $L_FLAGS $I_FLAGS $l_FLAGS $CONFIG_ARG; then if [ "$CFG_OPENVG" = "auto" ]; then CFG_OPENVG=yes @@ -6415,13 +6417,13 @@ if [ "$CFG_PTMALLOC" != "no" ]; then QMakeVar add QMAKE_LFLAGS "$outpath/lib/libptmalloc3.a" fi -if [ "$CFG_ALSA" = "auto" ] && [ "$XPLATFORM" != "symbian-sbsv2" ]; then +if [ "$CFG_ALSA" = "auto" ] && [ "$XPLATFORM_SYMBIAN_SBSV2" = "no" ]; then if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/alsa "alsa" $L_FLAGS $I_FLAGS $l_FLAGS; then CFG_ALSA=yes else CFG_ALSA=no fi -elif [ "$XPLATFORM" = "symbian-sbsv2" ]; then +elif [ "$XPLATFORM_SYMBIAN_SBSV2" = "yes" ]; then # Disabled for Symbian release CFG_ALSA=no fi @@ -6442,7 +6444,7 @@ elif [ "$CFG_JAVASCRIPTCORE_JIT" = "no" ]; then fi if [ "$CFG_AUDIO_BACKEND" = "auto" ]; then - if echo "$XPLATFORM" | grep symbian > /dev/null 2>&1; then + if [ "$XPLATFORM_SYMBIAN" = "yes" ]; then if "$symbiantests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/symbian/audio "audio" $L_FLAGS $I_FLAGS $l_FLAGS ; then CFG_AUDIO_BACKEND=yes fi @@ -6454,7 +6456,7 @@ fi if [ "$CFG_LARGEFILE" != "yes" ] && [ "$XPLATFORM_MINGW" = "yes" ]; then echo "Warning: largefile support cannot be disabled for win32." CFG_LARGEFILE="yes" -elif [ "$CFG_LARGEFILE" != "no" ] && echo "$XPLATFORM" | grep "symbian" > /dev/null; then +elif [ "$CFG_LARGEFILE" != "no" ] && [ "$XPLATFORM_SYMBIAN" = "yes" ]; then echo "Warning: largefile support cannot be enabled for symbian." CFG_LARGEFILE="no" fi @@ -6561,8 +6563,9 @@ if [ "$PLATFORM_MAC" = "yes" ]; then fi fi -# but disable Cocoa if cross-building for mingw +# but disable Cocoa if cross-building for mingw and symbian [ "$XPLATFORM_MINGW" = "yes" ] && CFG_MAC_COCOA="no" +[ "$XPLATFORM_SYMBIAN" = "yes" ] && CFG_MAC_COCOA="no" # set the global Mac deployment target. This is overridden on an arch-by-arch basis # in some cases, see code further down @@ -6640,13 +6643,11 @@ else fi # Just check if OpenGL is not set by command argumets for Symbian. -case "$XPLATFORM" in - symbian*) +if [ "$XPLATFORM_SYMBIAN" = "yes" ]; then if [ "$CFG_OPENGL" = "auto" ]; then CFG_OPENGL="no" fi - ;; -esac +fi # enable opengl if [ "$CFG_OPENGL" = "no" ]; then @@ -6830,7 +6831,7 @@ else fi -if [ "x$PLATFORM_MAC" = "xyes" ] && [ "$XPLATFORM_MINGW" != "yes" ]; then +if [ "x$PLATFORM_MAC" = "xyes" ] && [ "$XPLATFORM_MINGW" != "yes" ] && [ "$XPLATFORM_SYMBIAN" != "yes" ]; then #On Mac we implicitly link against libz, so we #never use the 3rdparty stuff. [ "$CFG_ZLIB" = "yes" ] && CFG_ZLIB="system" @@ -7469,14 +7470,11 @@ rm -f .options BUILD_OPTIONS="$BUILD_CONFIG $BUILD_OPTIONS" # extract the operating system from the XPLATFORM TARGET_OPERATING_SYSTEM=`echo $XPLATFORM | cut -f 2- -d/ | cut -f -1 -d-` -case "$XPLATFORM" in -symbian*) +if [ "$XPLATFORM_SYMBIAN" = "yes" ]; then QT_BUILD_KEY_SYSTEM_PART="Symbian" - ;; -*) +else QT_BUILD_KEY_SYSTEM_PART="$CFG_ARCH $TARGET_OPERATING_SYSTEM $COMPILER" - ;; -esac +fi # when cross-compiling, don't include build-host information (build key is target specific) QT_BUILD_KEY="$CFG_USER_BUILD_KEY $QT_BUILD_KEY_SYSTEM_PART $BUILD_OPTIONS" @@ -7808,8 +7806,7 @@ fi [ '!' -z "$AWK" ] && QCONFIG_FLAGS=`echo $QCONFIG_FLAGS | $AWK '{ gsub(" ", "\n"); print }' | sort | uniq` QCONFIG_FLAGS=`echo $QCONFIG_FLAGS` -if echo $XPLATFORM | grep symbian >/dev/null -then +if [ "$XPLATFORM_SYMBIAN" = "yes" ]; then # Enable Symbian DLLs and export rules. # We cannot use Linux's default export rules since they export everything. QCONFIG_FLAGS="$QCONFIG_FLAGS QT_DLL" @@ -7889,7 +7886,7 @@ else mv "$outpath/src/corelib/global/qconfig.h.new" "$outpath/src/corelib/global/qconfig.h" chmod -w "$outpath/src/corelib/global/qconfig.h" for conf in "$outpath/include/QtCore/qconfig.h" "$outpath/include/Qt/qconfig.h"; do - if echo "$XPLATFORM" | grep "symbian-sbsv2" > /dev/null 2>&1 ; then + if [ "$XPLATFORM_SYMBIAN_SBSV2" = "yes" ]; then [ -e "$conf" ] && rm -rf "$conf" cp -a "$outpath/src/corelib/global/qconfig.h" "$conf" elif [ '!' -f "$conf" ]; then @@ -8568,7 +8565,7 @@ for file in .projects .projects.3; do fi SPEC=$XQMAKESPEC ;; *s60main/s60main.pro) - if [ "$CFG_NOPROCESS" = "yes" ] || ! echo "$XPLATFORM" | grep "symbian" >/dev/null; then + if [ "$CFG_NOPROCESS" = "yes" ] || [ "$XPLATFORM_SYMBIAN" != "yes" ]; then continue fi;; *examples/activeqt/*) continue ;; diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index c2fb16c..d90f455 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -284,7 +284,7 @@ namespace QT_NAMESPACE {} # endif #endif -#if defined(Q_OS_MAC64) && !defined(QT_MAC_USE_COCOA) && !defined(QT_BUILD_QMAKE) +#if defined(Q_OS_MAC64) && !defined(QT_MAC_USE_COCOA) && !defined(QT_BUILD_QMAKE) && !defined(QT_BOOTSTRAPPED) #error "You are building a 64-bit application, but using a 32-bit version of Qt. Check your build configuration." #endif -- cgit v0.12 From d2f833db2323a1ca13b4f293b169a8401cd30ace Mon Sep 17 00:00:00 2001 From: axis <qt-info@nokia.com> Date: Mon, 21 Feb 2011 16:17:57 +0100 Subject: Fix some build issues for building Qt for Symbian on Mac OS X. Need to add edllstub.lib and change a bit because some refactored work for mkspecs in 86636e0c4ab91bfb60be1e18d6daff34d41a5927. RevBy: axis Conflicts: mkspecs/symbian-gcce/qmake.conf --- mkspecs/symbian-gcce/qmake.conf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mkspecs/symbian-gcce/qmake.conf b/mkspecs/symbian-gcce/qmake.conf index 8de9f26..4b54421 100644 --- a/mkspecs/symbian-gcce/qmake.conf +++ b/mkspecs/symbian-gcce/qmake.conf @@ -4,6 +4,7 @@ include(../common/symbian/symbian-makefile.conf) +include(../common/gcc-base.conf) include(../common/g++.conf) QMAKE_CC = arm-none-symbianelf-gcc @@ -53,7 +54,7 @@ DEFINES += __GCCE__ \ UNICODE QMAKE_LFLAGS_APP += --entry=_E32Startup -u _E32Startup -QMAKE_LFLAGS_SHLIB += --default-symver --entry=_E32Dll -u _E32Dll +QMAKE_LFLAGS_SHLIB += -shared --default-symver --entry _E32Dll -u _E32Dll QMAKE_LFLAGS_PLUGIN += $$QMAKE_LFLAGS_SHLIB gcceExtraFlags = --include=${EPOCROOT}/epoc32/include/gcce/gcce.h -march=armv5t -mapcs -mthumb-interwork -nostdinc -c -msoft-float -T script -- cgit v0.12 From 92afb21fb194a1bfa2d0529307d329b6ca941281 Mon Sep 17 00:00:00 2001 From: axis <qt-info@nokia.com> Date: Wed, 27 Oct 2010 14:48:25 +0200 Subject: Fixed a bug in the elf2e32_qtwrapper script. It did not handle missing symbols in all cases, most notably when elf2e32 decides to omit it from the produced def file. This required us to start reading the original def file as well, to find out what the original symbols was. Task: QTBUG-11839 RevBy: Thomas Zander --- bin/elf2e32_qtwrapper.pl | 104 ++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 90 insertions(+), 14 deletions(-) mode change 100644 => 100755 bin/elf2e32_qtwrapper.pl diff --git a/bin/elf2e32_qtwrapper.pl b/bin/elf2e32_qtwrapper.pl old mode 100644 new mode 100755 index 694d54a..c51c409 --- a/bin/elf2e32_qtwrapper.pl +++ b/bin/elf2e32_qtwrapper.pl @@ -75,26 +75,102 @@ while (1) { last; } - if ($buildingLibrary) { + if ($buildingLibrary && $runCount == 1) { my $tmpDefFile; - my $defFile; - open($defFile, "< $defoutput[1]") or die("Could not open $defoutput[1]"); + my $newDefFile; + my $origDefFile; + my $savedNewDefFileLine = ""; + open($origDefFile, "< $definput[1]") or die("Could not open $definput[1]"); + open($newDefFile, "< $defoutput[1]") or die("Could not open $defoutput[1]"); open($tmpDefFile, "> $defoutput[1].tmp") or die("Could not open $defoutput[1].tmp"); + print($tmpDefFile "EXPORTS\n"); $fixupFile = "$defoutput[1].tmp"; - while (<$defFile>) { - s/\r//; - s/\n//; - next if (/; NEW:/); - if (/([a-z0-9_]+) @/i) { - if (exists($fixupSymbols{$1})) { - s/ ABSENT//; - } elsif (s/; MISSING://) { - s/$/ ABSENT/; + while (1) { + my $origDefLine; + my $origSym; + my $origOrdinal; + my $origExtraData; + my $newDefLine; + my $newSym; + my $newOrdinal; + my $newExtraData; + my $defLine; + my $sym; + my $ordinal; + my $extraData; + # Read from original def file, and skip non-symbol lines + while (1) { + $origDefLine = <$origDefFile>; + if (defined($origDefLine)) { + $origDefLine =~ s/[\n\r]//; + if ($origDefLine =~ /([a-z0-9_]+) +\@ ([0-9]+) (.*)/i) { + $origSym = $1; + $origOrdinal = $2; + $origExtraData = $3; + last; + } + } else { + last; } } - print($tmpDefFile "$_\n"); + + if ($savedNewDefFileLine) { + # This happens if the new def file was missing an entry. + $newDefLine = $savedNewDefFileLine; + $newDefLine =~ /([a-z0-9_]+) +\@ ([0-9]+) (.*)/i or die("$0: Shouldn't happen"); + $newSym = $1; + $newOrdinal = $2; + $newExtraData = $3; + } else { + # Read from new def file, and skip non-symbol lines + while (1) { + $newDefLine = <$newDefFile>; + if (defined($newDefLine)) { + $newDefLine =~ s/[\n\r]//; + if ($newDefLine =~ /([a-z0-9_]+) +\@ ([0-9]+) (.*)/i) { + $newSym = $1; + $newOrdinal = $2; + $newExtraData = $3; + last; + } + } else { + last; + } + } + } + $savedNewDefFileLine = ""; + last if (!defined($origDefLine) && !defined($newDefLine)); + + if (defined($origOrdinal) && (!defined($newOrdinal) || $origOrdinal != $newOrdinal)) { + # If the symbol is missing from the new def file, use the original symbol. + $savedNewDefFileLine = $newDefLine; + $defLine = $origDefLine; + $sym = $origSym; + $ordinal = $origOrdinal; + $extraData = $origExtraData; + } else { + $defLine = $newDefLine; + $sym = $newSym; + $ordinal = $newOrdinal; + if ($newExtraData =~ /ABSENT/) { + # Special case to keep "DATA [0-9]+" data in absent entries. + $extraData = $origExtraData; + } else { + $extraData = $newExtraData; + } + } + if (exists($fixupSymbols{$sym})) { + # Fix symbols that have returned after first being marked ABSENT. + $extraData =~ s/ ABSENT//; + } elsif ($defLine =~ s/; MISSING://) { + # Auto-absent symbols. + $extraData .= " ABSENT"; + } + print($tmpDefFile "\t$sym \@ $ordinal $extraData\n"); } - close($defFile); + print($tmpDefFile "\n"); + close($origDefFile); + close($newDefFile); close($tmpDefFile); $definput[1] = "$defoutput[1].tmp"; -- cgit v0.12 From b3fe4cfad7815cb5acefad6edd88b773f2461ef8 Mon Sep 17 00:00:00 2001 From: axis <qt-info@nokia.com> Date: Thu, 4 Nov 2010 13:51:44 +0100 Subject: Fixed elf2e32_qtwrapper when not using def files. RevBy: Liang Qi Task: QTBUG-14952 --- bin/elf2e32_qtwrapper.pl | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/bin/elf2e32_qtwrapper.pl b/bin/elf2e32_qtwrapper.pl index c51c409..4eeb098 100755 --- a/bin/elf2e32_qtwrapper.pl +++ b/bin/elf2e32_qtwrapper.pl @@ -80,7 +80,9 @@ while (1) { my $newDefFile; my $origDefFile; my $savedNewDefFileLine = ""; - open($origDefFile, "< $definput[1]") or die("Could not open $definput[1]"); + if ($definput[1]) { + open($origDefFile, "< $definput[1]") or die("Could not open $definput[1]"); + } open($newDefFile, "< $defoutput[1]") or die("Could not open $defoutput[1]"); open($tmpDefFile, "> $defoutput[1].tmp") or die("Could not open $defoutput[1].tmp"); print($tmpDefFile "EXPORTS\n"); @@ -98,19 +100,21 @@ while (1) { my $sym; my $ordinal; my $extraData; - # Read from original def file, and skip non-symbol lines - while (1) { - $origDefLine = <$origDefFile>; - if (defined($origDefLine)) { - $origDefLine =~ s/[\n\r]//; - if ($origDefLine =~ /([a-z0-9_]+) +\@ ([0-9]+) (.*)/i) { - $origSym = $1; - $origOrdinal = $2; - $origExtraData = $3; + if ($definput[1]) { + # Read from original def file, and skip non-symbol lines + while (1) { + $origDefLine = <$origDefFile>; + if (defined($origDefLine)) { + $origDefLine =~ s/[\n\r]//; + if ($origDefLine =~ /([a-z0-9_]+) +\@ ([0-9]+) (.*)/i) { + $origSym = $1; + $origOrdinal = $2; + $origExtraData = $3; + last; + } + } else { last; } - } else { - last; } } @@ -169,7 +173,7 @@ while (1) { print($tmpDefFile "\t$sym \@ $ordinal $extraData\n"); } print($tmpDefFile "\n"); - close($origDefFile); + close($origDefFile) if ($definput[1]); close($newDefFile); close($tmpDefFile); -- cgit v0.12 From 99e32b0a2049f3b28d3a54bec31f2471586d8d74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= <samuel.rodal@nokia.com> Date: Thu, 24 Feb 2011 13:35:27 +0100 Subject: Added extended key event support in QWindowSystemInterface. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These are needed for compositor applications to be able to send the raw scan codes to the clients. Reviewed-by: Jørgen Lind --- src/gui/kernel/qapplication_qpa.cpp | 11 ++++++++-- src/gui/kernel/qevent.cpp | 1 + src/gui/kernel/qwindowsysteminterface_qpa.cpp | 30 +++++++++++++++++++++++++++ src/gui/kernel/qwindowsysteminterface_qpa.h | 11 ++++++++++ src/gui/kernel/qwindowsysteminterface_qpa_p.h | 12 ++++++++++- 5 files changed, 62 insertions(+), 3 deletions(-) diff --git a/src/gui/kernel/qapplication_qpa.cpp b/src/gui/kernel/qapplication_qpa.cpp index cd76adf..cb5439c 100644 --- a/src/gui/kernel/qapplication_qpa.cpp +++ b/src/gui/kernel/qapplication_qpa.cpp @@ -51,6 +51,7 @@ #endif #include "private/qwidget_p.h" +#include "private/qevent_p.h" #include "qgenericpluginfactory_qpa.h" #include "qplatformintegrationfactory_qpa_p.h" @@ -816,8 +817,14 @@ void QApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyEven if (app_do_modal && !qt_try_modal(focusW, e->keyType)) return; - QKeyEvent ev(e->keyType, e->key, e->modifiers, e->unicode, e->repeat, e->repeatCount); - QApplication::sendSpontaneousEvent(focusW, &ev); + if (e->nativeScanCode || e->nativeVirtualKey || e->nativeModifiers) { + QKeyEventEx ev(e->keyType, e->key, e->modifiers, e->unicode, e->repeat, e->repeatCount, + e->nativeScanCode, e->nativeVirtualKey, e->nativeModifiers); + QApplication::sendSpontaneousEvent(focusW, &ev); + } else { + QKeyEvent ev(e->keyType, e->key, e->modifiers, e->unicode, e->repeat, e->repeatCount); + QApplication::sendSpontaneousEvent(focusW, &ev); + } } void QApplicationPrivate::processEnterEvent(QWindowSystemInterfacePrivate::EnterEvent *e) diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index e7abb47..db25da3 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -43,6 +43,7 @@ #include "qcursor.h" #include "qapplication.h" #include "private/qapplication_p.h" +#include "private/qevent_p.h" #include "private/qkeysequence_p.h" #include "qwidget.h" #include "qgraphicsview.h" diff --git a/src/gui/kernel/qwindowsysteminterface_qpa.cpp b/src/gui/kernel/qwindowsysteminterface_qpa.cpp index b6177b0..1fd4afd 100644 --- a/src/gui/kernel/qwindowsysteminterface_qpa.cpp +++ b/src/gui/kernel/qwindowsysteminterface_qpa.cpp @@ -150,6 +150,36 @@ void QWindowSystemInterface::handleKeyEvent(QWidget *tlw, ulong timestamp, QEven QWindowSystemInterfacePrivate::queueWindowSystemEvent(e); } +void QWindowSystemInterface::handleExtendedKeyEvent(QWidget *w, QEvent::Type type, int key, Qt::KeyboardModifiers modifiers, + quint32 nativeScanCode, quint32 nativeVirtualKey, + quint32 nativeModifiers, + const QString& text, bool autorep, + ushort count) +{ + unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed(); + handleExtendedKeyEvent(w, time, type, key, modifiers, nativeScanCode, nativeVirtualKey, nativeModifiers, + text, autorep, count); +} + +void QWindowSystemInterface::handleExtendedKeyEvent(QWidget *tlw, ulong timestamp, QEvent::Type type, int key, + Qt::KeyboardModifiers modifiers, + quint32 nativeScanCode, quint32 nativeVirtualKey, + quint32 nativeModifiers, + const QString& text, bool autorep, + ushort count) +{ + if (tlw) { + QWidgetData *data = qt_qwidget_data(tlw); + if (data->in_destructor) + tlw = 0; + } + + QWindowSystemInterfacePrivate::KeyEvent * e = + new QWindowSystemInterfacePrivate::KeyEvent(tlw, timestamp, type, key, modifiers, + nativeScanCode, nativeVirtualKey, nativeModifiers, text, autorep, count); + QWindowSystemInterfacePrivate::queueWindowSystemEvent(e); +} + void QWindowSystemInterface::handleWheelEvent(QWidget *w, const QPoint & local, const QPoint & global, int d, Qt::Orientation o) { unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed(); handleWheelEvent(w, time, local, global, d, o); diff --git a/src/gui/kernel/qwindowsysteminterface_qpa.h b/src/gui/kernel/qwindowsysteminterface_qpa.h index 39c2f79..df67857 100644 --- a/src/gui/kernel/qwindowsysteminterface_qpa.h +++ b/src/gui/kernel/qwindowsysteminterface_qpa.h @@ -64,6 +64,17 @@ public: static void handleKeyEvent(QWidget *w, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1); static void handleKeyEvent(QWidget *w, ulong timestamp, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1); + static void handleExtendedKeyEvent(QWidget *w, QEvent::Type type, int key, Qt::KeyboardModifiers modifiers, + quint32 nativeScanCode, quint32 nativeVirtualKey, + quint32 nativeModifiers, + const QString& text = QString(), bool autorep = false, + ushort count = 1); + static void handleExtendedKeyEvent(QWidget *w, ulong timestamp, QEvent::Type type, int key, Qt::KeyboardModifiers modifiers, + quint32 nativeScanCode, quint32 nativeVirtualKey, + quint32 nativeModifiers, + const QString& text = QString(), bool autorep = false, + ushort count = 1); + static void handleWheelEvent(QWidget *w, const QPoint & local, const QPoint & global, int d, Qt::Orientation o); static void handleWheelEvent(QWidget *w, ulong timestamp, const QPoint & local, const QPoint & global, int d, Qt::Orientation o); diff --git a/src/gui/kernel/qwindowsysteminterface_qpa_p.h b/src/gui/kernel/qwindowsysteminterface_qpa_p.h index 3491a1a..6be86ad 100644 --- a/src/gui/kernel/qwindowsysteminterface_qpa_p.h +++ b/src/gui/kernel/qwindowsysteminterface_qpa_p.h @@ -142,13 +142,23 @@ public: public: KeyEvent(QWidget *w, ulong time, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1) :UserEvent(w, time, Key), key(k), unicode(text), repeat(autorep), - repeatCount(count), modifiers(mods), keyType(t) { } + repeatCount(count), modifiers(mods), keyType(t), + nativeScanCode(0), nativeVirtualKey(0), nativeModifiers(0) { } + KeyEvent(QWidget *w, ulong time, QEvent::Type t, int k, Qt::KeyboardModifiers mods, + quint32 nativeSC, quint32 nativeVK, quint32 nativeMods, + const QString & text = QString(), bool autorep = false, ushort count = 1) + :UserEvent(w, time, Key), key(k), unicode(text), repeat(autorep), + repeatCount(count), modifiers(mods), keyType(t), + nativeScanCode(nativeSC), nativeVirtualKey(nativeVK), nativeModifiers(nativeMods) { } int key; QString unicode; bool repeat; ushort repeatCount; Qt::KeyboardModifiers modifiers; QEvent::Type keyType; + quint32 nativeScanCode; + quint32 nativeVirtualKey; + quint32 nativeModifiers; }; class TouchEvent : public UserEvent { -- cgit v0.12 From 87c16f2bedaf1810cf9a96f65e5af0ad819bf9e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= <samuel.rodal@nokia.com> Date: Thu, 24 Feb 2011 13:49:16 +0100 Subject: Call the extended key event handlers in XCB and Xlib backends. --- src/plugins/platforms/xcb/qxcbkeyboard.cpp | 2 +- src/plugins/platforms/xlib/qxlibkeyboard.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.cpp b/src/plugins/platforms/xcb/qxcbkeyboard.cpp index dcb35fd..f594232 100644 --- a/src/plugins/platforms/xcb/qxcbkeyboard.cpp +++ b/src/plugins/platforms/xcb/qxcbkeyboard.cpp @@ -948,7 +948,7 @@ void QXcbKeyboard::handleKeyEvent(QWidget *widget, QEvent::Type type, xcb_keycod QString string = translateKeySym(sym, state, qtcode, modifiers, chars, count); - QWindowSystemInterface::handleKeyEvent(widget, time, type, qtcode, modifiers, string.left(count)); + QWindowSystemInterface::handleExtendedKeyEvent(widget, time, type, qtcode, modifiers, code, 0, state, string.left(count)); } void QXcbKeyboard::handleKeyPressEvent(QWidget *widget, const xcb_key_press_event_t *event) diff --git a/src/plugins/platforms/xlib/qxlibkeyboard.cpp b/src/plugins/platforms/xlib/qxlibkeyboard.cpp index 65727a4..a1e38b0 100644 --- a/src/plugins/platforms/xlib/qxlibkeyboard.cpp +++ b/src/plugins/platforms/xlib/qxlibkeyboard.cpp @@ -996,5 +996,5 @@ void QXlibKeyboard::handleKeyEvent(QWidget *widget, QEvent::Type type, XKeyEvent KeySym keySym; count = XLookupString(ev,chars.data(),chars.size(),&keySym,0); QString text = translateKeySym(keySym,ev->state,qtcode,modifiers,chars,count); - QWindowSystemInterface::handleKeyEvent(widget,ev->time,type,qtcode,modifiers,text.left(count)); + QWindowSystemInterface::handleExtendedKeyEvent(widget,ev->time,type,qtcode,modifiers,ev->keycode,0,ev->state,text.left(count)); } -- cgit v0.12 From 1f50a3aa50b934a181cd0d18c260f2533ab63d43 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete <paul.tvete@nokia.com> Date: Thu, 24 Feb 2011 17:31:15 +0100 Subject: Make it build when EGL is not available MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Jørgen --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 12 ++++++++++- src/plugins/platforms/wayland/qwaylandinclude.h | 6 ++++++ .../platforms/wayland/qwaylandintegration.cpp | 4 ++++ src/plugins/platforms/wayland/wayland.pro | 24 ++++++++++++++-------- 4 files changed, 37 insertions(+), 9 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index ca23165..c3e87a1 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -171,8 +171,9 @@ void QWaylandDisplay::flushRequests(void) QWaylandDisplay::QWaylandDisplay(void) : mWriteNotifier(0) { +#ifdef QT_WAYLAND_GL_SUPPORT EGLint major, minor; - +#endif mDisplay = wl_display_connect(NULL); if (mDisplay == NULL) { fprintf(stderr, "failed to create display: %m\n"); @@ -182,6 +183,7 @@ QWaylandDisplay::QWaylandDisplay(void) wl_display_add_global_listener(mDisplay, QWaylandDisplay::displayHandleGlobal, this); +#ifdef QT_WAYLAND_GL_SUPPORT mNativeEglDisplay = wl_egl_display_create(mDisplay); mEglDisplay = eglGetDisplay((EGLNativeDisplayType)mNativeEglDisplay); @@ -193,6 +195,12 @@ QWaylandDisplay::QWaylandDisplay(void) return; } } +#else + mNativeEglDisplay = 0; + mEglDisplay = 0; +#endif + + eventDispatcher(); int fd = wl_display_get_fd(mDisplay, sourceUpdate, this); mReadNotifier = new QSocketNotifier(fd, QSocketNotifier::Read, this); @@ -208,7 +216,9 @@ QWaylandDisplay::QWaylandDisplay(void) QWaylandDisplay::~QWaylandDisplay(void) { close(mFd); +#ifdef QT_WAYLAND_GL_SUPPORT eglTerminate(mEglDisplay); +#endif wl_display_destroy(mDisplay); } diff --git a/src/plugins/platforms/wayland/qwaylandinclude.h b/src/plugins/platforms/wayland/qwaylandinclude.h index afaa885..0135251 100644 --- a/src/plugins/platforms/wayland/qwaylandinclude.h +++ b/src/plugins/platforms/wayland/qwaylandinclude.h @@ -44,6 +44,7 @@ #include <wayland-client.h> +#ifdef QT_WAYLAND_GL_SUPPORT #include <wayland-egl.h> #define GL_GLEXT_PROTOTYPES @@ -54,4 +55,9 @@ #include <EGL/egl.h> #include <EGL/eglext.h> +#else +typedef void* EGLDisplay; +typedef void* EGLConfig; +#endif + #endif // QWAYLANDINCLUDE_H diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 9483a47..7c0f69e 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -54,7 +54,9 @@ #include <QtGui/QPlatformWindowFormat> #include <QtGui/private/qpixmap_raster_p.h> +#ifdef QT_WAYLAND_GL_SUPPORT #include <QtOpenGL/private/qpixmapdata_gl_p.h> +#endif QWaylandIntegration::QWaylandIntegration(bool useOpenGL) : mFontDb(new QFontconfigDatabase()) @@ -71,8 +73,10 @@ QWaylandIntegration::screens() const QPixmapData *QWaylandIntegration::createPixmapData(QPixmapData::PixelType type) const { +#ifdef QT_WAYLAND_GL_SUPPORT if (mUseOpenGL) return new QGLPixmapData(type); +#endif return new QRasterPixmapData(type); } diff --git a/src/plugins/platforms/wayland/wayland.pro b/src/plugins/platforms/wayland/wayland.pro index e40e423..9faa59b 100644 --- a/src/plugins/platforms/wayland/wayland.pro +++ b/src/plugins/platforms/wayland/wayland.pro @@ -8,15 +8,11 @@ DEFINES += Q_PLATFORM_WAYLAND SOURCES = main.cpp \ qwaylandintegration.cpp \ qwaylandshmsurface.cpp \ - qwaylanddrmsurface.cpp \ qwaylandinputdevice.cpp \ - qwaylandglcontext.cpp \ qwaylandcursor.cpp \ qwaylanddisplay.cpp \ qwaylandwindow.cpp \ qwaylandscreen.cpp \ - ../eglconvenience/qeglconvenience.cpp \ - qwaylandeglwindow.cpp \ qwaylandshmwindow.cpp HEADERS = qwaylandintegration.h \ @@ -24,19 +20,31 @@ HEADERS = qwaylandintegration.h \ qwaylanddisplay.h \ qwaylandwindow.h \ qwaylandscreen.h \ - qwaylandglcontext.h \ qwaylandshmsurface.h \ qwaylanddrmsurface.h \ qwaylandbuffer.h \ - ../eglconvenience/qeglconvenience.h \ qwaylandinclude.h \ qwaylandeglwindow.h \ qwaylandshmwindow.h -contains(QT_CONFIG, opengl) { +LIBS += -lwayland-client +LIBS += -lxkbcommon + +contains(QT_CONFIG, opengles2) { QT += opengl + LIBS += -lwayland-egl -lEGL + + SOURCES += qwaylanddrmsurface.cpp \ + qwaylandglcontext.cpp \ + ../eglconvenience/qeglconvenience.cpp \ + qwaylandeglwindow.cpp + + HEADERS += qwaylandglcontext.h \ + ../eglconvenience/qeglconvenience.h \ + + DEFINES += QT_WAYLAND_GL_SUPPORT } -LIBS += -lwayland-client -lwayland-egl -lxkbcommon -lEGL + unix { CONFIG += link_pkgconfig PKGCONFIG += libdrm -- cgit v0.12 From 2a9680ffcaf85f233323a0d41bea776a519e747a Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete <paul.tvete@nokia.com> Date: Fri, 25 Feb 2011 12:56:28 +0100 Subject: Avoid flicker Don't start a new paint until we get an ack from the compositor Reviewed-by: Samuel --- src/plugins/platforms/wayland/qwaylandshmsurface.cpp | 16 ++++++++++++++++ src/plugins/platforms/wayland/qwaylandshmsurface.h | 4 ++++ 2 files changed, 20 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandshmsurface.cpp b/src/plugins/platforms/wayland/qwaylandshmsurface.cpp index 9bcae26..b1cba71 100644 --- a/src/plugins/platforms/wayland/qwaylandshmsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmsurface.cpp @@ -95,6 +95,7 @@ QWaylandShmWindowSurface::QWaylandShmWindowSurface(QWidget *window) : QWindowSurface(window) , mBuffer(0) , mDisplay(QWaylandScreen::waylandScreenFromWidget(window)->display()) + , mWaitingForFrameSync(false) { } @@ -107,6 +108,19 @@ QPaintDevice *QWaylandShmWindowSurface::paintDevice() return mBuffer->image(); } +void QWaylandShmWindowSurface::beginPaint(const QRegion &) +{ + while (mWaitingForFrameSync) { + mDisplay->eventDispatcher(); + } +} + +void QWaylandShmWindowSurface::frameCallback(void *data, uint32_t time) +{ + QWaylandShmWindowSurface *self = static_cast<QWaylandShmWindowSurface*>(data); + self->mWaitingForFrameSync = false; +} + void QWaylandShmWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) { Q_UNUSED(widget); @@ -118,6 +132,8 @@ void QWaylandShmWindowSurface::flush(QWidget *widget, const QRegion ®ion, con for (int i = 0; i < rects.size(); i++) { waylandWindow->damage(rects.at(i)); } + mWaitingForFrameSync = true; + mDisplay->frameCallback(QWaylandShmWindowSurface::frameCallback, this); } void QWaylandShmWindowSurface::resize(const QSize &size) diff --git a/src/plugins/platforms/wayland/qwaylandshmsurface.h b/src/plugins/platforms/wayland/qwaylandshmsurface.h index 266b290..615d944 100644 --- a/src/plugins/platforms/wayland/qwaylandshmsurface.h +++ b/src/plugins/platforms/wayland/qwaylandshmsurface.h @@ -71,10 +71,14 @@ public: QPaintDevice *paintDevice(); void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); void resize(const QSize &size); + void beginPaint(const QRegion &); private: + static void frameCallback(void *data, uint32_t time);\ + QWaylandShmBuffer *mBuffer; QWaylandDisplay *mDisplay; + bool mWaitingForFrameSync; }; QT_END_NAMESPACE -- cgit v0.12 From c675b021d2d598a924a7c7e9786fbf7c9620549c Mon Sep 17 00:00:00 2001 From: Daniel Black <daniel@cacert.org> Date: Fri, 25 Feb 2011 11:51:46 +0100 Subject: Add Server Name Identification (RFC4366 section 3.1) ...to client QSslSocket connections when supported by openssl as per task tracker id #188841 Merge-request: 1574 Reviewed-by: Peter Hartmann <peter.hartmann@nokia.com> --- src/network/ssl/qsslsocket_openssl.cpp | 10 ++++++++++ src/network/ssl/qsslsocket_openssl_p.h | 3 +++ src/network/ssl/qsslsocket_openssl_symbols.cpp | 6 ++++++ src/network/ssl/qsslsocket_openssl_symbols_p.h | 3 +++ 4 files changed, 22 insertions(+) diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp index 83714ed..11dc941 100644 --- a/src/network/ssl/qsslsocket_openssl.cpp +++ b/src/network/ssl/qsslsocket_openssl.cpp @@ -386,6 +386,16 @@ init_context: return false; } +#if OPENSSL_VERSION_NUMBER >= 0x0090806fL && !defined(OPENSSL_NO_TLSEXT) + if (client) { + // Set server hostname on TLS extension. RFC4366 section 3.1 requires it in ACE format. + QByteArray ace = QUrl::toAce(hostName); + if (!ace.isEmpty()) { + q_SSL_ctrl(ssl,SSL_CTRL_SET_TLSEXT_HOSTNAME,TLSEXT_NAMETYPE_host_name,ace.constData()); + } + } +#endif + // Clear the session. q_SSL_clear(ssl); errorList.clear(); diff --git a/src/network/ssl/qsslsocket_openssl_p.h b/src/network/ssl/qsslsocket_openssl_p.h index 5a7963e..02d70f9 100644 --- a/src/network/ssl/qsslsocket_openssl_p.h +++ b/src/network/ssl/qsslsocket_openssl_p.h @@ -79,6 +79,9 @@ #include <openssl/x509_vfy.h> #include <openssl/dsa.h> #include <openssl/rsa.h> +#if OPENSSL_VERSION_NUMBER >= 0x0090806fL && !defined(OPENSSL_NO_TLSEXT) +#include <openssl/tls1.h> +#endif #if OPENSSL_VERSION_NUMBER >= 0x10000000L typedef _STACK STACK; diff --git a/src/network/ssl/qsslsocket_openssl_symbols.cpp b/src/network/ssl/qsslsocket_openssl_symbols.cpp index b9a05f3..4b6d84d 100644 --- a/src/network/ssl/qsslsocket_openssl_symbols.cpp +++ b/src/network/ssl/qsslsocket_openssl_symbols.cpp @@ -208,6 +208,9 @@ DEFINEFUNC(long, SSL_get_verify_result, SSL *a, a, return -1, return) DEFINEFUNC(int, SSL_library_init, void, DUMMYARG, return -1, return) DEFINEFUNC(void, SSL_load_error_strings, void, DUMMYARG, return, DUMMYARG) DEFINEFUNC(SSL *, SSL_new, SSL_CTX *a, a, return 0, return) +#if OPENSSL_VERSION_NUMBER >= 0x0090806fL && !defined(OPENSSL_NO_TLSEXT) +DEFINEFUNC4(long, SSL_ctrl, SSL *a, a, int cmd, cmd, long larg, larg, const void *parg, parg, return -1, return) +#endif DEFINEFUNC3(int, SSL_read, SSL *a, a, void *b, b, int c, c, return -1, return) DEFINEFUNC3(void, SSL_set_bio, SSL *a, a, BIO *b, b, BIO *c, c, return, DUMMYARG) DEFINEFUNC(void, SSL_set_accept_state, SSL *a, a, return, DUMMYARG) @@ -711,6 +714,9 @@ bool q_resolveOpenSslSymbols() RESOLVEFUNC(SSL_library_init) RESOLVEFUNC(SSL_load_error_strings) RESOLVEFUNC(SSL_new) +#if OPENSSL_VERSION_NUMBER >= 0x0090806fL && !defined(OPENSSL_NO_TLSEXT) + RESOLVEFUNC(SSL_ctrl) +#endif RESOLVEFUNC(SSL_read) RESOLVEFUNC(SSL_set_accept_state) RESOLVEFUNC(SSL_set_bio) diff --git a/src/network/ssl/qsslsocket_openssl_symbols_p.h b/src/network/ssl/qsslsocket_openssl_symbols_p.h index c05dfe11..5aab8d7 100644 --- a/src/network/ssl/qsslsocket_openssl_symbols_p.h +++ b/src/network/ssl/qsslsocket_openssl_symbols_p.h @@ -316,6 +316,9 @@ long q_SSL_get_verify_result(SSL *a); int q_SSL_library_init(); void q_SSL_load_error_strings(); SSL *q_SSL_new(SSL_CTX *a); +#if OPENSSL_VERSION_NUMBER >= 0x0090806fL && !defined(OPENSSL_NO_TLSEXT) +long q_SSL_ctrl(SSL *ssl,int cmd, long larg, const void *parg); +#endif int q_SSL_read(SSL *a, void *b, int c); void q_SSL_set_bio(SSL *a, BIO *b, BIO *c); void q_SSL_set_accept_state(SSL *a); -- cgit v0.12 From 3a16e772efe7f39d506b90e14b74a2b078648a56 Mon Sep 17 00:00:00 2001 From: David Faure <faure@kde.org> Date: Fri, 25 Feb 2011 11:49:40 +0100 Subject: QSslSocket SNI: prefer verificationPeerName then peerName then hostName As suggested by p--hartmann in a comment for MR 1574. Task-number: QTBUG-1352 Merge-request: 1110 Reviewed-by: Peter Hartmann <peter.hartmann@nokia.com> --- src/network/ssl/qsslsocket_openssl.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp index 11dc941..60d6cae 100644 --- a/src/network/ssl/qsslsocket_openssl.cpp +++ b/src/network/ssl/qsslsocket_openssl.cpp @@ -389,9 +389,12 @@ init_context: #if OPENSSL_VERSION_NUMBER >= 0x0090806fL && !defined(OPENSSL_NO_TLSEXT) if (client) { // Set server hostname on TLS extension. RFC4366 section 3.1 requires it in ACE format. - QByteArray ace = QUrl::toAce(hostName); + QString tlsHostName = verificationPeerName.isEmpty() ? q->peerName() : verificationPeerName; + if (tlsHostName.isEmpty()) + tlsHostName = hostName; + QByteArray ace = QUrl::toAce(tlsHostName); if (!ace.isEmpty()) { - q_SSL_ctrl(ssl,SSL_CTRL_SET_TLSEXT_HOSTNAME,TLSEXT_NAMETYPE_host_name,ace.constData()); + q_SSL_ctrl(ssl, SSL_CTRL_SET_TLSEXT_HOSTNAME, TLSEXT_NAMETYPE_host_name, ace.constData()); } } #endif -- cgit v0.12 From 600374f0e4ff5d497120a2dbabd6d0a9ed05c47c Mon Sep 17 00:00:00 2001 From: David Faure <faure@kde.org> Date: Fri, 25 Feb 2011 11:49:43 +0100 Subject: Add QSslSocket::setPeerVerifyName()/peerVerifyName() This allows to set the sslPeerName even when not using connectToHostEncrypted, but rather connectToHost + startClientEncryption Task-number: QTBUG-1352 Merge-request: 1110 Reviewed-by: Peter Hartmann <peter.hartmann@nokia.com> --- src/network/ssl/qsslsocket.cpp | 28 ++++++++++++++++++++++++++++ src/network/ssl/qsslsocket.h | 3 +++ 2 files changed, 31 insertions(+) diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp index 61f27fe..b9d8e16 100644 --- a/src/network/ssl/qsslsocket.cpp +++ b/src/network/ssl/qsslsocket.cpp @@ -659,6 +659,34 @@ void QSslSocket::setPeerVerifyDepth(int depth) } /*! + \since 4.8 + + Returns the different hostname for the certificate validation, as set by + setPeerVerifyName or by connectToHostEncrypted. + + \sa setPeerVerifyName(), connectToHostEncrypted() +*/ +QString QSslSocket::peerVerifyName() const +{ + Q_D(const QSslSocket); + return d->verificationPeerName; +} + +/*! + \since 4.8 + + Sets a different hostname for the certificate validation instead of the one used for the TCP + connection. + + \sa connectToHostEncrypted() +*/ +void QSslSocket::setPeerVerifyName(const QString &hostName) +{ + Q_D(QSslSocket); + d->verificationPeerName = hostName; +} + +/*! \reimp Returns the number of decrypted bytes that are immediately available for diff --git a/src/network/ssl/qsslsocket.h b/src/network/ssl/qsslsocket.h index 703a1fb..648fd8c 100644 --- a/src/network/ssl/qsslsocket.h +++ b/src/network/ssl/qsslsocket.h @@ -106,6 +106,9 @@ public: int peerVerifyDepth() const; void setPeerVerifyDepth(int depth); + QString peerVerifyName() const; + void setPeerVerifyName(const QString &hostName); + // From QIODevice qint64 bytesAvailable() const; qint64 bytesToWrite() const; -- cgit v0.12 From 2053ac707d0d74761ac926bafe3f3fced6daf490 Mon Sep 17 00:00:00 2001 From: Peter Hartmann <peter.hartmann@nokia.com> Date: Fri, 25 Feb 2011 12:03:57 +0100 Subject: QSslSocket backend: resolve symbols for SNI for Symbian Task-number: QTBUG-1352 --- src/network/ssl/qsslsocket_openssl_symbols.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/network/ssl/qsslsocket_openssl_symbols.cpp b/src/network/ssl/qsslsocket_openssl_symbols.cpp index 4b6d84d..732fc86 100644 --- a/src/network/ssl/qsslsocket_openssl_symbols.cpp +++ b/src/network/ssl/qsslsocket_openssl_symbols.cpp @@ -589,6 +589,9 @@ bool q_resolveOpenSslSymbols() RESOLVEFUNC(SSL_library_init, 137, libs.first ) RESOLVEFUNC(SSL_load_error_strings, 139, libs.first ) RESOLVEFUNC(SSL_new, 140, libs.first ) +#if OPENSSL_VERSION_NUMBER >= 0x0090806fL && !defined(OPENSSL_NO_TLSEXT) + RESOLVEFUNC(SSL_ctrl, 95, libs.first ) +#endif RESOLVEFUNC(SSL_read, 143, libs.first ) RESOLVEFUNC(SSL_set_accept_state, 148, libs.first ) RESOLVEFUNC(SSL_set_bio, 149, libs.first ) -- cgit v0.12 From 3287348434ee1f15c7468c7d25b2fc97c8791371 Mon Sep 17 00:00:00 2001 From: Peter Hartmann <peter.hartmann@nokia.com> Date: Fri, 25 Feb 2011 12:15:42 +0100 Subject: SSL: Switch default version to TLS 1.0 TLS is backward compatible, so servers only supporting SSL 3 should still work. All browsers send a TLS 1.0 Client Hello these days. However, some servers apparently have problems with a TLS handshake (and a SNI message); for now, wait and see how many of them are broken and either add a fallback to SSLv3 or blacklist them (i.e. set the used SSL version for those servers explicitly). Reviewed-by: Markus Goetz --- src/network/ssl/qssl.cpp | 4 ++-- src/network/ssl/qsslconfiguration.cpp | 4 ++-- src/network/ssl/qsslconfiguration_p.h | 2 +- src/network/ssl/qsslsocket.cpp | 4 ++-- tests/auto/qsslsocket/tst_qsslsocket.cpp | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/network/ssl/qssl.cpp b/src/network/ssl/qssl.cpp index e9e7d21..8a450b9 100644 --- a/src/network/ssl/qssl.cpp +++ b/src/network/ssl/qssl.cpp @@ -101,9 +101,9 @@ QT_BEGIN_NAMESPACE Describes the protocol of the cipher. - \value SslV3 SSLv3 - the default protocol. + \value SslV3 SSLv3 \value SslV2 SSLv2 - \value TlsV1 TLSv1 + \value TlsV1 TLSv1 - the default protocol. \value UnknownProtocol The cipher's protocol cannot be determined. \value AnyProtocol The socket understands SSLv2, SSLv3, and TLSv1. This value is used by QSslSocket only. diff --git a/src/network/ssl/qsslconfiguration.cpp b/src/network/ssl/qsslconfiguration.cpp index 3592226..b0d5c90 100644 --- a/src/network/ssl/qsslconfiguration.cpp +++ b/src/network/ssl/qsslconfiguration.cpp @@ -213,7 +213,7 @@ bool QSslConfiguration::isNull() const */ QSsl::SslProtocol QSslConfiguration::protocol() const { - return d ? d->protocol : QSsl::SslV3; + return d ? d->protocol : QSsl::TlsV1; } /*! @@ -518,7 +518,7 @@ void QSslConfiguration::setCaCertificates(const QList<QSslCertificate> &certific \list \o no local certificate and no private key - \o protocol SSLv3 + \o protocol TlsV1 \o the system's default CA certificate list \o the cipher list equal to the list of the SSL libraries' supported SSL ciphers diff --git a/src/network/ssl/qsslconfiguration_p.h b/src/network/ssl/qsslconfiguration_p.h index b039e69..47adace 100644 --- a/src/network/ssl/qsslconfiguration_p.h +++ b/src/network/ssl/qsslconfiguration_p.h @@ -80,7 +80,7 @@ class QSslConfigurationPrivate: public QSharedData { public: QSslConfigurationPrivate() - : protocol(QSsl::SslV3), + : protocol(QSsl::TlsV1), peerVerifyMode(QSslSocket::AutoVerifyPeer), peerVerifyDepth(0) { } diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp index b9d8e16..224ed67 100644 --- a/src/network/ssl/qsslsocket.cpp +++ b/src/network/ssl/qsslsocket.cpp @@ -56,7 +56,7 @@ QSslSocket establishes a secure, encrypted TCP connection you can use for transmitting encrypted data. It can operate in both client and server mode, and it supports modern SSL protocols, including - SSLv3 and TLSv1. By default, QSslSocket uses SSLv3, but you can + SSLv3 and TLSv1. By default, QSslSocket uses TLSv1, but you can change the SSL protocol by calling setProtocol() as long as you do it before the handshake has started. @@ -552,7 +552,7 @@ bool QSslSocket::isEncrypted() const } /*! - Returns the socket's SSL protocol. By default, \l QSsl::SslV3 is used. + Returns the socket's SSL protocol. By default, \l QSsl::TLSv1 is used. \sa setProtocol() */ diff --git a/tests/auto/qsslsocket/tst_qsslsocket.cpp b/tests/auto/qsslsocket/tst_qsslsocket.cpp index 739f902..4beddad 100644 --- a/tests/auto/qsslsocket/tst_qsslsocket.cpp +++ b/tests/auto/qsslsocket/tst_qsslsocket.cpp @@ -385,7 +385,7 @@ void tst_QSslSocket::constructing() QVERIFY(!socket.waitForConnected(10)); QTest::ignoreMessage(QtWarningMsg, "QSslSocket::waitForDisconnected() is not allowed in UnconnectedState"); QVERIFY(!socket.waitForDisconnected(10)); - QCOMPARE(socket.protocol(), QSsl::SslV3); + QCOMPARE(socket.protocol(), QSsl::TlsV1); QSslConfiguration savedDefault = QSslConfiguration::defaultConfiguration(); @@ -771,7 +771,7 @@ void tst_QSslSocket::protocol() #endif // qDebug() << "socket cert:" << socket->caCertificates().at(0).issuerInfo(QSslCertificate::CommonName); - QCOMPARE(socket->protocol(), QSsl::SslV3); + QCOMPARE(socket->protocol(), QSsl::TlsV1); { // Fluke allows SSLv3. socket->setProtocol(QSsl::SslV3); -- cgit v0.12 From 74c683c6879dea1cb4eaa99aaf61e16524b8a4a1 Mon Sep 17 00:00:00 2001 From: Peter Hartmann <peter.hartmann@nokia.com> Date: Mon, 28 Feb 2011 18:35:23 +0100 Subject: SSL TLS extension on Symbian: work around missing symbol ... by defining it ourselves. That symbol is missing in the header files for Symbian. Reviewed-by: Shane Kearns --- src/network/ssl/qsslsocket_openssl.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp index 60d6cae..455a49f1 100644 --- a/src/network/ssl/qsslsocket_openssl.cpp +++ b/src/network/ssl/qsslsocket_openssl.cpp @@ -60,6 +60,12 @@ #include <QtCore/qvarlengtharray.h> #include <QLibrary> // for loading the security lib for the CA store +#if OPENSSL_VERSION_NUMBER >= 0x0090806fL && !defined(OPENSSL_NO_TLSEXT) +// Symbian does not seem to have the symbol for SNI defined +#ifndef SSL_CTRL_SET_TLSEXT_HOSTNAME +#define SSL_CTRL_SET_TLSEXT_HOSTNAME 55 +#endif +#endif QT_BEGIN_NAMESPACE #if defined(Q_OS_MAC) -- cgit v0.12 From 5fe25728c0ebb04c3fd2958d902cc58d2064b84d Mon Sep 17 00:00:00 2001 From: Olivier Goffart <olivier.goffart@nokia.com> Date: Mon, 28 Feb 2011 18:42:06 +0100 Subject: Remove qt3support dependency of qtconfig Revert "Revert the integration of the merge request 2286." This reverts commit e3edad83a1e6e99a551d40d4118352435c6dd710. This had been submitted in the Qt 4.7, but reverted because the change was to intrusive to be pushed in a stable branch. Now re-apply the change in master. Conflicts: tools/qtconfig/mainwindowbase.cpp tools/qtconfig/mainwindowbase.h tools/qtconfig/paletteeditoradvancedbase.cpp tools/qtconfig/paletteeditoradvancedbase.h tools/qtconfig/paletteeditoradvancedbase.ui tools/qtconfig/previewwidgetbase.cpp tools/qtconfig/previewwidgetbase.h tools/qtconfig/previewwidgetbase.ui tools/tools.pro --- tools/qtconfig/colorbutton.cpp | 9 +- tools/qtconfig/main.cpp | 1 - tools/qtconfig/mainwindow.cpp | 785 +++++++-------- tools/qtconfig/mainwindow.h | 19 +- tools/qtconfig/mainwindow.ui | 1388 ++++++++++++++++++++++++++ tools/qtconfig/mainwindowbase.cpp | 250 ----- tools/qtconfig/mainwindowbase.h | 95 -- tools/qtconfig/mainwindowbase.ui | 1384 ------------------------- tools/qtconfig/paletteeditoradvanced.cpp | 579 ++++------- tools/qtconfig/paletteeditoradvanced.h | 66 +- tools/qtconfig/paletteeditoradvanced.ui | 416 ++++++++ tools/qtconfig/paletteeditoradvancedbase.cpp | 144 --- tools/qtconfig/paletteeditoradvancedbase.h | 78 -- tools/qtconfig/paletteeditoradvancedbase.ui | 617 ------------ tools/qtconfig/previewframe.cpp | 18 +- tools/qtconfig/previewframe.h | 13 +- tools/qtconfig/previewwidget.cpp | 29 +- tools/qtconfig/previewwidget.h | 18 +- tools/qtconfig/previewwidget.ui | 252 +++++ tools/qtconfig/previewwidgetbase.cpp | 88 -- tools/qtconfig/previewwidgetbase.h | 68 -- tools/qtconfig/previewwidgetbase.ui | 340 ------- tools/qtconfig/qtconfig.pro | 19 +- tools/tools.pro | 2 +- 24 files changed, 2688 insertions(+), 3990 deletions(-) create mode 100644 tools/qtconfig/mainwindow.ui delete mode 100644 tools/qtconfig/mainwindowbase.cpp delete mode 100644 tools/qtconfig/mainwindowbase.h delete mode 100644 tools/qtconfig/mainwindowbase.ui create mode 100644 tools/qtconfig/paletteeditoradvanced.ui delete mode 100644 tools/qtconfig/paletteeditoradvancedbase.cpp delete mode 100644 tools/qtconfig/paletteeditoradvancedbase.h delete mode 100644 tools/qtconfig/paletteeditoradvancedbase.ui create mode 100644 tools/qtconfig/previewwidget.ui delete mode 100644 tools/qtconfig/previewwidgetbase.cpp delete mode 100644 tools/qtconfig/previewwidgetbase.h delete mode 100644 tools/qtconfig/previewwidgetbase.ui diff --git a/tools/qtconfig/colorbutton.cpp b/tools/qtconfig/colorbutton.cpp index 1a98897..0b0fefc 100644 --- a/tools/qtconfig/colorbutton.cpp +++ b/tools/qtconfig/colorbutton.cpp @@ -52,19 +52,20 @@ QT_BEGIN_NAMESPACE ColorButton::ColorButton(QWidget *parent) - : QAbstractButton(parent), mousepressed(false) + : QAbstractButton(parent) + , mousepressed(false) + , col(Qt::black) { setAcceptDrops(true); - col = Qt::black; connect(this, SIGNAL(clicked()), SLOT(changeColor())); } ColorButton::ColorButton(const QColor &c, QWidget *parent) : QAbstractButton(parent) + , col(c) { setAcceptDrops(true); - col = c; connect(this, SIGNAL(clicked()), SLOT(changeColor())); } @@ -182,7 +183,7 @@ void ColorButton::mouseReleaseEvent(QMouseEvent *e) void ColorButton::mouseMoveEvent(QMouseEvent *e) { - if (! mousepressed) + if (!mousepressed) return; if ((presspos - e->pos()).manhattanLength() > QApplication::startDragDistance()) { diff --git a/tools/qtconfig/main.cpp b/tools/qtconfig/main.cpp index 3c17511..38435d9 100644 --- a/tools/qtconfig/main.cpp +++ b/tools/qtconfig/main.cpp @@ -39,7 +39,6 @@ ** ****************************************************************************/ -#include "ui_previewwidgetbase.h" #include "mainwindow.h" #include <QApplication> #include <QLibraryInfo> diff --git a/tools/qtconfig/mainwindow.cpp b/tools/qtconfig/mainwindow.cpp index 5dd321e..7bff03d 100644 --- a/tools/qtconfig/mainwindow.cpp +++ b/tools/qtconfig/mainwindow.cpp @@ -40,6 +40,8 @@ ****************************************************************************/ #include "mainwindow.h" +#include "ui_mainwindow.h" + #include "colorbutton.h" #include "previewframe.h" #include "paletteeditoradvanced.h" @@ -59,7 +61,6 @@ #include <QMessageBox> #include <QStyle> #include <QtEvents> -#include <Q3ValueList> #include <QInputContext> #include <QInputContextFactory> #include <QtDebug> @@ -155,36 +156,20 @@ static const char *phonon_text = QT_TRANSLATE_NOOP("MainWindow", "<p>It is reccommended to leave all settings on \"Auto\" to let " "Phonon determine your settings automatically."); -static QColorGroup::ColorRole centralFromItem( int item ) -{ - switch( item ) { - case 0: return QColorGroup::Window; - case 1: return QColorGroup::WindowText; - case 2: return QColorGroup::Button; - case 3: return QColorGroup::Base; - case 4: return QColorGroup::Text; - case 5: return QColorGroup::BrightText; - case 6: return QColorGroup::ButtonText; - case 7: return QColorGroup::Highlight; - case 8: return QColorGroup::HighlightedText; - default: return QColorGroup::NColorRoles; - } -} - -static QColorGroup::ColorRole effectFromItem( int item ) +QPalette::ColorGroup MainWindow::groupFromIndex(int item) { - switch( item ) { - case 0: return QColorGroup::Light; - case 1: return QColorGroup::Midlight; - case 2: return QColorGroup::Mid; - case 3: return QColorGroup::Dark; - case 4: return QColorGroup::Shadow; - default: return QColorGroup::NColorRoles; + switch (item) { + case 0: + default: + return QPalette::Active; + case 1: + return QPalette::Inactive; + case 2: + return QPalette::Disabled; } } - static void setStyleHelper(QWidget *w, QStyle *s) { const QObjectList children = w->children(); @@ -196,100 +181,141 @@ static void setStyleHelper(QWidget *w, QStyle *s) w->setStyle(s); } - MainWindow::MainWindow() - : MainWindowBase(0, "main window"), - editPalette(palette()), previewPalette(palette()), previewstyle(0) -{ + : ui(new Ui::MainWindow), + editPalette(palette()), + previewPalette(palette()), + previewstyle(0) +{ + ui->setupUi(this); + statusBar(); + + // signals and slots connections + connect(ui->fontPathLineEdit, SIGNAL(returnPressed()), SLOT(addFontpath())); + connect(ui->addFontPathButton, SIGNAL(clicked()), SLOT(addFontpath())); + connect(ui->addSubstitutionButton, SIGNAL(clicked()), SLOT(addSubstitute())); + connect(ui->browseFontPathButton, SIGNAL(clicked()), SLOT(browseFontpath())); + connect(ui->fontStyleCombo, SIGNAL(activated(int)), SLOT(buildFont())); + connect(ui->pointSizeCombo, SIGNAL(activated(int)), SLOT(buildFont())); + connect(ui->downFontpathButton, SIGNAL(clicked()), SLOT(downFontpath())); + connect(ui->downSubstitutionButton, SIGNAL(clicked()), SLOT(downSubstitute())); + connect(ui->fontFamilyCombo, SIGNAL(activated(QString)), SLOT(familySelected(QString))); + connect(ui->fileExitAction, SIGNAL(activated()), SLOT(fileExit())); + connect(ui->fileSaveAction, SIGNAL(activated()), SLOT(fileSave())); + connect(ui->helpAboutAction, SIGNAL(activated()), SLOT(helpAbout())); + connect(ui->helpAboutQtAction, SIGNAL(activated()), SLOT(helpAboutQt())); + connect(ui->mainTabWidget, SIGNAL(currentChanged(QWidget*)), SLOT(pageChanged(QWidget*))); + connect(ui->paletteCombo, SIGNAL(activated(int)), SLOT(paletteSelected(int))); + connect(ui->removeFontpathButton, SIGNAL(clicked()), SLOT(removeFontpath())); + connect(ui->removeSubstitutionButton, SIGNAL(clicked()), SLOT(removeSubstitute())); + connect(ui->toolBoxEffectCombo, SIGNAL(activated(int)), SLOT(somethingModified())); + connect(ui->doubleClickIntervalSpinBox, SIGNAL(valueChanged(int)), SLOT(somethingModified())); + connect(ui->cursorFlashTimeSpinBox, SIGNAL(valueChanged(int)), SLOT(somethingModified())); + connect(ui->wheelScrollLinesSpinBox, SIGNAL(valueChanged(int)), SLOT(somethingModified())); + connect(ui->menuEffectCombo, SIGNAL(activated(int)), SLOT(somethingModified())); + connect(ui->comboEffectCombo, SIGNAL(activated(int)), SLOT(somethingModified())); + connect(ui->audiosinkCombo, SIGNAL(activated(int)), SLOT(somethingModified())); + connect(ui->videomodeCombo, SIGNAL(activated(int)), SLOT(somethingModified())); + connect(ui->toolTipEffectCombo, SIGNAL(activated(int)), SLOT(somethingModified())); + connect(ui->strutWidthSpinBox, SIGNAL(valueChanged(int)), SLOT(somethingModified())); + connect(ui->strutHeightSpinBox, SIGNAL(valueChanged(int)), SLOT(somethingModified())); + connect(ui->effectsCheckBox, SIGNAL(toggled(bool)), SLOT(somethingModified())); + connect(ui->resolveLinksCheckBox, SIGNAL(toggled(bool)), SLOT(somethingModified())); + connect(ui->fontEmbeddingCheckBox, SIGNAL(clicked()), SLOT(somethingModified())); + connect(ui->rtlExtensionsCheckBox, SIGNAL(toggled(bool)), SLOT(somethingModified())); + connect(ui->inputStyleCombo, SIGNAL(activated(int)), SLOT(somethingModified())); + connect(ui->inputMethodCombo, SIGNAL(activated(int)), SLOT(somethingModified())); + connect(ui->guiStyleCombo, SIGNAL(activated(QString)), SLOT(styleSelected(QString))); + connect(ui->familySubstitutionCombo, SIGNAL(activated(QString)), SLOT(substituteSelected(QString))); + connect(ui->tunePaletteButton, SIGNAL(clicked()), SLOT(tunePalette())); + connect(ui->upFontpathButton, SIGNAL(clicked()), SLOT(upFontpath())); + connect(ui->upSubstitutionButton, SIGNAL(clicked()), SLOT(upSubstitute())); + modified = true; desktopThemeName = tr("Desktop Settings (Default)"); setIcon(QPixmap(":/trolltech/qtconfig/images/appicon.png")); QStringList gstyles = QStyleFactory::keys(); gstyles.sort(); - gstylecombo->addItem(desktopThemeName); - gstylecombo->setItemData(gstylecombo->findText(desktopThemeName), - tr("Choose style and palette based on your desktop settings."), Qt::ToolTipRole); - gstylecombo->insertStringList(gstyles); + ui->guiStyleCombo->addItem(desktopThemeName); + ui->guiStyleCombo->setItemData(ui->guiStyleCombo->findText(desktopThemeName), + tr("Choose style and palette based on your desktop settings."), + Qt::ToolTipRole); + ui->guiStyleCombo->addItems(gstyles); QSettings settings(QLatin1String("Trolltech")); settings.beginGroup(QLatin1String("Qt")); QString currentstyle = settings.value(QLatin1String("style")).toString(); if (currentstyle.isEmpty()) { - gstylecombo->setCurrentItem(gstylecombo->findText(desktopThemeName)); - currentstyle = QLatin1String(QApplication::style()->name()); + ui->guiStyleCombo->setCurrentIndex(ui->guiStyleCombo->findText(desktopThemeName)); + currentstyle = QApplication::style()->objectName(); } else { - int index = gstylecombo->findText(currentstyle, Qt::MatchFixedString); + int index = ui->guiStyleCombo->findText(currentstyle, Qt::MatchFixedString); if (index != -1) { - gstylecombo->setCurrentItem(index); + ui->guiStyleCombo->setCurrentIndex(index); } else { // we give up - gstylecombo->insertItem(QLatin1String("Unknown")); - gstylecombo->setCurrentItem(gstylecombo->count() - 1); + ui->guiStyleCombo->addItem(tr("Unknown")); + ui->guiStyleCombo->setCurrentIndex(ui->guiStyleCombo->count() - 1); } } - buttonMainColor->setColor(palette().color(QPalette::Active, - QColorGroup::Button)); - buttonMainColor2->setColor(palette().color(QPalette::Active, - QColorGroup::Window)); - connect(buttonMainColor, SIGNAL(colorChanged(QColor)), - this, SLOT(buildPalette())); - connect(buttonMainColor2, SIGNAL(colorChanged(QColor)), - this, SLOT(buildPalette())); + ui->buttonMainColor->setColor(palette().color(QPalette::Active, QPalette::Button)); + ui->buttonWindowColor->setColor(palette().color(QPalette::Active, QPalette::Window)); + connect(ui->buttonMainColor, SIGNAL(colorChanged(QColor)), SLOT(buildPalette())); + connect(ui->buttonWindowColor, SIGNAL(colorChanged(QColor)), SLOT(buildPalette())); if (X11->desktopEnvironment == DE_KDE) - colorConfig->hide(); + ui->colorConfig->hide(); else - labelKDENote->hide(); + ui->kdeNoteLabel->hide(); QFontDatabase db; QStringList families = db.families(); - familycombo->insertStringList(families); + ui->fontFamilyCombo->addItems(families); QStringList fs = families; QStringList fs2 = QFont::substitutions(); QStringList::Iterator fsit = fs2.begin(); while (fsit != fs2.end()) { - if (! fs.contains(*fsit)) + if (!fs.contains(*fsit)) fs += *fsit; fsit++; } fs.sort(); - familysubcombo->insertStringList(fs); + ui->familySubstitutionCombo->addItems(fs); - choosesubcombo->insertStringList(families); - Q3ValueList<int> sizes = db.standardSizes(); - Q3ValueList<int>::Iterator it = sizes.begin(); - while (it != sizes.end()) - psizecombo->insertItem(QString::number(*it++)); + ui->chooseSubstitutionCombo->addItems(families); + QList<int> sizes = db.standardSizes(); + foreach(int i, sizes) + ui->pointSizeCombo->addItem(QString::number(i)); - dcispin->setValue(QApplication::doubleClickInterval()); - cfispin->setValue(QApplication::cursorFlashTime()); - wslspin->setValue(QApplication::wheelScrollLines()); + ui->doubleClickIntervalSpinBox->setValue(QApplication::doubleClickInterval()); + ui->cursorFlashTimeSpinBox->setValue(QApplication::cursorFlashTime()); + ui->wheelScrollLinesSpinBox->setValue(QApplication::wheelScrollLines()); // ############# -// resolvelinks->setChecked(qt_resolve_symlinks); + // resolveLinksCheckBox->setChecked(qt_resolve_symlinks); - effectcheckbox->setChecked(QApplication::isEffectEnabled(Qt::UI_General)); - effectbase->setEnabled(effectcheckbox->isChecked()); + ui->effectsCheckBox->setChecked(QApplication::isEffectEnabled(Qt::UI_General)); + ui->effectsFrame->setEnabled(ui->effectsCheckBox->isChecked()); if (QApplication::isEffectEnabled(Qt::UI_FadeMenu)) - menueffect->setCurrentItem(2); + ui->menuEffectCombo->setCurrentIndex(2); else if (QApplication::isEffectEnabled(Qt::UI_AnimateMenu)) - menueffect->setCurrentItem(1); + ui->menuEffectCombo->setCurrentIndex(1); if (QApplication::isEffectEnabled(Qt::UI_AnimateCombo)) - comboeffect->setCurrentItem(1); + ui->comboEffectCombo->setCurrentIndex(1); if (QApplication::isEffectEnabled(Qt::UI_FadeTooltip)) - tooltipeffect->setCurrentItem(2); + ui->toolTipEffectCombo->setCurrentIndex(2); else if (QApplication::isEffectEnabled(Qt::UI_AnimateTooltip)) - tooltipeffect->setCurrentItem(1); + ui->toolTipEffectCombo->setCurrentIndex(1); - if ( QApplication::isEffectEnabled( Qt::UI_AnimateToolBox ) ) - toolboxeffect->setCurrentItem( 1 ); + if (QApplication::isEffectEnabled(Qt::UI_AnimateToolBox)) + ui->toolBoxEffectCombo->setCurrentIndex(1); QSize globalStrut = QApplication::globalStrut(); - strutwidth->setValue(globalStrut.width()); - strutheight->setValue(globalStrut.height()); + ui->strutWidthSpinBox->setValue(globalStrut.width()); + ui->strutHeightSpinBox->setValue(globalStrut.height()); // find the default family QStringList::Iterator sit = families.begin(); @@ -308,10 +334,10 @@ MainWindow::MainWindow() if (i == -1) // no clue about the current font i = 0; - familycombo->setCurrentItem(i); + ui->fontFamilyCombo->setCurrentIndex(i); - QStringList styles = db.styles(familycombo->currentText()); - stylecombo->insertStringList(styles); + QStringList styles = db.styles(ui->fontFamilyCombo->currentText()); + ui->fontStyleCombo->addItems(styles); QString stylestring = db.styleString(QApplication::font()); sit = styles.begin(); @@ -330,91 +356,98 @@ MainWindow::MainWindow() i = possible; if (i == -1) // no clue about the current font i = 0; - stylecombo->setCurrentItem(i); + ui->fontStyleCombo->setCurrentIndex(i); i = 0; - for (int psize = QApplication::font().pointSize(); i < psizecombo->count(); ++i) { - const int sz = psizecombo->text(i).toInt(); + for (int psize = QApplication::font().pointSize(); i < ui->pointSizeCombo->count(); ++i) { + const int sz = ui->pointSizeCombo->itemText(i).toInt(); if (sz == psize) { - psizecombo->setCurrentItem(i); + ui->pointSizeCombo->setCurrentIndex(i); break; } else if(sz > psize) { - psizecombo->insertItem(i, QString::number(psize)); - psizecombo->setCurrentItem(i); + ui->pointSizeCombo->insertItem(i, QString::number(psize)); + ui->pointSizeCombo->setCurrentIndex(i); break; } } - QStringList subs = QFont::substitutes(familysubcombo->currentText()); - sublistbox->clear(); - sublistbox->insertStringList(subs); + QStringList subs = QFont::substitutes(ui->familySubstitutionCombo->currentText()); + ui->substitutionsListBox->clear(); + ui->substitutionsListBox->insertItems(0, subs); - rtlExtensions->setChecked(settings.value(QLatin1String("useRtlExtensions"), false).toBool()); + ui->rtlExtensionsCheckBox->setChecked(settings.value(QLatin1String("useRtlExtensions"), false) + .toBool()); #ifdef Q_WS_X11 - inputStyle->setCurrentText(settings.value(QLatin1String("XIMInputStyle"), trUtf8("On The Spot")).toString()); + QString settingsInputStyle = settings.value(QLatin1String("XIMInputStyle")).toString(); + if (!settingsInputStyle.isEmpty()) + ui->inputStyleCombo->setCurrentIndex(ui->inputStyleCombo->findText(settingsInputStyle)); #else - inputStyle->hide(); - inputStyleLabel->hide(); + ui->inputStyleCombo->hide(); + ui->inputStyleComboLabel->hide(); #endif #if defined(Q_WS_X11) && !defined(QT_NO_XIM) - QStringList inputMethods = QInputContextFactory::keys(); - int inputMethodIndex = -1; + QStringList inputMethodCombo = QInputContextFactory::keys(); + int inputMethodComboIndex = -1; QString defaultInputMethod = settings.value(QLatin1String("DefaultInputMethod"), QLatin1String("xim")).toString(); - for (int i = inputMethods.size()-1; i >= 0; --i) { - const QString &im = inputMethods.at(i); + for (int i = inputMethodCombo.size()-1; i >= 0; --i) { + const QString &im = inputMethodCombo.at(i); if (im.contains(QLatin1String("imsw"))) { - inputMethods.removeAt(i); - if (inputMethodIndex > i) - --inputMethodIndex; + inputMethodCombo.removeAt(i); + if (inputMethodComboIndex > i) + --inputMethodComboIndex; } else if (im == defaultInputMethod) { - inputMethodIndex = i; + inputMethodComboIndex = i; } } - if (inputMethodIndex == -1 && !inputMethods.isEmpty()) - inputMethodIndex = 0; - inputMethod->addItems(inputMethods); - inputMethod->setCurrentIndex(inputMethodIndex); + if (inputMethodComboIndex == -1 && !inputMethodCombo.isEmpty()) + inputMethodComboIndex = 0; + ui->inputMethodCombo->addItems(inputMethodCombo); + ui->inputMethodCombo->setCurrentIndex(inputMethodComboIndex); #else - inputMethod->hide(); - inputMethodLabel->hide(); + ui->inputMethodCombo->hide(); + ui->inputMethodComboLabel->hide(); #endif - fontembeddingcheckbox->setChecked(settings.value(QLatin1String("embedFonts"), true).toBool()); + ui->fontEmbeddingCheckBox->setChecked(settings.value(QLatin1String("embedFonts"), true) + .toBool()); fontpaths = settings.value(QLatin1String("fontPath")).toStringList(); - fontpathlistbox->insertStringList(fontpaths); - - audiosinkCombo->addItem(tr("Auto (default)"), QLatin1String("Auto")); - audiosinkCombo->setItemData(audiosinkCombo->findText(tr("Auto (default)")), - tr("Choose audio output automatically."), Qt::ToolTipRole); - audiosinkCombo->addItem(tr("aRts"), QLatin1String("artssink")); - audiosinkCombo->setItemData(audiosinkCombo->findText(tr("aRts")), - tr("Experimental aRts support for GStreamer."), Qt::ToolTipRole); + ui->fontpathListBox->insertItems(0, fontpaths); + + ui->audiosinkCombo->addItem(tr("Auto (default)"), QLatin1String("Auto")); + ui->audiosinkCombo->setItemData(ui->audiosinkCombo->findText(tr("Auto (default)")), + tr("Choose audio output automatically."), Qt::ToolTipRole); + ui->audiosinkCombo->addItem(tr("aRts"), QLatin1String("artssink")); + ui->audiosinkCombo->setItemData(ui->audiosinkCombo->findText(tr("aRts")), + tr("Experimental aRts support for GStreamer."), + Qt::ToolTipRole); #ifdef HAVE_PHONON - phononVersionLabel->setText(QLatin1String(Phonon::phononVersion())); + ui->phononVersionLabel->setText(QLatin1String(Phonon::phononVersion())); #endif #ifndef QT_NO_GSTREAMER if (gst_init_check(0, 0, 0)) { gchar *versionString = gst_version_string(); - gstversionLabel->setText(QLatin1String(versionString)); + ui->gstVersionLabel->setText(QLatin1String(versionString)); g_free(versionString); - GList* factoryList = gst_registry_get_feature_list(gst_registry_get_default (), GST_TYPE_ELEMENT_FACTORY); + GList *factoryList = gst_registry_get_feature_list(gst_registry_get_default(), + GST_TYPE_ELEMENT_FACTORY); QString name, klass, description; - for (GList* iter = g_list_first(factoryList) ; iter != NULL ; iter = g_list_next(iter)) { + for (GList *iter = g_list_first(factoryList) ; iter != NULL ; iter = g_list_next(iter)) { GstPluginFeature *feature = GST_PLUGIN_FEATURE(iter->data); klass = QLatin1String(gst_element_factory_get_klass(GST_ELEMENT_FACTORY(feature))); if (klass == QLatin1String("Sink/Audio")) { name = QLatin1String(GST_PLUGIN_FEATURE_NAME(feature)); if (name == QLatin1String("sfsink")) - continue; //useless to output audio to file when you cannot set the file path + continue; // useless to output audio to file when you cannot set the file path else if (name == QLatin1String("autoaudiosink")) continue; //This is used implicitly from the auto setting GstElement *sink = gst_element_factory_make (qPrintable(name), NULL); if (sink) { - description = QLatin1String(gst_element_factory_get_description (GST_ELEMENT_FACTORY(feature))); - audiosinkCombo->addItem(name, name); - audiosinkCombo->setItemData(audiosinkCombo->findText(name), description, Qt::ToolTipRole); + description = QLatin1String(gst_element_factory_get_description(GST_ELEMENT_FACTORY(feature))); + ui->audiosinkCombo->addItem(name, name); + ui->audiosinkCombo->setItemData(ui->audiosinkCombo->findText(name), description, + Qt::ToolTipRole); gst_object_unref (sink); } } @@ -422,39 +455,43 @@ MainWindow::MainWindow() g_list_free(factoryList); } #else - tab4->setEnabled(false); - phononLabel->setText(tr("Phonon GStreamer backend not available.")); + ui->phononTab->setEnabled(false); + ui->phononLabel->setText(tr("Phonon GStreamer backend not available.")); #endif - videomodeCombo->addItem(tr("Auto (default)"), QLatin1String("Auto")); - videomodeCombo->setItemData(videomodeCombo->findText(tr("Auto (default)")), tr("Choose render method automatically"), Qt::ToolTipRole); + ui->videomodeCombo->addItem(tr("Auto (default)"), QLatin1String("Auto")); + ui->videomodeCombo->setItemData(ui->videomodeCombo->findText(tr("Auto (default)")), + tr("Choose render method automatically"), Qt::ToolTipRole); #ifdef Q_WS_X11 - videomodeCombo->addItem(tr("X11"), QLatin1String("X11")); - videomodeCombo->setItemData(videomodeCombo->findText(tr("X11")), tr("Use X11 Overlays"), Qt::ToolTipRole); + ui->videomodeCombo->addItem(tr("X11"), QLatin1String("X11")); + ui->videomodeCombo->setItemData(ui->videomodeCombo->findText(tr("X11")), + tr("Use X11 Overlays"), Qt::ToolTipRole); #endif #ifndef QT_NO_OPENGL - videomodeCombo->addItem(tr("OpenGL"), QLatin1String("OpenGL")); - videomodeCombo->setItemData(videomodeCombo->findText(tr("OpenGL")), tr("Use OpenGL if available"), Qt::ToolTipRole); + ui->videomodeCombo->addItem(tr("OpenGL"), QLatin1String("OpenGL")); + ui->videomodeCombo->setItemData(ui->videomodeCombo->findText(tr("OpenGL")), + tr("Use OpenGL if available"), Qt::ToolTipRole); #endif - videomodeCombo->addItem(tr("Software"), QLatin1String("Software")); - videomodeCombo->setItemData(videomodeCombo->findText(tr("Software")), tr("Use simple software rendering"), Qt::ToolTipRole); + ui->videomodeCombo->addItem(tr("Software"), QLatin1String("Software")); + ui->videomodeCombo->setItemData(ui->videomodeCombo->findText(tr("Software")), + tr("Use simple software rendering"), Qt::ToolTipRole); QString audioSink = settings.value(QLatin1String("audiosink"), QLatin1String("Auto")).toString(); QString videoMode = settings.value(QLatin1String("videomode"), QLatin1String("Auto")).toString(); - audiosinkCombo->setCurrentItem(audiosinkCombo->findData(audioSink)); - videomodeCombo->setCurrentItem(videomodeCombo->findData(videoMode)); + ui->audiosinkCombo->setCurrentIndex(ui->audiosinkCombo->findData(audioSink)); + ui->videomodeCombo->setCurrentIndex(ui->videomodeCombo->findData(videoMode)); settings.endGroup(); // Qt - helpview->setText(tr(appearance_text)); + ui->helpView->setText(tr(appearance_text)); setModified(false); updateStyleLayout(); } - MainWindow::~MainWindow() { + delete ui; } #ifdef Q_WS_X11 @@ -474,23 +511,23 @@ void MainWindow::fileSave() QSettings settings(QLatin1String("Trolltech")); settings.beginGroup(QLatin1String("Qt")); QFontDatabase db; - QFont font = db.font(familycombo->currentText(), - stylecombo->currentText(), - psizecombo->currentText().toInt()); + QFont font = db.font(ui->fontFamilyCombo->currentText(), + ui->fontStyleCombo->currentText(), + ui->pointSizeCombo->currentText().toInt()); QStringList actcg, inactcg, discg; - bool overrideDesktopSettings = (gstylecombo->currentText() != desktopThemeName); + bool overrideDesktopSettings = (ui->guiStyleCombo->currentText() != desktopThemeName); if (overrideDesktopSettings) { int i; - for (i = 0; i < QColorGroup::NColorRoles; i++) + for (i = 0; i < QPalette::NColorRoles; i++) actcg << editPalette.color(QPalette::Active, - (QColorGroup::ColorRole) i).name(); - for (i = 0; i < QColorGroup::NColorRoles; i++) + QPalette::ColorRole(i)).name(); + for (i = 0; i < QPalette::NColorRoles; i++) inactcg << editPalette.color(QPalette::Inactive, - (QColorGroup::ColorRole) i).name(); - for (i = 0; i < QColorGroup::NColorRoles; i++) + QPalette::ColorRole(i)).name(); + for (i = 0; i < QPalette::NColorRoles; i++) discg << editPalette.color(QPalette::Disabled, - (QColorGroup::ColorRole) i).name(); + QPalette::ColorRole(i)).name(); } settings.setValue(QLatin1String("font"), font.toString()); @@ -499,59 +536,63 @@ void MainWindow::fileSave() settings.setValue(QLatin1String("Palette/disabled"), discg); settings.setValue(QLatin1String("fontPath"), fontpaths); - settings.setValue(QLatin1String("embedFonts"), fontembeddingcheckbox->isChecked()); - settings.setValue(QLatin1String("style"), overrideDesktopSettings ? gstylecombo->currentText() : QString()); + settings.setValue(QLatin1String("embedFonts"), ui->fontEmbeddingCheckBox->isChecked()); + settings.setValue(QLatin1String("style"), + overrideDesktopSettings ? ui->guiStyleCombo->currentText() : QString()); - settings.setValue(QLatin1String("doubleClickInterval"), dcispin->value()); - settings.setValue(QLatin1String("cursorFlashTime"), cfispin->value() == 9 ? 0 : cfispin->value() ); - settings.setValue(QLatin1String("wheelScrollLines"), wslspin->value()); - settings.setValue(QLatin1String("resolveSymlinks"), resolvelinks->isChecked()); + settings.setValue(QLatin1String("doubleClickInterval"), ui->doubleClickIntervalSpinBox->value()); + settings.setValue(QLatin1String("cursorFlashTime"), + ui->cursorFlashTimeSpinBox->value() == 9 ? 0 : ui->cursorFlashTimeSpinBox->value()); + settings.setValue(QLatin1String("wheelScrollLines"), ui->wheelScrollLinesSpinBox->value()); + settings.setValue(QLatin1String("resolveSymlinks"), ui->resolveLinksCheckBox->isChecked()); - QSize strut(strutwidth->value(), strutheight->value()); + QSize strut(ui->strutWidthSpinBox->value(), ui->strutHeightSpinBox->value()); settings.setValue(QLatin1String("globalStrut/width"), strut.width()); settings.setValue(QLatin1String("globalStrut/height"), strut.height()); - settings.setValue(QLatin1String("useRtlExtensions"), rtlExtensions->isChecked()); + settings.setValue(QLatin1String("useRtlExtensions"), ui->rtlExtensionsCheckBox->isChecked()); #ifdef Q_WS_X11 - QString style = inputStyle->currentText(); + QString style = ui->inputStyleCombo->currentText(); QString str = QLatin1String("On The Spot"); - if ( style == trUtf8( "Over The Spot" ) ) + if (style == tr("Over The Spot")) str = QLatin1String("Over The Spot"); - else if ( style == trUtf8( "Off The Spot" ) ) + else if (style == tr("Off The Spot")) str = QLatin1String("Off The Spot"); - else if ( style == trUtf8( "Root" ) ) + else if (style == tr("Root")) str = QLatin1String("Root"); - settings.setValue( QLatin1String("XIMInputStyle"), str ); + settings.setValue(QLatin1String("XIMInputStyle"), str); #endif #if defined(Q_WS_X11) && !defined(QT_NO_XIM) - settings.setValue(QLatin1String("DefaultInputMethod"), inputMethod->currentText()); + settings.setValue(QLatin1String("DefaultInputMethod"), ui->inputMethodCombo->currentText()); #endif QString audioSink = settings.value(QLatin1String("audiosink"), QLatin1String("Auto")).toString(); QString videoMode = settings.value(QLatin1String("videomode"), QLatin1String("Auto")).toString(); - settings.setValue(QLatin1String("audiosink"), audiosinkCombo->itemData(audiosinkCombo->currentIndex())); - settings.setValue(QLatin1String("videomode"), videomodeCombo->itemData(videomodeCombo->currentIndex())); + settings.setValue(QLatin1String("audiosink"), + ui->audiosinkCombo->itemData(ui->audiosinkCombo->currentIndex())); + settings.setValue(QLatin1String("videomode"), + ui->videomodeCombo->itemData(ui->videomodeCombo->currentIndex())); QStringList effects; - if (effectcheckbox->isChecked()) { + if (ui->effectsCheckBox->isChecked()) { effects << QLatin1String("general"); - switch (menueffect->currentItem()) { + switch (ui->menuEffectCombo->currentIndex()) { case 1: effects << QLatin1String("animatemenu"); break; case 2: effects << QLatin1String("fademenu"); break; } - switch (comboeffect->currentItem()) { + switch (ui->comboEffectCombo->currentIndex()) { case 1: effects << QLatin1String("animatecombo"); break; } - switch (tooltipeffect->currentItem()) { + switch (ui->toolTipEffectCombo->currentIndex()) { case 1: effects << QLatin1String("animatetooltip"); break; case 2: effects << QLatin1String("fadetooltip"); break; } - switch ( toolboxeffect->currentItem() ) { + switch (ui->toolBoxEffectCombo->currentIndex()) { case 1: effects << QLatin1String("animatetoolbox"); break; } } else @@ -575,189 +616,63 @@ void MainWindow::fileSave() #endif // Q_WS_X11 setModified(false); - statusBar()->showMessage(QLatin1String("Saved changes.")); + statusBar()->showMessage(tr("Saved changes.")); } - void MainWindow::fileExit() { qApp->closeAllWindows(); } - void MainWindow::setModified(bool m) { if (modified == m) return; modified = m; - fileSaveAction->setEnabled(m); + ui->fileSaveAction->setEnabled(m); } - void MainWindow::buildPalette() { - int i; - QColorGroup cg; - QColor btn = buttonMainColor->color(); - QColor back = buttonMainColor2->color(); - QPalette automake( btn, back ); - - for (i = 0; i<9; i++) - cg.setColor( centralFromItem(i), automake.active().color( centralFromItem(i) ) ); - - editPalette.setActive( cg ); - buildActiveEffect(); - - cg = editPalette.inactive(); - - QPalette temp( editPalette.active().color( QColorGroup::Button ), - editPalette.active().color( QColorGroup::Window ) ); - - for (i = 0; i<9; i++) - cg.setColor( centralFromItem(i), temp.inactive().color( centralFromItem(i) ) ); - - editPalette.setInactive( cg ); - buildInactiveEffect(); - - cg = editPalette.disabled(); - - for (i = 0; i<9; i++) - cg.setColor( centralFromItem(i), temp.disabled().color( centralFromItem(i) ) ); - - editPalette.setDisabled( cg ); - buildDisabledEffect(); + QPalette temp(ui->buttonMainColor->color(), ui->buttonWindowColor->color()); + for (int i = 0; i < QPalette::NColorGroups; i++) + temp = PaletteEditorAdvanced::buildEffect(QPalette::ColorGroup(i), temp); + editPalette = temp; + setPreviewPalette(editPalette); updateColorButtons(); setModified(true); } - -void MainWindow::buildActiveEffect() -{ - QColorGroup cg = editPalette.active(); - QColor btn = cg.color( QColorGroup::Button ); - - QPalette temp( btn, btn ); - - for (int i = 0; i<5; i++) - cg.setColor( effectFromItem(i), temp.active().color( effectFromItem(i) ) ); - - editPalette.setActive( cg ); - setPreviewPalette( editPalette ); - - updateColorButtons(); -} - - -void MainWindow::buildInactive() +void MainWindow::setPreviewPalette(const QPalette &pal) { - editPalette.setInactive( editPalette.active() ); - buildInactiveEffect(); -} - + QPalette::ColorGroup colorGroup = groupFromIndex(ui->paletteCombo->currentIndex()); -void MainWindow::buildInactiveEffect() -{ - QColorGroup cg = editPalette.inactive(); - - QColor light, midlight, mid, dark, shadow; - QColor btn = cg.color( QColorGroup::Button ); - - light = btn.light(150); - midlight = btn.light(115); - mid = btn.dark(150); - dark = btn.dark(); - shadow = Qt::black; - - cg.setColor( QColorGroup::Light, light ); - cg.setColor( QColorGroup::Midlight, midlight ); - cg.setColor( QColorGroup::Mid, mid ); - cg.setColor( QColorGroup::Dark, dark ); - cg.setColor( QColorGroup::Shadow, shadow ); - - editPalette.setInactive( cg ); - setPreviewPalette( editPalette ); - updateColorButtons(); -} - - -void MainWindow::buildDisabled() -{ - QColorGroup cg = editPalette.active(); - cg.setColor( QColorGroup::ButtonText, Qt::darkGray ); - cg.setColor( QColorGroup::WindowText, Qt::darkGray ); - cg.setColor( QColorGroup::Text, Qt::darkGray ); - cg.setColor( QColorGroup::HighlightedText, Qt::darkGray ); - editPalette.setDisabled( cg ); - - buildDisabledEffect(); -} - - -void MainWindow::buildDisabledEffect() -{ - QColorGroup cg = editPalette.disabled(); - - QColor light, midlight, mid, dark, shadow; - QColor btn = cg.color( QColorGroup::Button ); - - light = btn.light(150); - midlight = btn.light(115); - mid = btn.dark(150); - dark = btn.dark(); - shadow = Qt::black; - - cg.setColor( QColorGroup::Light, light ); - cg.setColor( QColorGroup::Midlight, midlight ); - cg.setColor( QColorGroup::Mid, mid ); - cg.setColor( QColorGroup::Dark, dark ); - cg.setColor( QColorGroup::Shadow, shadow ); - - editPalette.setDisabled( cg ); - setPreviewPalette( editPalette ); - updateColorButtons(); -} - - -void MainWindow::setPreviewPalette( const QPalette& pal ) -{ - QColorGroup cg; - - switch (paletteCombo->currentItem()) { - case 0: - default: - cg = pal.active(); - break; - case 1: - cg = pal.inactive(); - break; - case 2: - cg = pal.disabled(); - break; + for (int i = 0; i < QPalette::NColorGroups; i++) { + for (int j = 0; j < QPalette::NColorRoles; j++) { + QPalette::ColorGroup targetGroup = QPalette::ColorGroup(i); + QPalette::ColorRole targetRole = QPalette::ColorRole(j); + previewPalette.setColor(targetGroup, targetRole, pal.color(colorGroup, targetRole)); + } } - previewPalette.setActive( cg ); - previewPalette.setInactive( cg ); - previewPalette.setDisabled( cg ); - previewFrame->setPreviewPalette(previewPalette); + ui->previewFrame->setPreviewPalette(previewPalette); } - void MainWindow::updateColorButtons() { - buttonMainColor->setColor( editPalette.active().color( QColorGroup::Button )); - buttonMainColor2->setColor( editPalette.active().color( QColorGroup::Window )); + ui->buttonMainColor->setColor(editPalette.color(QPalette::Active, QPalette::Button)); + ui->buttonWindowColor->setColor(editPalette.color(QPalette::Active, QPalette::Window)); } - void MainWindow::tunePalette() { bool ok; QPalette pal = PaletteEditorAdvanced::getPalette(&ok, editPalette, - backgroundMode(), this); - if (! ok) + backgroundRole(), this); + if (!ok) return; editPalette = pal; @@ -765,7 +680,6 @@ void MainWindow::tunePalette() setModified(true); } - void MainWindow::paletteSelected(int) { setPreviewPalette(editPalette); @@ -773,10 +687,10 @@ void MainWindow::paletteSelected(int) void MainWindow::updateStyleLayout() { - QString currentStyle = gstylecombo->currentText(); + QString currentStyle = ui->guiStyleCombo->currentText(); bool autoStyle = (currentStyle == desktopThemeName); - previewFrame->setPreviewVisible(!autoStyle); - groupAutoPalette->setEnabled(currentStyle.toLower() != QLatin1String("gtk") && !autoStyle); + ui->previewFrame->setPreviewVisible(!autoStyle); + ui->buildPaletteGroup->setEnabled(currentStyle.toLower() != QLatin1String("gtk") && !autoStyle); } void MainWindow::styleSelected(const QString &stylename) @@ -788,7 +702,7 @@ void MainWindow::styleSelected(const QString &stylename) style = QStyleFactory::create(stylename); if (!style) return; - setStyleHelper(previewFrame, style); + setStyleHelper(ui->previewFrame, style); delete previewstyle; previewstyle = style; setModified(true); @@ -796,210 +710,191 @@ void MainWindow::styleSelected(const QString &stylename) updateStyleLayout(); } - void MainWindow::familySelected(const QString &family) { QFontDatabase db; QStringList styles = db.styles(family); - stylecombo->clear(); - stylecombo->insertStringList(styles); - familysubcombo->insertItem(family); + ui->fontStyleCombo->clear(); + ui->fontStyleCombo->addItems(styles); + ui->familySubstitutionCombo->addItem(family); buildFont(); } - void MainWindow::buildFont() { QFontDatabase db; - QFont font = db.font(familycombo->currentText(), - stylecombo->currentText(), - psizecombo->currentText().toInt()); - samplelineedit->setFont(font); + QFont font = db.font(ui->fontFamilyCombo->currentText(), + ui->fontStyleCombo->currentText(), + ui->pointSizeCombo->currentText().toInt()); + ui->sampleLineEdit->setFont(font); setModified(true); } - void MainWindow::substituteSelected(const QString &family) { QStringList subs = QFont::substitutes(family); - sublistbox->clear(); - sublistbox->insertStringList(subs); + ui->substitutionsListBox->clear(); + ui->substitutionsListBox->insertItems(0, subs); } - void MainWindow::removeSubstitute() { - if (sublistbox->currentItem() < 0 || - uint(sublistbox->currentItem()) > sublistbox->count()) + if (!ui->substitutionsListBox->currentItem()) return; - int item = sublistbox->currentItem(); - QStringList subs = QFont::substitutes(familysubcombo->currentText()); - subs.removeAt(sublistbox->currentItem()); - sublistbox->clear(); - sublistbox->insertStringList(subs); - if (uint(item) > sublistbox->count()) - item = int(sublistbox->count()) - 1; - sublistbox->setCurrentItem(item); - QFont::removeSubstitution(familysubcombo->currentText()); - QFont::insertSubstitutions(familysubcombo->currentText(), subs); + int row = ui->substitutionsListBox->currentRow(); + QStringList subs = QFont::substitutes(ui->familySubstitutionCombo->currentText()); + subs.removeAt(ui->substitutionsListBox->currentRow()); + ui->substitutionsListBox->clear(); + ui->substitutionsListBox->insertItems(0, subs); + if (row > ui->substitutionsListBox->count()) + row = ui->substitutionsListBox->count() - 1; + ui->substitutionsListBox->setCurrentRow(row); + QFont::removeSubstitution(ui->familySubstitutionCombo->currentText()); + QFont::insertSubstitutions(ui->familySubstitutionCombo->currentText(), subs); setModified(true); } - void MainWindow::addSubstitute() { - if (sublistbox->currentItem() < 0 || - uint(sublistbox->currentItem()) > sublistbox->count()) { - QFont::insertSubstitution(familysubcombo->currentText(), choosesubcombo->currentText()); - QStringList subs = QFont::substitutes(familysubcombo->currentText()); - sublistbox->clear(); - sublistbox->insertStringList(subs); + if (!ui->substitutionsListBox->currentItem()) { + QFont::insertSubstitution(ui->familySubstitutionCombo->currentText(), + ui->chooseSubstitutionCombo->currentText()); + QStringList subs = QFont::substitutes(ui->familySubstitutionCombo->currentText()); + ui->substitutionsListBox->clear(); + ui->substitutionsListBox->insertItems(0, subs); setModified(true); return; } - int item = sublistbox->currentItem(); - QFont::insertSubstitution(familysubcombo->currentText(), choosesubcombo->currentText()); - QStringList subs = QFont::substitutes(familysubcombo->currentText()); - sublistbox->clear(); - sublistbox->insertStringList(subs); - sublistbox->setCurrentItem(item); + int row = ui->substitutionsListBox->currentRow(); + QFont::insertSubstitution(ui->familySubstitutionCombo->currentText(), ui->chooseSubstitutionCombo->currentText()); + QStringList subs = QFont::substitutes(ui->familySubstitutionCombo->currentText()); + ui->substitutionsListBox->clear(); + ui->substitutionsListBox->insertItems(0, subs); + ui->substitutionsListBox->setCurrentRow(row); setModified(true); } - void MainWindow::downSubstitute() { - if (sublistbox->currentItem() < 0 || - uint(sublistbox->currentItem()) >= sublistbox->count()) + if (!ui->substitutionsListBox->currentItem() || ui->substitutionsListBox->currentRow() >= ui->substitutionsListBox->count()) return; - int item = sublistbox->currentItem(); - QStringList subs = QFont::substitutes(familysubcombo->currentText()); - QString fam = subs.at(item); - subs.removeAt(item); - subs.insert(item+1, fam); - sublistbox->clear(); - sublistbox->insertStringList(subs); - sublistbox->setCurrentItem(item + 1); - QFont::removeSubstitution(familysubcombo->currentText()); - QFont::insertSubstitutions(familysubcombo->currentText(), subs); + int row = ui->substitutionsListBox->currentRow(); + QStringList subs = QFont::substitutes(ui->familySubstitutionCombo->currentText()); + QString fam = subs.at(row); + subs.removeAt(row); + subs.insert(row + 1, fam); + ui->substitutionsListBox->clear(); + ui->substitutionsListBox->insertItems(0, subs); + ui->substitutionsListBox->setCurrentRow(row + 1); + QFont::removeSubstitution(ui->familySubstitutionCombo->currentText()); + QFont::insertSubstitutions(ui->familySubstitutionCombo->currentText(), subs); setModified(true); } - void MainWindow::upSubstitute() { - if (sublistbox->currentItem() < 1) + if (!ui->substitutionsListBox->currentItem() || ui->substitutionsListBox->currentRow() < 1) return; - int item = sublistbox->currentItem(); - QStringList subs = QFont::substitutes(familysubcombo->currentText()); - QString fam = subs.at(item); - subs.removeAt(item); - subs.insert(item-1, fam); - sublistbox->clear(); - sublistbox->insertStringList(subs); - sublistbox->setCurrentItem(item - 1); - QFont::removeSubstitution(familysubcombo->currentText()); - QFont::insertSubstitutions(familysubcombo->currentText(), subs); + int row = ui->substitutionsListBox->currentRow(); + QStringList subs = QFont::substitutes(ui->familySubstitutionCombo->currentText()); + QString fam = subs.at(row); + subs.removeAt(row); + subs.insert(row-1, fam); + ui->substitutionsListBox->clear(); + ui->substitutionsListBox->insertItems(0, subs); + ui->substitutionsListBox->setCurrentRow(row - 1); + QFont::removeSubstitution(ui->familySubstitutionCombo->currentText()); + QFont::insertSubstitutions(ui->familySubstitutionCombo->currentText(), subs); setModified(true); } - void MainWindow::removeFontpath() { - if (fontpathlistbox->currentItem() < 0 || - uint(fontpathlistbox->currentItem()) > fontpathlistbox->count()) + if (!ui->fontpathListBox->currentItem()) return; - int item = fontpathlistbox->currentItem(); - fontpaths.removeAt(fontpathlistbox->currentItem()); - fontpathlistbox->clear(); - fontpathlistbox->insertStringList(fontpaths); - if (uint(item) > fontpathlistbox->count()) - item = int(fontpathlistbox->count()) - 1; - fontpathlistbox->setCurrentItem(item); + int row = ui->fontpathListBox->currentRow(); + fontpaths.removeAt(row); + ui->fontpathListBox->clear(); + ui->fontpathListBox->insertItems(0, fontpaths); + if (row > ui->fontpathListBox->count()) + row = ui->fontpathListBox->count() - 1; + ui->fontpathListBox->setCurrentRow(row); setModified(true); } - void MainWindow::addFontpath() { - if (fontpathlineedit->text().isEmpty()) + if (ui->fontPathLineEdit->text().isEmpty()) return; - if (fontpathlistbox->currentItem() < 0 || - uint(fontpathlistbox->currentItem()) > fontpathlistbox->count()) { - fontpaths.append(fontpathlineedit->text()); - fontpathlistbox->clear(); - fontpathlistbox->insertStringList(fontpaths); + if (!ui->fontpathListBox->currentItem()) { + fontpaths.append(ui->fontPathLineEdit->text()); + ui->fontpathListBox->clear(); + ui->fontpathListBox->insertItems(0, fontpaths); setModified(true); return; } - int item = fontpathlistbox->currentItem(); - fontpaths.insert(fontpathlistbox->currentItem()+1, - fontpathlineedit->text()); - fontpathlistbox->clear(); - fontpathlistbox->insertStringList(fontpaths); - fontpathlistbox->setCurrentItem(item); + int row = ui->fontpathListBox->currentRow(); + fontpaths.insert(row + 1, ui->fontPathLineEdit->text()); + ui->fontpathListBox->clear(); + ui->fontpathListBox->insertItems(0, fontpaths); + ui->fontpathListBox->setCurrentRow(row); setModified(true); } - void MainWindow::downFontpath() { - if (fontpathlistbox->currentItem() < 0 || - uint(fontpathlistbox->currentItem()) >= fontpathlistbox->count() - 1) + if (!ui->fontpathListBox->currentItem() + || ui->fontpathListBox->currentRow() >= (ui->fontpathListBox->count() - 1)) { return; + } - int item = fontpathlistbox->currentItem(); - QString fam = fontpaths.at(item); - fontpaths.removeAt(item); - fontpaths.insert(item+1, fam); - fontpathlistbox->clear(); - fontpathlistbox->insertStringList(fontpaths); - fontpathlistbox->setCurrentItem(item + 1); + int row = ui->fontpathListBox->currentRow(); + QString fam = fontpaths.at(row); + fontpaths.removeAt(row); + fontpaths.insert(row + 1, fam); + ui->fontpathListBox->clear(); + ui->fontpathListBox->insertItems(0, fontpaths); + ui->fontpathListBox->setCurrentRow(row + 1); setModified(true); } - void MainWindow::upFontpath() { - if (fontpathlistbox->currentItem() < 1) + if (!ui->fontpathListBox->currentItem() || ui->fontpathListBox->currentRow() < 1) return; - int item = fontpathlistbox->currentItem(); - QString fam = fontpaths.at(item); - fontpaths.removeAt(item); - fontpaths.insert(item-1, fam); - fontpathlistbox->clear(); - fontpathlistbox->insertStringList(fontpaths); - fontpathlistbox->setCurrentItem(item - 1); + int row = ui->fontpathListBox->currentRow(); + QString fam = fontpaths.at(row); + fontpaths.removeAt(row); + fontpaths.insert(row - 1, fam); + ui->fontpathListBox->clear(); + ui->fontpathListBox->insertItems(0, fontpaths); + ui->fontpathListBox->setCurrentRow(row - 1); setModified(true); } - void MainWindow::browseFontpath() { - QString dirname = QFileDialog::getExistingDirectory(QString(), this, 0, - tr("Select a Directory")); + QString dirname = QFileDialog::getExistingDirectory(this, tr("Select a Directory")); if (dirname.isNull()) return; - fontpathlineedit->setText(dirname); + ui->fontPathLineEdit->setText(dirname); } - void MainWindow::somethingModified() { setModified(true); } - void MainWindow::helpAbout() { QMessageBox box(this); @@ -1012,44 +907,42 @@ void MainWindow::helpAbout() box.exec(); } - void MainWindow::helpAboutQt() { QMessageBox::aboutQt(this, tr("Qt Configuration")); } - void MainWindow::pageChanged(QWidget *page) { - if (page == tab) - helpview->setText(tr(interface_text)); - else if (page == tab1) - helpview->setText(tr(appearance_text)); - else if (page == tab2) - helpview->setText(tr(font_text)); - else if (page == tab3) - helpview->setText(tr(printer_text)); - else if (page == tab4) - helpview->setText(tr(phonon_text)); + if (page == ui->interfaceTab) + ui->helpView->setText(tr(interface_text)); + else if (page == ui->appearanceTab) + ui->helpView->setText(tr(appearance_text)); + else if (page == ui->fontsTab) + ui->helpView->setText(tr(font_text)); + else if (page == ui->printerTab) + ui->helpView->setText(tr(printer_text)); + else if (page == ui->phononTab) + ui->helpView->setText(tr(phonon_text)); } - void MainWindow::closeEvent(QCloseEvent *e) { if (modified) { - switch(QMessageBox::warning(this, tr("Save Changes"), - tr("Save changes to settings?"), - tr("&Yes"), tr("&No"), tr("&Cancel"), 0, 2)) { - case 0: // save + switch (QMessageBox::warning(this, tr("Save Changes"), + tr("Save changes to settings?"), + (QMessageBox::Yes | QMessageBox::No + | QMessageBox::Cancel))) { + case QMessageBox::Yes: // save qApp->processEvents(); fileSave(); // fall through intended - case 1: // don't save + case QMessageBox::No: // don't save e->accept(); break; - case 2: // cancel + case QMessageBox::Cancel: // cancel e->ignore(); break; diff --git a/tools/qtconfig/mainwindow.h b/tools/qtconfig/mainwindow.h index cc7d597..0cd2b29 100644 --- a/tools/qtconfig/mainwindow.h +++ b/tools/qtconfig/mainwindow.h @@ -42,11 +42,15 @@ #ifndef MAINWINDOW_H #define MAINWINDOW_H -#include "mainwindowbase.h" +#include <QtGui/QMainWindow> QT_BEGIN_NAMESPACE -class MainWindow : public MainWindowBase +namespace Ui { + class MainWindow; +} + +class MainWindow : public QMainWindow { Q_OBJECT @@ -56,7 +60,6 @@ public: void closeEvent(QCloseEvent *); - public slots: virtual void buildPalette(); virtual void buildFont(); @@ -83,21 +86,17 @@ public slots: private: - void buildActive(); - void buildActiveEffect(); - void buildInactive(); - void buildInactiveEffect(); - void buildDisabled(); - void buildDisabledEffect(); - void updateColorButtons(); void updateFontSample(); void updateStyleLayout(); + static QPalette::ColorGroup groupFromIndex(int); + void setPreviewPalette(const QPalette &); void setModified(bool); + Ui::MainWindow *ui; QString desktopThemeName; QPalette editPalette, previewPalette; QStyle *previewstyle; diff --git a/tools/qtconfig/mainwindow.ui b/tools/qtconfig/mainwindow.ui new file mode 100644 index 0000000..d906800 --- /dev/null +++ b/tools/qtconfig/mainwindow.ui @@ -0,0 +1,1388 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <comment>********************************************************************* +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +*********************************************************************</comment> + <class>MainWindow</class> + <widget class="QMainWindow" name="MainWindow"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>815</width> + <height>716</height> + </rect> + </property> + <property name="windowTitle"> + <string>Qt Configuration</string> + </property> + <widget class="QWidget" name="widget"> + <layout class="QGridLayout" name="gridLayout"> + <property name="margin"> + <number>8</number> + </property> + <item row="0" column="0"> + <widget class="QTextEdit" name="helpView"> + <property name="minimumSize"> + <size> + <width>200</width> + <height>0</height> + </size> + </property> + <property name="readOnly"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QTabWidget" name="mainTabWidget"> + <property name="currentIndex"> + <number>0</number> + </property> + <widget class="QWidget" name="appearanceTab"> + <attribute name="title"> + <string>Appearance</string> + </attribute> + <layout class="QGridLayout" name="gridLayout_5"> + <item row="0" column="0"> + <widget class="QGroupBox" name="guiStyleGroup"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="title"> + <string>GUI Style</string> + </property> + <layout class="QHBoxLayout"> + <property name="spacing"> + <number>4</number> + </property> + <property name="margin"> + <number>8</number> + </property> + <item> + <widget class="QLabel" name="guiStyleLabel"> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>Select GUI &Style:</string> + </property> + <property name="buddy"> + <cstring>guiStyleCombo</cstring> + </property> + </widget> + </item> + <item> + <widget class="QComboBox" name="guiStyleCombo"/> + </item> + </layout> + </widget> + </item> + <item row="3" column="0"> + <widget class="QGroupBox" name="previewGroup"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Expanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="title"> + <string>Preview</string> + </property> + <layout class="QGridLayout" name="gridLayout_4"> + <item row="0" column="0"> + <widget class="QLabel" name="paletteLabel"> + <property name="text"> + <string>Select &Palette:</string> + </property> + <property name="buddy"> + <cstring>paletteCombo</cstring> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QComboBox" name="paletteCombo"> + <item> + <property name="text"> + <string>Active Palette</string> + </property> + </item> + <item> + <property name="text"> + <string>Inactive Palette</string> + </property> + </item> + <item> + <property name="text"> + <string>Disabled Palette</string> + </property> + </item> + </widget> + </item> + <item row="1" column="0" colspan="2"> + <widget class="PreviewFrame" name="previewFrame" native="true"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Expanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>410</width> + <height>260</height> + </size> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item row="1" column="0"> + <widget class="QGroupBox" name="buildPaletteGroup"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>400</width> + <height>0</height> + </size> + </property> + <property name="title"> + <string>Build Palette</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <item> + <widget class="QWidget" name="colorConfig" native="true"> + <layout class="QHBoxLayout" name="horizontalLayout_2"> + <property name="margin"> + <number>0</number> + </property> + <item> + <widget class="QLabel" name="labelMainColor"> + <property name="text"> + <string>&Button Background:</string> + </property> + <property name="buddy"> + <cstring>buttonMainColor</cstring> + </property> + </widget> + </item> + <item> + <widget class="ColorButton" name="buttonMainColor" native="true"/> + </item> + <item> + <widget class="QLabel" name="labelWindowColor"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>50</width> + <height>0</height> + </size> + </property> + <property name="lineWidth"> + <number>1</number> + </property> + <property name="midLineWidth"> + <number>0</number> + </property> + <property name="text"> + <string>Window Back&ground:</string> + </property> + <property name="alignment"> + <set>Qt::AlignVCenter</set> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="buddy"> + <cstring>buttonWindowColor</cstring> + </property> + </widget> + </item> + <item> + <widget class="ColorButton" name="buttonWindowColor" native="true"/> + </item> + <item> + <spacer name="spacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Expanding</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>70</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QPushButton" name="tunePaletteButton"> + <property name="text"> + <string>&Tune Palette...</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QLabel" name="kdeNoteLabel"> + <property name="text"> + <string>Please use the KDE Control Center to set the palette.</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + </layout> + </widget> + <widget class="QWidget" name="fontsTab"> + <attribute name="title"> + <string>Fonts</string> + </attribute> + <layout class="QVBoxLayout"> + <item> + <widget class="QGroupBox" name="defaultFontGroup"> + <property name="title"> + <string>Default Font</string> + </property> + <layout class="QGridLayout"> + <property name="margin"> + <number>8</number> + </property> + <property name="spacing"> + <number>4</number> + </property> + <item row="1" column="1"> + <widget class="QComboBox" name="fontStyleCombo"> + <property name="autoCompletion"> + <bool>true</bool> + </property> + <property name="duplicatesEnabled"> + <bool>false</bool> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QComboBox" name="fontFamilyCombo"> + <property name="autoCompletion"> + <bool>true</bool> + </property> + <property name="duplicatesEnabled"> + <bool>false</bool> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QComboBox" name="pointSizeCombo"> + <property name="editable"> + <bool>true</bool> + </property> + <property name="autoCompletion"> + <bool>true</bool> + </property> + <property name="duplicatesEnabled"> + <bool>false</bool> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="fontStyleLabel"> + <property name="text"> + <string>&Style:</string> + </property> + <property name="buddy"> + <cstring>fontStyleCombo</cstring> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="pointSizeLabel"> + <property name="text"> + <string>&Point Size:</string> + </property> + <property name="buddy"> + <cstring>pointSizeCombo</cstring> + </property> + </widget> + </item> + <item row="0" column="0"> + <widget class="QLabel" name="fontFamilyLabel"> + <property name="text"> + <string>F&amily:</string> + </property> + <property name="buddy"> + <cstring>fontFamilyCombo</cstring> + </property> + </widget> + </item> + <item row="3" column="0" colspan="2"> + <widget class="QLineEdit" name="sampleLineEdit"> + <property name="text"> + <string>Sample Text</string> + </property> + <property name="alignment"> + <set>Qt::AlignHCenter</set> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="fontSubstitutionGroup"> + <property name="title"> + <string>Font Substitution</string> + </property> + <layout class="QVBoxLayout"> + <property name="spacing"> + <number>4</number> + </property> + <property name="margin"> + <number>8</number> + </property> + <item> + <layout class="QHBoxLayout"> + <property name="spacing"> + <number>4</number> + </property> + <property name="margin"> + <number>0</number> + </property> + <item> + <widget class="QLabel" name="familySubstitutionLabel"> + <property name="text"> + <string>S&elect or Enter a Family:</string> + </property> + <property name="buddy"> + <cstring>familySubstitutionCombo</cstring> + </property> + </widget> + </item> + <item> + <widget class="QComboBox" name="familySubstitutionCombo"> + <property name="editable"> + <bool>true</bool> + </property> + <property name="autoCompletion"> + <bool>true</bool> + </property> + <property name="duplicatesEnabled"> + <bool>false</bool> + </property> + </widget> + </item> + </layout> + </item> + <item> + <widget class="Line" name="Line1"> + <property name="frameShape"> + <enum>QFrame::HLine</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Sunken</enum> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="substitutionsLabel"> + <property name="text"> + <string>Current Substitutions:</string> + </property> + </widget> + </item> + <item> + <widget class="QListWidget" name="substitutionsListBox"/> + </item> + <item> + <layout class="QHBoxLayout"> + <property name="spacing"> + <number>4</number> + </property> + <property name="margin"> + <number>0</number> + </property> + <item> + <widget class="QPushButton" name="upSubstitutionButton"> + <property name="text"> + <string>Up</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="downSubstitutionButton"> + <property name="text"> + <string>Down</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="removeSubstitutionButton"> + <property name="text"> + <string>Remove</string> + </property> + </widget> + </item> + </layout> + </item> + <item> + <widget class="Line" name="Line2"> + <property name="frameShape"> + <enum>QFrame::HLine</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Sunken</enum> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + </widget> + </item> + <item> + <layout class="QHBoxLayout"> + <property name="spacing"> + <number>4</number> + </property> + <property name="margin"> + <number>0</number> + </property> + <item> + <widget class="QLabel" name="chooseSubstitutionLabel"> + <property name="text"> + <string>Select s&ubstitute Family:</string> + </property> + <property name="buddy"> + <cstring>chooseSubstitutionCombo</cstring> + </property> + </widget> + </item> + <item> + <widget class="QComboBox" name="chooseSubstitutionCombo"> + <property name="autoCompletion"> + <bool>true</bool> + </property> + <property name="duplicatesEnabled"> + <bool>false</bool> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="addSubstitutionButton"> + <property name="text"> + <string>Add</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + </item> + </layout> + </widget> + <widget class="QWidget" name="interfaceTab"> + <attribute name="title"> + <string>Interface</string> + </attribute> + <layout class="QVBoxLayout"> + <item> + <widget class="QGroupBox" name="feelSettingsGroup"> + <property name="title"> + <string>Feel Settings</string> + </property> + <layout class="QGridLayout"> + <property name="margin"> + <number>8</number> + </property> + <property name="spacing"> + <number>4</number> + </property> + <item row="0" column="1"> + <widget class="QSpinBox" name="doubleClickIntervalSpinBox"> + <property name="suffix"> + <string> ms</string> + </property> + <property name="minimum"> + <number>10</number> + </property> + <property name="maximum"> + <number>10000</number> + </property> + </widget> + </item> + <item row="0" column="0"> + <widget class="QLabel" name="doubleClickIntervalLabel"> + <property name="text"> + <string>&Double Click Interval:</string> + </property> + <property name="buddy"> + <cstring>doubleClickIntervalSpinBox</cstring> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QSpinBox" name="cursorFlashTimeSpinBox"> + <property name="specialValueText"> + <string>No blinking</string> + </property> + <property name="suffix"> + <string> ms</string> + </property> + <property name="minimum"> + <number>9</number> + </property> + <property name="maximum"> + <number>10000</number> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="cursorFlashTimeLabel"> + <property name="text"> + <string>&Cursor Flash Time:</string> + </property> + <property name="buddy"> + <cstring>cursorFlashTimeSpinBox</cstring> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QSpinBox" name="wheelScrollLinesSpinBox"> + <property name="suffix"> + <string> lines</string> + </property> + <property name="minimum"> + <number>1</number> + </property> + <property name="maximum"> + <number>20</number> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="wheelScrollLinesLabel"> + <property name="text"> + <string>Wheel &Scroll Lines:</string> + </property> + <property name="buddy"> + <cstring>wheelScrollLinesSpinBox</cstring> + </property> + </widget> + </item> + <item row="3" column="0" colspan="2"> + <widget class="QCheckBox" name="resolveLinksCheckBox"> + <property name="text"> + <string>Resolve symlinks in URLs</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="guiEffectsGroup"> + <property name="title"> + <string>GUI Effects</string> + </property> + <layout class="QVBoxLayout"> + <property name="spacing"> + <number>4</number> + </property> + <property name="margin"> + <number>8</number> + </property> + <item> + <widget class="QCheckBox" name="effectsCheckBox"> + <property name="text"> + <string>&Enable</string> + </property> + <property name="shortcut"> + <string>Alt+E</string> + </property> + </widget> + </item> + <item> + <widget class="QFrame" name="effectsFrame"> + <layout class="QGridLayout"> + <property name="spacing"> + <number>4</number> + </property> + <item row="0" column="0"> + <widget class="QLabel" name="menuEffectLabel"> + <property name="text"> + <string>&Menu Effect:</string> + </property> + <property name="buddy"> + <cstring>menuEffectCombo</cstring> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="comboEffectLabel"> + <property name="text"> + <string>C&omboBox Effect:</string> + </property> + <property name="buddy"> + <cstring>comboEffectCombo</cstring> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="toolTipEffectLabel"> + <property name="text"> + <string>&ToolTip Effect:</string> + </property> + <property name="buddy"> + <cstring>toolTipEffectCombo</cstring> + </property> + </widget> + </item> + <item row="3" column="0"> + <widget class="QLabel" name="toolBoxEffectLabel"> + <property name="text"> + <string>Tool&Box Effect:</string> + </property> + <property name="buddy"> + <cstring>toolBoxEffectCombo</cstring> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QComboBox" name="menuEffectCombo"> + <property name="currentIndex"> + <number>0</number> + </property> + <property name="autoCompletion"> + <bool>true</bool> + </property> + <item> + <property name="text"> + <string>Disable</string> + </property> + </item> + <item> + <property name="text"> + <string>Animate</string> + </property> + </item> + <item> + <property name="text"> + <string>Fade</string> + </property> + </item> + </widget> + </item> + <item row="1" column="1"> + <widget class="QComboBox" name="comboEffectCombo"> + <item> + <property name="text"> + <string>Disable</string> + </property> + </item> + <item> + <property name="text"> + <string>Animate</string> + </property> + </item> + </widget> + </item> + <item row="2" column="1"> + <widget class="QComboBox" name="toolTipEffectCombo"> + <item> + <property name="text"> + <string>Disable</string> + </property> + </item> + <item> + <property name="text"> + <string>Animate</string> + </property> + </item> + <item> + <property name="text"> + <string>Fade</string> + </property> + </item> + </widget> + </item> + <item row="3" column="1"> + <widget class="QComboBox" name="toolBoxEffectCombo"> + <item> + <property name="text"> + <string>Disable</string> + </property> + </item> + <item> + <property name="text"> + <string>Animate</string> + </property> + </item> + </widget> + </item> + </layout> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="globalStrutGroup"> + <property name="title"> + <string>Global Strut</string> + </property> + <layout class="QGridLayout"> + <property name="margin"> + <number>8</number> + </property> + <property name="spacing"> + <number>4</number> + </property> + <item row="0" column="0"> + <widget class="QLabel" name="strutWidthLabel"> + <property name="text"> + <string>Minimum &Width:</string> + </property> + <property name="buddy"> + <cstring>strutWidthSpinBox</cstring> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="strutHeightLabel"> + <property name="text"> + <string>Minimum Hei&ght:</string> + </property> + <property name="buddy"> + <cstring>strutHeightSpinBox</cstring> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QSpinBox" name="strutWidthSpinBox"> + <property name="suffix"> + <string> pixels</string> + </property> + <property name="maximum"> + <number>1000</number> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QSpinBox" name="strutHeightSpinBox"> + <property name="suffix"> + <string> pixels</string> + </property> + <property name="maximum"> + <number>1000</number> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QCheckBox" name="rtlExtensionsCheckBox"> + <property name="text"> + <string>Enhanced support for languages written right-to-left</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="inputStyleLabel"> + <property name="text"> + <string>XIM Input Style:</string> + </property> + </widget> + </item> + <item> + <widget class="QComboBox" name="inputStyleCombo"> + <property name="currentIndex"> + <number>0</number> + </property> + <item> + <property name="text"> + <string>On The Spot</string> + </property> + </item> + <item> + <property name="text"> + <string>Over The Spot</string> + </property> + </item> + <item> + <property name="text"> + <string>Off The Spot</string> + </property> + </item> + <item> + <property name="text"> + <string>Root</string> + </property> + </item> + </widget> + </item> + <item> + <widget class="QLabel" name="inputMethodLabel"> + <property name="text"> + <string>Default Input Method:</string> + </property> + </widget> + </item> + <item> + <widget class="QComboBox" name="inputMethodCombo"> + <property name="currentIndex"> + <number>-1</number> + </property> + </widget> + </item> + <item> + <spacer> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Expanding</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> + <widget class="QWidget" name="printerTab"> + <attribute name="title"> + <string>Printer</string> + </attribute> + <layout class="QVBoxLayout"> + <item> + <widget class="QCheckBox" name="fontEmbeddingCheckBox"> + <property name="text"> + <string>Enable Font embedding</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QGroupBox" name="fontPathsGroup"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Expanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="title"> + <string>Font Paths</string> + </property> + <layout class="QVBoxLayout"> + <property name="spacing"> + <number>4</number> + </property> + <property name="margin"> + <number>8</number> + </property> + <item> + <layout class="QGridLayout"> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>4</number> + </property> + <item row="1" column="0"> + <widget class="QPushButton" name="upFontpathButton"> + <property name="text"> + <string>Up</string> + </property> + </widget> + </item> + <item row="1" column="2"> + <widget class="QPushButton" name="removeFontpathButton"> + <property name="text"> + <string>Remove</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QPushButton" name="downFontpathButton"> + <property name="text"> + <string>Down</string> + </property> + </widget> + </item> + <item row="0" column="0" colspan="3"> + <widget class="QListWidget" name="fontpathListBox"/> + </item> + </layout> + </item> + <item> + <layout class="QGridLayout"> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>4</number> + </property> + <item row="2" column="0"> + <spacer> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Minimum</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item row="2" column="2"> + <widget class="QPushButton" name="addFontPathButton"> + <property name="text"> + <string>Add</string> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QPushButton" name="browseFontPathButton"> + <property name="text"> + <string>Browse...</string> + </property> + </widget> + </item> + <item row="0" column="0" colspan="3"> + <widget class="QLabel" name="browseFontPathLabel"> + <property name="text"> + <string>Press the <b>Browse</b> button or enter a directory and press Enter to add them to the list.</string> + </property> + </widget> + </item> + <item row="1" column="0" colspan="3"> + <widget class="QLineEdit" name="fontPathLineEdit"/> + </item> + </layout> + </item> + </layout> + </widget> + </item> + </layout> + </widget> + <widget class="QWidget" name="phononTab"> + <attribute name="title"> + <string>Phonon</string> + </attribute> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <widget class="QGroupBox" name="aboutPhononGroup"> + <property name="title"> + <string>About Phonon</string> + </property> + <layout class="QGridLayout" name="gridLayout_2"> + <item row="0" column="0"> + <widget class="QLabel" name="phononVersionBuddyLabel"> + <property name="text"> + <string>Current Version:</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLabel" name="phononVersionLabel"> + <property name="text"> + <string>Not available</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="phononWebsiteBuddyLabel"> + <property name="text"> + <string>Website:</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QLabel" name="phononWebsiteLabel"> + <property name="text"> + <string><a href="http://phonon.kde.org">http://phonon.kde.org/</a></string> + </property> + <property name="openExternalLinks"> + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="aboutGStreamerGroup"> + <property name="title"> + <string>About GStreamer</string> + </property> + <layout class="QGridLayout"> + <item row="0" column="0"> + <widget class="QLabel" name="gstVersionBuddyLabel"> + <property name="text"> + <string>Current Version:</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLabel" name="gstVersionLabel"> + <property name="text"> + <string>Not available</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="gstWebsiteBuddyLabel"> + <property name="text"> + <string>Website:</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QLabel" name="gstWebsiteLabel"> + <property name="text"> + <string><a href="http://gstreamer.freedesktop.org/">http://gstreamer.freedesktop.org/</a></string> + </property> + <property name="openExternalLinks"> + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="gstBackendGroup"> + <property name="title"> + <string>GStreamer backend settings</string> + </property> + <layout class="QGridLayout" name="gridLayout_3"> + <item row="0" column="0"> + <widget class="QLabel" name="audiosinkLabel"> + <property name="text"> + <string>Preferred audio sink:</string> + </property> + <property name="buddy"> + <cstring>audiosinkCombo</cstring> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QComboBox" name="audiosinkCombo"/> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="videomodeLabel"> + <property name="text"> + <string>Preferred render method:</string> + </property> + <property name="buddy"> + <cstring>videomodeCombo</cstring> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QComboBox" name="videomodeCombo"/> + </item> + <item row="2" column="0" colspan="2"> + <widget class="QLabel" name="gstBackendNoteLabel"> + <property name="text"> + <string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-style:italic;">Note: changes to these settings may prevent applications from starting up correctly.</span></p></body></html></string> + </property> + <property name="textFormat"> + <enum>Qt::RichText</enum> + </property> + <property name="scaledContents"> + <bool>false</bool> + </property> + <property name="wordWrap"> + <bool>true</bool> + </property> + <property name="margin"> + <number>2</number> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QLabel" name="phononLabel"> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> + </widget> + </item> + </layout> + </widget> + <widget class="QMenuBar" name="mainMenu"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>815</width> + <height>19</height> + </rect> + </property> + <widget class="QMenu" name="fileMenu"> + <property name="geometry"> + <rect> + <x>203</x> + <y>114</y> + <width>161</width> + <height>110</height> + </rect> + </property> + <property name="title"> + <string>&File</string> + </property> + <addaction name="fileSaveAction"/> + <addaction name="separator"/> + <addaction name="fileExitAction"/> + </widget> + <widget class="QMenu" name="saveMenu"> + <property name="geometry"> + <rect> + <x>543</x> + <y>98</y> + <width>161</width> + <height>106</height> + </rect> + </property> + <property name="title"> + <string>&Help</string> + </property> + <addaction name="helpAboutAction"/> + <addaction name="helpAboutQtAction"/> + </widget> + <addaction name="fileMenu"/> + <addaction name="separator"/> + <addaction name="saveMenu"/> + </widget> + <action name="fileSaveAction"> + <property name="text"> + <string>&Save</string> + </property> + <property name="iconText"> + <string>Save</string> + </property> + <property name="shortcut"> + <string>Ctrl+S</string> + </property> + </action> + <action name="fileExitAction"> + <property name="text"> + <string>E&xit</string> + </property> + <property name="iconText"> + <string>Exit</string> + </property> + <property name="shortcut"> + <string>Ctrl+Q</string> + </property> + </action> + <action name="helpAboutAction"> + <property name="text"> + <string>&About</string> + </property> + <property name="iconText"> + <string>About</string> + </property> + <property name="shortcut"> + <string/> + </property> + </action> + <action name="helpAboutQtAction"> + <property name="text"> + <string>About &Qt</string> + </property> + <property name="iconText"> + <string>About Qt</string> + </property> + </action> + </widget> + <customwidgets> + <customwidget> + <class>ColorButton</class> + <extends></extends> + <header>colorbutton.h</header> + </customwidget> + <customwidget> + <class>PreviewFrame</class> + <extends></extends> + <header>previewframe.h</header> + </customwidget> + </customwidgets> + <tabstops> + <tabstop>helpView</tabstop> + <tabstop>mainTabWidget</tabstop> + <tabstop>guiStyleCombo</tabstop> + <tabstop>tunePaletteButton</tabstop> + <tabstop>paletteCombo</tabstop> + <tabstop>fontFamilyCombo</tabstop> + <tabstop>fontStyleCombo</tabstop> + <tabstop>pointSizeCombo</tabstop> + <tabstop>sampleLineEdit</tabstop> + <tabstop>familySubstitutionCombo</tabstop> + <tabstop>substitutionsListBox</tabstop> + <tabstop>upSubstitutionButton</tabstop> + <tabstop>downSubstitutionButton</tabstop> + <tabstop>removeSubstitutionButton</tabstop> + <tabstop>chooseSubstitutionCombo</tabstop> + <tabstop>addSubstitutionButton</tabstop> + <tabstop>doubleClickIntervalSpinBox</tabstop> + <tabstop>cursorFlashTimeSpinBox</tabstop> + <tabstop>wheelScrollLinesSpinBox</tabstop> + <tabstop>resolveLinksCheckBox</tabstop> + <tabstop>effectsCheckBox</tabstop> + <tabstop>menuEffectCombo</tabstop> + <tabstop>comboEffectCombo</tabstop> + <tabstop>toolTipEffectCombo</tabstop> + <tabstop>toolBoxEffectCombo</tabstop> + <tabstop>strutWidthSpinBox</tabstop> + <tabstop>strutHeightSpinBox</tabstop> + <tabstop>rtlExtensionsCheckBox</tabstop> + <tabstop>inputStyleCombo</tabstop> + <tabstop>inputMethodCombo</tabstop> + <tabstop>fontEmbeddingCheckBox</tabstop> + <tabstop>fontpathListBox</tabstop> + <tabstop>upFontpathButton</tabstop> + <tabstop>downFontpathButton</tabstop> + <tabstop>removeFontpathButton</tabstop> + <tabstop>fontPathLineEdit</tabstop> + <tabstop>browseFontPathButton</tabstop> + <tabstop>addFontPathButton</tabstop> + <tabstop>audiosinkCombo</tabstop> + <tabstop>videomodeCombo</tabstop> + </tabstops> + <resources/> + <connections> + <connection> + <sender>effectsCheckBox</sender> + <signal>toggled(bool)</signal> + <receiver>effectsFrame</receiver> + <slot>setEnabled(bool)</slot> + <hints> + <hint type="sourcelabel"> + <x>417</x> + <y>257</y> + </hint> + <hint type="destinationlabel"> + <x>578</x> + <y>379</y> + </hint> + </hints> + </connection> + <connection> + <sender>fontEmbeddingCheckBox</sender> + <signal>toggled(bool)</signal> + <receiver>fontPathsGroup</receiver> + <slot>setEnabled(bool)</slot> + <hints> + <hint type="sourcelabel"> + <x>449</x> + <y>69</y> + </hint> + <hint type="destinationlabel"> + <x>447</x> + <y>94</y> + </hint> + </hints> + </connection> + </connections> +</ui> diff --git a/tools/qtconfig/mainwindowbase.cpp b/tools/qtconfig/mainwindowbase.cpp deleted file mode 100644 index efca58b..0000000 --- a/tools/qtconfig/mainwindowbase.cpp +++ /dev/null @@ -1,250 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "mainwindowbase.h" -#include "colorbutton.h" -#include "previewframe.h" - -#include <QVariant> -#include <QImage> -#include <QPixmap> - -QT_BEGIN_NAMESPACE - -/* - * Constructs a MainWindowBase as a child of 'parent', with the - * name 'name' and widget flags set to 'f'. - * - */ -MainWindowBase::MainWindowBase(QWidget* parent, const char* name, Qt::WindowFlags fl) - : Q3MainWindow(parent, name, fl) -{ - setupUi(this); - - (void)statusBar(); - - // signals and slots connections - connect(fontpathlineedit, SIGNAL(returnPressed()), this, SLOT(addFontpath())); - connect(PushButton15, SIGNAL(clicked()), this, SLOT(addFontpath())); - connect(PushButton1, SIGNAL(clicked()), this, SLOT(addSubstitute())); - connect(PushButton14, SIGNAL(clicked()), this, SLOT(browseFontpath())); - connect(stylecombo, SIGNAL(activated(int)), this, SLOT(buildFont())); - connect(psizecombo, SIGNAL(activated(int)), this, SLOT(buildFont())); - connect(PushButton12, SIGNAL(clicked()), this, SLOT(downFontpath())); - connect(PushButton3, SIGNAL(clicked()), this, SLOT(downSubstitute())); - connect(familycombo, SIGNAL(activated(QString)), this, SLOT(familySelected(QString))); - connect(fileExitAction, SIGNAL(activated()), this, SLOT(fileExit())); - connect(fileSaveAction, SIGNAL(activated()), this, SLOT(fileSave())); - connect(helpAboutAction, SIGNAL(activated()), this, SLOT(helpAbout())); - connect(helpAboutQtAction, SIGNAL(activated()), this, SLOT(helpAboutQt())); - connect(TabWidget3, SIGNAL(currentChanged(QWidget*)), this, SLOT(pageChanged(QWidget*))); - connect(paletteCombo, SIGNAL(activated(int)), this, SLOT(paletteSelected(int))); - connect(PushButton13, SIGNAL(clicked()), this, SLOT(removeFontpath())); - connect(PushButton4, SIGNAL(clicked()), this, SLOT(removeSubstitute())); - connect(effectcheckbox, SIGNAL(toggled(bool)), effectbase, SLOT(setEnabled(bool))); - connect(fontembeddingcheckbox, SIGNAL(toggled(bool)), GroupBox10, SLOT(setEnabled(bool))); - connect(toolboxeffect, SIGNAL(activated(int)), this, SLOT(somethingModified())); - connect(dcispin, SIGNAL(valueChanged(int)), this, SLOT(somethingModified())); - connect(cfispin, SIGNAL(valueChanged(int)), this, SLOT(somethingModified())); - connect(wslspin, SIGNAL(valueChanged(int)), this, SLOT(somethingModified())); - connect(menueffect, SIGNAL(activated(int)), this, SLOT(somethingModified())); - connect(comboeffect, SIGNAL(activated(int)), this, SLOT(somethingModified())); - connect(audiosinkCombo, SIGNAL(activated(int)), this, SLOT(somethingModified())); - connect(videomodeCombo, SIGNAL(activated(int)), this, SLOT(somethingModified())); - connect(tooltipeffect, SIGNAL(activated(int)), this, SLOT(somethingModified())); - connect(strutwidth, SIGNAL(valueChanged(int)), this, SLOT(somethingModified())); - connect(strutheight, SIGNAL(valueChanged(int)), this, SLOT(somethingModified())); - connect(effectcheckbox, SIGNAL(toggled(bool)), this, SLOT(somethingModified())); - connect(resolvelinks, SIGNAL(toggled(bool)), this, SLOT(somethingModified())); - connect(fontembeddingcheckbox, SIGNAL(clicked()), this, SLOT(somethingModified())); - connect(rtlExtensions, SIGNAL(toggled(bool)), this, SLOT(somethingModified())); - connect(inputStyle, SIGNAL(activated(int)), this, SLOT(somethingModified())); - connect(inputMethod, SIGNAL(activated(int)), this, SLOT(somethingModified())); - connect(gstylecombo, SIGNAL(activated(QString)), this, SLOT(styleSelected(QString))); - connect(familysubcombo, SIGNAL(activated(QString)), this, SLOT(substituteSelected(QString))); - connect(btnAdvanced, SIGNAL(clicked()), this, SLOT(tunePalette())); - connect(PushButton11, SIGNAL(clicked()), this, SLOT(upFontpath())); - connect(PushButton2, SIGNAL(clicked()), this, SLOT(upSubstitute())); - init(); -} - -/* - * Destroys the object and frees any allocated resources - */ -MainWindowBase::~MainWindowBase() -{ - destroy(); - // no need to delete child widgets, Qt does it all for us -} - -/* - * Sets the strings of the subwidgets using the current - * language. - */ -void MainWindowBase::languageChange() -{ - retranslateUi(this); -} - -void MainWindowBase::init() -{ -} - -void MainWindowBase::destroy() -{ -} - -void MainWindowBase::addFontpath() -{ - qWarning("MainWindowBase::addFontpath(): Not implemented yet"); -} - -void MainWindowBase::addSubstitute() -{ - qWarning("MainWindowBase::addSubstitute(): Not implemented yet"); -} - -void MainWindowBase::browseFontpath() -{ - qWarning("MainWindowBase::browseFontpath(): Not implemented yet"); -} - -void MainWindowBase::buildFont() -{ - qWarning("MainWindowBase::buildFont(): Not implemented yet"); -} - -void MainWindowBase::buildPalette() -{ - qWarning("MainWindowBase::buildPalette(): Not implemented yet"); -} - -void MainWindowBase::downFontpath() -{ - qWarning("MainWindowBase::downFontpath(): Not implemented yet"); -} - -void MainWindowBase::downSubstitute() -{ - qWarning("MainWindowBase::downSubstitute(): Not implemented yet"); -} - -void MainWindowBase::familySelected( const QString &) -{ - qWarning("MainWindowBase::familySelected( const QString &): Not implemented yet"); -} - -void MainWindowBase::fileExit() -{ - qWarning("MainWindowBase::fileExit(): Not implemented yet"); -} - -void MainWindowBase::fileSave() -{ - qWarning("MainWindowBase::fileSave(): Not implemented yet"); -} - -void MainWindowBase::helpAbout() -{ - qWarning("MainWindowBase::helpAbout(): Not implemented yet"); -} - -void MainWindowBase::helpAboutQt() -{ - qWarning("MainWindowBase::helpAboutQt(): Not implemented yet"); -} - -void MainWindowBase::new_slot() -{ - qWarning("MainWindowBase::new_slot(): Not implemented yet"); -} - -void MainWindowBase::pageChanged( QWidget *) -{ - qWarning("MainWindowBase::pageChanged( QWidget *): Not implemented yet"); -} - -void MainWindowBase::paletteSelected(int) -{ - qWarning("MainWindowBase::paletteSelected(int): Not implemented yet"); -} - -void MainWindowBase::removeFontpath() -{ - qWarning("MainWindowBase::removeFontpath(): Not implemented yet"); -} - -void MainWindowBase::removeSubstitute() -{ - qWarning("MainWindowBase::removeSubstitute(): Not implemented yet"); -} - -void MainWindowBase::somethingModified() -{ - qWarning("MainWindowBase::somethingModified(): Not implemented yet"); -} - -void MainWindowBase::styleSelected( const QString &) -{ - qWarning("MainWindowBase::styleSelected( const QString &): Not implemented yet"); -} - -void MainWindowBase::substituteSelected( const QString &) -{ - qWarning("MainWindowBase::substituteSelected( const QString &): Not implemented yet"); -} - -void MainWindowBase::tunePalette() -{ - qWarning("MainWindowBase::tunePalette(): Not implemented yet"); -} - -void MainWindowBase::upFontpath() -{ - qWarning("MainWindowBase::upFontpath(): Not implemented yet"); -} - -void MainWindowBase::upSubstitute() -{ - qWarning("MainWindowBase::upSubstitute(): Not implemented yet"); -} - -QT_END_NAMESPACE diff --git a/tools/qtconfig/mainwindowbase.h b/tools/qtconfig/mainwindowbase.h deleted file mode 100644 index 97c6716..0000000 --- a/tools/qtconfig/mainwindowbase.h +++ /dev/null @@ -1,95 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef MAINWINDOWBASE_H -#define MAINWINDOWBASE_H - -#include "ui_mainwindowbase.h" -#include <QVariant> - -QT_BEGIN_NAMESPACE - -class ColorButton; -class PreviewFrame; - -class MainWindowBase : public Q3MainWindow, public Ui::MainWindowBase -{ - Q_OBJECT - -public: - MainWindowBase(QWidget* parent = 0, const char* name = 0, Qt::WindowFlags fl = Qt::Window); - ~MainWindowBase(); - -public slots: - virtual void addFontpath(); - virtual void addSubstitute(); - virtual void browseFontpath(); - virtual void buildFont(); - virtual void buildPalette(); - virtual void downFontpath(); - virtual void downSubstitute(); - virtual void familySelected( const QString & ); - virtual void fileExit(); - virtual void fileSave(); - virtual void helpAbout(); - virtual void helpAboutQt(); - virtual void new_slot(); - virtual void pageChanged( QWidget * ); - virtual void paletteSelected( int ); - virtual void removeFontpath(); - virtual void removeSubstitute(); - virtual void somethingModified(); - virtual void styleSelected( const QString & ); - virtual void substituteSelected( const QString & ); - virtual void tunePalette(); - virtual void upFontpath(); - virtual void upSubstitute(); - -protected slots: - virtual void languageChange(); - - virtual void init(); - virtual void destroy(); -}; - -QT_END_NAMESPACE - -#endif // MAINWINDOWBASE_H diff --git a/tools/qtconfig/mainwindowbase.ui b/tools/qtconfig/mainwindowbase.ui deleted file mode 100644 index c5b4470..0000000 --- a/tools/qtconfig/mainwindowbase.ui +++ /dev/null @@ -1,1384 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <comment>********************************************************************* -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -*********************************************************************</comment> - <class>MainWindowBase</class> - <widget class="Q3MainWindow" name="MainWindowBase"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>815</width> - <height>716</height> - </rect> - </property> - <property name="windowTitle"> - <string>Qt Configuration</string> - </property> - <widget class="QWidget" name="widget"> - <property name="geometry"> - <rect> - <x>0</x> - <y>26</y> - <width>815</width> - <height>690</height> - </rect> - </property> - <layout class="QGridLayout" name="gridLayout"> - <property name="margin"> - <number>8</number> - </property> - <item row="0" column="0"> - <widget class="QTextEdit" name="helpview"> - <property name="minimumSize"> - <size> - <width>200</width> - <height>0</height> - </size> - </property> - <property name="readOnly"> - <bool>true</bool> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QTabWidget" name="TabWidget3"> - <property name="currentIndex"> - <number>0</number> - </property> - <widget class="QWidget" name="tab1"> - <attribute name="title"> - <string>Appearance</string> - </attribute> - <layout class="QGridLayout" name="gridLayout_5"> - <item row="0" column="0"> - <widget class="QGroupBox" name="GroupBox40"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>0</width> - <height>0</height> - </size> - </property> - <property name="title"> - <string>GUI Style</string> - </property> - <layout class="QHBoxLayout"> - <property name="spacing"> - <number>4</number> - </property> - <property name="margin"> - <number>8</number> - </property> - <item> - <widget class="QLabel" name="gstylebuddy"> - <property name="minimumSize"> - <size> - <width>0</width> - <height>0</height> - </size> - </property> - <property name="text"> - <string>Select GUI &Style:</string> - </property> - <property name="buddy"> - <cstring>gstylecombo</cstring> - </property> - </widget> - </item> - <item> - <widget class="QComboBox" name="gstylecombo"/> - </item> - </layout> - </widget> - </item> - <item row="3" column="0"> - <widget class="QGroupBox" name="groupPreview"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Expanding"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="title"> - <string>Preview</string> - </property> - <layout class="QGridLayout" name="gridLayout_4"> - <item row="0" column="0"> - <widget class="QLabel" name="TextLabel1"> - <property name="text"> - <string>Select &Palette:</string> - </property> - <property name="buddy"> - <cstring>paletteCombo</cstring> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QComboBox" name="paletteCombo"> - <item> - <property name="text"> - <string>Active Palette</string> - </property> - </item> - <item> - <property name="text"> - <string>Inactive Palette</string> - </property> - </item> - <item> - <property name="text"> - <string>Disabled Palette</string> - </property> - </item> - </widget> - </item> - <item row="1" column="0" colspan="2"> - <widget class="PreviewFrame" name="previewFrame" native="true"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Expanding"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>410</width> - <height>260</height> - </size> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item row="1" column="0"> - <widget class="QGroupBox" name="groupAutoPalette"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>400</width> - <height>0</height> - </size> - </property> - <property name="title"> - <string>Build Palette</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout_2"> - <item> - <widget class="QWidget" name="colorConfig" native="true"> - <layout class="QHBoxLayout" name="horizontalLayout_2"> - <property name="margin"> - <number>0</number> - </property> - <item> - <widget class="QLabel" name="labelMainColor"> - <property name="text"> - <string>&3-D Effects:</string> - </property> - <property name="buddy"> - <cstring>buttonMainColor</cstring> - </property> - </widget> - </item> - <item> - <widget class="ColorButton" name="buttonMainColor" native="true"/> - </item> - <item> - <widget class="QLabel" name="labelMainColor2"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>50</width> - <height>0</height> - </size> - </property> - <property name="lineWidth"> - <number>1</number> - </property> - <property name="midLineWidth"> - <number>0</number> - </property> - <property name="text"> - <string>Window Back&ground:</string> - </property> - <property name="alignment"> - <set>Qt::AlignVCenter</set> - </property> - <property name="margin"> - <number>0</number> - </property> - <property name="buddy"> - <cstring>buttonMainColor2</cstring> - </property> - </widget> - </item> - <item> - <widget class="ColorButton" name="buttonMainColor2" native="true"/> - </item> - <item> - <spacer name="spacer"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeType"> - <enum>QSizePolicy::Expanding</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>70</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QPushButton" name="btnAdvanced"> - <property name="text"> - <string>&Tune Palette...</string> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <widget class="QLabel" name="labelKDENote"> - <property name="text"> - <string>Please use the KDE Control Center to set the palette.</string> - </property> - </widget> - </item> - </layout> - </widget> - </item> - </layout> - </widget> - <widget class="QWidget" name="tab2"> - <attribute name="title"> - <string>Fonts</string> - </attribute> - <layout class="QVBoxLayout"> - <item> - <widget class="QGroupBox" name="GroupBox1"> - <property name="title"> - <string>Default Font</string> - </property> - <layout class="QGridLayout"> - <property name="margin"> - <number>8</number> - </property> - <property name="spacing"> - <number>4</number> - </property> - <item row="1" column="1"> - <widget class="QComboBox" name="stylecombo"> - <property name="autoCompletion"> - <bool>true</bool> - </property> - <property name="duplicatesEnabled"> - <bool>false</bool> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QComboBox" name="familycombo"> - <property name="autoCompletion"> - <bool>true</bool> - </property> - <property name="duplicatesEnabled"> - <bool>false</bool> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QComboBox" name="psizecombo"> - <property name="editable"> - <bool>true</bool> - </property> - <property name="autoCompletion"> - <bool>true</bool> - </property> - <property name="duplicatesEnabled"> - <bool>false</bool> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="stylebuddy"> - <property name="text"> - <string>&Style:</string> - </property> - <property name="buddy"> - <cstring>stylecombo</cstring> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="psizebuddy"> - <property name="text"> - <string>&Point Size:</string> - </property> - <property name="buddy"> - <cstring>psizecombo</cstring> - </property> - </widget> - </item> - <item row="0" column="0"> - <widget class="QLabel" name="familybuddy"> - <property name="text"> - <string>F&amily:</string> - </property> - <property name="buddy"> - <cstring>familycombo</cstring> - </property> - </widget> - </item> - <item row="3" column="0" colspan="2"> - <widget class="QLineEdit" name="samplelineedit"> - <property name="text"> - <string>Sample Text</string> - </property> - <property name="alignment"> - <set>Qt::AlignHCenter</set> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <widget class="QGroupBox" name="GroupBox2"> - <property name="title"> - <string>Font Substitution</string> - </property> - <layout class="QVBoxLayout"> - <property name="spacing"> - <number>4</number> - </property> - <property name="margin"> - <number>8</number> - </property> - <item> - <layout class="QHBoxLayout"> - <property name="spacing"> - <number>4</number> - </property> - <property name="margin"> - <number>0</number> - </property> - <item> - <widget class="QLabel" name="famsubbuddy"> - <property name="text"> - <string>S&elect or Enter a Family:</string> - </property> - <property name="buddy"> - <cstring>familysubcombo</cstring> - </property> - </widget> - </item> - <item> - <widget class="QComboBox" name="familysubcombo"> - <property name="editable"> - <bool>true</bool> - </property> - <property name="autoCompletion"> - <bool>true</bool> - </property> - <property name="duplicatesEnabled"> - <bool>false</bool> - </property> - </widget> - </item> - </layout> - </item> - <item> - <widget class="Line" name="Line1"> - <property name="frameShape"> - <enum>QFrame::HLine</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Sunken</enum> - </property> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="TextLabel5"> - <property name="text"> - <string>Current Substitutions:</string> - </property> - </widget> - </item> - <item> - <widget class="Q3ListBox" name="sublistbox"/> - </item> - <item> - <layout class="QHBoxLayout"> - <property name="spacing"> - <number>4</number> - </property> - <property name="margin"> - <number>0</number> - </property> - <item> - <widget class="QPushButton" name="PushButton2"> - <property name="text"> - <string>Up</string> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="PushButton3"> - <property name="text"> - <string>Down</string> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="PushButton4"> - <property name="text"> - <string>Remove</string> - </property> - </widget> - </item> - </layout> - </item> - <item> - <widget class="Line" name="Line2"> - <property name="frameShape"> - <enum>QFrame::HLine</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Sunken</enum> - </property> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - </widget> - </item> - <item> - <layout class="QHBoxLayout"> - <property name="spacing"> - <number>4</number> - </property> - <property name="margin"> - <number>0</number> - </property> - <item> - <widget class="QLabel" name="choosebuddy"> - <property name="text"> - <string>Select s&ubstitute Family:</string> - </property> - <property name="buddy"> - <cstring>choosesubcombo</cstring> - </property> - </widget> - </item> - <item> - <widget class="QComboBox" name="choosesubcombo"> - <property name="autoCompletion"> - <bool>true</bool> - </property> - <property name="duplicatesEnabled"> - <bool>false</bool> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="PushButton1"> - <property name="text"> - <string>Add</string> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </widget> - </item> - </layout> - </widget> - <widget class="QWidget" name="tab"> - <attribute name="title"> - <string>Interface</string> - </attribute> - <layout class="QVBoxLayout"> - <item> - <widget class="QGroupBox" name="GroupBox4"> - <property name="title"> - <string>Feel Settings</string> - </property> - <layout class="QGridLayout"> - <property name="margin"> - <number>8</number> - </property> - <property name="spacing"> - <number>4</number> - </property> - <item row="0" column="1"> - <widget class="QSpinBox" name="dcispin"> - <property name="suffix"> - <string> ms</string> - </property> - <property name="minimum"> - <number>10</number> - </property> - <property name="maximum"> - <number>10000</number> - </property> - </widget> - </item> - <item row="0" column="0"> - <widget class="QLabel" name="dcibuddy"> - <property name="text"> - <string>&Double Click Interval:</string> - </property> - <property name="buddy"> - <cstring>dcispin</cstring> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QSpinBox" name="cfispin"> - <property name="specialValueText"> - <string>No blinking</string> - </property> - <property name="suffix"> - <string> ms</string> - </property> - <property name="minimum"> - <number>9</number> - </property> - <property name="maximum"> - <number>10000</number> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="cfibuddy"> - <property name="text"> - <string>&Cursor Flash Time:</string> - </property> - <property name="buddy"> - <cstring>cfispin</cstring> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QSpinBox" name="wslspin"> - <property name="suffix"> - <string> lines</string> - </property> - <property name="minimum"> - <number>1</number> - </property> - <property name="maximum"> - <number>20</number> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="wslbuddy"> - <property name="text"> - <string>Wheel &Scroll Lines:</string> - </property> - <property name="buddy"> - <cstring>wslspin</cstring> - </property> - </widget> - </item> - <item row="3" column="0" colspan="2"> - <widget class="QCheckBox" name="resolvelinks"> - <property name="text"> - <string>Resolve symlinks in URLs</string> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <widget class="QGroupBox" name="GroupBox3"> - <property name="title"> - <string>GUI Effects</string> - </property> - <layout class="QVBoxLayout"> - <property name="spacing"> - <number>4</number> - </property> - <property name="margin"> - <number>8</number> - </property> - <item> - <widget class="QCheckBox" name="effectcheckbox"> - <property name="text"> - <string>&Enable</string> - </property> - <property name="shortcut"> - <string>Alt+E</string> - </property> - </widget> - </item> - <item> - <widget class="Q3Frame" name="effectbase"> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Plain</enum> - </property> - <layout class="QGridLayout"> - <property name="margin"> - <number>0</number> - </property> - <property name="spacing"> - <number>4</number> - </property> - <item row="0" column="0"> - <widget class="QLabel" name="meffectbuddy"> - <property name="text"> - <string>&Menu Effect:</string> - </property> - <property name="buddy"> - <cstring>menueffect</cstring> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="ceffectbuddy"> - <property name="text"> - <string>C&omboBox Effect:</string> - </property> - <property name="buddy"> - <cstring>comboeffect</cstring> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="teffectbuddy"> - <property name="text"> - <string>&ToolTip Effect:</string> - </property> - <property name="buddy"> - <cstring>tooltipeffect</cstring> - </property> - </widget> - </item> - <item row="3" column="0"> - <widget class="QLabel" name="beffectbuddy"> - <property name="text"> - <string>Tool&Box Effect:</string> - </property> - <property name="buddy"> - <cstring>toolboxeffect</cstring> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QComboBox" name="menueffect"> - <property name="currentIndex"> - <number>0</number> - </property> - <property name="autoCompletion"> - <bool>true</bool> - </property> - <item> - <property name="text"> - <string>Disable</string> - </property> - </item> - <item> - <property name="text"> - <string>Animate</string> - </property> - </item> - <item> - <property name="text"> - <string>Fade</string> - </property> - </item> - </widget> - </item> - <item row="1" column="1"> - <widget class="QComboBox" name="comboeffect"> - <item> - <property name="text"> - <string>Disable</string> - </property> - </item> - <item> - <property name="text"> - <string>Animate</string> - </property> - </item> - </widget> - </item> - <item row="2" column="1"> - <widget class="QComboBox" name="tooltipeffect"> - <item> - <property name="text"> - <string>Disable</string> - </property> - </item> - <item> - <property name="text"> - <string>Animate</string> - </property> - </item> - <item> - <property name="text"> - <string>Fade</string> - </property> - </item> - </widget> - </item> - <item row="3" column="1"> - <widget class="QComboBox" name="toolboxeffect"> - <item> - <property name="text"> - <string>Disable</string> - </property> - </item> - <item> - <property name="text"> - <string>Animate</string> - </property> - </item> - </widget> - </item> - </layout> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <widget class="QGroupBox" name="GroupBox5"> - <property name="title"> - <string>Global Strut</string> - </property> - <layout class="QGridLayout"> - <property name="margin"> - <number>8</number> - </property> - <property name="spacing"> - <number>4</number> - </property> - <item row="0" column="0"> - <widget class="QLabel" name="swbuddy"> - <property name="text"> - <string>Minimum &Width:</string> - </property> - <property name="buddy"> - <cstring>strutwidth</cstring> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="shbuddy"> - <property name="text"> - <string>Minimum Hei&ght:</string> - </property> - <property name="buddy"> - <cstring>strutheight</cstring> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QSpinBox" name="strutwidth"> - <property name="suffix"> - <string> pixels</string> - </property> - <property name="maximum"> - <number>1000</number> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QSpinBox" name="strutheight"> - <property name="suffix"> - <string> pixels</string> - </property> - <property name="maximum"> - <number>1000</number> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <widget class="QCheckBox" name="rtlExtensions"> - <property name="text"> - <string>Enhanced support for languages written right-to-left</string> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="inputStyleLabel"> - <property name="text"> - <string>XIM Input Style:</string> - </property> - </widget> - </item> - <item> - <widget class="QComboBox" name="inputStyle"> - <property name="currentIndex"> - <number>0</number> - </property> - <item> - <property name="text"> - <string>On The Spot</string> - </property> - </item> - <item> - <property name="text"> - <string>Over The Spot</string> - </property> - </item> - <item> - <property name="text"> - <string>Off The Spot</string> - </property> - </item> - <item> - <property name="text"> - <string>Root</string> - </property> - </item> - </widget> - </item> - <item> - <widget class="QLabel" name="inputMethodLabel"> - <property name="text"> - <string>Default Input Method:</string> - </property> - </widget> - </item> - <item> - <widget class="QComboBox" name="inputMethod"> - <property name="currentIndex"> - <number>-1</number> - </property> - </widget> - </item> - <item> - <spacer> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeType"> - <enum>QSizePolicy::Expanding</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>40</height> - </size> - </property> - </spacer> - </item> - </layout> - </widget> - <widget class="QWidget" name="tab3"> - <attribute name="title"> - <string>Printer</string> - </attribute> - <layout class="QVBoxLayout"> - <item> - <widget class="QCheckBox" name="fontembeddingcheckbox"> - <property name="text"> - <string>Enable Font embedding</string> - </property> - <property name="checked"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QGroupBox" name="GroupBox10"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Expanding"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="title"> - <string>Font Paths</string> - </property> - <layout class="QVBoxLayout"> - <property name="spacing"> - <number>4</number> - </property> - <property name="margin"> - <number>8</number> - </property> - <item> - <layout class="QGridLayout"> - <property name="margin"> - <number>0</number> - </property> - <property name="spacing"> - <number>4</number> - </property> - <item row="1" column="0"> - <widget class="QPushButton" name="PushButton11"> - <property name="text"> - <string>Up</string> - </property> - </widget> - </item> - <item row="1" column="2"> - <widget class="QPushButton" name="PushButton13"> - <property name="text"> - <string>Remove</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QPushButton" name="PushButton12"> - <property name="text"> - <string>Down</string> - </property> - </widget> - </item> - <item row="0" column="0" colspan="3"> - <widget class="Q3ListBox" name="fontpathlistbox"/> - </item> - </layout> - </item> - <item> - <layout class="QGridLayout"> - <property name="margin"> - <number>0</number> - </property> - <property name="spacing"> - <number>4</number> - </property> - <item row="2" column="0"> - <spacer> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeType"> - <enum>QSizePolicy::Minimum</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item row="2" column="2"> - <widget class="QPushButton" name="PushButton15"> - <property name="text"> - <string>Add</string> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QPushButton" name="PushButton14"> - <property name="text"> - <string>Browse...</string> - </property> - </widget> - </item> - <item row="0" column="0" colspan="3"> - <widget class="QLabel" name="TextLabel15_2"> - <property name="text"> - <string>Press the <b>Browse</b> button or enter a directory and press Enter to add them to the list.</string> - </property> - </widget> - </item> - <item row="1" column="0" colspan="3"> - <widget class="QLineEdit" name="fontpathlineedit"/> - </item> - </layout> - </item> - </layout> - </widget> - </item> - </layout> - </widget> - <widget class="QWidget" name="tab4"> - <attribute name="title"> - <string>Phonon</string> - </attribute> - <layout class="QVBoxLayout" name="verticalLayout"> - <item> - <widget class="QGroupBox" name="groupBox_4"> - <property name="title"> - <string>About Phonon</string> - </property> - <layout class="QGridLayout" name="gridLayout_2"> - <item row="0" column="0"> - <widget class="QLabel" name="label_7"> - <property name="text"> - <string>Current Version:</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QLabel" name="phononVersionLabel"> - <property name="text"> - <string>Not available</string> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_5"> - <property name="text"> - <string>Website:</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QLabel" name="gstversionLabel_3"> - <property name="text"> - <string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://phonon.kde.org"><span style=" text-decoration: underline; color:#0000ff;">http://phonon.kde.org</span></a></p></body></html></string> - </property> - <property name="openExternalLinks"> - <bool>true</bool> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <widget class="QGroupBox" name="groupBox_3"> - <property name="title"> - <string>About GStreamer</string> - </property> - <layout class="QGridLayout"> - <item row="0" column="0"> - <widget class="QLabel" name="label_3"> - <property name="text"> - <string>Current Version:</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QLabel" name="gstversionLabel"> - <property name="text"> - <string>Not available</string> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_4"> - <property name="text"> - <string>Website:</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QLabel" name="gstversionLabel_2"> - <property name="text"> - <string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://gstreamer.freedesktop.org/"><span style=" text-decoration: underline; color:#0000ff;">http://gstreamer.freedesktop.org/</span></a></p></body></html></string> - </property> - <property name="openExternalLinks"> - <bool>true</bool> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <widget class="QGroupBox" name="groupBox"> - <property name="title"> - <string>GStreamer backend settings</string> - </property> - <layout class="QGridLayout" name="gridLayout_3"> - <item row="0" column="0"> - <widget class="QLabel" name="label"> - <property name="text"> - <string>Preferred audio sink:</string> - </property> - <property name="buddy"> - <cstring>audiosinkCombo</cstring> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QComboBox" name="audiosinkCombo"/> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_2"> - <property name="text"> - <string>Preferred render method:</string> - </property> - <property name="buddy"> - <cstring>videomodeCombo</cstring> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QComboBox" name="videomodeCombo"/> - </item> - <item row="2" column="0" colspan="2"> - <widget class="QLabel" name="label_6"> - <property name="text"> - <string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-style:italic;">Note: changes to these settings may prevent applications from starting up correctly.</span></p></body></html></string> - </property> - <property name="textFormat"> - <enum>Qt::RichText</enum> - </property> - <property name="scaledContents"> - <bool>false</bool> - </property> - <property name="wordWrap"> - <bool>true</bool> - </property> - <property name="margin"> - <number>2</number> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <widget class="QLabel" name="phononLabel"> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item> - <spacer name="verticalSpacer"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>40</height> - </size> - </property> - </spacer> - </item> - </layout> - </widget> - </widget> - </item> - </layout> - </widget> - <widget class="QMenuBar" name="menubar"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>815</width> - <height>26</height> - </rect> - </property> - <widget class="QMenu" name="PopupMenu"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>123</width> - <height>92</height> - </rect> - </property> - <property name="title"> - <string>&File</string> - </property> - <action name=""/> - <action name=""/> - <action name=""/> - <addaction name="fileSaveAction"/> - <addaction name="separator"/> - <addaction name="fileExitAction"/> - </widget> - <widget class="QMenu" name="PopupMenu_2"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>123</width> - <height>90</height> - </rect> - </property> - <property name="title"> - <string>&Help</string> - </property> - <addaction name="helpAboutAction"/> - <addaction name="helpAboutQtAction"/> - </widget> - <action name=""/> - <action name=""/> - <action name=""/> - <addaction name="PopupMenu"/> - <addaction name="separator"/> - <addaction name="PopupMenu_2"/> - </widget> - <action name="fileSaveAction"> - <property name="text"> - <string>&Save</string> - </property> - <property name="iconText"> - <string>Save</string> - </property> - <property name="shortcut"> - <string>Ctrl+S</string> - </property> - </action> - <action name="fileExitAction"> - <property name="text"> - <string>E&xit</string> - </property> - <property name="iconText"> - <string>Exit</string> - </property> - <property name="shortcut"> - <string/> - </property> - </action> - <action name="helpAboutAction"> - <property name="text"> - <string>&About</string> - </property> - <property name="iconText"> - <string>About</string> - </property> - <property name="shortcut"> - <string/> - </property> - </action> - <action name="helpAboutQtAction"> - <property name="text"> - <string>About &Qt</string> - </property> - <property name="iconText"> - <string>About Qt</string> - </property> - </action> - </widget> - <customwidgets> - <customwidget> - <class>Q3Frame</class> - <extends>QFrame</extends> - <header>Qt3Support/Q3Frame</header> - <container>1</container> - </customwidget> - <customwidget> - <class>Q3MainWindow</class> - <extends>QWidget</extends> - <header>q3mainwindow.h</header> - <container>1</container> - </customwidget> - <customwidget> - <class>Q3ListBox</class> - <extends>Q3Frame</extends> - <header>q3listbox.h</header> - </customwidget> - <customwidget> - <class>ColorButton</class> - <extends></extends> - <header>colorbutton.h</header> - </customwidget> - <customwidget> - <class>PreviewFrame</class> - <extends></extends> - <header>previewframe.h</header> - </customwidget> - </customwidgets> - <tabstops> - <tabstop>helpview</tabstop> - <tabstop>familycombo</tabstop> - <tabstop>stylecombo</tabstop> - <tabstop>psizecombo</tabstop> - <tabstop>samplelineedit</tabstop> - <tabstop>familysubcombo</tabstop> - <tabstop>PushButton2</tabstop> - <tabstop>PushButton3</tabstop> - <tabstop>PushButton4</tabstop> - <tabstop>choosesubcombo</tabstop> - <tabstop>PushButton1</tabstop> - <tabstop>dcispin</tabstop> - <tabstop>cfispin</tabstop> - <tabstop>wslspin</tabstop> - <tabstop>effectcheckbox</tabstop> - <tabstop>menueffect</tabstop> - <tabstop>comboeffect</tabstop> - <tabstop>tooltipeffect</tabstop> - <tabstop>strutwidth</tabstop> - <tabstop>strutheight</tabstop> - <tabstop>sublistbox</tabstop> - </tabstops> - <resources/> - <connections/> -</ui> diff --git a/tools/qtconfig/paletteeditoradvanced.cpp b/tools/qtconfig/paletteeditoradvanced.cpp index 5f28413..4797ead 100644 --- a/tools/qtconfig/paletteeditoradvanced.cpp +++ b/tools/qtconfig/paletteeditoradvanced.cpp @@ -38,58 +38,74 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ - +#include "ui_paletteeditoradvanced.h" #include "paletteeditoradvanced.h" #include "colorbutton.h" -#include <QCheckBox> -#include <QComboBox> -#include <QApplication> -#include <QPushButton> -#include <QPainter> -#include <QGroupBox> - QT_BEGIN_NAMESPACE -PaletteEditorAdvanced::PaletteEditorAdvanced( QWidget * parent, - const char * name, bool modal, Qt::WindowFlags f ) - : PaletteEditorAdvancedBase( parent, name, modal, f ), selectedPalette(0) +PaletteEditorAdvanced::PaletteEditorAdvanced(QWidget *parent) + : QDialog(parent), ui(new Ui::PaletteEditorAdvanced), selectedPalette(0) { - // work around buggy UI file - comboEffect->setEnabled(false); + ui->setupUi(this); + + // create a ColorButton's + buttonCentral = new ColorButton(ui->groupCentral); + buttonCentral->setToolTip(tr("Choose a color")); + buttonCentral->setWhatsThis(tr("Choose a color for the selected central color role.")); + ui->layoutCentral->addWidget(buttonCentral); + ui->labelCentral->setBuddy(buttonCentral); + + buttonEffect = new ColorButton(ui->groupEffect); + buttonEffect->setToolTip(tr("Choose a color")); + buttonEffect->setWhatsThis(tr("Choose a color for the selected effect color role.")); buttonEffect->setEnabled(false); + ui->layoutEffect->addWidget(buttonEffect); + ui->labelEffect->setBuddy(buttonEffect); + + // signals and slots connections + connect(ui->paletteCombo, SIGNAL(activated(int)), SLOT(paletteSelected(int))); + connect(ui->comboCentral, SIGNAL(activated(int)), SLOT(onCentral(int))); + connect(buttonCentral, SIGNAL(clicked()), SLOT(onChooseCentralColor())); + connect(buttonEffect, SIGNAL(clicked()), SLOT(onChooseEffectColor())); + connect(ui->comboEffect, SIGNAL(activated(int)), SLOT(onEffect(int))); + connect(ui->checkBuildEffect, SIGNAL(toggled(bool)), SLOT(onToggleBuildEffects(bool))); + connect(ui->checkBuildEffect, SIGNAL(toggled(bool)), buttonEffect, SLOT(setDisabled(bool))); + connect(ui->checkBuildInactive, SIGNAL(toggled(bool)), SLOT(onToggleBuildInactive(bool))); + connect(ui->checkBuildDisabled, SIGNAL(toggled(bool)), SLOT(onToggleBuildDisabled(bool))); + onToggleBuildEffects(true); editPalette = QApplication::palette(); - setPreviewPalette( editPalette ); } PaletteEditorAdvanced::~PaletteEditorAdvanced() { + delete ui; } -void PaletteEditorAdvanced::onToggleBuildInactive( bool v ) +void PaletteEditorAdvanced::onToggleBuildInactive(bool v) { if (selectedPalette == 1) { - groupCentral->setDisabled(v); - groupEffect->setDisabled(v); + ui->groupCentral->setDisabled(v); + ui->groupEffect->setDisabled(v); } if (v) { - buildInactive(); + build(QPalette::Inactive); updateColorButtons(); } } -void PaletteEditorAdvanced::onToggleBuildDisabled( bool v ) +void PaletteEditorAdvanced::onToggleBuildDisabled(bool v) { if (selectedPalette == 2) { - groupCentral->setDisabled(v); - groupEffect->setDisabled(v); + ui->groupCentral->setDisabled(v); + ui->groupEffect->setDisabled(v); } if (v) { - buildDisabled(); + build(QPalette::Disabled); updateColorButtons(); } } @@ -99,402 +115,204 @@ void PaletteEditorAdvanced::paletteSelected(int p) selectedPalette = p; if(p == 1) { // inactive - groupCentral->setDisabled(checkBuildInactive->isChecked()); - groupEffect->setDisabled(checkBuildInactive->isChecked()); - } - else if (p == 2) { // disabled - groupCentral->setDisabled(checkBuildDisabled->isChecked()); - groupEffect->setDisabled(checkBuildDisabled->isChecked()); - } - else { - groupCentral->setEnabled(true); - groupEffect->setEnabled(true); + ui->groupCentral->setDisabled(ui->checkBuildInactive->isChecked()); + ui->groupEffect->setDisabled(ui->checkBuildInactive->isChecked()); + } else if (p == 2) { // disabled + ui->groupCentral->setDisabled(ui->checkBuildDisabled->isChecked()); + ui->groupEffect->setDisabled(ui->checkBuildDisabled->isChecked()); + } else { + ui->groupCentral->setEnabled(true); + ui->groupEffect->setEnabled(true); } updateColorButtons(); } void PaletteEditorAdvanced::onChooseCentralColor() { - switch(selectedPalette) { - case 0: - default: - mapToActiveCentralRole( buttonCentral->color() ); - break; - case 1: - mapToInactiveCentralRole( buttonCentral->color() ); - break; - case 2: - mapToDisabledCentralRole( buttonCentral->color() ); - break; + QPalette::ColorGroup group = groupFromIndex(selectedPalette); + editPalette.setColor(group, centralFromIndex(ui->comboCentral->currentIndex()), + buttonCentral->color()); + + buildEffect(group); + if (group == QPalette::Active) { + if(ui->checkBuildInactive->isChecked()) + build(QPalette::Inactive); + if(ui->checkBuildDisabled->isChecked()) + build(QPalette::Disabled); } + updateColorButtons(); } void PaletteEditorAdvanced::onChooseEffectColor() { - switch(selectedPalette) { - case 0: - default: - mapToActiveEffectRole( buttonEffect->color() ); - break; - case 1: - mapToInactiveEffectRole( buttonEffect->color() ); - break; - case 2: - mapToDisabledEffectRole( buttonEffect->color() ); - break; + QPalette::ColorGroup group = groupFromIndex(selectedPalette); + editPalette.setColor(group, effectFromIndex(ui->comboEffect->currentIndex()), + buttonEffect->color()); + + if (group == QPalette::Active) { + if(ui->checkBuildInactive->isChecked()) + build(QPalette::Inactive); + if(ui->checkBuildDisabled->isChecked()) + build(QPalette::Disabled); } - updateColorButtons(); -} -void PaletteEditorAdvanced::onToggleBuildEffects( bool on ) -{ - if (!on) return; - buildActiveEffect(); - buildInactiveEffect(); - buildDisabledEffect(); + updateColorButtons(); } -QColorGroup::ColorRole PaletteEditorAdvanced::centralFromItem( int item ) +void PaletteEditorAdvanced::onToggleBuildEffects(bool on) { - switch( item ) { - case 0: - return QColorGroup::Window; - case 1: - return QColorGroup::WindowText; - case 2: - return QColorGroup::Button; - case 3: - return QColorGroup::Base; - case 4: - return QColorGroup::Text; - case 5: - return QColorGroup::BrightText; - case 6: - return QColorGroup::ButtonText; - case 7: - return QColorGroup::Highlight; - case 8: - return QColorGroup::HighlightedText; - default: - return QColorGroup::NColorRoles; + if (on) { + for (int i = 0; i < QPalette::NColorGroups; i++) + buildEffect(QPalette::ColorGroup(i)); } } -QColorGroup::ColorRole PaletteEditorAdvanced::effectFromItem( int item ) - +QPalette::ColorGroup PaletteEditorAdvanced::groupFromIndex(int item) { - switch( item ) { + switch (item) { case 0: - return QColorGroup::Light; + default: + return QPalette::Active; case 1: - return QColorGroup::Midlight; + return QPalette::Inactive; case 2: - return QColorGroup::Mid; - case 3: - return QColorGroup::Dark; - case 4: - return QColorGroup::Shadow; - default: - return QColorGroup::NColorRoles; + return QPalette::Disabled; } } -void PaletteEditorAdvanced::onCentral( int item ) +QPalette::ColorRole PaletteEditorAdvanced::centralFromIndex(int item) { - QColor c; - - switch(selectedPalette) { + switch (item) { case 0: - default: - c = editPalette.active().color( centralFromItem(item) ); - break; + return QPalette::Window; case 1: - c = editPalette.inactive().color( centralFromItem(item) ); - break; + return QPalette::WindowText; case 2: - c = editPalette.disabled().color( centralFromItem(item) ); - break; + return QPalette::Base; + case 3: + return QPalette::AlternateBase; + case 4: + return QPalette::ToolTipBase; + case 5: + return QPalette::ToolTipText; + case 6: + return QPalette::Text; + case 7: + return QPalette::Button; + case 8: + return QPalette::ButtonText; + case 9: + return QPalette::BrightText; + case 10: + return QPalette::Highlight; + case 11: + return QPalette::HighlightedText; + case 12: + return QPalette::Link; + case 13: + return QPalette::LinkVisited; + default: + return QPalette::NoRole; } - - buttonCentral->setColor(c); } -void PaletteEditorAdvanced::onEffect( int item ) +QPalette::ColorRole PaletteEditorAdvanced::effectFromIndex(int item) { - QColor c; - switch(selectedPalette) { + switch (item) { case 0: - default: - c = editPalette.active().color( effectFromItem(item) ); - break; + return QPalette::Light; case 1: - editPalette.inactive().color( effectFromItem(item) ); - break; + return QPalette::Midlight; case 2: - editPalette.disabled().color( effectFromItem(item) ); - break; + return QPalette::Mid; + case 3: + return QPalette::Dark; + case 4: + return QPalette::Shadow; + default: + return QPalette::NoRole; } - buttonEffect->setColor(c); -} - -void PaletteEditorAdvanced::mapToActiveCentralRole( const QColor& c ) -{ - QColorGroup cg = editPalette.active(); - cg.setColor( centralFromItem(comboCentral->currentItem()), c ); - editPalette.setActive( cg ); - - buildActiveEffect(); - if(checkBuildInactive->isChecked()) - buildInactive(); - if(checkBuildDisabled->isChecked()) - buildDisabled(); - - setPreviewPalette( editPalette ); -} - -void PaletteEditorAdvanced::mapToActiveEffectRole( const QColor& c ) -{ - QColorGroup cg = editPalette.active(); - cg.setColor( effectFromItem(comboEffect->currentItem()), c ); - editPalette.setActive( cg ); - - if(checkBuildInactive->isChecked()) - buildInactive(); - if(checkBuildDisabled->isChecked()) - buildDisabled(); - - setPreviewPalette( editPalette ); -} - -void PaletteEditorAdvanced::mapToActivePixmapRole( const QPixmap& pm ) -{ - QColorGroup::ColorRole role = centralFromItem(comboCentral->currentItem()); - QColorGroup cg = editPalette.active(); - if ( !pm.isNull() ) - cg.setBrush( role, QBrush( cg.color( role ), pm ) ); - else - cg.setBrush( role, QBrush( cg.color( role ) ) ); - editPalette.setActive( cg ); - - - buildActiveEffect(); - if(checkBuildInactive->isChecked()) - buildInactive(); - if(checkBuildDisabled->isChecked()) - buildDisabled(); - - setPreviewPalette( editPalette ); -} - -void PaletteEditorAdvanced::mapToInactiveCentralRole( const QColor& c ) -{ - QColorGroup cg = editPalette.inactive(); - cg.setColor( centralFromItem(comboCentral->currentItem()), c ); - editPalette.setInactive( cg ); - - buildInactiveEffect(); - - setPreviewPalette( editPalette ); } -void PaletteEditorAdvanced::mapToInactiveEffectRole( const QColor& c ) +void PaletteEditorAdvanced::onCentral(int item) { - QColorGroup cg = editPalette.inactive(); - cg.setColor( effectFromItem(comboEffect->currentItem()), c ); - editPalette.setInactive( cg ); - - setPreviewPalette( editPalette ); -} - -void PaletteEditorAdvanced::mapToInactivePixmapRole( const QPixmap& pm ) -{ - QColorGroup::ColorRole role = centralFromItem(comboCentral->currentItem()); - QColorGroup cg = editPalette.inactive(); - if ( !pm.isNull() ) - cg.setBrush( role, QBrush( cg.color( role ), pm ) ); - else - cg.setBrush( role, QBrush( cg.color( role ) ) ); - editPalette.setInactive( cg ); - - setPreviewPalette( editPalette ); -} - -void PaletteEditorAdvanced::mapToDisabledCentralRole( const QColor& c ) -{ - QColorGroup cg = editPalette.disabled(); - cg.setColor( centralFromItem(comboCentral->currentItem()), c ); - editPalette.setDisabled( cg ); - - buildDisabledEffect(); - - setPreviewPalette( editPalette ); -} - -void PaletteEditorAdvanced::mapToDisabledEffectRole( const QColor& c ) -{ - QColorGroup cg = editPalette.disabled(); - cg.setColor( effectFromItem(comboEffect->currentItem()), c ); - editPalette.setDisabled( cg ); - - setPreviewPalette( editPalette ); + QColor c = editPalette.color(groupFromIndex(selectedPalette), centralFromIndex(item)); + buttonCentral->setColor(c); } -void PaletteEditorAdvanced::mapToDisabledPixmapRole( const QPixmap& pm ) +void PaletteEditorAdvanced::onEffect(int item) { - QColorGroup::ColorRole role = centralFromItem(comboCentral->currentItem()); - QColorGroup cg = editPalette.disabled(); - if ( !pm.isNull() ) - cg.setBrush( role, QBrush( cg.color( role ), pm ) ); - else - cg.setBrush( role, QBrush( cg.color( role ) ) ); - - editPalette.setDisabled( cg ); - - setPreviewPalette( editPalette ); + QColor c = editPalette.color(groupFromIndex(selectedPalette), effectFromIndex(item)); + buttonEffect->setColor(c); } -void PaletteEditorAdvanced::buildActiveEffect() +QPalette PaletteEditorAdvanced::buildEffect(QPalette::ColorGroup colorGroup, + const QPalette &basePalette) { - QColorGroup cg = editPalette.active(); - QColor btn = cg.color( QColorGroup::Button ); - - QPalette temp( btn, btn ); - - for (int i = 0; i<5; i++) - cg.setColor( effectFromItem(i), temp.active().color( effectFromItem(i) ) ); + QPalette result(basePalette); - editPalette.setActive( cg ); - setPreviewPalette( editPalette ); + if (colorGroup == QPalette::Active) { + QPalette calculatedPalette(basePalette.color(colorGroup, QPalette::Button), + basePalette.color(colorGroup, QPalette::Window)); - updateColorButtons(); -} + for (int i = 0; i < 5; i++) { + QPalette::ColorRole effectRole = effectFromIndex(i); + result.setColor(colorGroup, effectRole, + calculatedPalette.color(colorGroup, effectRole)); + } + } else { + QColor btn = basePalette.color(colorGroup, QPalette::Button); -void PaletteEditorAdvanced::buildInactive() -{ - editPalette.setInactive( editPalette.active() ); - if ( checkBuildEffect->isChecked() ) - buildInactiveEffect(); - else { - setPreviewPalette( editPalette ); - updateColorButtons(); + result.setColor(colorGroup, QPalette::Light, btn.lighter()); + result.setColor(colorGroup, QPalette::Midlight, btn.lighter(115)); + result.setColor(colorGroup, QPalette::Mid, btn.darker(150)); + result.setColor(colorGroup, QPalette::Dark, btn.darker()); + result.setColor(colorGroup, QPalette::Shadow, Qt::black); } + return result; } -void PaletteEditorAdvanced::buildInactiveEffect() +void PaletteEditorAdvanced::buildEffect(QPalette::ColorGroup colorGroup) { - QColorGroup cg = editPalette.inactive(); - - QColor light, midlight, mid, dark, shadow; - QColor btn = cg.color( QColorGroup::Button ); - - light = btn.light(150); - midlight = btn.light(115); - mid = btn.dark(150); - dark = btn.dark(); - shadow = Qt::black; - - cg.setColor( QColorGroup::Light, light ); - cg.setColor( QColorGroup::Midlight, midlight ); - cg.setColor( QColorGroup::Mid, mid ); - cg.setColor( QColorGroup::Dark, dark ); - cg.setColor( QColorGroup::Shadow, shadow ); - - editPalette.setInactive( cg ); - setPreviewPalette( editPalette ); + editPalette = buildEffect(colorGroup, editPalette); updateColorButtons(); } -void PaletteEditorAdvanced::buildDisabled() +void PaletteEditorAdvanced::build(QPalette::ColorGroup colorGroup) { - QColorGroup cg = editPalette.active(); - cg.setColor( QColorGroup::ButtonText, Qt::darkGray ); - cg.setColor( QColorGroup::WindowText, Qt::darkGray ); - cg.setColor( QColorGroup::Text, Qt::darkGray ); - cg.setColor( QColorGroup::HighlightedText, Qt::darkGray ); - editPalette.setDisabled( cg ); - - if ( checkBuildEffect->isChecked() ) - buildDisabledEffect(); - else { - setPreviewPalette( editPalette ); - updateColorButtons(); - } -} - -void PaletteEditorAdvanced::buildDisabledEffect() -{ - QColorGroup cg = editPalette.disabled(); - - QColor light, midlight, mid, dark, shadow; - QColor btn = cg.color( QColorGroup::Button ); - - light = btn.light(150); - midlight = btn.light(115); - mid = btn.dark(150); - dark = btn.dark(); - shadow = Qt::black; + if (colorGroup != QPalette::Active) { + for (int i = 0; i < QPalette::NColorRoles; i++) + editPalette.setColor(colorGroup, QPalette::ColorRole(i), + editPalette.color(QPalette::Active, QPalette::ColorRole(i))); - cg.setColor( QColorGroup::Light, light ); - cg.setColor( QColorGroup::Midlight, midlight ); - cg.setColor( QColorGroup::Mid, mid ); - cg.setColor( QColorGroup::Dark, dark ); - cg.setColor( QColorGroup::Shadow, shadow ); + if (colorGroup == QPalette::Disabled) { + editPalette.setColor(colorGroup, QPalette::ButtonText, Qt::darkGray); + editPalette.setColor(colorGroup, QPalette::WindowText, Qt::darkGray); + editPalette.setColor(colorGroup, QPalette::Text, Qt::darkGray); + editPalette.setColor(colorGroup, QPalette::HighlightedText, Qt::darkGray); + } - editPalette.setDisabled( cg ); - setPreviewPalette( editPalette ); - updateColorButtons(); -} - -void PaletteEditorAdvanced::setPreviewPalette( const QPalette& pal ) -{ - QColorGroup cg; - - switch (selectedPalette) { - case 0: - default: - cg = pal.active(); - break; - case 1: - cg = pal.inactive(); - break; - case 2: - cg = pal.disabled(); - break; + if (ui->checkBuildEffect->isChecked()) + buildEffect(colorGroup); + else + updateColorButtons(); } - previewPalette.setActive( cg ); - previewPalette.setInactive( cg ); - previewPalette.setDisabled( cg ); } void PaletteEditorAdvanced::updateColorButtons() { - QColor central, effect; - switch (selectedPalette) { - case 0: - default: - central = editPalette.active().color( centralFromItem( comboCentral->currentItem() ) ); - effect = editPalette.active().color( effectFromItem( comboEffect->currentItem() ) ); - break; - case 1: - central = editPalette.inactive().color( centralFromItem( comboCentral->currentItem() ) ); - effect = editPalette.inactive().color( effectFromItem( comboEffect->currentItem() ) ); - break; - case 2: - central = editPalette.disabled().color( centralFromItem( comboCentral->currentItem() ) ); - effect = editPalette.disabled().color( effectFromItem( comboEffect->currentItem() ) ); - break; - } - - buttonCentral->setColor(central); - buttonEffect->setColor(effect); + QPalette::ColorGroup colorGroup = groupFromIndex(selectedPalette); + buttonCentral->setColor(editPalette.color(colorGroup, + centralFromIndex(ui->comboCentral->currentIndex()))); + buttonEffect->setColor(editPalette.color(colorGroup, + effectFromIndex(ui->comboEffect->currentIndex()))); } -void PaletteEditorAdvanced::setPal( const QPalette& pal ) +void PaletteEditorAdvanced::setPal(const QPalette &pal) { editPalette = pal; - setPreviewPalette( pal ); updateColorButtons(); } @@ -503,51 +321,51 @@ QPalette PaletteEditorAdvanced::pal() const return editPalette; } -void PaletteEditorAdvanced::setupBackgroundMode( Qt::BackgroundMode mode ) +void PaletteEditorAdvanced::setupBackgroundRole(QPalette::ColorRole role) { int initRole = 0; - switch( mode ) { - case Qt::PaletteBackground: + switch (role) { + case QPalette::Window: initRole = 0; break; - case Qt::PaletteForeground: + case QPalette::WindowText: initRole = 1; break; - case Qt::PaletteButton: + case QPalette::Base: initRole = 2; break; - case Qt::PaletteBase: + case QPalette::AlternateBase: initRole = 3; break; - case Qt::PaletteText: + case QPalette::ToolTipBase: initRole = 4; break; - case Qt::PaletteBrightText: + case QPalette::ToolTipText: initRole = 5; break; - case Qt::PaletteButtonText: + case QPalette::Text: initRole = 6; break; - case Qt::PaletteHighlight: + case QPalette::Button: initRole = 7; break; - case Qt::PaletteHighlightedText: + case QPalette::ButtonText: initRole = 8; break; - case Qt::PaletteLight: + case QPalette::BrightText: initRole = 9; break; - case Qt::PaletteMidlight: + case QPalette::Highlight: initRole = 10; break; - case Qt::PaletteDark: + case QPalette::HighlightedText: initRole = 11; break; - case Qt::PaletteMid: + case QPalette::Link: initRole = 12; break; - case Qt::PaletteShadow: + case QPalette::LinkVisited: initRole = 13; break; default: @@ -555,36 +373,27 @@ void PaletteEditorAdvanced::setupBackgroundMode( Qt::BackgroundMode mode ) break; } - if ( initRole <= -1 ) return; - - if (initRole > 8 ) { - comboEffect->setCurrentItem( initRole - 9 ); - } - else { - comboCentral->setCurrentItem( initRole ); - } + if (initRole != -1) + ui->comboCentral->setCurrentIndex(initRole); } -QPalette PaletteEditorAdvanced::getPalette( bool *ok, const QPalette &init, - Qt::BackgroundMode mode, QWidget* parent, - const char* name ) +QPalette PaletteEditorAdvanced::getPalette(bool *ok, const QPalette &init, + QPalette::ColorRole backgroundRole, QWidget *parent) { - PaletteEditorAdvanced* dlg = new PaletteEditorAdvanced( parent, name, true ); - dlg->setupBackgroundMode( mode ); + PaletteEditorAdvanced *dlg = new PaletteEditorAdvanced(parent); + dlg->setupBackgroundRole(backgroundRole); - if ( init != QPalette() ) - dlg->setPal( init ); + if (init != QPalette()) + dlg->setPal(init); int resultCode = dlg->exec(); QPalette result = init; - if ( resultCode == QDialog::Accepted ) { - if ( ok ) - *ok = true; + if (resultCode == QDialog::Accepted) result = dlg->pal(); - } else { - if ( ok ) - *ok = false; - } + + if (ok) + *ok = resultCode; + delete dlg; return result; } diff --git a/tools/qtconfig/paletteeditoradvanced.h b/tools/qtconfig/paletteeditoradvanced.h index 83bcebb..4f61676 100644 --- a/tools/qtconfig/paletteeditoradvanced.h +++ b/tools/qtconfig/paletteeditoradvanced.h @@ -42,69 +42,65 @@ #ifndef PALETTEEDITORADVANCED_H #define PALETTEEDITORADVANCED_H -#include "paletteeditoradvancedbase.h" +#include <QtGui/QDialog> QT_BEGIN_NAMESPACE -class PaletteEditorAdvanced : public PaletteEditorAdvancedBase +namespace Ui { + class PaletteEditorAdvanced; +} + +class ColorButton; + +class PaletteEditorAdvanced : public QDialog { Q_OBJECT public: - PaletteEditorAdvanced( QWidget * parent=0, const char * name=0, - bool modal=false, Qt::WindowFlags f=0 ); + PaletteEditorAdvanced(QWidget *parent = 0); ~PaletteEditorAdvanced(); - static QPalette getPalette( bool *ok, const QPalette &pal, Qt::BackgroundMode mode = Qt::PaletteBackground, - QWidget* parent = 0, const char* name = 0 ); + static QPalette getPalette(bool *ok, const QPalette &pal, + QPalette::ColorRole backgroundRole = QPalette::Window, + QWidget *parent = 0); + + static QPalette buildEffect(QPalette::ColorGroup colorGroup, const QPalette &basePalette); protected slots: void paletteSelected(int); - void onCentral( int ); - void onEffect( int ); + void onCentral(int); + void onEffect(int); void onChooseCentralColor(); void onChooseEffectColor(); - void onToggleBuildEffects( bool ); - void onToggleBuildInactive( bool ); - void onToggleBuildDisabled( bool ); + void onToggleBuildEffects(bool); + void onToggleBuildInactive(bool); + void onToggleBuildDisabled(bool); protected: - void mapToActiveCentralRole( const QColor& ); - void mapToActiveEffectRole( const QColor& ); - void mapToActivePixmapRole( const QPixmap& ); - void mapToInactiveCentralRole( const QColor& ); - void mapToInactiveEffectRole( const QColor& ); - void mapToInactivePixmapRole( const QPixmap& ); - void mapToDisabledCentralRole( const QColor& ); - void mapToDisabledEffectRole( const QColor& ); - void mapToDisabledPixmapRole( const QPixmap& ); - - - void buildPalette(); - void buildActiveEffect(); - void buildInactive(); - void buildInactiveEffect(); - void buildDisabled(); - void buildDisabledEffect(); + void buildEffect(QPalette::ColorGroup); + void build(QPalette::ColorGroup); private: - void setPreviewPalette( const QPalette& ); void updateColorButtons(); - void setupBackgroundMode( Qt::BackgroundMode ); + void setupBackgroundRole(QPalette::ColorRole); QPalette pal() const; - void setPal( const QPalette& ); + void setPal(const QPalette &); - QColorGroup::ColorRole centralFromItem( int ); - QColorGroup::ColorRole effectFromItem( int ); + static QPalette::ColorGroup groupFromIndex(int); + static QPalette::ColorRole centralFromIndex(int); + static QPalette::ColorRole effectFromIndex(int); QPalette editPalette; - QPalette previewPalette; + + Ui::PaletteEditorAdvanced *ui; int selectedPalette; + ColorButton *buttonCentral; + ColorButton *buttonEffect; }; QT_END_NAMESPACE -#endif +#endif // PALETTEEDITORADVANCED_H diff --git a/tools/qtconfig/paletteeditoradvanced.ui b/tools/qtconfig/paletteeditoradvanced.ui new file mode 100644 index 0000000..b1d6b95 --- /dev/null +++ b/tools/qtconfig/paletteeditoradvanced.ui @@ -0,0 +1,416 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <comment>********************************************************************* +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +*********************************************************************</comment> + <class>PaletteEditorAdvanced</class> + <widget class="QDialog" name="PaletteEditorAdvanced"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>239</width> + <height>344</height> + </rect> + </property> + <property name="windowTitle"> + <string>Tune Palette</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_4"> + <item> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QLabel" name="paletteComboLabel"> + <property name="text"> + <string>Select &Palette:</string> + </property> + <property name="buddy"> + <cstring>paletteCombo</cstring> + </property> + </widget> + </item> + <item> + <widget class="QComboBox" name="paletteCombo"> + <item> + <property name="text"> + <string>Active Palette</string> + </property> + </item> + <item> + <property name="text"> + <string>Inactive Palette</string> + </property> + </item> + <item> + <property name="text"> + <string>Disabled Palette</string> + </property> + </item> + </widget> + </item> + </layout> + </item> + <item> + <widget class="QGroupBox" name="autoGroupBox"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="title"> + <string>Auto</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <widget class="QCheckBox" name="checkBuildInactive"> + <property name="text"> + <string>Build inactive palette from active</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="checkBuildDisabled"> + <property name="text"> + <string>Build disabled palette from active</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="groupCentral"> + <property name="title"> + <string>Central color &roles</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <item> + <widget class="QComboBox" name="comboCentral"> + <property name="toolTip"> + <string>Choose central color role</string> + </property> + <property name="whatsThis"> + <string><b>Select a color role.</b><p>Available central roles are: <ul> <li>Window - general background color.</li> <li>WindowText - general foreground color. </li> <li>Base - used as background color for e.g. text entry widgets, usually white or another light color. </li> <li>Text - the foreground color used with Base. Usually this is the same as WindowText, in what case it must provide good contrast both with Window and Base. </li> <li>Button - general button background color, where buttons need a background different from Window, as in the Macintosh style. </li> <li>ButtonText - a foreground color used with the Button color. </li> <li>Highlight - a color to indicate a selected or highlighted item. </li> <li>HighlightedText - a text color that contrasts to Highlight. </li> <li>BrightText - a text color that is very different from WindowText and contrasts well with e.g. black. </li> </ul> </p></string> + </property> + <item> + <property name="text"> + <string>Window</string> + </property> + </item> + <item> + <property name="text"> + <string>WindowText</string> + </property> + </item> + <item> + <property name="text"> + <string>Base</string> + </property> + </item> + <item> + <property name="text"> + <string>AlternateBase</string> + </property> + </item> + <item> + <property name="text"> + <string>ToolTipBase</string> + </property> + </item> + <item> + <property name="text"> + <string>ToolTipText</string> + </property> + </item> + <item> + <property name="text"> + <string>Text</string> + </property> + </item> + <item> + <property name="text"> + <string>Button</string> + </property> + </item> + <item> + <property name="text"> + <string>ButtonText</string> + </property> + </item> + <item> + <property name="text"> + <string>BrightText</string> + </property> + </item> + <item> + <property name="text"> + <string>Highlight</string> + </property> + </item> + <item> + <property name="text"> + <string>HighlightedText</string> + </property> + </item> + <item> + <property name="text"> + <string>Link</string> + </property> + </item> + <item> + <property name="text"> + <string>LinkVisited</string> + </property> + </item> + </widget> + </item> + <item> + <layout class="QHBoxLayout" name="layoutCentral"> + <item> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QLabel" name="labelCentral"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>&Select Color:</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="groupEffect"> + <property name="title"> + <string>3-D shadow &effects</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_3"> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_2"> + <item> + <widget class="QCheckBox" name="checkBuildEffect"> + <property name="toolTip"> + <string>Generate shadings</string> + </property> + <property name="whatsThis"> + <string>Check to let 3D-effect colors be calculated from button-color.</string> + </property> + <property name="text"> + <string>Build &from button color</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QComboBox" name="comboEffect"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="toolTip"> + <string>Choose 3D-effect color role</string> + </property> + <property name="whatsThis"> + <string><b>Select a color role.</b><p>Available effect roles are: <ul> <li>Light - lighter than Button color. </li> <li>Midlight - between Button and Light. </li> <li>Mid - between Button and Dark. </li> <li>Dark - darker than Button. </li> <li>Shadow - a very dark color. </li> </ul></string> + </property> + <item> + <property name="text"> + <string>Light</string> + </property> + </item> + <item> + <property name="text"> + <string>Midlight</string> + </property> + </item> + <item> + <property name="text"> + <string>Mid</string> + </property> + </item> + <item> + <property name="text"> + <string>Dark</string> + </property> + </item> + <item> + <property name="text"> + <string>Shadow</string> + </property> + </item> + </widget> + </item> + </layout> + </item> + <item> + <layout class="QHBoxLayout" name="layoutEffect"> + <item> + <spacer name="horizontalSpacer_2"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QLabel" name="labelEffect"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>Select Co&lor:</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QDialogButtonBox" name="buttonBox"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="standardButtons"> + <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> + </property> + </widget> + </item> + </layout> + </widget> + <resources/> + <connections> + <connection> + <sender>buttonBox</sender> + <signal>accepted()</signal> + <receiver>PaletteEditorAdvanced</receiver> + <slot>accept()</slot> + <hints> + <hint type="sourcelabel"> + <x>238</x> + <y>384</y> + </hint> + <hint type="destinationlabel"> + <x>157</x> + <y>274</y> + </hint> + </hints> + </connection> + <connection> + <sender>buttonBox</sender> + <signal>rejected()</signal> + <receiver>PaletteEditorAdvanced</receiver> + <slot>reject()</slot> + <hints> + <hint type="sourcelabel"> + <x>306</x> + <y>390</y> + </hint> + <hint type="destinationlabel"> + <x>286</x> + <y>274</y> + </hint> + </hints> + </connection> + <connection> + <sender>checkBuildEffect</sender> + <signal>toggled(bool)</signal> + <receiver>comboEffect</receiver> + <slot>setDisabled(bool)</slot> + <hints> + <hint type="sourcelabel"> + <x>82</x> + <y>262</y> + </hint> + <hint type="destinationlabel"> + <x>190</x> + <y>262</y> + </hint> + </hints> + </connection> + </connections> +</ui> diff --git a/tools/qtconfig/paletteeditoradvancedbase.cpp b/tools/qtconfig/paletteeditoradvancedbase.cpp deleted file mode 100644 index 55a03b7..0000000 --- a/tools/qtconfig/paletteeditoradvancedbase.cpp +++ /dev/null @@ -1,144 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "paletteeditoradvancedbase.h" -#include "colorbutton.h" - -#include <QVariant> - -QT_BEGIN_NAMESPACE - -/* - * Constructs a PaletteEditorAdvancedBase as a child of 'parent', with the - * name 'name' and widget flags set to 'f'. - * - * The dialog will by default be modeless, unless you set 'modal' to - * true to construct a modal dialog. - */ -PaletteEditorAdvancedBase::PaletteEditorAdvancedBase(QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl) - : QDialog(parent, name, modal, fl) -{ - setupUi(this); - - - // signals and slots connections - connect(buttonOk, SIGNAL(clicked()), this, SLOT(accept())); - connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject())); - connect(paletteCombo, SIGNAL(activated(int)), this, SLOT(paletteSelected(int))); - connect(comboCentral, SIGNAL(activated(int)), this, SLOT(onCentral(int))); - connect(buttonCentral, SIGNAL(clicked()), this, SLOT(onChooseCentralColor())); - connect(buttonEffect, SIGNAL(clicked()), this, SLOT(onChooseEffectColor())); - connect(comboEffect, SIGNAL(activated(int)), this, SLOT(onEffect(int))); - connect(checkBuildEffect, SIGNAL(toggled(bool)), this, SLOT(onToggleBuildEffects(bool))); - connect(checkBuildEffect, SIGNAL(toggled(bool)), comboEffect, SLOT(setDisabled(bool))); - connect(checkBuildEffect, SIGNAL(toggled(bool)), buttonEffect, SLOT(setDisabled(bool))); - connect(checkBuildInactive, SIGNAL(toggled(bool)), this, SLOT(onToggleBuildInactive(bool))); - connect(checkBuildDisabled, SIGNAL(toggled(bool)), this, SLOT(onToggleBuildDisabled(bool))); - init(); -} - -/* - * Destroys the object and frees any allocated resources - */ -PaletteEditorAdvancedBase::~PaletteEditorAdvancedBase() -{ - destroy(); - // no need to delete child widgets, Qt does it all for us -} - -/* - * Sets the strings of the subwidgets using the current - * language. - */ -void PaletteEditorAdvancedBase::languageChange() -{ - retranslateUi(this); -} - -void PaletteEditorAdvancedBase::init() -{ -} - -void PaletteEditorAdvancedBase::destroy() -{ -} - -void PaletteEditorAdvancedBase::onCentral(int) -{ - qWarning("PaletteEditorAdvancedBase::onCentral(int): Not implemented yet"); -} - -void PaletteEditorAdvancedBase::onChooseCentralColor() -{ - qWarning("PaletteEditorAdvancedBase::onChooseCentralColor(): Not implemented yet"); -} - -void PaletteEditorAdvancedBase::onChooseEffectColor() -{ - qWarning("PaletteEditorAdvancedBase::onChooseEffectColor(): Not implemented yet"); -} - -void PaletteEditorAdvancedBase::onEffect(int) -{ - qWarning("PaletteEditorAdvancedBase::onEffect(int): Not implemented yet"); -} - -void PaletteEditorAdvancedBase::onToggleBuildDisabled(bool) -{ - qWarning("PaletteEditorAdvancedBase::onToggleBuildDisabled(bool): Not implemented yet"); -} - -void PaletteEditorAdvancedBase::onToggleBuildEffects(bool) -{ - qWarning("PaletteEditorAdvancedBase::onToggleBuildEffects(bool): Not implemented yet"); -} - -void PaletteEditorAdvancedBase::onToggleBuildInactive(bool) -{ - qWarning("PaletteEditorAdvancedBase::onToggleBuildInactive(bool): Not implemented yet"); -} - -void PaletteEditorAdvancedBase::paletteSelected(int) -{ - qWarning("PaletteEditorAdvancedBase::paletteSelected(int): Not implemented yet"); -} - -QT_END_NAMESPACE diff --git a/tools/qtconfig/paletteeditoradvancedbase.h b/tools/qtconfig/paletteeditoradvancedbase.h deleted file mode 100644 index c097382..0000000 --- a/tools/qtconfig/paletteeditoradvancedbase.h +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef PALETTEEDITORADVANCEDBASE_H -#define PALETTEEDITORADVANCEDBASE_H - -#include "ui_paletteeditoradvancedbase.h" -#include <QVariant> - -QT_BEGIN_NAMESPACE - -class ColorButton; - -class PaletteEditorAdvancedBase : public QDialog, public Ui::PaletteEditorAdvancedBase -{ - Q_OBJECT - -public: - PaletteEditorAdvancedBase(QWidget* parent = 0, const char* name = 0, bool modal = false, Qt::WindowFlags fl = 0); - ~PaletteEditorAdvancedBase(); - -protected slots: - virtual void languageChange(); - - virtual void init(); - virtual void destroy(); - virtual void onCentral(int); - virtual void onChooseCentralColor(); - virtual void onChooseEffectColor(); - virtual void onEffect(int); - virtual void onToggleBuildDisabled(bool); - virtual void onToggleBuildEffects(bool); - virtual void onToggleBuildInactive(bool); - virtual void paletteSelected(int); - -}; - -QT_END_NAMESPACE - -#endif // PALETTEEDITORADVANCEDBASE_H diff --git a/tools/qtconfig/paletteeditoradvancedbase.ui b/tools/qtconfig/paletteeditoradvancedbase.ui deleted file mode 100644 index 8965960..0000000 --- a/tools/qtconfig/paletteeditoradvancedbase.ui +++ /dev/null @@ -1,617 +0,0 @@ -<ui version="4.0" stdsetdef="1" > - <author></author> - <comment>********************************************************************* -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -*********************************************************************</comment> - <exportmacro></exportmacro> - <class>PaletteEditorAdvancedBase</class> - <widget class="QDialog" name="PaletteEditorAdvancedBase" > - <property name="objectName" > - <string notr="true" >PaletteEditorAdvancedBase</string> - </property> - <property name="enabled" > - <bool>true</bool> - </property> - <property name="geometry" > - <rect> - <x>0</x> - <y>0</y> - <width>295</width> - <height>346</height> - </rect> - </property> - <property name="windowTitle" > - <string>Tune Palette</string> - </property> - <property name="sizeGripEnabled" > - <bool>true</bool> - </property> - <property name="whatsThis" stdset="0" > - <string><b>Edit Palette</b><p>Change the palette of the current widget or form.</p><p>Use a generated palette or select colors for each color group and each color role.</p><p>The palette can be tested with different widget layouts in the preview section.</p></string> - </property> - <layout class="QVBoxLayout" > - <property name="objectName" > - <string notr="true" >unnamed</string> - </property> - <property name="margin" > - <number>11</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <layout class="QHBoxLayout" > - <property name="objectName" > - <string notr="true" >unnamed</string> - </property> - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QLabel" name="TextLabel1" > - <property name="objectName" > - <string notr="true" >TextLabel1</string> - </property> - <property name="text" > - <string>Select &Palette:</string> - </property> - <property name="buddy" stdset="0" > - <cstring>paletteCombo</cstring> - </property> - </widget> - </item> - <item> - <widget class="QComboBox" name="paletteCombo" > - <property name="objectName" > - <string notr="true" >paletteCombo</string> - </property> - <item> - <property name="text" > - <string>Active Palette</string> - </property> - </item> - <item> - <property name="text" > - <string>Inactive Palette</string> - </property> - </item> - <item> - <property name="text" > - <string>Disabled Palette</string> - </property> - </item> - </widget> - </item> - </layout> - </item> - <item> - <widget class="Q3ButtonGroup" name="ButtonGroup1" > - <property name="objectName" > - <string notr="true" >ButtonGroup1</string> - </property> - <property name="sizePolicy" > - <sizepolicy> - <hsizetype>5</hsizetype> - <vsizetype>4</vsizetype> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="title" > - <string>Auto</string> - </property> - <layout class="QVBoxLayout" > - <property name="objectName" > - <string notr="true" >unnamed</string> - </property> - <property name="margin" > - <number>11</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QCheckBox" name="checkBuildInactive" > - <property name="objectName" > - <string notr="true" >checkBuildInactive</string> - </property> - <property name="text" > - <string>Build inactive palette from active</string> - </property> - <property name="checked" > - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QCheckBox" name="checkBuildDisabled" > - <property name="objectName" > - <string notr="true" >checkBuildDisabled</string> - </property> - <property name="text" > - <string>Build disabled palette from active</string> - </property> - <property name="checked" > - <bool>true</bool> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <widget class="Q3GroupBox" name="groupCentral" > - <property name="objectName" > - <string notr="true" >groupCentral</string> - </property> - <property name="title" > - <string>Central color &roles</string> - </property> - <layout class="QVBoxLayout" > - <property name="objectName" > - <string notr="true" >unnamed</string> - </property> - <property name="margin" > - <number>11</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QComboBox" name="comboCentral" > - <property name="objectName" > - <string notr="true" >comboCentral</string> - </property> - <property name="toolTip" stdset="0" > - <string>Choose central color role</string> - </property> - <property name="whatsThis" stdset="0" > - <string><b>Select a color role.</b><p>Available central roles are: <ul> <li>Window - general background color.</li> <li>WindowText - general foreground color. </li> <li>Base - used as background color for e.g. text entry widgets, usually white or another light color. </li> <li>Text - the foreground color used with Base. Usually this is the same as WindowText, in what case it must provide good contrast both with Window and Base. </li> <li>Button - general button background color, where buttons need a background different from Window, as in the Macintosh style. </li> <li>ButtonText - a foreground color used with the Button color. </li> <li>Highlight - a color to indicate a selected or highlighted item. </li> <li>HighlightedText - a text color that contrasts to Highlight. </li> <li>BrightText - a text color that is very different from WindowText and contrasts well with e.g. black. </li> </ul> </p></string> - </property> - <item> - <property name="text" > - <string>Window</string> - </property> - </item> - <item> - <property name="text" > - <string>WindowText</string> - </property> - </item> - <item> - <property name="text" > - <string>Button</string> - </property> - </item> - <item> - <property name="text" > - <string>Base</string> - </property> - </item> - <item> - <property name="text" > - <string>Text</string> - </property> - </item> - <item> - <property name="text" > - <string>BrightText</string> - </property> - </item> - <item> - <property name="text" > - <string>ButtonText</string> - </property> - </item> - <item> - <property name="text" > - <string>Highlight</string> - </property> - </item> - <item> - <property name="text" > - <string>HighlightedText</string> - </property> - </item> - </widget> - </item> - <item> - <layout class="QHBoxLayout" > - <property name="objectName" > - <string notr="true" >unnamed</string> - </property> - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <spacer name="Horizontal_Spacing1" > - <property name="sizeHint" > - <size> - <width>20</width> - <height>20</height> - </size> - </property> - <property name="sizeType" > - <enum>Expanding</enum> - </property> - <property name="orientation" > - <enum>Horizontal</enum> - </property> - </spacer> - </item> - <item> - <widget class="QLabel" name="labelCentral" > - <property name="objectName" > - <string notr="true" >labelCentral</string> - </property> - <property name="sizePolicy" > - <sizepolicy> - <hsizetype>1</hsizetype> - <vsizetype>1</vsizetype> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize" > - <size> - <width>0</width> - <height>0</height> - </size> - </property> - <property name="text" > - <string>&Select Color:</string> - </property> - <property name="buddy" stdset="0" > - <cstring>buttonCentral</cstring> - </property> - </widget> - </item> - <item> - <widget class="ColorButton" name="buttonCentral" > - <property name="objectName" > - <string notr="true" >buttonCentral</string> - </property> - <property name="sizePolicy" > - <sizepolicy> - <hsizetype>0</hsizetype> - <vsizetype>0</vsizetype> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="focusPolicy" > - <enum>Qt::TabFocus</enum> - </property> - <property name="toolTip" stdset="0" > - <string>Choose a color</string> - </property> - <property name="whatsThis" stdset="0" > - <string>Choose a color for the selected central color role.</string> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </widget> - </item> - <item> - <widget class="Q3GroupBox" name="groupEffect" > - <property name="objectName" > - <string notr="true" >groupEffect</string> - </property> - <property name="title" > - <string>3-D shadow &effects</string> - </property> - <layout class="QVBoxLayout" > - <property name="objectName" > - <string notr="true" >unnamed</string> - </property> - <property name="margin" > - <number>11</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <layout class="QHBoxLayout" > - <property name="objectName" > - <string notr="true" >unnamed</string> - </property> - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QCheckBox" name="checkBuildEffect" > - <property name="objectName" > - <string notr="true" >checkBuildEffect</string> - </property> - <property name="text" > - <string>Build &from button color</string> - </property> - <property name="checked" > - <bool>true</bool> - </property> - <property name="toolTip" stdset="0" > - <string>Generate shadings</string> - </property> - <property name="whatsThis" stdset="0" > - <string>Check to let 3D-effect colors be calculated from button-color.</string> - </property> - </widget> - </item> - <item> - <widget class="QComboBox" name="comboEffect" > - <property name="objectName" > - <string notr="true" >comboEffect</string> - </property> - <property name="toolTip" stdset="0" > - <string>Choose 3D-effect color role</string> - </property> - <property name="whatsThis" stdset="0" > - <string><b>Select a color role.</b><p>Available effect roles are: <ul> <li>Light - lighter than Button color. </li> <li>Midlight - between Button and Light. </li> <li>Mid - between Button and Dark. </li> <li>Dark - darker than Button. </li> <li>Shadow - a very dark color. </li> </ul></string> - </property> - <item> - <property name="text" > - <string>Light</string> - </property> - </item> - <item> - <property name="text" > - <string>Midlight</string> - </property> - </item> - <item> - <property name="text" > - <string>Mid</string> - </property> - </item> - <item> - <property name="text" > - <string>Dark</string> - </property> - </item> - <item> - <property name="text" > - <string>Shadow</string> - </property> - </item> - </widget> - </item> - </layout> - </item> - <item> - <layout class="QHBoxLayout" > - <property name="objectName" > - <string notr="true" >unnamed</string> - </property> - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <spacer name="Horizontal_Spacing3" > - <property name="sizeHint" > - <size> - <width>20</width> - <height>20</height> - </size> - </property> - <property name="sizeType" > - <enum>Expanding</enum> - </property> - <property name="orientation" > - <enum>Horizontal</enum> - </property> - </spacer> - </item> - <item> - <widget class="QLabel" name="labelEffect" > - <property name="objectName" > - <string notr="true" >labelEffect</string> - </property> - <property name="sizePolicy" > - <sizepolicy> - <hsizetype>1</hsizetype> - <vsizetype>1</vsizetype> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize" > - <size> - <width>0</width> - <height>0</height> - </size> - </property> - <property name="text" > - <string>Select Co&lor:</string> - </property> - <property name="buddy" stdset="0" > - <cstring>buttonEffect</cstring> - </property> - </widget> - </item> - <item> - <widget class="ColorButton" name="buttonEffect" > - <property name="objectName" > - <string notr="true" >buttonEffect</string> - </property> - <property name="sizePolicy" > - <sizepolicy> - <hsizetype>0</hsizetype> - <vsizetype>0</vsizetype> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="focusPolicy" > - <enum>Qt::TabFocus</enum> - </property> - <property name="toolTip" stdset="0" > - <string>Choose a color</string> - </property> - <property name="whatsThis" stdset="0" > - <string>Choose a color for the selected effect color role.</string> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </widget> - </item> - <item> - <layout class="QHBoxLayout" > - <property name="objectName" > - <string notr="true" >unnamed</string> - </property> - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <spacer name="Horizontal_Spacing2" > - <property name="sizeHint" > - <size> - <width>20</width> - <height>20</height> - </size> - </property> - <property name="sizeType" > - <enum>Expanding</enum> - </property> - <property name="orientation" > - <enum>Horizontal</enum> - </property> - </spacer> - </item> - <item> - <widget class="QPushButton" name="buttonOk" > - <property name="objectName" > - <string notr="true" >buttonOk</string> - </property> - <property name="text" > - <string>OK</string> - </property> - <property name="autoDefault" > - <bool>true</bool> - </property> - <property name="default" > - <bool>true</bool> - </property> - <property name="whatsThis" stdset="0" > - <string>Close dialog and apply all changes.</string> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="buttonCancel" > - <property name="objectName" > - <string notr="true" >buttonCancel</string> - </property> - <property name="text" > - <string>Cancel</string> - </property> - <property name="autoDefault" > - <bool>true</bool> - </property> - <property name="whatsThis" stdset="0" > - <string>Close dialog and discard all changes.</string> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </widget> - <pixmapfunction></pixmapfunction> - <customwidgets> - <customwidget> - <class>ColorButton</class> - <extends></extends> - <header location="local" >colorbutton.h</header> - <sizehint> - <width>40</width> - <height>25</height> - </sizehint> - <container>0</container> - <sizepolicy> - <hordata>5</hordata> - <verdata>5</verdata> - </sizepolicy> - <pixmap>image0</pixmap> - <properties> - <property type="Color" >color</property> - <property type="Pixmap" >pixmap</property> - </properties> - </customwidget> - </customwidgets> - <tabstops> - <tabstop>buttonOk</tabstop> - <tabstop>buttonCancel</tabstop> - <tabstop>paletteCombo</tabstop> - <tabstop>checkBuildInactive</tabstop> - <tabstop>checkBuildDisabled</tabstop> - <tabstop>comboCentral</tabstop> - <tabstop>buttonCentral</tabstop> - <tabstop>checkBuildEffect</tabstop> - <tabstop>comboEffect</tabstop> - <tabstop>buttonEffect</tabstop> - </tabstops> - <images> - <image name="image0" > - <data format="XPM.GZ" length="646" >789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data> - </image> - </images> -</ui> diff --git a/tools/qtconfig/previewframe.cpp b/tools/qtconfig/previewframe.cpp index 2d7b113..c6df899 100644 --- a/tools/qtconfig/previewframe.cpp +++ b/tools/qtconfig/previewframe.cpp @@ -40,6 +40,7 @@ ****************************************************************************/ #include "previewframe.h" +#include "previewwidget.h" #include <QBoxLayout> #include <QPainter> @@ -47,8 +48,8 @@ QT_BEGIN_NAMESPACE -PreviewFrame::PreviewFrame( QWidget *parent, const char *name ) - : QFrame( parent, name ) +PreviewFrame::PreviewFrame(QWidget *parent) + : QFrame(parent) { setMinimumSize(200, 200); setFrameStyle(QFrame::StyledPanel | QFrame::Sunken); @@ -82,23 +83,22 @@ void PreviewFrame::setPreviewVisible(bool visible) workspace->viewport()->update(); } -Workspace::Workspace(PreviewFrame* parent, const char* name) +Workspace::Workspace(PreviewFrame *parent) : QMdiArea(parent) { previewFrame = parent; PreviewWidget *previewWidget = previewFrame->widget(); - setObjectName(QLatin1String(name)); QMdiSubWindow *frame = addSubWindow(previewWidget, Qt::Window); - frame->move(10,10); + frame->move(10, 10); frame->show(); } -void Workspace::paintEvent( QPaintEvent* ) +void Workspace::paintEvent(QPaintEvent *) { - QPainter p (viewport()); + QPainter p(viewport()); p.fillRect(rect(), palette().color(backgroundRole()).dark()); - p.setPen( QPen( Qt::white ) ); - p.drawText ( 0, height() / 2, width(), height(), Qt::AlignHCenter, previewFrame->previewText()); + p.setPen(QPen(Qt::white)); + p.drawText(0, height() / 2, width(), height(), Qt::AlignHCenter, previewFrame->previewText()); } QT_END_NAMESPACE diff --git a/tools/qtconfig/previewframe.h b/tools/qtconfig/previewframe.h index cd7bd0b..5cb0d59 100644 --- a/tools/qtconfig/previewframe.h +++ b/tools/qtconfig/previewframe.h @@ -42,8 +42,6 @@ #ifndef PREVIEWFRAME_H #define PREVIEWFRAME_H -#include "previewwidget.h" - #include <QMdiArea> QT_BEGIN_NAMESPACE @@ -54,28 +52,29 @@ class Workspace : public QMdiArea Q_OBJECT public: - Workspace( PreviewFrame* parent = 0, const char* name = 0 ); + Workspace(PreviewFrame *parent = 0); ~Workspace() {} protected: - void paintEvent( QPaintEvent* ); + void paintEvent(QPaintEvent *); private: PreviewFrame *previewFrame; }; +class PreviewWidget; class PreviewFrame : public QFrame { Q_OBJECT public: - PreviewFrame( QWidget *parent = 0, const char *name = 0 ); + PreviewFrame(QWidget *parent = 0); void setPreviewPalette(QPalette); void setPreviewVisible(bool val); QString previewText() const; PreviewWidget *widget() const { return previewWidget; } private: - Workspace *workspace; - PreviewWidget *previewWidget; + Workspace *workspace; + PreviewWidget *previewWidget; QString m_previewWindowText; }; diff --git a/tools/qtconfig/previewwidget.cpp b/tools/qtconfig/previewwidget.cpp index 71cef23..66ebb92 100644 --- a/tools/qtconfig/previewwidget.cpp +++ b/tools/qtconfig/previewwidget.cpp @@ -40,32 +40,32 @@ ****************************************************************************/ #include "previewwidget.h" +#include "ui_previewwidget.h" #include <QtEvents> QT_BEGIN_NAMESPACE -PreviewWidget::PreviewWidget( QWidget *parent, const char *name ) - : PreviewWidgetBase( parent, name ) +PreviewWidget::PreviewWidget(QWidget *parent) + : QWidget(parent), ui(new Ui::PreviewWidget) { + ui->setupUi(this); + // install event filter on child widgets - QObjectList l = queryList("QWidget"); - for (int i = 0; i < l.size(); ++i) { - QObject * obj = l.at(i); - obj->installEventFilter(this); - ((QWidget*)obj)->setFocusPolicy(Qt::NoFocus); + QList<QWidget *> l = findChildren<QWidget *>(); + foreach(QWidget *w, l) { + w->installEventFilter(this); + w->setFocusPolicy(Qt::NoFocus); } } - -void PreviewWidget::closeEvent(QCloseEvent *e) +PreviewWidget::~PreviewWidget() { - e->ignore(); + delete ui; } - bool PreviewWidget::eventFilter(QObject *, QEvent *e) { - switch ( e->type() ) { + switch (e->type()) { case QEvent::MouseButtonPress: case QEvent::MouseButtonRelease: case QEvent::MouseButtonDblClick: @@ -81,4 +81,9 @@ bool PreviewWidget::eventFilter(QObject *, QEvent *e) return false; } +void PreviewWidget::closeEvent(QCloseEvent *e) +{ + e->ignore(); +} + QT_END_NAMESPACE diff --git a/tools/qtconfig/previewwidget.h b/tools/qtconfig/previewwidget.h index a6ec5b3..d39fd75 100644 --- a/tools/qtconfig/previewwidget.h +++ b/tools/qtconfig/previewwidget.h @@ -42,21 +42,29 @@ #ifndef PREVIEWWIDGET_H #define PREVIEWWIDGET_H -#include "previewwidgetbase.h" +#include <QtGui/QWidget> QT_BEGIN_NAMESPACE -class PreviewWidget : public PreviewWidgetBase +namespace Ui { + class PreviewWidget; +} + + +class PreviewWidget : public QWidget { Q_OBJECT public: - PreviewWidget( QWidget *parent = 0, const char *name = 0 ); + PreviewWidget(QWidget *parent = 0); + ~PreviewWidget(); - void closeEvent(QCloseEvent *); bool eventFilter(QObject *, QEvent *); +private: + void closeEvent(QCloseEvent *); + Ui::PreviewWidget *ui; }; QT_END_NAMESPACE -#endif +#endif // PREVIEWWIDGET_H diff --git a/tools/qtconfig/previewwidget.ui b/tools/qtconfig/previewwidget.ui new file mode 100644 index 0000000..2e0789f --- /dev/null +++ b/tools/qtconfig/previewwidget.ui @@ -0,0 +1,252 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <comment>********************************************************************* +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +*********************************************************************</comment> + <class>PreviewWidget</class> + <widget class="QWidget" name="PreviewWidget"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>398</width> + <height>282</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="windowTitle"> + <string>Preview Window</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_5"> + <item> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <property name="spacing"> + <number>6</number> + </property> + <property name="margin"> + <number>0</number> + </property> + <item> + <widget class="QGroupBox" name="GroupBox1"> + <property name="title"> + <string>GroupBox</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_3"> + <property name="spacing"> + <number>6</number> + </property> + <property name="margin"> + <number>11</number> + </property> + <item> + <widget class="QRadioButton" name="RadioButton1"> + <property name="text"> + <string>RadioButton1</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="RadioButton2"> + <property name="text"> + <string>RadioButton2</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="RadioButton3"> + <property name="text"> + <string>RadioButton3</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="GroupBox2"> + <property name="title"> + <string>GroupBox2</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_4"> + <property name="spacing"> + <number>6</number> + </property> + <property name="margin"> + <number>11</number> + </property> + <item> + <widget class="QCheckBox" name="CheckBox1"> + <property name="text"> + <string>CheckBox1</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="CheckBox2"> + <property name="text"> + <string>CheckBox2</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QProgressBar" name="ProgressBar1"> + <property name="value"> + <number>50</number> + </property> + </widget> + </item> + </layout> + </item> + <item> + <layout class="QVBoxLayout" name="verticalLayout"> + <property name="spacing"> + <number>6</number> + </property> + <property name="margin"> + <number>0</number> + </property> + <item> + <widget class="QLineEdit" name="LineEdit1"> + <property name="text"> + <string>LineEdit</string> + </property> + </widget> + </item> + <item> + <widget class="QComboBox" name="ComboBox1"> + <item> + <property name="text"> + <string>ComboBox</string> + </property> + </item> + </widget> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_2"> + <property name="spacing"> + <number>6</number> + </property> + <property name="margin"> + <number>0</number> + </property> + <item> + <widget class="QSpinBox" name="SpinBox1"/> + </item> + <item> + <widget class="QPushButton" name="PushButton1"> + <property name="text"> + <string>PushButton</string> + </property> + </widget> + </item> + </layout> + </item> + <item> + <widget class="QScrollBar" name="ScrollBar1"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + </widget> + </item> + <item> + <widget class="QSlider" name="Slider1"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + </widget> + </item> + <item> + <widget class="QTextEdit" name="textView"> + <property name="maximumSize"> + <size> + <width>32767</width> + <height>55</height> + </size> + </property> + <property name="readOnly"> + <bool>true</bool> + </property> + <property name="html"> + <string><p><a href="http://qt.nokia.com">http://qt.nokia.com</a></p> +<p><a href="http://www.kde.org">http://www.kde.org</a></p></string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </item> + <item> + <spacer name="Spacer2"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Expanding</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>0</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> + <resources/> + <connections/> +</ui> diff --git a/tools/qtconfig/previewwidgetbase.cpp b/tools/qtconfig/previewwidgetbase.cpp deleted file mode 100644 index c156c32..0000000 --- a/tools/qtconfig/previewwidgetbase.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "previewwidgetbase.h" - -#include <QVariant> - -QT_BEGIN_NAMESPACE - -/* - * Constructs a PreviewWidgetBase as a child of 'parent', with the - * name 'name' and widget flags set to 'f'. - */ -PreviewWidgetBase::PreviewWidgetBase(QWidget* parent, const char* name, Qt::WindowFlags fl) - : QWidget(parent, name, fl) -{ - setupUi(this); - - - // signals and slots connections - init(); -} - -/* - * Destroys the object and frees any allocated resources - */ -PreviewWidgetBase::~PreviewWidgetBase() -{ - destroy(); - // no need to delete child widgets, Qt does it all for us -} - -/* - * Sets the strings of the subwidgets using the current - * language. - */ -void PreviewWidgetBase::languageChange() -{ - retranslateUi(this); -} - -void PreviewWidgetBase::init() -{ -} - -void PreviewWidgetBase::destroy() -{ -} - -QT_END_NAMESPACE diff --git a/tools/qtconfig/previewwidgetbase.h b/tools/qtconfig/previewwidgetbase.h deleted file mode 100644 index 624e612..0000000 --- a/tools/qtconfig/previewwidgetbase.h +++ /dev/null @@ -1,68 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef PREVIEWWIDGETBASE_H -#define PREVIEWWIDGETBASE_H - -#include "ui_previewwidgetbase.h" -#include <QVariant> - -QT_BEGIN_NAMESPACE - -class PreviewWidgetBase : public QWidget, public Ui::PreviewWidgetBase -{ - Q_OBJECT - -public: - PreviewWidgetBase(QWidget* parent = 0, const char* name = 0, Qt::WindowFlags fl = 0); - ~PreviewWidgetBase(); - -protected slots: - virtual void languageChange(); - - virtual void init(); - virtual void destroy(); - -}; - -QT_END_NAMESPACE - -#endif // PREVIEWWIDGETBASE_H diff --git a/tools/qtconfig/previewwidgetbase.ui b/tools/qtconfig/previewwidgetbase.ui deleted file mode 100644 index bd8a5f3..0000000 --- a/tools/qtconfig/previewwidgetbase.ui +++ /dev/null @@ -1,340 +0,0 @@ -<ui version="4.0" stdsetdef="1" > - <author></author> - <comment>********************************************************************* -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -*********************************************************************</comment> - <exportmacro></exportmacro> - <class>PreviewWidgetBase</class> - <widget class="QWidget" name="PreviewWidgetBase" > - <property name="objectName" > - <string notr="true" >PreviewWidgetBase</string> - </property> - <property name="geometry" > - <rect> - <x>0</x> - <y>0</y> - <width>378</width> - <height>236</height> - </rect> - </property> - <property name="sizePolicy" > - <sizepolicy> - <hsizetype>1</hsizetype> - <vsizetype>1</vsizetype> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="windowTitle" > - <string>Preview Window</string> - </property> - <layout class="QVBoxLayout" > - <property name="objectName" > - <string notr="true" >unnamed</string> - </property> - <property name="margin" > - <number>11</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <layout class="QHBoxLayout" > - <property name="objectName" > - <string notr="true" >unnamed</string> - </property> - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <layout class="QVBoxLayout" > - <property name="objectName" > - <string notr="true" >unnamed</string> - </property> - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="Q3ButtonGroup" name="ButtonGroup1" > - <property name="objectName" > - <string notr="true" >ButtonGroup1</string> - </property> - <property name="title" > - <string>ButtonGroup</string> - </property> - <layout class="QVBoxLayout" > - <property name="objectName" > - <string notr="true" >unnamed</string> - </property> - <property name="margin" > - <number>11</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QRadioButton" name="RadioButton1" > - <property name="objectName" > - <string notr="true" >RadioButton1</string> - </property> - <property name="text" > - <string>RadioButton1</string> - </property> - <property name="checked" > - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QRadioButton" name="RadioButton2" > - <property name="objectName" > - <string notr="true" >RadioButton2</string> - </property> - <property name="text" > - <string>RadioButton2</string> - </property> - </widget> - </item> - <item> - <widget class="QRadioButton" name="RadioButton3" > - <property name="objectName" > - <string notr="true" >RadioButton3</string> - </property> - <property name="text" > - <string>RadioButton3</string> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <widget class="Q3ButtonGroup" name="ButtonGroup2" > - <property name="objectName" > - <string notr="true" >ButtonGroup2</string> - </property> - <property name="title" > - <string>ButtonGroup2</string> - </property> - <layout class="QVBoxLayout" > - <property name="objectName" > - <string notr="true" >unnamed</string> - </property> - <property name="margin" > - <number>11</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QCheckBox" name="CheckBox1" > - <property name="objectName" > - <string notr="true" >CheckBox1</string> - </property> - <property name="text" > - <string>CheckBox1</string> - </property> - <property name="checked" > - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QCheckBox" name="CheckBox2" > - <property name="objectName" > - <string notr="true" >CheckBox2</string> - </property> - <property name="text" > - <string>CheckBox2</string> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <widget class="QProgressBar" name="ProgressBar1" > - <property name="objectName" > - <string notr="true" >ProgressBar1</string> - </property> - <property name="value" > - <number>50</number> - </property> - </widget> - </item> - </layout> - </item> - <item> - <layout class="QVBoxLayout" > - <property name="objectName" > - <string notr="true" >unnamed</string> - </property> - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QLineEdit" name="LineEdit1" > - <property name="objectName" > - <string notr="true" >LineEdit1</string> - </property> - <property name="text" > - <string>LineEdit</string> - </property> - </widget> - </item> - <item> - <widget class="QComboBox" name="ComboBox1" > - <property name="objectName" > - <string notr="true" >ComboBox1</string> - </property> - <item> - <property name="text" > - <string>ComboBox</string> - </property> - </item> - </widget> - </item> - <item> - <layout class="QHBoxLayout" > - <property name="objectName" > - <string notr="true" >unnamed</string> - </property> - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QSpinBox" name="SpinBox1" > - <property name="objectName" > - <string notr="true" >SpinBox1</string> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="PushButton1" > - <property name="objectName" > - <string notr="true" >PushButton1</string> - </property> - <property name="text" > - <string>PushButton</string> - </property> - </widget> - </item> - </layout> - </item> - <item> - <widget class="QScrollBar" name="ScrollBar1" > - <property name="objectName" > - <string notr="true" >ScrollBar1</string> - </property> - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - </widget> - </item> - <item> - <widget class="QSlider" name="Slider1" > - <property name="objectName" > - <string notr="true" >Slider1</string> - </property> - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - </widget> - </item> - <item> - <widget class="QTextEdit" name="textView" > - <property name="objectName" > - <string notr="true" >textView</string> - </property> - <property name="maximumSize" > - <size> - <width>32767</width> - <height>50</height> - </size> - </property> - <property name="readOnly" > - <bool>true</bool> - </property> - <property name="text" > - <string><p> -<a href="http://qt.nokia.com">http://qt.nokia.com</a> -</p> -<p> -<a href="http://www.kde.org">http://www.kde.org</a> -</p></string> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </item> - <item> - <spacer name="Spacer2" > - <property name="sizeHint" > - <size> - <width>20</width> - <height>20</height> - </size> - </property> - <property name="sizeType" > - <enum>Expanding</enum> - </property> - <property name="orientation" > - <enum>Vertical</enum> - </property> - </spacer> - </item> - </layout> - </widget> - <pixmapfunction>qPixmapFromMimeSource</pixmapfunction> -</ui> diff --git a/tools/qtconfig/qtconfig.pro b/tools/qtconfig/qtconfig.pro index d1fd320..cb06e5a 100644 --- a/tools/qtconfig/qtconfig.pro +++ b/tools/qtconfig/qtconfig.pro @@ -1,11 +1,10 @@ TEMPLATE = app -CONFIG += qt warn_on x11 +CONFIG += qt warn_on x11 build_all:!build_pass { CONFIG -= build_all CONFIG += release } LANGUAGE = C++ -QT += qt3support contains(QT_CONFIG, gstreamer):LIBS += $$QT_LIBS_GSTREAMER -lgstinterfaces-0.10 -lgstvideo-0.10 -lgstbase-0.10 contains(QT_CONFIG, gstreamer):QMAKE_CXXFLAGS += $$QT_CFLAGS_GSTREAMER @@ -13,19 +12,17 @@ contains(QT_CONFIG, phonon) { QT += phonon DEFINES += HAVE_PHONON } -SOURCES += colorbutton.cpp main.cpp previewframe.cpp previewwidget.cpp mainwindow.cpp paletteeditoradvanced.cpp \ - mainwindowbase.cpp paletteeditoradvancedbase.cpp previewwidgetbase.cpp -HEADERS += colorbutton.h previewframe.h previewwidget.h mainwindow.h paletteeditoradvanced.h \ - mainwindowbase.h paletteeditoradvancedbase.h previewwidgetbase.h +SOURCES += colorbutton.cpp main.cpp previewframe.cpp previewwidget.cpp mainwindow.cpp paletteeditoradvanced.cpp +HEADERS += colorbutton.h previewframe.h previewwidget.h mainwindow.h paletteeditoradvanced.h -FORMS = mainwindowbase.ui paletteeditoradvancedbase.ui previewwidgetbase.ui +FORMS = mainwindow.ui paletteeditoradvanced.ui previewwidget.ui RESOURCES = qtconfig.qrc PROJECTNAME = Qt Configuration -TARGET = qtconfig -DESTDIR = ../../bin +TARGET = qtconfig +DESTDIR = ../../bin target.path=$$[QT_INSTALL_BINS] INSTALLS += target -INCLUDEPATH += . -DBFILE = qtconfig.db +INCLUDEPATH += . +DBFILE = qtconfig.db diff --git a/tools/tools.pro b/tools/tools.pro index e82bcaa..04596ee 100644 --- a/tools/tools.pro +++ b/tools/tools.pro @@ -20,7 +20,7 @@ TEMPLATE = subdirs SUBDIRS += designer } } - unix:!mac:!embedded:!qpa:contains(QT_CONFIG, qt3support):SUBDIRS += qtconfig + unix:!mac:!embedded:!qpa:SUBDIRS += qtconfig win32:!wince*:SUBDIRS += activeqt } contains(QT_CONFIG, declarative):SUBDIRS += qml -- cgit v0.12 From 654b0866a4a189d428416a8daae80844ad4e280e Mon Sep 17 00:00:00 2001 From: Olivier Goffart <olivier.goffart@nokia.com> Date: Mon, 28 Feb 2011 19:02:27 +0100 Subject: Fix errors and warnings in qtconfig. That occured with the removal of the qt3support dependency. The setIcon call was added after the merge request was created. --- tools/qtconfig/colorbutton.cpp | 2 +- tools/qtconfig/mainwindow.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/qtconfig/colorbutton.cpp b/tools/qtconfig/colorbutton.cpp index 0b0fefc..33c1b25 100644 --- a/tools/qtconfig/colorbutton.cpp +++ b/tools/qtconfig/colorbutton.cpp @@ -53,8 +53,8 @@ QT_BEGIN_NAMESPACE ColorButton::ColorButton(QWidget *parent) : QAbstractButton(parent) - , mousepressed(false) , col(Qt::black) + , mousepressed(false) { setAcceptDrops(true); connect(this, SIGNAL(clicked()), SLOT(changeColor())); diff --git a/tools/qtconfig/mainwindow.cpp b/tools/qtconfig/mainwindow.cpp index 7bff03d..629574f 100644 --- a/tools/qtconfig/mainwindow.cpp +++ b/tools/qtconfig/mainwindow.cpp @@ -233,7 +233,7 @@ MainWindow::MainWindow() modified = true; desktopThemeName = tr("Desktop Settings (Default)"); - setIcon(QPixmap(":/trolltech/qtconfig/images/appicon.png")); + setWindowIcon(QPixmap(":/trolltech/qtconfig/images/appicon.png")); QStringList gstyles = QStyleFactory::keys(); gstyles.sort(); ui->guiStyleCombo->addItem(desktopThemeName); -- cgit v0.12 From 83aff7323172497e68ac59e79eacda3fe28ed9e7 Mon Sep 17 00:00:00 2001 From: Olivier Goffart <olivier.goffart@nokia.com> Date: Mon, 28 Feb 2011 20:10:58 +0100 Subject: qtconfig: don't connect to qt3support signals --- tools/qtconfig/mainwindow.cpp | 13 +++++++------ tools/qtconfig/mainwindow.h | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/tools/qtconfig/mainwindow.cpp b/tools/qtconfig/mainwindow.cpp index 629574f..059adb3 100644 --- a/tools/qtconfig/mainwindow.cpp +++ b/tools/qtconfig/mainwindow.cpp @@ -200,11 +200,11 @@ MainWindow::MainWindow() connect(ui->downFontpathButton, SIGNAL(clicked()), SLOT(downFontpath())); connect(ui->downSubstitutionButton, SIGNAL(clicked()), SLOT(downSubstitute())); connect(ui->fontFamilyCombo, SIGNAL(activated(QString)), SLOT(familySelected(QString))); - connect(ui->fileExitAction, SIGNAL(activated()), SLOT(fileExit())); - connect(ui->fileSaveAction, SIGNAL(activated()), SLOT(fileSave())); - connect(ui->helpAboutAction, SIGNAL(activated()), SLOT(helpAbout())); - connect(ui->helpAboutQtAction, SIGNAL(activated()), SLOT(helpAboutQt())); - connect(ui->mainTabWidget, SIGNAL(currentChanged(QWidget*)), SLOT(pageChanged(QWidget*))); + connect(ui->fileExitAction, SIGNAL(triggered()), SLOT(fileExit())); + connect(ui->fileSaveAction, SIGNAL(triggered()), SLOT(fileSave())); + connect(ui->helpAboutAction, SIGNAL(triggered()), SLOT(helpAbout())); + connect(ui->helpAboutQtAction, SIGNAL(triggered()), SLOT(helpAboutQt())); + connect(ui->mainTabWidget, SIGNAL(currentChanged(int)), SLOT(pageChanged(int))); connect(ui->paletteCombo, SIGNAL(activated(int)), SLOT(paletteSelected(int))); connect(ui->removeFontpathButton, SIGNAL(clicked()), SLOT(removeFontpath())); connect(ui->removeSubstitutionButton, SIGNAL(clicked()), SLOT(removeSubstitute())); @@ -912,8 +912,9 @@ void MainWindow::helpAboutQt() QMessageBox::aboutQt(this, tr("Qt Configuration")); } -void MainWindow::pageChanged(QWidget *page) +void MainWindow::pageChanged(int pageNumber) { + QWidget *page = ui->mainTabWidget->widget(pageNumber); if (page == ui->interfaceTab) ui->helpView->setText(tr(interface_text)); else if (page == ui->appearanceTab) diff --git a/tools/qtconfig/mainwindow.h b/tools/qtconfig/mainwindow.h index 0cd2b29..6f4c8a5 100644 --- a/tools/qtconfig/mainwindow.h +++ b/tools/qtconfig/mainwindow.h @@ -82,7 +82,7 @@ public slots: virtual void somethingModified(); virtual void helpAbout(); virtual void helpAboutQt(); - virtual void pageChanged(QWidget *); + virtual void pageChanged(int); private: -- cgit v0.12 From cb042e8dcc836a89919d7c048698154f2c423307 Mon Sep 17 00:00:00 2001 From: Olivier Goffart <olivier.goffart@nokia.com> Date: Mon, 28 Feb 2011 20:17:36 +0100 Subject: Don't compile qtconfig on symbian Reviewed-by: Benjamin Poulain --- tools/tools.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/tools.pro b/tools/tools.pro index 04596ee..f090b86 100644 --- a/tools/tools.pro +++ b/tools/tools.pro @@ -20,7 +20,7 @@ TEMPLATE = subdirs SUBDIRS += designer } } - unix:!mac:!embedded:!qpa:SUBDIRS += qtconfig + unix:!symbian:!mac:!embedded:!qpa:SUBDIRS += qtconfig win32:!wince*:SUBDIRS += activeqt } contains(QT_CONFIG, declarative):SUBDIRS += qml -- cgit v0.12 From 463cee77f75d20760f9f74f52e1dfccb44fcb862 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= <jorgen.lind@nokia.com> Date: Thu, 24 Feb 2011 12:27:20 +0100 Subject: Lighthouse: Xlib added QXlibDisplay type We still use the nativeDisplay all over the place. Maybe we should? --- src/plugins/platforms/xlib/qxlibclipboard.cpp | 77 ++++++++++++----------- src/plugins/platforms/xlib/qxlibcursor.cpp | 39 ++++++------ src/plugins/platforms/xlib/qxlibdisplay.cpp | 37 +++++++++++ src/plugins/platforms/xlib/qxlibdisplay.h | 22 +++++++ src/plugins/platforms/xlib/qxlibintegration.cpp | 3 +- src/plugins/platforms/xlib/qxlibkeyboard.cpp | 3 +- src/plugins/platforms/xlib/qxlibscreen.cpp | 73 ++++++++++++--------- src/plugins/platforms/xlib/qxlibscreen.h | 16 ++--- src/plugins/platforms/xlib/qxlibstatic.cpp | 15 ++--- src/plugins/platforms/xlib/qxlibwindow.cpp | 67 ++++++++++---------- src/plugins/platforms/xlib/qxlibwindowsurface.cpp | 14 ++--- src/plugins/platforms/xlib/xlib.pro | 6 +- 12 files changed, 228 insertions(+), 144 deletions(-) create mode 100644 src/plugins/platforms/xlib/qxlibdisplay.cpp create mode 100644 src/plugins/platforms/xlib/qxlibdisplay.h diff --git a/src/plugins/platforms/xlib/qxlibclipboard.cpp b/src/plugins/platforms/xlib/qxlibclipboard.cpp index 7930fcb..49b2dc7 100644 --- a/src/plugins/platforms/xlib/qxlibclipboard.cpp +++ b/src/plugins/platforms/xlib/qxlibclipboard.cpp @@ -43,6 +43,7 @@ #include "qxlibscreen.h" #include "qxlibmime.h" +#include "qxlibdisplay.h" #include <private/qapplication_p.h> @@ -92,7 +93,7 @@ protected: if (targets[i] == 0) continue; - QStringList formatsForAtom = mimeFormatsForAtom(m_clipboard->screen()->display(),targets[i]); + QStringList formatsForAtom = mimeFormatsForAtom(m_clipboard->screen()->display()->nativeDisplay(),targets[i]); for (int j = 0; j < formatsForAtom.size(); ++j) { if (!formatList.contains(formatsForAtom.at(j))) that->formatList.append(formatsForAtom.at(j)); @@ -124,17 +125,17 @@ protected: atoms.append(targets[i]); QByteArray encoding; - Atom fmtatom = mimeAtomForFormat(m_clipboard->screen()->display(),fmt, requestedType, atoms, &encoding); + Atom fmtatom = mimeAtomForFormat(m_clipboard->screen()->display()->nativeDisplay(),fmt, requestedType, atoms, &encoding); if (fmtatom == 0) return QVariant(); - return mimeConvertToFormat(m_clipboard->screen()->display(),fmtatom, m_clipboard->getDataInFormat(modeAtom,fmtatom), fmt, requestedType, encoding); + return mimeConvertToFormat(m_clipboard->screen()->display()->nativeDisplay(),fmtatom, m_clipboard->getDataInFormat(modeAtom,fmtatom), fmt, requestedType, encoding); } private: bool empty() const { - Window win = XGetSelectionOwner(m_clipboard->screen()->display(), modeAtom); + Window win = XGetSelectionOwner(m_clipboard->screen()->display()->nativeDisplay(), modeAtom); return win == XNone; } @@ -167,7 +168,7 @@ const QMimeData * QXlibClipboard::mimeData(QClipboard::Mode mode) const QXlibClipboard *that = const_cast<QXlibClipboard *>(this); that->m_xClipboard = new QXlibClipboardMime(mode,that); } - Window clipboardOwner = XGetSelectionOwner(screen()->display(),QXlibStatic::atom(QXlibStatic::CLIPBOARD)); + Window clipboardOwner = XGetSelectionOwner(screen()->display()->nativeDisplay(),QXlibStatic::atom(QXlibStatic::CLIPBOARD)); if (clipboardOwner == owner()) { return m_clientClipboard; } else { @@ -178,7 +179,7 @@ const QMimeData * QXlibClipboard::mimeData(QClipboard::Mode mode) const QXlibClipboard *that = const_cast<QXlibClipboard *>(this); that->m_xSelection = new QXlibClipboardMime(mode,that); } - Window clipboardOwner = XGetSelectionOwner(screen()->display(),XA_PRIMARY); + Window clipboardOwner = XGetSelectionOwner(screen()->display()->nativeDisplay(),XA_PRIMARY); if (clipboardOwner == owner()) { return m_clientSelection; } else { @@ -218,9 +219,9 @@ void QXlibClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode) *d = data; } - XSetSelectionOwner(m_screen->display(), modeAtom, newOwner, CurrentTime); + XSetSelectionOwner(m_screen->display()->nativeDisplay(), modeAtom, newOwner, CurrentTime); - if (XGetSelectionOwner(m_screen->display(), modeAtom) != newOwner) { + if (XGetSelectionOwner(m_screen->display()->nativeDisplay(), modeAtom) != newOwner) { qWarning("QClipboard::setData: Cannot set X11 selection owner"); } @@ -244,7 +245,7 @@ Window QXlibClipboard::requestor() const if (!m_requestor) { int x = 0, y = 0, w = 3, h = 3; QXlibClipboard *that = const_cast<QXlibClipboard *>(this); - Window window = XCreateSimpleWindow(m_screen->display(), m_screen->rootWindow(), + Window window = XCreateSimpleWindow(m_screen->display()->nativeDisplay(), m_screen->rootWindow(), x, y, w, h, 0 /*border_width*/, m_screen->blackPixel(), m_screen->whitePixel()); that->setRequestor(window); @@ -255,7 +256,7 @@ Window QXlibClipboard::requestor() const void QXlibClipboard::setRequestor(Window window) { if (m_requestor != XNone) { - XDestroyWindow(m_screen->display(),m_requestor); + XDestroyWindow(m_screen->display()->nativeDisplay(),m_requestor); } m_requestor = window; } @@ -265,7 +266,7 @@ Window QXlibClipboard::owner() const if (!m_owner) { int x = 0, y = 0, w = 3, h = 3; QXlibClipboard *that = const_cast<QXlibClipboard *>(this); - Window window = XCreateSimpleWindow(m_screen->display(), m_screen->rootWindow(), + Window window = XCreateSimpleWindow(m_screen->display()->nativeDisplay(), m_screen->rootWindow(), x, y, w, h, 0 /*border_width*/, m_screen->blackPixel(), m_screen->whitePixel()); that->setOwner(window); @@ -276,7 +277,7 @@ Window QXlibClipboard::owner() const void QXlibClipboard::setOwner(Window window) { if (m_owner != XNone){ - XDestroyWindow(m_screen->display(),m_owner); + XDestroyWindow(m_screen->display()->nativeDisplay(),m_owner); } m_owner = window; } @@ -286,7 +287,7 @@ Atom QXlibClipboard::sendTargetsSelection(QMimeData *d, Window window, Atom prop QVector<Atom> types; QStringList formats = QInternalMimeData::formatsHelper(d); for (int i = 0; i < formats.size(); ++i) { - QList<Atom> atoms = QXlibMime::mimeAtomsForFormat(screen()->display(),formats.at(i)); + QList<Atom> atoms = QXlibMime::mimeAtomsForFormat(screen()->display()->nativeDisplay(),formats.at(i)); for (int j = 0; j < atoms.size(); ++j) { if (!types.contains(atoms.at(j))) types.append(atoms.at(j)); @@ -297,7 +298,7 @@ Atom QXlibClipboard::sendTargetsSelection(QMimeData *d, Window window, Atom prop types.append(QXlibStatic::atom(QXlibStatic::TIMESTAMP)); types.append(QXlibStatic::atom(QXlibStatic::SAVE_TARGETS)); - XChangeProperty(screen()->display(), window, property, XA_ATOM, 32, + XChangeProperty(screen()->display()->nativeDisplay(), window, property, XA_ATOM, 32, PropModeReplace, (uchar *) types.data(), types.size()); return property; } @@ -308,14 +309,14 @@ Atom QXlibClipboard::sendSelection(QMimeData *d, Atom target, Window window, Ato int dataFormat = 0; QByteArray data; - QString fmt = QXlibMime::mimeAtomToString(screen()->display(), target); + QString fmt = QXlibMime::mimeAtomToString(screen()->display()->nativeDisplay(), target); if (fmt.isEmpty()) { // Not a MIME type we have qDebug() << "QClipboard: send_selection(): converting to type '%s' is not supported" << fmt.data(); return XNone; } qDebug() << "QClipboard: send_selection(): converting to type '%s'" << fmt.data(); - if (QXlibMime::mimeDataForAtom(screen()->display(),target, d, &data, &atomFormat, &dataFormat)) { + if (QXlibMime::mimeDataForAtom(screen()->display()->nativeDisplay(),target, d, &data, &atomFormat, &dataFormat)) { // don't allow INCR transfers when using MULTIPLE or to // Motif clients (since Motif doesn't support INCR) @@ -323,10 +324,10 @@ Atom QXlibClipboard::sendSelection(QMimeData *d, Atom target, Window window, Ato bool allow_incr = property != motif_clip_temporary; // X_ChangeProperty protocol request is 24 bytes - const int increment = (XMaxRequestSize(screen()->display()) * 4) - 24; + const int increment = (XMaxRequestSize(screen()->display()->nativeDisplay()) * 4) - 24; if (data.size() > increment && allow_incr) { long bytes = data.size(); - XChangeProperty(screen()->display(), window, property, + XChangeProperty(screen()->display()->nativeDisplay(), window, property, QXlibStatic::atom(QXlibStatic::INCR), 32, PropModeReplace, (uchar *) &bytes, 1); // (void)new QClipboardINCRTransaction(window, property, atomFormat, dataFormat, data, increment); @@ -339,7 +340,7 @@ Atom QXlibClipboard::sendSelection(QMimeData *d, Atom target, Window window, Ato return XNone; // ### perhaps use several XChangeProperty calls w/ PropModeAppend? int dataSize = data.size() / (dataFormat / 8); // use a single request to transfer data - XChangeProperty(screen()->display(), window, property, atomFormat, + XChangeProperty(screen()->display()->nativeDisplay(), window, property, atomFormat, dataFormat, PropModeReplace, (uchar *) data.data(), dataSize); } @@ -371,13 +372,13 @@ void QXlibClipboard::handleSelectionRequest(XEvent *xevent) d = m_clientClipboard; } else { qWarning("QClipboard: Unknown selection '%lx'", req->selection); - XSendEvent(screen()->display(), req->requestor, False, NoEventMask, &event); + XSendEvent(screen()->display()->nativeDisplay(), req->requestor, False, NoEventMask, &event); return; } if (!d) { qWarning("QClipboard: Cannot transfer data, no data available"); - XSendEvent(screen()->display(), req->requestor, False, NoEventMask, &event); + XSendEvent(screen()->display()->nativeDisplay(), req->requestor, False, NoEventMask, &event); return; } @@ -399,7 +400,7 @@ void QXlibClipboard::handleSelectionRequest(XEvent *xevent) 0, &multi_type, &multi_format) || multi_format != 32) { // MULTIPLE property not formatted correctly - XSendEvent(screen()->display(), req->requestor, False, NoEventMask, &event); + XSendEvent(screen()->display()->nativeDisplay(), req->requestor, False, NoEventMask, &event); return; } nmulti = multi_data.size()/sizeof(*multi); @@ -427,7 +428,7 @@ void QXlibClipboard::handleSelectionRequest(XEvent *xevent) ; } else if (target == xa_timestamp) { // if (d->timestamp != CurrentTime) { -// XChangeProperty(screen()->display(), req->requestor, property, XA_INTEGER, 32, +// XChangeProperty(screen()->display()->nativeDisplay(), req->requestor, property, XA_INTEGER, 32, // PropModeReplace, CurrentTime, 1); // ret = property; // } else { @@ -454,7 +455,7 @@ void QXlibClipboard::handleSelectionRequest(XEvent *xevent) if (multi_writeback) { // according to ICCCM 2.6.2 says to put None back // into the original property on the requestor window - XChangeProperty(screen()->display(), req->requestor, req->property, multi_type, 32, + XChangeProperty(screen()->display()->nativeDisplay(), req->requestor, req->property, multi_type, 32, PropModeReplace, (uchar *) multi, nmulti * 2); } @@ -463,7 +464,7 @@ void QXlibClipboard::handleSelectionRequest(XEvent *xevent) } // send selection notify to requestor - XSendEvent(screen()->display(), req->requestor, False, NoEventMask, &event); + XSendEvent(screen()->display()->nativeDisplay(), req->requestor, False, NoEventMask, &event); } static inline int maxSelectionIncr(Display *dpy) @@ -471,7 +472,7 @@ static inline int maxSelectionIncr(Display *dpy) bool QXlibClipboard::clipboardReadProperty(Window win, Atom property, bool deleteProperty, QByteArray *buffer, int *size, Atom *type, int *format) const { - int maxsize = maxSelectionIncr(screen()->display()); + int maxsize = maxSelectionIncr(screen()->display()->nativeDisplay()); ulong bytes_left; // bytes_after ulong length; // nitems uchar *data; @@ -485,7 +486,7 @@ bool QXlibClipboard::clipboardReadProperty(Window win, Atom property, bool delet format = &dummy_format; // Don't read anything, just get the size of the property data - r = XGetWindowProperty(screen()->display(), win, property, 0, 0, False, + r = XGetWindowProperty(screen()->display()->nativeDisplay(), win, property, 0, 0, False, AnyPropertyType, type, format, &length, &bytes_left, &data); if (r != Success || (type && *type == XNone)) { @@ -524,7 +525,7 @@ bool QXlibClipboard::clipboardReadProperty(Window win, Atom property, bool delet while (bytes_left) { // more to read... - r = XGetWindowProperty(screen()->display(), win, property, offset, maxsize/4, + r = XGetWindowProperty(screen()->display()->nativeDisplay(), win, property, offset, maxsize/4, False, AnyPropertyType, type, format, &length, &bytes_left, &data); if (r != Success || (type && *type == XNone)) @@ -559,7 +560,7 @@ bool QXlibClipboard::clipboardReadProperty(Window win, Atom property, bool delet char **list_ret = 0; int count; - if (XmbTextPropertyToTextList(screen()->display(), &textprop, &list_ret, + if (XmbTextPropertyToTextList(screen()->display()->nativeDisplay(), &textprop, &list_ret, &count) == Success && count && list_ret) { offset = buffer_offset = strlen(list_ret[0]); buffer->resize(offset); @@ -574,9 +575,9 @@ bool QXlibClipboard::clipboardReadProperty(Window win, Atom property, bool delet *size = buffer_offset; if (deleteProperty) - XDeleteProperty(screen()->display(), win, property); + XDeleteProperty(screen()->display()->nativeDisplay(), win, property); - XFlush(screen()->display()); + screen()->display()->flush(); return ok; } @@ -600,7 +601,7 @@ QByteArray QXlibClipboard::clipboardReadIncrementalProperty(Window win, Atom pro } for (;;) { - XFlush(screen()->display()); + screen()->display()->flush(); if (!screen()->waitForClipboardEvent(win,PropertyNotify,&event,clipboard_timeout)) break; if (event.xproperty.atom != property || @@ -645,11 +646,11 @@ QByteArray QXlibClipboard::getDataInFormat(Atom modeAtom, Atom fmtatom) Window win = requestor(); - XSelectInput(screen()->display(), win, NoEventMask); // don't listen for any events + XSelectInput(screen()->display()->nativeDisplay(), win, NoEventMask); // don't listen for any events - XDeleteProperty(screen()->display(), win, QXlibStatic::atom(QXlibStatic::_QT_SELECTION)); - XConvertSelection(screen()->display(), modeAtom, fmtatom, QXlibStatic::atom(QXlibStatic::_QT_SELECTION), win, CurrentTime); - XSync(screen()->display(), false); + XDeleteProperty(screen()->display()->nativeDisplay(), win, QXlibStatic::atom(QXlibStatic::_QT_SELECTION)); + XConvertSelection(screen()->display()->nativeDisplay(), modeAtom, fmtatom, QXlibStatic::atom(QXlibStatic::_QT_SELECTION), win, CurrentTime); + screen()->display()->sync(); XEvent xevent; if (!screen()->waitForClipboardEvent(win,SelectionNotify,&xevent,clipboard_timeout) || @@ -658,7 +659,7 @@ QByteArray QXlibClipboard::getDataInFormat(Atom modeAtom, Atom fmtatom) } Atom type; - XSelectInput(screen()->display(), win, PropertyChangeMask); + XSelectInput(screen()->display()->nativeDisplay(), win, PropertyChangeMask); if (clipboardReadProperty(win, QXlibStatic::atom(QXlibStatic::_QT_SELECTION), true, &buf, 0, &type, 0)) { if (type == QXlibStatic::atom(QXlibStatic::INCR)) { @@ -667,7 +668,7 @@ QByteArray QXlibClipboard::getDataInFormat(Atom modeAtom, Atom fmtatom) } } - XSelectInput(screen()->display(), win, NoEventMask); + XSelectInput(screen()->display()->nativeDisplay(), win, NoEventMask); return buf; diff --git a/src/plugins/platforms/xlib/qxlibcursor.cpp b/src/plugins/platforms/xlib/qxlibcursor.cpp index e4d248c..074d2f7 100644 --- a/src/plugins/platforms/xlib/qxlibcursor.cpp +++ b/src/plugins/platforms/xlib/qxlibcursor.cpp @@ -44,6 +44,7 @@ #include "qxlibintegration.h" #include "qxlibscreen.h" #include "qxlibwindow.h" +#include "qxlibdisplay.h" #include <QtGui/QBitmap> @@ -121,11 +122,11 @@ Cursor QXlibCursor::createCursorBitmap(QCursor * cursor) memcpy(maskBits + (destLineSize * i),mask + (bytesPerLine * i), destLineSize); } - Pixmap cp = XCreateBitmapFromData(testLiteScreen()->display(), rootwin, mapBits, width, height); - Pixmap mp = XCreateBitmapFromData(testLiteScreen()->display(), rootwin, maskBits, width, height); - Cursor c = XCreatePixmapCursor(testLiteScreen()->display(), cp, mp, &fg, &bg, spot.x(), spot.y()); - XFreePixmap(testLiteScreen()->display(), cp); - XFreePixmap(testLiteScreen()->display(), mp); + Pixmap cp = XCreateBitmapFromData(testLiteScreen()->display()->nativeDisplay(), rootwin, mapBits, width, height); + Pixmap mp = XCreateBitmapFromData(testLiteScreen()->display()->nativeDisplay(), rootwin, maskBits, width, height); + Cursor c = XCreatePixmapCursor(testLiteScreen()->display()->nativeDisplay(), cp, mp, &fg, &bg, spot.x(), spot.y()); + XFreePixmap(testLiteScreen()->display()->nativeDisplay(), cp); + XFreePixmap(testLiteScreen()->display()->nativeDisplay(), mp); delete[] mapBits; delete[] maskBits; @@ -141,48 +142,48 @@ Cursor QXlibCursor::createCursorShape(int cshape) switch (cshape) { case Qt::ArrowCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_left_ptr); + cursor = XCreateFontCursor(testLiteScreen()->display()->nativeDisplay(), XC_left_ptr); break; case Qt::UpArrowCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_center_ptr); + cursor = XCreateFontCursor(testLiteScreen()->display()->nativeDisplay(), XC_center_ptr); break; case Qt::CrossCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_crosshair); + cursor = XCreateFontCursor(testLiteScreen()->display()->nativeDisplay(), XC_crosshair); break; case Qt::WaitCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_watch); + cursor = XCreateFontCursor(testLiteScreen()->display()->nativeDisplay(), XC_watch); break; case Qt::IBeamCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_xterm); + cursor = XCreateFontCursor(testLiteScreen()->display()->nativeDisplay(), XC_xterm); break; case Qt::SizeAllCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_fleur); + cursor = XCreateFontCursor(testLiteScreen()->display()->nativeDisplay(), XC_fleur); break; case Qt::PointingHandCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_hand2); + cursor = XCreateFontCursor(testLiteScreen()->display()->nativeDisplay(), XC_hand2); break; case Qt::SizeBDiagCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_top_right_corner); + cursor = XCreateFontCursor(testLiteScreen()->display()->nativeDisplay(), XC_top_right_corner); break; case Qt::SizeFDiagCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_bottom_right_corner); + cursor = XCreateFontCursor(testLiteScreen()->display()->nativeDisplay(), XC_bottom_right_corner); break; case Qt::SizeVerCursor: case Qt::SplitVCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_sb_v_double_arrow); + cursor = XCreateFontCursor(testLiteScreen()->display()->nativeDisplay(), XC_sb_v_double_arrow); break; case Qt::SizeHorCursor: case Qt::SplitHCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_sb_h_double_arrow); + cursor = XCreateFontCursor(testLiteScreen()->display()->nativeDisplay(), XC_sb_h_double_arrow); break; case Qt::WhatsThisCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_question_arrow); + cursor = XCreateFontCursor(testLiteScreen()->display()->nativeDisplay(), XC_question_arrow); break; case Qt::ForbiddenCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_circle); + cursor = XCreateFontCursor(testLiteScreen()->display()->nativeDisplay(), XC_circle); break; case Qt::BusyCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_watch); + cursor = XCreateFontCursor(testLiteScreen()->display()->nativeDisplay(), XC_watch); break; default: //default cursor for all the rest diff --git a/src/plugins/platforms/xlib/qxlibdisplay.cpp b/src/plugins/platforms/xlib/qxlibdisplay.cpp new file mode 100644 index 0000000..3b60af2 --- /dev/null +++ b/src/plugins/platforms/xlib/qxlibdisplay.cpp @@ -0,0 +1,37 @@ +#include "qxlibdisplay.h" + +QXlibDisplay::QXlibDisplay(Display *display) + : mDisplay(display) +{ + if (!mDisplay) { + qFatal("Cannot connect to X server"); + } + mDisplayName = QString::fromLocal8Bit(DisplayString(mDisplay)); +} + +QXlibDisplay::~QXlibDisplay() +{ + XCloseDisplay(mDisplay); +} + +QString QXlibDisplay::displayName() const +{ + { return mDisplayName; } +} + + + +Display * QXlibDisplay::nativeDisplay() const +{ + return mDisplay; +} + +void QXlibDisplay::sync() const +{ + XSync(mDisplay, False); +} + +void QXlibDisplay::flush() const +{ + XFlush(mDisplay); +} diff --git a/src/plugins/platforms/xlib/qxlibdisplay.h b/src/plugins/platforms/xlib/qxlibdisplay.h new file mode 100644 index 0000000..f2cca9e --- /dev/null +++ b/src/plugins/platforms/xlib/qxlibdisplay.h @@ -0,0 +1,22 @@ +#ifndef QXLIBDISPLAY_H +#define QXLIBDISPLAY_H + +#include "qxlibintegration.h" + +class QXlibDisplay +{ +public: + QXlibDisplay(Display *display); + ~QXlibDisplay(); + QString displayName() const; + + Display *nativeDisplay() const; + + void sync() const; + void flush() const; +private: + Display *mDisplay; + QString mDisplayName; +}; + +#endif // QXLIBDISPLAY_H diff --git a/src/plugins/platforms/xlib/qxlibintegration.cpp b/src/plugins/platforms/xlib/qxlibintegration.cpp index 46eabbf..e3ebb13 100644 --- a/src/plugins/platforms/xlib/qxlibintegration.cpp +++ b/src/plugins/platforms/xlib/qxlibintegration.cpp @@ -48,6 +48,7 @@ #include "qgenericunixfontdatabase.h" #include "qxlibscreen.h" #include "qxlibclipboard.h" +#include "qxlibdisplay.h" #if !defined(QT_NO_OPENGL) #if !defined(QT_OPENGL_ES_2) @@ -143,7 +144,7 @@ bool QXlibIntegration::hasOpenGL() const const QXlibScreen *screen = static_cast<const QXlibScreen *>(mScreens.at(0)); EGLint major, minor; eglBindAPI(EGL_OPENGL_ES_API); - EGLDisplay disp = eglGetDisplay(screen->display()); + EGLDisplay disp = eglGetDisplay(screen->display()->nativeDisplay()); wasEglInitialized = eglInitialize(disp,&major,&minor); } return wasEglInitialized; diff --git a/src/plugins/platforms/xlib/qxlibkeyboard.cpp b/src/plugins/platforms/xlib/qxlibkeyboard.cpp index a1e38b0..690d273 100644 --- a/src/plugins/platforms/xlib/qxlibkeyboard.cpp +++ b/src/plugins/platforms/xlib/qxlibkeyboard.cpp @@ -42,6 +42,7 @@ #include "qxlibkeyboard.h" #include "qxlibscreen.h" +#include "qxlibdisplay.h" #include <QtGui/QWindowSystemInterface> @@ -951,7 +952,7 @@ QXlibKeyboard::QXlibKeyboard(QXlibScreen *screen) void QXlibKeyboard::changeLayout() { - XkbDescPtr xkbDesc = XkbGetMap(m_screen->display(), XkbAllClientInfoMask, XkbUseCoreKbd); + XkbDescPtr xkbDesc = XkbGetMap(m_screen->display()->nativeDisplay(), XkbAllClientInfoMask, XkbUseCoreKbd); for (int i = xkbDesc->min_key_code; i < xkbDesc->max_key_code; ++i) { const uint mask = xkbDesc->map->modmap ? xkbDesc->map->modmap[i] : 0; if (mask == 0) { diff --git a/src/plugins/platforms/xlib/qxlibscreen.cpp b/src/plugins/platforms/xlib/qxlibscreen.cpp index ef04fb2..5a9aca9 100644 --- a/src/plugins/platforms/xlib/qxlibscreen.cpp +++ b/src/plugins/platforms/xlib/qxlibscreen.cpp @@ -46,6 +46,7 @@ #include "qxlibkeyboard.h" #include "qxlibstatic.h" #include "qxlibclipboard.h" +#include "qxlibdisplay.h" #include <QtCore/QDebug> #include <QtCore/QSocketNotifier> @@ -192,36 +193,32 @@ QXlibScreen::QXlibScreen() : mFormat(QImage::Format_RGB32) { char *display_name = getenv("DISPLAY"); - mDisplay = XOpenDisplay(display_name); - mDisplayName = QString::fromLocal8Bit(display_name); - if (!mDisplay) { - fprintf(stderr, "Cannot connect to X server: %s\n", - display_name); - exit(1); - } + Display *display = XOpenDisplay(display_name); + mDisplay = new QXlibDisplay(display); + #ifndef DONT_USE_MIT_SHM - Status MIT_SHM_extension_supported = XShmQueryExtension (mDisplay); + Status MIT_SHM_extension_supported = XShmQueryExtension (mDisplay->nativeDisplay()); Q_ASSERT(MIT_SHM_extension_supported == True); #endif original_x_errhandler = XSetErrorHandler(qt_x_errhandler); if (qgetenv("DO_X_SYNCHRONIZE").toInt()) - XSynchronize(mDisplay, true); + XSynchronize(mDisplay->nativeDisplay(), true); - mScreen = DefaultScreen(mDisplay); - XSelectInput(mDisplay,rootWindow(), KeymapStateMask | EnterWindowMask | LeaveWindowMask | PropertyChangeMask); - int width = DisplayWidth(mDisplay, mScreen); - int height = DisplayHeight(mDisplay, mScreen); + mScreen = DefaultScreen(mDisplay->nativeDisplay()); + XSelectInput(mDisplay->nativeDisplay(),rootWindow(), KeymapStateMask | EnterWindowMask | LeaveWindowMask | PropertyChangeMask); + int width = DisplayWidth(mDisplay->nativeDisplay(), mScreen); + int height = DisplayHeight(mDisplay->nativeDisplay(), mScreen); mGeometry = QRect(0,0,width,height); - int physicalWidth = DisplayWidthMM(mDisplay, mScreen); - int physicalHeight = DisplayHeightMM(mDisplay, mScreen); + int physicalWidth = DisplayWidthMM(mDisplay->nativeDisplay(), mScreen); + int physicalHeight = DisplayHeightMM(mDisplay->nativeDisplay(), mScreen); mPhysicalSize = QSize(physicalWidth,physicalHeight); - int xSocketNumber = XConnectionNumber(mDisplay); + int xSocketNumber = XConnectionNumber(mDisplay->nativeDisplay()); - mDepth = DefaultDepth(mDisplay,mScreen); + mDepth = DefaultDepth(mDisplay->nativeDisplay(),mScreen); #ifdef MYX11_DEBUG qDebug() << "X socket:"<< xSocketNumber; #endif @@ -235,7 +232,22 @@ QXlibScreen::QXlibScreen() QXlibScreen::~QXlibScreen() { delete mCursor; - XCloseDisplay(mDisplay); + delete mDisplay; +} + +Window QXlibScreen::rootWindow() +{ + return RootWindow(mDisplay->nativeDisplay(), mScreen); +} + +unsigned long QXlibScreen::blackPixel() +{ + return BlackPixel(mDisplay->nativeDisplay(), mScreen); +} + +unsigned long QXlibScreen::whitePixel() +{ + return WhitePixel(mDisplay->nativeDisplay(), mScreen); } #ifdef KeyPress @@ -358,15 +370,15 @@ bool QXlibScreen::waitForClipboardEvent(Window win, int type, XEvent *event, int QElapsedTimer timer; timer.start(); do { - if (XCheckTypedWindowEvent(mDisplay,win,type,event)) + if (XCheckTypedWindowEvent(mDisplay->nativeDisplay(),win,type,event)) return true; // process other clipboard events, since someone is probably requesting data from us XEvent e; - if (XCheckIfEvent(mDisplay, &e, checkForClipboardEvents, 0)) + if (XCheckIfEvent(mDisplay->nativeDisplay(), &e, checkForClipboardEvents, 0)) handleEvent(&e); - XFlush(mDisplay); + mDisplay->flush(); // sleep 50 ms, so we don't use up CPU cycles all the time. struct timeval usleep_tv; @@ -379,11 +391,11 @@ bool QXlibScreen::waitForClipboardEvent(Window win, int type, XEvent *event, int void QXlibScreen::eventDispatcher() { - ulong marker = XNextRequest(mDisplay); + ulong marker = XNextRequest(mDisplay->nativeDisplay()); // int i = 0; - while (XPending(mDisplay)) { + while (XPending(mDisplay->nativeDisplay())) { XEvent event; - XNextEvent(mDisplay, &event); + XNextEvent(mDisplay->nativeDisplay(), &event); /* done = */ handleEvent(&event); @@ -392,7 +404,7 @@ void QXlibScreen::eventDispatcher() qDebug() << "potential livelock averted"; #endif #if 0 - if (XEventsQueued(mDisplay, QueuedAfterFlush)) { + if (XEventsQueued(mDisplay->nativeDisplay(), QueuedAfterFlush)) { qDebug() << " with events queued"; QTimer::singleShot(0, this, SLOT(eventDispatcher())); } @@ -412,7 +424,7 @@ QImage QXlibScreen::grabWindow(Window window, int x, int y, int w, int h) window = rootWindow(); XWindowAttributes window_attr; - if (!XGetWindowAttributes(mDisplay, window, &window_attr)) + if (!XGetWindowAttributes(mDisplay->nativeDisplay(), window, &window_attr)) return QImage(); if (w < 0) @@ -424,7 +436,7 @@ QImage QXlibScreen::grabWindow(Window window, int x, int y, int w, int h) // that it's "unsafe" to go outside the screen, so we can ignore that problem. //We're definitely not optimizing for speed... - XImage *xi = XGetImage(mDisplay, window, x, y, w, h, AllPlanes, ZPixmap); + XImage *xi = XGetImage(mDisplay->nativeDisplay(), window, x, y, w, h, AllPlanes, ZPixmap); if (!xi) return QImage(); @@ -443,7 +455,7 @@ QXlibScreen * QXlibScreen::testLiteScreenForWidget(QWidget *widget) return static_cast<QXlibScreen *>(platformScreen); } -Display * QXlibScreen::display() const +QXlibDisplay * QXlibScreen::display() const { return mDisplay; } @@ -453,6 +465,11 @@ int QXlibScreen::xScreenNumber() const return mScreen; } +Visual * QXlibScreen::defaultVisual() const +{ + DefaultVisual(display()->nativeDisplay(), xScreenNumber()); +} + QXlibKeyboard * QXlibScreen::keyboard() const { return mKeyboard; diff --git a/src/plugins/platforms/xlib/qxlibscreen.h b/src/plugins/platforms/xlib/qxlibscreen.h index c8043fb..8dac41d 100644 --- a/src/plugins/platforms/xlib/qxlibscreen.h +++ b/src/plugins/platforms/xlib/qxlibscreen.h @@ -49,6 +49,7 @@ QT_BEGIN_NAMESPACE class QXlibCursor; class QXlibKeyboard; +class QXlibDisplay; class QXlibScreen : public QPlatformScreen { @@ -58,16 +59,14 @@ public: ~QXlibScreen(); - QString displayName() const { return mDisplayName; } - QRect geometry() const { return mGeometry; } int depth() const { return mDepth; } QImage::Format format() const { return mFormat; } QSize physicalSize() const { return mPhysicalSize; } - Window rootWindow() { return RootWindow(mDisplay, mScreen); } - unsigned long blackPixel() { return BlackPixel(mDisplay, mScreen); } - unsigned long whitePixel() { return WhitePixel(mDisplay, mScreen); } + Window rootWindow(); + unsigned long blackPixel(); + unsigned long whitePixel(); bool handleEvent(XEvent *xe); bool waitForClipboardEvent(Window win, int type, XEvent *event, int timeout); @@ -76,9 +75,11 @@ public: static QXlibScreen *testLiteScreenForWidget(QWidget *widget); - Display *display() const; + QXlibDisplay *display() const; int xScreenNumber() const; + Visual *defaultVisual() const; + QXlibKeyboard *keyboard() const; public slots: @@ -87,7 +88,6 @@ public slots: private: void handleSelectionRequest(XEvent *event); - QString mDisplayName; QRect mGeometry; QSize mPhysicalSize; int mDepth; @@ -95,7 +95,7 @@ private: QXlibCursor *mCursor; QXlibKeyboard *mKeyboard; - Display * mDisplay; + QXlibDisplay * mDisplay; int mScreen; }; diff --git a/src/plugins/platforms/xlib/qxlibstatic.cpp b/src/plugins/platforms/xlib/qxlibstatic.cpp index 3ce5768..f67fbdc 100644 --- a/src/plugins/platforms/xlib/qxlibstatic.cpp +++ b/src/plugins/platforms/xlib/qxlibstatic.cpp @@ -41,6 +41,7 @@ #include "qxlibstatic.h" #include "qxlibscreen.h" +#include "qxlibdisplay.h" #include <qplatformdefs.h> @@ -366,7 +367,7 @@ private: Q_ASSERT(i == QXlibStatic::NPredefinedAtoms); QByteArray settings_atom_name("_QT_SETTINGS_TIMESTAMP_"); - settings_atom_name += XDisplayName(qPrintable(screen->displayName())); + settings_atom_name += XDisplayName(qPrintable(screen->display()->displayName())); names[i++] = settings_atom_name; Q_ASSERT(i == QXlibStatic::NAtoms); @@ -374,7 +375,7 @@ private: XInternAtoms(screen->display(), (char **)names, i, False, m_allAtoms); #else for (i = 0; i < QXlibStatic::NAtoms; ++i) - m_allAtoms[i] = XInternAtom(screen->display(), (char *)names[i], False); + m_allAtoms[i] = XInternAtom(screen->display()->nativeDisplay(), (char *)names[i], False); #endif } @@ -386,7 +387,7 @@ private: unsigned long nitems, after; unsigned char *data = 0; - int e = XGetWindowProperty(screen->display(), screen->rootWindow(), + int e = XGetWindowProperty(screen->display()->nativeDisplay(), screen->rootWindow(), this->atom(QXlibStatic::_NET_SUPPORTED), 0, 0, False, XA_ATOM, &type, &format, &nitems, &after, &data); if (data) @@ -397,7 +398,7 @@ private: ts.open(QIODevice::WriteOnly); while (after > 0) { - XGetWindowProperty(screen->display(), screen->rootWindow(), + XGetWindowProperty(screen->display()->nativeDisplay(), screen->rootWindow(), this->atom(QXlibStatic::_NET_SUPPORTED), offset, 1024, False, XA_ATOM, &type, &format, &nitems, &after, &data); @@ -427,7 +428,7 @@ private: { #ifndef QT_NO_XFIXES // See if Xfixes is supported on the connected display - if (XQueryExtension(screen->display(), "XFIXES", &xfixes_major, + if (XQueryExtension(screen->display()->nativeDisplay(), "XFIXES", &xfixes_major, &xfixes_eventbase, &xfixes_errorbase)) { ptrXFixesQueryExtension = XFIXES_LOAD_V1(XFixesQueryExtension); ptrXFixesQueryVersion = XFIXES_LOAD_V1(XFixesQueryVersion); @@ -435,7 +436,7 @@ private: ptrXFixesSelectSelectionInput = XFIXES_LOAD_V2(XFixesSelectSelectionInput); if(ptrXFixesQueryExtension && ptrXFixesQueryVersion - && ptrXFixesQueryExtension(screen->display(), &xfixes_eventbase, + && ptrXFixesQueryExtension(screen->display()->nativeDisplay(), &xfixes_eventbase, &xfixes_errorbase)) { // Xfixes is supported. // Note: the XFixes protocol version is negotiated using QueryVersion. @@ -446,7 +447,7 @@ private: // X server when it receives an XFixes request is undefined. int major = 3; int minor = 0; - ptrXFixesQueryVersion(screen->display(), &major, &minor); + ptrXFixesQueryVersion(screen->display()->nativeDisplay(), &major, &minor); use_xfixes = (major >= 1); xfixes_major = major; } diff --git a/src/plugins/platforms/xlib/qxlibwindow.cpp b/src/plugins/platforms/xlib/qxlibwindow.cpp index ddd4002..90b36cf 100644 --- a/src/plugins/platforms/xlib/qxlibwindow.cpp +++ b/src/plugins/platforms/xlib/qxlibwindow.cpp @@ -45,6 +45,7 @@ #include "qxlibscreen.h" #include "qxlibkeyboard.h" #include "qxlibstatic.h" +#include "qxlibdisplay.h" #include <QtGui/QWindowSystemInterface> #include <QSocketNotifier> @@ -86,9 +87,9 @@ QXlibWindow::QXlibWindow(QWidget *window) #else QPlatformWindowFormat windowFormat = correctColorBuffers(window->platformWindowFormat()); - EGLDisplay eglDisplay = eglGetDisplay(mScreen->display()); + EGLDisplay eglDisplay = eglGetDisplay(mScreen->display()->nativeDisplay()); EGLConfig eglConfig = q_configFromQPlatformWindowFormat(eglDisplay,windowFormat); - VisualID id = QXlibEglIntegration::getCompatibleVisualId(mScreen->display(),eglConfig); + VisualID id = QXlibEglIntegration::getCompatibleVisualId(mScreen->display()->nativeDisplay(),eglConfig); XVisualInfo visualInfoTemplate; memset(&visualInfoTemplate, 0, sizeof(XVisualInfo)); @@ -96,14 +97,14 @@ QXlibWindow::QXlibWindow(QWidget *window) XVisualInfo *visualInfo; int matchingCount = 0; - visualInfo = XGetVisualInfo(mScreen->display(), VisualIDMask, &visualInfoTemplate, &matchingCount); + visualInfo = XGetVisualInfo(mScreen->display()->nativeDisplay(), VisualIDMask, &visualInfoTemplate, &matchingCount); #endif //!defined(QT_OPENGL_ES_2) if (visualInfo) { - Colormap cmap = XCreateColormap(mScreen->display(),mScreen->rootWindow(),visualInfo->visual,AllocNone); + Colormap cmap = XCreateColormap(mScreen->display()->nativeDisplay(),mScreen->rootWindow(),visualInfo->visual,AllocNone); XSetWindowAttributes a; a.colormap = cmap; - x_window = XCreateWindow(mScreen->display(), mScreen->rootWindow(),x, y, w, h, + x_window = XCreateWindow(mScreen->display()->nativeDisplay(), mScreen->rootWindow(),x, y, w, h, 0, visualInfo->depth, InputOutput, visualInfo->visual, CWColormap, &a); } else { @@ -111,7 +112,7 @@ QXlibWindow::QXlibWindow(QWidget *window) } #endif //!defined(QT_NO_OPENGL) } else { - x_window = XCreateSimpleWindow(mScreen->display(), mScreen->rootWindow(), + x_window = XCreateSimpleWindow(mScreen->display()->nativeDisplay(), mScreen->rootWindow(), x, y, w, h, 0 /*border_width*/, mScreen->blackPixel(), mScreen->whitePixel()); } @@ -120,9 +121,9 @@ QXlibWindow::QXlibWindow(QWidget *window) qDebug() << "QTestLiteWindow::QTestLiteWindow creating" << hex << x_window << window; #endif - XSetWindowBackgroundPixmap(mScreen->display(), x_window, XNone); + XSetWindowBackgroundPixmap(mScreen->display()->nativeDisplay(), x_window, XNone); - XSelectInput(mScreen->display(), x_window, + XSelectInput(mScreen->display()->nativeDisplay(), x_window, ExposureMask | KeyPressMask | KeyReleaseMask | EnterWindowMask | LeaveWindowMask | FocusChangeMask | PointerMotionMask | ButtonPressMask | ButtonReleaseMask | @@ -141,7 +142,7 @@ QXlibWindow::QXlibWindow(QWidget *window) #endif // QT_NO_XSYNC if (window->windowFlags() & Qt::WindowContextHelpButtonHint) protocols[n++] = QXlibStatic::atom(QXlibStatic::_NET_WM_CONTEXT_HELP); - XSetWMProtocols(mScreen->display(), x_window, protocols, n); + XSetWMProtocols(mScreen->display()->nativeDisplay(), x_window, protocols, n); } @@ -152,8 +153,8 @@ QXlibWindow::~QXlibWindow() qDebug() << "~QTestLiteWindow" << hex << x_window; #endif delete mGLContext; - XFreeGC(mScreen->display(), gc); - XDestroyWindow(mScreen->display(), x_window); + XFreeGC(mScreen->display()->nativeDisplay(), gc); + XDestroyWindow(mScreen->display()->nativeDisplay(), x_window); } //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -245,7 +246,7 @@ void QXlibWindow::handleFocusOutEvent() void QXlibWindow::setGeometry(const QRect &rect) { - XMoveResizeWindow(mScreen->display(), x_window, rect.x(), rect.y(), rect.width(), rect.height()); + XMoveResizeWindow(mScreen->display()->nativeDisplay(), x_window, rect.x(), rect.y(), rect.width(), rect.height()); QPlatformWindow::setGeometry(rect); } @@ -263,17 +264,17 @@ WId QXlibWindow::winId() const void QXlibWindow::setParent(const QPlatformWindow *window) { QPoint topLeft = geometry().topLeft(); - XReparentWindow(mScreen->display(),x_window,window->winId(),topLeft.x(),topLeft.y()); + XReparentWindow(mScreen->display()->nativeDisplay(),x_window,window->winId(),topLeft.x(),topLeft.y()); } void QXlibWindow::raise() { - XRaiseWindow(mScreen->display(), x_window); + XRaiseWindow(mScreen->display()->nativeDisplay(), x_window); } void QXlibWindow::lower() { - XLowerWindow(mScreen->display(), x_window); + XLowerWindow(mScreen->display()->nativeDisplay(), x_window); } void QXlibWindow::setWindowTitle(const QString &title) @@ -285,14 +286,14 @@ void QXlibWindow::setWindowTitle(const QString &title) windowName.format = 8; windowName.nitems = ba.length(); - XSetWMName(mScreen->display(), x_window, &windowName); + XSetWMName(mScreen->display()->nativeDisplay(), x_window, &windowName); } GC QXlibWindow::createGC() { GC gc; - gc = XCreateGC(mScreen->display(), x_window, 0, 0); + gc = XCreateGC(mScreen->display()->nativeDisplay(), x_window, 0, 0); if (gc < 0) { qWarning("QTestLiteWindow::createGC() could not create GC"); } @@ -311,7 +312,7 @@ void QXlibWindow::paintEvent() void QXlibWindow::requestActivateWindow() { - XSetInputFocus(mScreen->display(), x_window, XRevertToParent, CurrentTime); + XSetInputFocus(mScreen->display()->nativeDisplay(), x_window, XRevertToParent, CurrentTime); } void QXlibWindow::resizeEvent(XConfigureEvent *e) @@ -365,7 +366,7 @@ QXlibMWMHints QXlibWindow::getMWMHints() const ulong nitems, bytesLeft; uchar *data = 0; Atom atomForMotifWmHints = QXlibStatic::atom(QXlibStatic::_MOTIF_WM_HINTS); - if ((XGetWindowProperty(mScreen->display(), x_window, atomForMotifWmHints, 0, 5, false, + if ((XGetWindowProperty(mScreen->display()->nativeDisplay(), x_window, atomForMotifWmHints, 0, 5, false, atomForMotifWmHints, &type, &format, &nitems, &bytesLeft, &data) == Success) && (type == atomForMotifWmHints @@ -390,11 +391,11 @@ void QXlibWindow::setMWMHints(const QXlibMWMHints &mwmhints) { Atom atomForMotifWmHints = QXlibStatic::atom(QXlibStatic::_MOTIF_WM_HINTS); if (mwmhints.flags != 0l) { - XChangeProperty(mScreen->display(), x_window, + XChangeProperty(mScreen->display()->nativeDisplay(), x_window, atomForMotifWmHints, atomForMotifWmHints, 32, PropModeReplace, (unsigned char *) &mwmhints, 5); } else { - XDeleteProperty(mScreen->display(), x_window, atomForMotifWmHints); + XDeleteProperty(mScreen->display()->nativeDisplay(), x_window, atomForMotifWmHints); } } @@ -421,7 +422,7 @@ QVector<Atom> QXlibWindow::getNetWmState() const ulong propertyLength; ulong bytesLeft; uchar *propertyData = 0; - if (XGetWindowProperty(mScreen->display(), x_window, QXlibStatic::atom(QXlibStatic::_NET_WM_STATE), 0, 0, + if (XGetWindowProperty(mScreen->display()->nativeDisplay(), x_window, QXlibStatic::atom(QXlibStatic::_NET_WM_STATE), 0, 0, False, XA_ATOM, &actualType, &actualFormat, &propertyLength, &bytesLeft, &propertyData) == Success && actualType == XA_ATOM && actualFormat == 32) { @@ -429,7 +430,7 @@ QVector<Atom> QXlibWindow::getNetWmState() const XFree((char*) propertyData); // fetch all data - if (XGetWindowProperty(mScreen->display(), x_window, QXlibStatic::atom(QXlibStatic::_NET_WM_STATE), 0, + if (XGetWindowProperty(mScreen->display()->nativeDisplay(), x_window, QXlibStatic::atom(QXlibStatic::_NET_WM_STATE), 0, returnValue.size(), False, XA_ATOM, &actualType, &actualFormat, &propertyLength, &bytesLeft, &propertyData) != Success) { returnValue.clear(); @@ -591,11 +592,11 @@ Qt::WindowFlags QXlibWindow::setWindowFlags(Qt::WindowFlags flags) } if (!netWmState.isEmpty()) { - XChangeProperty(mScreen->display(), x_window, + XChangeProperty(mScreen->display()->nativeDisplay(), x_window, QXlibStatic::atom(QXlibStatic::_NET_WM_STATE), XA_ATOM, 32, PropModeReplace, (unsigned char *) netWmState.data(), netWmState.size()); } else { - XDeleteProperty(mScreen->display(), x_window, QXlibStatic::atom(QXlibStatic::_NET_WM_STATE)); + XDeleteProperty(mScreen->display()->nativeDisplay(), x_window, QXlibStatic::atom(QXlibStatic::_NET_WM_STATE)); } //##### only if initializeWindow??? @@ -609,7 +610,7 @@ Qt::WindowFlags QXlibWindow::setWindowFlags(Qt::WindowFlags flags) wsa.override_redirect = True; wsa.save_under = True; - XChangeWindowAttributes(mScreen->display(), x_window, CWOverrideRedirect | CWSaveUnder, + XChangeWindowAttributes(mScreen->display()->nativeDisplay(), x_window, CWOverrideRedirect | CWSaveUnder, &wsa); } else { #ifdef MYX11_DEBUG @@ -634,22 +635,22 @@ void QXlibWindow::setVisible(bool visible) parentXWindow = parentWidnow->x_window; } } - XSetTransientForHint(mScreen->display(),x_window,parentXWindow); + XSetTransientForHint(mScreen->display()->nativeDisplay(),x_window,parentXWindow); } if (visible) { //ensure that the window is viewed in correct position. doSizeHints(); - XMapWindow(mScreen->display(), x_window); + XMapWindow(mScreen->display()->nativeDisplay(), x_window); } else { - XUnmapWindow(mScreen->display(), x_window); + XUnmapWindow(mScreen->display()->nativeDisplay(), x_window); } } void QXlibWindow::setCursor(const Cursor &cursor) { - XDefineCursor(mScreen->display(), x_window, cursor); - XFlush(mScreen->display()); + XDefineCursor(mScreen->display()->nativeDisplay(), x_window, cursor); + mScreen->display()->flush(); } QPlatformGLContext *QXlibWindow::glContext() const @@ -662,7 +663,7 @@ QPlatformGLContext *QXlibWindow::glContext() const #if !defined(QT_OPENGL_ES_2) that->mGLContext = new QGLXContext(x_window, mScreen,widget()->platformWindowFormat()); #else - EGLDisplay display = eglGetDisplay(mScreen->display()); + EGLDisplay display = eglGetDisplay(mScreen->display()->nativeDisplay()); QPlatformWindowFormat windowFormat = correctColorBuffers(widget()->platformWindowFormat()); @@ -706,7 +707,7 @@ void QXlibWindow::doSizeHints() s.flags |= PSize; s.flags |= PWinGravity; s.win_gravity = QApplication::isRightToLeft() ? NorthEastGravity : NorthWestGravity; - XSetWMNormalHints(mScreen->display(), x_window, &s); + XSetWMNormalHints(mScreen->display()->nativeDisplay(), x_window, &s); } QPlatformWindowFormat QXlibWindow::correctColorBuffers(const QPlatformWindowFormat &platformWindowFormat) const diff --git a/src/plugins/platforms/xlib/qxlibwindowsurface.cpp b/src/plugins/platforms/xlib/qxlibwindowsurface.cpp index 92e1793..fa1e197 100644 --- a/src/plugins/platforms/xlib/qxlibwindowsurface.cpp +++ b/src/plugins/platforms/xlib/qxlibwindowsurface.cpp @@ -47,6 +47,7 @@ #include "qxlibwindow.h" #include "qxlibscreen.h" +#include "qxlibdisplay.h" # include <sys/ipc.h> # include <sys/shm.h> @@ -88,12 +89,11 @@ void QXlibWindowSurface::resizeShmImage(int width, int height) if (image_info) image_info->destroy(); else - image_info = new QXlibShmImageInfo(screen->display()); + image_info = new QXlibShmImageInfo(screen->display()->nativeDisplay()); - Visual *visual = DefaultVisual(screen->display(), screen->xScreenNumber()); + Visual *visual = screen->defaultVisual(); - - XImage *image = XShmCreateImage (screen->display(), visual, 24, ZPixmap, 0, + XImage *image = XShmCreateImage (screen->display()->nativeDisplay(), visual, 24, ZPixmap, 0, &image_info->shminfo, width, height); @@ -105,7 +105,7 @@ void QXlibWindowSurface::resizeShmImage(int width, int height) image_info->image = image; - Status shm_attach_status = XShmAttach(screen->display(), &image_info->shminfo); + Status shm_attach_status = XShmAttach(screen->display()->nativeDisplay(), &image_info->shminfo); Q_ASSERT(shm_attach_status == True); @@ -185,11 +185,11 @@ void QXlibWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPo // We could set send_event to true, and then use the ShmCompletion to synchronize, // but let's do like Qt/11 and just use XSync - XShmPutImage (screen->display(), window, gc, image_info->image, 0, 0, + XShmPutImage (screen->display()->nativeDisplay(), window, gc, image_info->image, 0, 0, x, y, image_info->image->width, image_info->image->height, /*send_event*/ False); - XSync(screen->display(), False); + screen->display()->sync(); } #endif } diff --git a/src/plugins/platforms/xlib/xlib.pro b/src/plugins/platforms/xlib/xlib.pro index 999621b..dc22b80 100644 --- a/src/plugins/platforms/xlib/xlib.pro +++ b/src/plugins/platforms/xlib/xlib.pro @@ -13,7 +13,8 @@ SOURCES = \ qxlibkeyboard.cpp \ qxlibclipboard.cpp \ qxlibmime.cpp \ - qxlibstatic.cpp + qxlibstatic.cpp \ + qxlibdisplay.cpp HEADERS = \ qxlibintegration.h \ @@ -24,7 +25,8 @@ HEADERS = \ qxlibkeyboard.h \ qxlibclipboard.h \ qxlibmime.h \ - qxlibstatic.h + qxlibstatic.h \ + qxlibdisplay.h LIBS += -lX11 -lXext -- cgit v0.12 From 7629130b24c01d406f5dee8e6600538db666cfa8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= <jorgen.lind@nokia.com> Date: Thu, 24 Feb 2011 17:43:52 +0100 Subject: Lighthouse: Adding EGL support to the xcb plugin --- .../eglconvenience/qxlibeglintegration.cpp | 186 +++++++++++++++++++++ .../platforms/eglconvenience/qxlibeglintegration.h | 53 ++++++ src/plugins/platforms/xcb/qxcbconnection.cpp | 6 +- src/plugins/platforms/xcb/qxcbconnection.h | 4 +- src/plugins/platforms/xcb/qxcbintegration.cpp | 18 +- src/plugins/platforms/xcb/qxcbwindow.cpp | 53 ++++-- src/plugins/platforms/xcb/qxcbwindow.h | 6 +- src/plugins/platforms/xcb/xcb.pro | 27 ++- src/plugins/platforms/xlib/qxlibeglintegration.cpp | 186 --------------------- src/plugins/platforms/xlib/qxlibeglintegration.h | 54 ------ src/plugins/platforms/xlib/qxlibwindow.cpp | 2 +- src/plugins/platforms/xlib/xlib.pro | 4 +- 12 files changed, 328 insertions(+), 271 deletions(-) create mode 100644 src/plugins/platforms/eglconvenience/qxlibeglintegration.cpp create mode 100644 src/plugins/platforms/eglconvenience/qxlibeglintegration.h delete mode 100644 src/plugins/platforms/xlib/qxlibeglintegration.cpp delete mode 100644 src/plugins/platforms/xlib/qxlibeglintegration.h diff --git a/src/plugins/platforms/eglconvenience/qxlibeglintegration.cpp b/src/plugins/platforms/eglconvenience/qxlibeglintegration.cpp new file mode 100644 index 0000000..1135d2f --- /dev/null +++ b/src/plugins/platforms/eglconvenience/qxlibeglintegration.cpp @@ -0,0 +1,186 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qxlibeglintegration.h" + +static int countBits(unsigned long mask) +{ + int count = 0; + while (mask != 0) { + if (mask & 1) + ++count; + mask >>= 1; + } + return count; +} + +VisualID QXlibEglIntegration::getCompatibleVisualId(Display *display, EGLConfig config) +{ + VisualID visualId = 0; + EGLint eglValue = 0; + + EGLDisplay eglDisplay = eglGetDisplay(display); + + EGLint configRedSize = 0; + eglGetConfigAttrib(eglDisplay, config, EGL_RED_SIZE, &configRedSize); + + EGLint configGreenSize = 0; + eglGetConfigAttrib(eglDisplay, config, EGL_GREEN_SIZE, &configGreenSize); + + EGLint configBlueSize = 0; + eglGetConfigAttrib(eglDisplay, config, EGL_BLUE_SIZE, &configBlueSize); + + EGLint configAlphaSize = 0; + eglGetConfigAttrib(eglDisplay, config, EGL_ALPHA_SIZE, &configAlphaSize); + + eglGetConfigAttrib(eglDisplay, config, EGL_CONFIG_ID, &eglValue); + int configId = eglValue; + + // See if EGL provided a valid VisualID: + eglGetConfigAttrib(eglDisplay, config, EGL_NATIVE_VISUAL_ID, &eglValue); + visualId = (VisualID)eglValue; + if (visualId) { + // EGL has suggested a visual id, so get the rest of the visual info for that id: + XVisualInfo visualInfoTemplate; + memset(&visualInfoTemplate, 0, sizeof(XVisualInfo)); + visualInfoTemplate.visualid = visualId; + + XVisualInfo *chosenVisualInfo; + int matchingCount = 0; + chosenVisualInfo = XGetVisualInfo(display, VisualIDMask, &visualInfoTemplate, &matchingCount); + if (chosenVisualInfo) { + // Skip size checks if implementation supports non-matching visual + // and config (http://bugreports.qt.nokia.com/browse/QTBUG-9444). + if (q_hasEglExtension(eglDisplay,"EGL_NV_post_convert_rounding")) { + XFree(chosenVisualInfo); + return visualId; + } + + int visualRedSize = countBits(chosenVisualInfo->red_mask); + int visualGreenSize = countBits(chosenVisualInfo->green_mask); + int visualBlueSize = countBits(chosenVisualInfo->blue_mask); + int visualAlphaSize = -1; // Need XRender to tell us the alpha channel size + + bool visualMatchesConfig = false; + if ( visualRedSize == configRedSize && + visualGreenSize == configGreenSize && + visualBlueSize == configBlueSize ) + { + // We need XRender to check the alpha channel size of the visual. If we don't have + // the alpha size, we don't check it against the EGL config's alpha size. + if (visualAlphaSize >= 0) + visualMatchesConfig = visualAlphaSize == configAlphaSize; + else + visualMatchesConfig = true; + } + + if (!visualMatchesConfig) { + if (visualAlphaSize >= 0) { + qWarning("Warning: EGL suggested using X Visual ID %d (ARGB%d%d%d%d) for EGL config %d (ARGB%d%d%d%d), but this is incompatable", + (int)visualId, visualAlphaSize, visualRedSize, visualGreenSize, visualBlueSize, + configId, configAlphaSize, configRedSize, configGreenSize, configBlueSize); + } else { + qWarning("Warning: EGL suggested using X Visual ID %d (RGB%d%d%d) for EGL config %d (RGB%d%d%d), but this is incompatable", + (int)visualId, visualRedSize, visualGreenSize, visualBlueSize, + configId, configRedSize, configGreenSize, configBlueSize); + } + visualId = 0; + } + } else { + qWarning("Warning: EGL suggested using X Visual ID %d for EGL config %d, but that isn't a valid ID", + (int)visualId, configId); + visualId = 0; + } + XFree(chosenVisualInfo); + } +#ifdef QT_DEBUG_X11_VISUAL_SELECTION + else + qDebug("EGL did not suggest a VisualID (EGL_NATIVE_VISUAL_ID was zero) for EGLConfig %d", configId); +#endif + + if (visualId) { +#ifdef QT_DEBUG_X11_VISUAL_SELECTION + if (configAlphaSize > 0) + qDebug("Using ARGB Visual ID %d provided by EGL for config %d", (int)visualId, configId); + else + qDebug("Using Opaque Visual ID %d provided by EGL for config %d", (int)visualId, configId); +#endif + return visualId; + } + + // Finally, try to + // use XGetVisualInfo and only use the bit depths to match on: + if (!visualId) { + XVisualInfo visualInfoTemplate; + memset(&visualInfoTemplate, 0, sizeof(XVisualInfo)); + XVisualInfo *matchingVisuals; + int matchingCount = 0; + + visualInfoTemplate.depth = configRedSize + configGreenSize + configBlueSize + configAlphaSize; + matchingVisuals = XGetVisualInfo(display, + VisualDepthMask, + &visualInfoTemplate, + &matchingCount); + if (!matchingVisuals) { + // Try again without taking the alpha channel into account: + visualInfoTemplate.depth = configRedSize + configGreenSize + configBlueSize; + matchingVisuals = XGetVisualInfo(display, + VisualDepthMask, + &visualInfoTemplate, + &matchingCount); + } + + if (matchingVisuals) { + visualId = matchingVisuals[0].visualid; + XFree(matchingVisuals); + } + } + + if (visualId) { +#ifdef QT_DEBUG_X11_VISUAL_SELECTION + qDebug("Using Visual ID %d provided by XGetVisualInfo for EGL config %d", (int)visualId, configId); +#endif + return visualId; + } + + qWarning("Unable to find an X11 visual which matches EGL config %d", configId); + return (VisualID)0; +} diff --git a/src/plugins/platforms/eglconvenience/qxlibeglintegration.h b/src/plugins/platforms/eglconvenience/qxlibeglintegration.h new file mode 100644 index 0000000..f62dce4 --- /dev/null +++ b/src/plugins/platforms/eglconvenience/qxlibeglintegration.h @@ -0,0 +1,53 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTESTLITEEGLINTEGRATION_H +#define QTESTLITEEGLINTEGRATION_H + +#include "qeglconvenience.h" + +class QXlibEglIntegration +{ +public: + static VisualID getCompatibleVisualId(Display *display, EGLConfig config); +}; + +#endif // QTESTLITEEGLINTEGRATION_H diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index 0696ed3..967aa4d 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -49,7 +49,7 @@ #include <stdio.h> -#ifdef XCB_USE_XLIB_FOR_GLX +#ifdef XCB_USE_XLIB #include <X11/Xlib.h> #include <X11/Xlib-xcb.h> #endif @@ -59,7 +59,7 @@ QXcbConnection::QXcbConnection(const char *displayName) { int primaryScreen = 0; -#ifdef XCB_USE_XLIB_FOR_GLX +#ifdef XCB_USE_XLIB Display *dpy = XOpenDisplay(m_displayName.constData()); primaryScreen = DefaultScreen(dpy); m_connection = XGetXCBConnection(dpy); @@ -91,7 +91,7 @@ QXcbConnection::~QXcbConnection() { qDeleteAll(m_screens); -#ifdef XCB_USE_XLIB_FOR_GLX +#ifdef XCB_USE_XLIB XCloseDisplay((Display *)m_xlib_display); #else xcb_disconnect(xcb_connection()); diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index 8a225c2..6a472a7 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -232,7 +232,7 @@ public: QXcbKeyboard *keyboard() const { return m_keyboard; } -#ifdef XCB_USE_XLIB_FOR_GLX +#ifdef XCB_USE_XLIB void *xlib_display() const { return m_xlib_display; } #endif @@ -254,7 +254,7 @@ private: QXcbKeyboard *m_keyboard; -#ifdef XCB_USE_XLIB_FOR_GLX +#ifdef XCB_USE_XLIB void *m_xlib_display; #endif }; diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp index 89a6154..6dc5a5c 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.cpp +++ b/src/plugins/platforms/xcb/qxcbintegration.cpp @@ -53,6 +53,10 @@ #include <stdio.h> +#ifdef XCB_USE_EGL +#include <EGL/egl.h> +#endif + QXcbIntegration::QXcbIntegration() : m_connection(new QXcbConnection) { @@ -118,8 +122,20 @@ QPixmap QXcbIntegration::grabWindow(WId window, int x, int y, int width, int hei bool QXcbIntegration::hasOpenGL() const { -#ifdef XCB_USE_XLIB_FOR_GLX +#if defined(XCB_USE_GLX) return true; +#elif defined(XCB_USE_EGL) + static bool eglHasbeenInitialized = false; + static bool wasEglInitialized = false; + if (!eglHasbeenInitialized) { + eglHasbeenInitialized = true; + const QXcbScreen *screen = static_cast<const QXcbScreen *>(m_screens.at(0)); + EGLint major, minor; + eglBindAPI(EGL_OPENGL_ES_API); + EGLDisplay disp = eglGetDisplay((Display*)screen->connection()->xlib_display()); + wasEglInitialized = eglInitialize(disp,&major,&minor); + } + return wasEglInitialized; #else return false; #endif diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 78cba1c..bb856f2 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -53,10 +53,17 @@ #include <stdio.h> -#ifdef XCB_USE_XLIB_FOR_GLX +#ifdef XCB_USE_XLIB #include <X11/Xlib.h> #include <X11/Xutil.h> +#endif + +#if defined(XCB_USE_GLX) #include "qglxintegration.h" +#elif defined(XCB_USE_EGL) +#include "../eglconvenience/qeglplatformcontext.h" +#include "../eglconvenience/qeglconvenience.h" +#include "../eglconvenience/qxlibeglintegration.h" #endif // Returns true if we should set WM_TRANSIENT_FOR on \a w @@ -74,9 +81,7 @@ static inline bool isTransient(const QWidget *w) QXcbWindow::QXcbWindow(QWidget *tlw) : QPlatformWindow(tlw) -#ifdef XCB_USE_XLIB_FOR_GLX - , m_glx_context(0) -#endif + , m_context(0) { m_screen = static_cast<QXcbScreen *>(QPlatformScreen::platformScreenForWidget(tlw)); @@ -100,10 +105,24 @@ QXcbWindow::QXcbWindow(QWidget *tlw) | XCB_EVENT_MASK_FOCUS_CHANGE }; -#ifdef XCB_USE_XLIB_FOR_GLX +#if defined(XCB_USE_GLX) || defined(XCB_USE_EGL) if (tlw->platformWindowFormat().windowApi() == QPlatformWindowFormat::OpenGL && QApplicationPrivate::platformIntegration()->hasOpenGL() ) { +#if defined(XCB_USE_GLX) XVisualInfo *visualInfo = QGLXContext::findVisualInfo(m_screen, tlw->platformWindowFormat()); +#elif defined(XCB_USE_EGL) + EGLDisplay eglDisplay = eglGetDisplay(DISPLAY_FROM_XCB(this)); + EGLConfig eglConfig = q_configFromQPlatformWindowFormat(eglDisplay,tlw->platformWindowFormat(),true); + VisualID id = QXlibEglIntegration::getCompatibleVisualId(DISPLAY_FROM_XCB(this),eglConfig); + + XVisualInfo visualInfoTemplate; + memset(&visualInfoTemplate, 0, sizeof(XVisualInfo)); + visualInfoTemplate.visualid = id; + + XVisualInfo *visualInfo; + int matchingCount = 0; + visualInfo = XGetVisualInfo(DISPLAY_FROM_XCB(this), VisualIDMask, &visualInfoTemplate, &matchingCount); +#endif //XCB_USE_GLX if (visualInfo) { Colormap cmap = XCreateColormap(DISPLAY_FROM_XCB(this), m_screen->root(), visualInfo->visual, AllocNone); @@ -395,21 +414,31 @@ void QXcbWindow::requestActivateWindow() QPlatformGLContext *QXcbWindow::glContext() const { -#ifdef XCB_USE_XLIB_FOR_GLX if (!QApplicationPrivate::platformIntegration()->hasOpenGL()) { printf("no opengl\n"); return 0; } - - if (!m_glx_context) { +#if defined(XCB_USE_GLX) + if (!m_context) { QXcbWindow *that = const_cast<QXcbWindow *>(this); - that->m_glx_context = new QGLXContext(m_window, m_screen, widget()->platformWindowFormat()); + that->m_context = new QGLXContext(m_window, m_screen, widget()->platformWindowFormat()); } +#elif defined(XCB_USE_EGL) + if (!m_context) { + EGLDisplay display = eglGetDisplay(DISPLAY_FROM_XCB(this)); - return m_glx_context; -#else - return 0; + EGLConfig config = q_configFromQPlatformWindowFormat(display,widget()->platformWindowFormat(),true); + QVector<EGLint> eglContextAttrs; + eglContextAttrs.append(EGL_CONTEXT_CLIENT_VERSION); + eglContextAttrs.append(2); + eglContextAttrs.append(EGL_NONE); + + EGLSurface eglSurface = eglCreateWindowSurface(display,config,(EGLNativeWindowType)m_window,0); + QXcbWindow *that = const_cast<QXcbWindow *>(this); + that->m_context = new QEGLPlatformContext(display, config, eglContextAttrs.data(), eglSurface, EGL_OPENGL_ES_API); + } #endif + return m_context; } void QXcbWindow::handleExposeEvent(const xcb_expose_event_t *event) diff --git a/src/plugins/platforms/xcb/qxcbwindow.h b/src/plugins/platforms/xcb/qxcbwindow.h index 8db1a1e..2e8238b 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.h +++ b/src/plugins/platforms/xcb/qxcbwindow.h @@ -43,12 +43,12 @@ #define QXCBWINDOW_H #include <QtGui/QPlatformWindow> +#include <QtGui/QPlatformWindowFormat> #include <xcb/xcb.h> #include "qxcbobject.h" -class QGLXContext; class QXcbScreen; class QXcbWindow : public QXcbObject, public QPlatformWindow @@ -92,9 +92,7 @@ private: QXcbScreen *m_screen; xcb_window_t m_window; -#ifdef XCB_USE_XLIB_FOR_GLX - QGLXContext *m_glx_context; -#endif + QPlatformGLContext *m_context; }; #endif diff --git a/src/plugins/platforms/xcb/xcb.pro b/src/plugins/platforms/xcb/xcb.pro index a6e92ef..b5850e4 100644 --- a/src/plugins/platforms/xcb/xcb.pro +++ b/src/plugins/platforms/xcb/xcb.pro @@ -21,14 +21,29 @@ HEADERS = \ qxcbwindow.h \ qxcbwindowsurface.h -contains(QT_CONFIG, opengl):DEFINES += XCB_USE_XLIB_FOR_GLX - -contains(DEFINES, XCB_USE_XLIB_FOR_GLX) { +contains(QT_CONFIG, opengl) { QT += opengl - - HEADERS += qglxintegration.h - SOURCES += qglxintegration.cpp + DEFINES += XCB_USE_XLIB LIBS += -lX11 -lX11-xcb + + contains(QT_CONFIG, opengles2) { + DEFINES += XCB_USE_EGL + HEADERS += \ + ../eglconvenience/qeglplatformcontext.h \ + ../eglconvenience/qeglconvenience.h \ + ../eglconvenience/qxlibeglintegration.h + + SOURCES += \ + ../eglconvenience/qeglplatformcontext.cpp \ + ../eglconvenience/qeglconvenience.cpp \ + ../eglconvenience/qxlibeglintegration.cpp + + LIBS += -lEGL + } else { + DEFINES += XCB_USE_GLX + HEADERS += qglxintegration.h + SOURCES += qglxintegration.cpp + } } LIBS += -lxcb -lxcb-image -lxcb-keysyms -lxcb-icccm diff --git a/src/plugins/platforms/xlib/qxlibeglintegration.cpp b/src/plugins/platforms/xlib/qxlibeglintegration.cpp deleted file mode 100644 index 1135d2f..0000000 --- a/src/plugins/platforms/xlib/qxlibeglintegration.cpp +++ /dev/null @@ -1,186 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qxlibeglintegration.h" - -static int countBits(unsigned long mask) -{ - int count = 0; - while (mask != 0) { - if (mask & 1) - ++count; - mask >>= 1; - } - return count; -} - -VisualID QXlibEglIntegration::getCompatibleVisualId(Display *display, EGLConfig config) -{ - VisualID visualId = 0; - EGLint eglValue = 0; - - EGLDisplay eglDisplay = eglGetDisplay(display); - - EGLint configRedSize = 0; - eglGetConfigAttrib(eglDisplay, config, EGL_RED_SIZE, &configRedSize); - - EGLint configGreenSize = 0; - eglGetConfigAttrib(eglDisplay, config, EGL_GREEN_SIZE, &configGreenSize); - - EGLint configBlueSize = 0; - eglGetConfigAttrib(eglDisplay, config, EGL_BLUE_SIZE, &configBlueSize); - - EGLint configAlphaSize = 0; - eglGetConfigAttrib(eglDisplay, config, EGL_ALPHA_SIZE, &configAlphaSize); - - eglGetConfigAttrib(eglDisplay, config, EGL_CONFIG_ID, &eglValue); - int configId = eglValue; - - // See if EGL provided a valid VisualID: - eglGetConfigAttrib(eglDisplay, config, EGL_NATIVE_VISUAL_ID, &eglValue); - visualId = (VisualID)eglValue; - if (visualId) { - // EGL has suggested a visual id, so get the rest of the visual info for that id: - XVisualInfo visualInfoTemplate; - memset(&visualInfoTemplate, 0, sizeof(XVisualInfo)); - visualInfoTemplate.visualid = visualId; - - XVisualInfo *chosenVisualInfo; - int matchingCount = 0; - chosenVisualInfo = XGetVisualInfo(display, VisualIDMask, &visualInfoTemplate, &matchingCount); - if (chosenVisualInfo) { - // Skip size checks if implementation supports non-matching visual - // and config (http://bugreports.qt.nokia.com/browse/QTBUG-9444). - if (q_hasEglExtension(eglDisplay,"EGL_NV_post_convert_rounding")) { - XFree(chosenVisualInfo); - return visualId; - } - - int visualRedSize = countBits(chosenVisualInfo->red_mask); - int visualGreenSize = countBits(chosenVisualInfo->green_mask); - int visualBlueSize = countBits(chosenVisualInfo->blue_mask); - int visualAlphaSize = -1; // Need XRender to tell us the alpha channel size - - bool visualMatchesConfig = false; - if ( visualRedSize == configRedSize && - visualGreenSize == configGreenSize && - visualBlueSize == configBlueSize ) - { - // We need XRender to check the alpha channel size of the visual. If we don't have - // the alpha size, we don't check it against the EGL config's alpha size. - if (visualAlphaSize >= 0) - visualMatchesConfig = visualAlphaSize == configAlphaSize; - else - visualMatchesConfig = true; - } - - if (!visualMatchesConfig) { - if (visualAlphaSize >= 0) { - qWarning("Warning: EGL suggested using X Visual ID %d (ARGB%d%d%d%d) for EGL config %d (ARGB%d%d%d%d), but this is incompatable", - (int)visualId, visualAlphaSize, visualRedSize, visualGreenSize, visualBlueSize, - configId, configAlphaSize, configRedSize, configGreenSize, configBlueSize); - } else { - qWarning("Warning: EGL suggested using X Visual ID %d (RGB%d%d%d) for EGL config %d (RGB%d%d%d), but this is incompatable", - (int)visualId, visualRedSize, visualGreenSize, visualBlueSize, - configId, configRedSize, configGreenSize, configBlueSize); - } - visualId = 0; - } - } else { - qWarning("Warning: EGL suggested using X Visual ID %d for EGL config %d, but that isn't a valid ID", - (int)visualId, configId); - visualId = 0; - } - XFree(chosenVisualInfo); - } -#ifdef QT_DEBUG_X11_VISUAL_SELECTION - else - qDebug("EGL did not suggest a VisualID (EGL_NATIVE_VISUAL_ID was zero) for EGLConfig %d", configId); -#endif - - if (visualId) { -#ifdef QT_DEBUG_X11_VISUAL_SELECTION - if (configAlphaSize > 0) - qDebug("Using ARGB Visual ID %d provided by EGL for config %d", (int)visualId, configId); - else - qDebug("Using Opaque Visual ID %d provided by EGL for config %d", (int)visualId, configId); -#endif - return visualId; - } - - // Finally, try to - // use XGetVisualInfo and only use the bit depths to match on: - if (!visualId) { - XVisualInfo visualInfoTemplate; - memset(&visualInfoTemplate, 0, sizeof(XVisualInfo)); - XVisualInfo *matchingVisuals; - int matchingCount = 0; - - visualInfoTemplate.depth = configRedSize + configGreenSize + configBlueSize + configAlphaSize; - matchingVisuals = XGetVisualInfo(display, - VisualDepthMask, - &visualInfoTemplate, - &matchingCount); - if (!matchingVisuals) { - // Try again without taking the alpha channel into account: - visualInfoTemplate.depth = configRedSize + configGreenSize + configBlueSize; - matchingVisuals = XGetVisualInfo(display, - VisualDepthMask, - &visualInfoTemplate, - &matchingCount); - } - - if (matchingVisuals) { - visualId = matchingVisuals[0].visualid; - XFree(matchingVisuals); - } - } - - if (visualId) { -#ifdef QT_DEBUG_X11_VISUAL_SELECTION - qDebug("Using Visual ID %d provided by XGetVisualInfo for EGL config %d", (int)visualId, configId); -#endif - return visualId; - } - - qWarning("Unable to find an X11 visual which matches EGL config %d", configId); - return (VisualID)0; -} diff --git a/src/plugins/platforms/xlib/qxlibeglintegration.h b/src/plugins/platforms/xlib/qxlibeglintegration.h deleted file mode 100644 index 6a94b8e..0000000 --- a/src/plugins/platforms/xlib/qxlibeglintegration.h +++ /dev/null @@ -1,54 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QTESTLITEEGLINTEGRATION_H -#define QTESTLITEEGLINTEGRATION_H - -#include "qxlibstatic.h" -#include "../eglconvenience/qeglconvenience.h" - -class QXlibEglIntegration -{ -public: - static VisualID getCompatibleVisualId(Display *display, EGLConfig config); -}; - -#endif // QTESTLITEEGLINTEGRATION_H diff --git a/src/plugins/platforms/xlib/qxlibwindow.cpp b/src/plugins/platforms/xlib/qxlibwindow.cpp index 90b36cf..b0d32d9 100644 --- a/src/plugins/platforms/xlib/qxlibwindow.cpp +++ b/src/plugins/platforms/xlib/qxlibwindow.cpp @@ -61,7 +61,7 @@ #else #include "../eglconvenience/qeglconvenience.h" #include "../eglconvenience/qeglplatformcontext.h" -#include "qxlibeglintegration.h" +#include "../eglconvenience/qxlibeglintegration.h" #endif //QT_OPENGL_ES_2 #endif //QT_NO_OPENGL diff --git a/src/plugins/platforms/xlib/xlib.pro b/src/plugins/platforms/xlib/xlib.pro index dc22b80..159fdbe 100644 --- a/src/plugins/platforms/xlib/xlib.pro +++ b/src/plugins/platforms/xlib/xlib.pro @@ -45,12 +45,12 @@ contains(QT_CONFIG, opengl) { HEADERS += \ ../eglconvenience/qeglplatformcontext.h \ ../eglconvenience/qeglconvenience.h \ - qxlibeglintegration.h + ../eglconvenience/qxlibeglintegration.h SOURCES += \ ../eglconvenience/qeglplatformcontext.cpp \ ../eglconvenience/qeglconvenience.cpp \ - qxlibeglintegration.cpp + ../eglconvenience/qxlibeglintegration.cpp LIBS += -lEGL } } -- cgit v0.12 From 93e0fc1476757331d25b9fe2d357e930eda55331 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= <jorgen.lind@nokia.com> Date: Tue, 1 Mar 2011 10:06:31 +0100 Subject: Lighthouse: Xcb. implement dri2 context handling --- src/plugins/platforms/xcb/qdri2context.cpp | 224 ++++++++++++++++++++++++++ src/plugins/platforms/xcb/qdri2context.h | 34 ++++ src/plugins/platforms/xcb/qxcbconnection.cpp | 131 ++++++++++++++- src/plugins/platforms/xcb/qxcbconnection.h | 23 ++- src/plugins/platforms/xcb/qxcbintegration.cpp | 9 +- src/plugins/platforms/xcb/qxcbwindow.cpp | 16 +- src/plugins/platforms/xcb/xcb.pro | 48 +++--- 7 files changed, 460 insertions(+), 25 deletions(-) create mode 100644 src/plugins/platforms/xcb/qdri2context.cpp create mode 100644 src/plugins/platforms/xcb/qdri2context.h diff --git a/src/plugins/platforms/xcb/qdri2context.cpp b/src/plugins/platforms/xcb/qdri2context.cpp new file mode 100644 index 0000000..44b8fc2 --- /dev/null +++ b/src/plugins/platforms/xcb/qdri2context.cpp @@ -0,0 +1,224 @@ +#include "qdri2context.h" + +#include "qxcbwindow.h" +#include "qxcbconnection.h" + +#include <QtCore/QDebug> +#include <QtGui/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> + +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 QPlatformGLContext *currentContext = QPlatformGLContext::currentContext(); + if (currentContext) + const_cast<QPlatformGLContext*>(currentContext)->makeCurrent(); +} + +QDri2Context::~QDri2Context() +{ + //cleanup +} + +void QDri2Context::makeCurrent() +{ + QPlatformGLContext::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() +{ + QPlatformGLContext::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; +} diff --git a/src/plugins/platforms/xcb/qdri2context.h b/src/plugins/platforms/xcb/qdri2context.h new file mode 100644 index 0000000..5646565 --- /dev/null +++ b/src/plugins/platforms/xcb/qdri2context.h @@ -0,0 +1,34 @@ +#ifndef QDRI2CONTEXT_H +#define QDRI2CONTEXT_H + +#include <QtGui/QPlatformGLContext> + +class QXcbWindow; +class QDri2ContextPrivate; + +struct xcb_dri2_dri2_buffer_t; + +class QDri2Context : public QPlatformGLContext +{ + 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; + +protected: + xcb_dri2_dri2_buffer_t *backBuffer(); + QScopedPointer<QDri2ContextPrivate> d_ptr; +private: + Q_DISABLE_COPY(QDri2Context) +}; + +#endif // QDRI2CONTEXT_H diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index 967aa4d..06e4d13 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -46,16 +46,38 @@ #include <QtAlgorithms> #include <QSocketNotifier> +#include <QtGui/private/qapplication_p.h> + +#include <QtCore/QDebug> #include <stdio.h> +#include <errno.h> #ifdef XCB_USE_XLIB #include <X11/Xlib.h> #include <X11/Xlib-xcb.h> #endif +#ifdef XCB_USE_DRI2 +#include <xcb/dri2.h> +#include <xcb/xfixes.h> +extern "C" { +#include <xf86drm.h> +} +#define MESA_EGL_NO_X11_HEADERS +#define EGL_EGLEXT_PROTOTYPES +#include <EGL/egl.h> +#include <EGL/eglext.h> +#endif + QXcbConnection::QXcbConnection(const char *displayName) : m_displayName(displayName ? QByteArray(displayName) : qgetenv("DISPLAY")) +#ifdef XCB_USE_DRI2 + , m_dri2_major(0) + , m_dri2_minor(0) + , m_dri2_support_probed(false) + , m_has_support_for_dri2(false) +#endif { int primaryScreen = 0; @@ -67,8 +89,8 @@ QXcbConnection::QXcbConnection(const char *displayName) m_xlib_display = dpy; #else m_connection = xcb_connect(m_displayName.constData(), &primaryScreen); -#endif +#endif //XCB_USE_XLIB m_setup = xcb_get_setup(xcb_connection()); xcb_screen_iterator_t it = xcb_setup_roots_iterator(m_setup); @@ -85,6 +107,10 @@ QXcbConnection::QXcbConnection(const char *displayName) m_keyboard = new QXcbKeyboard(this); initializeAllAtoms(); + +#ifdef XCB_USE_DRI2 + initializeDri2(); +#endif } QXcbConnection::~QXcbConnection() @@ -124,7 +150,7 @@ break; } \ break; -#define XCB_EVENT_DEBUG +//#define XCB_EVENT_DEBUG void printXcbEvent(const char *message, xcb_generic_event_t *event) { @@ -405,3 +431,104 @@ void QXcbConnection::initializeAllAtoms() { for (i = 0; i < QXcbAtom::NAtoms; ++i) m_allAtoms[i] = xcb_intern_atom_reply(xcb_connection(), cookies[i], 0)->atom; } + +#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) { + qDebug() << "Failed to connect to dri2"; + return; + } + + QString dri2DeviceName = QString::fromLocal8Bit(xcb_dri2_connect_device_name (connect), + xcb_dri2_connect_device_name_length (connect)); + delete connect; + + int fd = open(qPrintable(dri2DeviceName), O_RDWR); + if (fd < 0) { + qDebug() << "InitializeDri2: Could'nt open device << dri2DeviceName"; + return; + } + + drm_magic_t magic; + if (drmGetMagic(fd, &magic)) { + qDebug() << "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) { + fprintf(stderr, "DRI2: failed to authenticate\n"); + free(authenticate); + return; + } + + delete authenticate; + + EGLDisplay display = eglGetDRMDisplayMESA(fd); + if (!display) { + fprintf(stderr, "failed to create display\n"); + return; + } + + m_egl_display = display; + EGLint major,minor; + if (!eglInitialize(display, &major, &minor)) { + fprintf(stderr, "failed to initialize display\n"); + return; + } +} + +bool QXcbConnection::hasSupportForDri2() const +{ + if (!m_dri2_support_probed) { + xcb_generic_error_t *error = 0; + + xcb_prefetch_extension_data (m_connection, &xcb_xfixes_id); + xcb_prefetch_extension_data (m_connection, &xcb_dri2_id); + + xcb_xfixes_query_version_cookie_t xfixes_query_cookie = xcb_xfixes_query_version(m_connection, + XCB_XFIXES_MAJOR_VERSION, + XCB_XFIXES_MINOR_VERSION); + + xcb_dri2_query_version_cookie_t dri2_query_cookie = xcb_dri2_query_version (m_connection, + XCB_DRI2_MAJOR_VERSION, + XCB_DRI2_MINOR_VERSION); + + xcb_xfixes_query_version_reply_t *xfixes_query = xcb_xfixes_query_version_reply (m_connection, + xfixes_query_cookie, &error); + if (!xfixes_query || error || xfixes_query->major_version < 2) { + delete error; + delete xfixes_query; + return false; + } + delete xfixes_query; + + 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 diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index 6a472a7..3aa36db 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -236,11 +236,19 @@ public: void *xlib_display() const { return m_xlib_display; } #endif +#ifdef XCB_USE_DRI2 + bool hasSupportForDri2() const; + void *egl_display() const { return m_egl_display; } +#endif + private slots: void eventDispatcher(); private: void initializeAllAtoms(); +#ifdef XCB_USE_DRI2 + void initializeDri2(); +#endif xcb_connection_t *m_connection; const xcb_setup_t *m_setup; @@ -254,11 +262,24 @@ private: QXcbKeyboard *m_keyboard; -#ifdef XCB_USE_XLIB +#if defined(XCB_USE_XLIB) void *m_xlib_display; #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; + void *m_egl_display; +#endif + }; #define DISPLAY_FROM_XCB(object) ((Display *)(object->connection()->xlib_display())) +#ifdef XCB_USE_DRI2 +#define EGL_DISPLAY_FROM_XCB(object) ((EGLDisplay)(object->connection()->egl_display())) +#endif //endifXCB_USE_DRI2 + #endif diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp index 6dc5a5c..7f6d4c5 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.cpp +++ b/src/plugins/platforms/xcb/qxcbintegration.cpp @@ -136,7 +136,12 @@ bool QXcbIntegration::hasOpenGL() const wasEglInitialized = eglInitialize(disp,&major,&minor); } return wasEglInitialized; -#else - return false; +#elif defined(XCB_USE_DRI2) + if (m_connection->hasSupportForDri2()) { + return true; + } #endif + return false; +} + } diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index bb856f2..005aa0e 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -43,6 +43,9 @@ #include "qxcbconnection.h" #include "qxcbscreen.h" +#ifdef XCB_USE_DRI2 +#include "qdri2context.h" +#endif #include <xcb/xcb_icccm.h> @@ -137,7 +140,7 @@ QXcbWindow::QXcbWindow(QWidget *tlw) qFatal("no window!"); } } else -#endif +#endif //defined(XCB_USE_GLX) || defined(XCB_USE_EGL) { m_window = xcb_generate_id(xcb_connection()); @@ -437,6 +440,12 @@ QPlatformGLContext *QXcbWindow::glContext() const QXcbWindow *that = const_cast<QXcbWindow *>(this); that->m_context = new QEGLPlatformContext(display, config, eglContextAttrs.data(), eglSurface, EGL_OPENGL_ES_API); } +#elif defined(XCB_USE_DRI2) + if (!m_context) { + QXcbWindow *that = const_cast<QXcbWindow *>(this); + that->m_context = new QDri2Context(that); + } + #endif return m_context; } @@ -474,6 +483,11 @@ void QXcbWindow::handleConfigureNotifyEvent(const xcb_configure_notify_event_t * QPlatformWindow::setGeometry(rect); QWindowSystemInterface::handleGeometryChange(widget(), rect); + +#if XCB_USE_DRI2 + if (m_context) + static_cast<QDri2Context *>(m_context)->resize(rect.size()); +#endif } static Qt::MouseButtons translateMouseButtons(int s) diff --git a/src/plugins/platforms/xcb/xcb.pro b/src/plugins/platforms/xcb/xcb.pro index b5850e4..9a3f735 100644 --- a/src/plugins/platforms/xcb/xcb.pro +++ b/src/plugins/platforms/xcb/xcb.pro @@ -23,26 +23,36 @@ HEADERS = \ contains(QT_CONFIG, opengl) { QT += opengl - DEFINES += XCB_USE_XLIB - LIBS += -lX11 -lX11-xcb - - contains(QT_CONFIG, opengles2) { - DEFINES += XCB_USE_EGL - HEADERS += \ - ../eglconvenience/qeglplatformcontext.h \ - ../eglconvenience/qeglconvenience.h \ - ../eglconvenience/qxlibeglintegration.h - - SOURCES += \ - ../eglconvenience/qeglplatformcontext.cpp \ - ../eglconvenience/qeglconvenience.cpp \ - ../eglconvenience/qxlibeglintegration.cpp - - LIBS += -lEGL + + DEFINES += XCB_USE_DRI2 + contains(DEFINES, XCB_USE_DRI2) { + LIBS += -lxcb-dri2 -lxcb-xfixes -lEGL + + HEADERS += qdri2context.h + SOURCES += qdri2context.cpp + } else { - DEFINES += XCB_USE_GLX - HEADERS += qglxintegration.h - SOURCES += qglxintegration.cpp + DEFINES += XCB_USE_XLIB + LIBS += -lX11 -lX11-xcb + + contains(QT_CONFIG, opengles2) { + DEFINES += XCB_USE_EGL + HEADERS += \ + ../eglconvenience/qeglplatformcontext.h \ + ../eglconvenience/qeglconvenience.h \ + ../eglconvenience/qxlibeglintegration.h + + SOURCES += \ + ../eglconvenience/qeglplatformcontext.cpp \ + ../eglconvenience/qeglconvenience.cpp \ + ../eglconvenience/qxlibeglintegration.cpp + + LIBS += -lEGL + } else { + DEFINES += XCB_USE_GLX + HEADERS += qglxintegration.h + SOURCES += qglxintegration.cpp + } } } -- cgit v0.12 From 044e06d5a40e3f8d5ae6861341b1f5449e3c0afe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= <jorgen.lind@nokia.com> Date: Tue, 1 Mar 2011 10:09:18 +0100 Subject: Lighthouse: Add a native interface. Sometimes in applications code you need to get the native handles for displays, egl displays etc. The native interface class is how you access these handles. Reviewed-by: paul --- src/gui/kernel/kernel.pri | 6 ++- src/gui/kernel/qplatformintegration_qpa.cpp | 5 ++ src/gui/kernel/qplatformintegration_qpa.h | 4 +- src/gui/kernel/qplatformnativeinterface_qpa.cpp | 70 +++++++++++++++++++++++++ src/gui/kernel/qplatformnativeinterface_qpa.h | 68 ++++++++++++++++++++++++ 5 files changed, 150 insertions(+), 3 deletions(-) create mode 100644 src/gui/kernel/qplatformnativeinterface_qpa.cpp create mode 100644 src/gui/kernel/qplatformnativeinterface_qpa.h diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri index 0ff3d88..32fa3d3 100644 --- a/src/gui/kernel/kernel.pri +++ b/src/gui/kernel/kernel.pri @@ -223,7 +223,8 @@ qpa { kernel/qdesktopwidget_qpa_p.h \ kernel/qplatformeventloopintegration_qpa.h \ kernel/qplatformcursor_qpa.h \ - kernel/qplatformclipboard_qpa.h + kernel/qplatformclipboard_qpa.h \ + kernel/qplatformnativeinterface_qpa.h SOURCES += \ kernel/qapplication_qpa.cpp \ @@ -246,7 +247,8 @@ qpa { kernel/qplatformeventloopintegration_qpa.cpp \ kernel/qplatformglcontext_qpa.cpp \ kernel/qplatformcursor_qpa.cpp \ - kernel/qplatformclipboard_qpa.cpp + kernel/qplatformclipboard_qpa.cpp \ + kernel/qplatformnativeinterface_qpa.cpp contains(QT_CONFIG, glib) { SOURCES += \ diff --git a/src/gui/kernel/qplatformintegration_qpa.cpp b/src/gui/kernel/qplatformintegration_qpa.cpp index 0cac57d..9f62538 100644 --- a/src/gui/kernel/qplatformintegration_qpa.cpp +++ b/src/gui/kernel/qplatformintegration_qpa.cpp @@ -111,6 +111,11 @@ QPlatformClipboard *QPlatformIntegration::clipboard() const return clipboard; } +QPlatformNativeInterface * QPlatformIntegration::nativeInterface() const +{ + return 0; +} + /*! \class QPlatformIntegration \since 4.8 diff --git a/src/gui/kernel/qplatformintegration_qpa.h b/src/gui/kernel/qplatformintegration_qpa.h index 7050245..f01d462 100644 --- a/src/gui/kernel/qplatformintegration_qpa.h +++ b/src/gui/kernel/qplatformintegration_qpa.h @@ -60,6 +60,7 @@ class QWidget; class QPlatformEventLoopIntegration; class QPlatformFontDatabase; class QPlatformClipboard; +class QPlatformNativeInterface; class Q_GUI_EXPORT QPlatformIntegration { @@ -89,7 +90,8 @@ public: //jl:XXX should it be hasGLContext and do we need it at all? virtual bool hasOpenGL() const; - +// Access native handles. The window handle is allready available from Wid; + virtual QPlatformNativeInterface *nativeInterface() const; }; QT_END_NAMESPACE diff --git a/src/gui/kernel/qplatformnativeinterface_qpa.cpp b/src/gui/kernel/qplatformnativeinterface_qpa.cpp new file mode 100644 index 0000000..67406cd --- /dev/null +++ b/src/gui/kernel/qplatformnativeinterface_qpa.cpp @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qplatformnativeinterface_qpa.h" + +QT_BEGIN_NAMESPACE + +void * QPlatformNativeInterface::nativeDisplayForWidget(QWidget *widget) +{ + Q_UNUSED(widget); + return 0; +} + +void * QPlatformNativeInterface::eglDisplayForWidget(QWidget *widget) +{ + Q_UNUSED(widget); + return 0; +} + +void * QPlatformNativeInterface::nativeConnectionForWidget(QWidget *widget) +{ + Q_UNUSED(widget); + return 0; +} + +void * QPlatformNativeInterface::nativeScreenForWidget(QWidget *widget) +{ + Q_UNUSED(widget); + return 0; +} + +QT_END_NAMESPACE diff --git a/src/gui/kernel/qplatformnativeinterface_qpa.h b/src/gui/kernel/qplatformnativeinterface_qpa.h new file mode 100644 index 0000000..d576297 --- /dev/null +++ b/src/gui/kernel/qplatformnativeinterface_qpa.h @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPLATFORMNATIVEINTERFACE_QPA_H +#define QPLATFORMNATIVEINTERFACE_QPA_H + +#include <QtGui/qwindowdefs.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QWidget; + +class Q_GUI_EXPORT QPlatformNativeInterface +{ +public: + virtual void *nativeDisplayForWidget(QWidget *widget); + virtual void *eglDisplayForWidget(QWidget *widget); + virtual void *nativeConnectionForWidget(QWidget *widget); + virtual void *nativeScreenForWidget(QWidget *widget); +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QPLATFORMNATIVEINTERFACE_QPA_H -- cgit v0.12 From 4d803a3493d15fdf7374689b774d02662dbd43b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= <jorgen.lind@nokia.com> Date: Tue, 1 Mar 2011 10:11:36 +0100 Subject: Lighthouse: Xcb, implement native interface --- src/plugins/platforms/xcb/qxcbintegration.cpp | 5 +++ src/plugins/platforms/xcb/qxcbintegration.h | 3 ++ src/plugins/platforms/xcb/qxcbnativeinterface.cpp | 50 +++++++++++++++++++++++ src/plugins/platforms/xcb/qxcbnativeinterface.h | 20 +++++++++ src/plugins/platforms/xcb/xcb.pro | 6 ++- 5 files changed, 82 insertions(+), 2 deletions(-) create mode 100644 src/plugins/platforms/xcb/qxcbnativeinterface.cpp create mode 100644 src/plugins/platforms/xcb/qxcbnativeinterface.h diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp index 7f6d4c5..b6df550 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.cpp +++ b/src/plugins/platforms/xcb/qxcbintegration.cpp @@ -44,6 +44,7 @@ #include "qxcbscreen.h" #include "qxcbwindow.h" #include "qxcbwindowsurface.h" +#include "qxcbnativeinterface.h" #include <xcb/xcb.h> @@ -64,6 +65,7 @@ QXcbIntegration::QXcbIntegration() m_screens << screen; m_fontDatabase = new QGenericUnixFontDatabase(); + m_nativeInterface = new QXcbNativeInterface; } QXcbIntegration::~QXcbIntegration() @@ -144,4 +146,7 @@ bool QXcbIntegration::hasOpenGL() const return false; } +QPlatformNativeInterface * QXcbIntegration::nativeInterface() const +{ + return m_nativeInterface; } diff --git a/src/plugins/platforms/xcb/qxcbintegration.h b/src/plugins/platforms/xcb/qxcbintegration.h index 80f70fb..eab6949 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.h +++ b/src/plugins/platforms/xcb/qxcbintegration.h @@ -67,11 +67,14 @@ public: QPlatformFontDatabase *fontDatabase() const; bool hasOpenGL() const; + QPlatformNativeInterface *nativeInterface()const; + private: QList<QPlatformScreen *> m_screens; QXcbConnection *m_connection; QPlatformFontDatabase *m_fontDatabase; + QPlatformNativeInterface *m_nativeInterface; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp new file mode 100644 index 0000000..859b6c3 --- /dev/null +++ b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp @@ -0,0 +1,50 @@ +#include "qxcbnativeinterface.h" + +#include "qxcbscreen.h" + +#include <QtGui/private/qapplication_p.h> + +QXcbScreen *QXcbNativeInterface::screenForWidget(QWidget *widget) +{ + QXcbScreen *screen; + if (widget) { + screen = static_cast<QXcbScreen *>(QPlatformScreen::platformScreenForWidget(widget)); + }else { + screen = static_cast<QXcbScreen *>(QApplicationPrivate::platformIntegration()->screens()[0]); + } + return screen; +} + +void * QXcbNativeInterface::nativeDisplayForWidget(QWidget *widget) +{ +#if defined(XCB_USE_XLIB) + QXcbScreen *screen = screenForWidget(widget); + return screen->connection()->xlib_display(); +#else + Q_UNUSED(widget); + return 0; +#endif +} + +void * QXcbNativeInterface::eglDisplayForWidget(QWidget *widget) +{ +#if defined(XCB_USE_DRI2) + QXcbScreen *screen = screenForWidget(widget); + return screen->connection()->egl_display(); +#else + Q_UNUSED(widget) + return 0; +#endif +} + +void * QXcbNativeInterface::nativeConnectionForWidget(QWidget *widget) +{ + QXcbScreen *screen = screenForWidget(widget); + return screen->xcb_connection(); +} + +void * QXcbNativeInterface::nativeScreenForWidget(QWidget *widget) +{ + QXcbScreen *screen = screenForWidget(widget); + return screen->screen(); +} diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.h b/src/plugins/platforms/xcb/qxcbnativeinterface.h new file mode 100644 index 0000000..fb48833 --- /dev/null +++ b/src/plugins/platforms/xcb/qxcbnativeinterface.h @@ -0,0 +1,20 @@ +#ifndef QXCBNATIVEINTERFACE_H +#define QXCBNATIVEINTERFACE_H + +#include <QtGui/QPlatformNativeInterface> + +class QWidget; +class QXcbScreen; + +class QXcbNativeInterface : public QPlatformNativeInterface +{ + void * nativeDisplayForWidget(QWidget *widget); + void * eglDisplayForWidget(QWidget *widget); + void * nativeConnectionForWidget(QWidget *widget); + void * nativeScreenForWidget(QWidget *widget); + +private: + static QXcbScreen *screenForWidget(QWidget *widget); +}; + +#endif // QXCBNATIVEINTERFACE_H diff --git a/src/plugins/platforms/xcb/xcb.pro b/src/plugins/platforms/xcb/xcb.pro index 9a3f735..2237cee 100644 --- a/src/plugins/platforms/xcb/xcb.pro +++ b/src/plugins/platforms/xcb/xcb.pro @@ -10,7 +10,8 @@ SOURCES = \ qxcbscreen.cpp \ qxcbwindow.cpp \ qxcbwindowsurface.cpp \ - main.cpp + main.cpp \ + qxcbnativeinterface.cpp HEADERS = \ qxcbconnection.h \ @@ -19,7 +20,8 @@ HEADERS = \ qxcbobject.h \ qxcbscreen.h \ qxcbwindow.h \ - qxcbwindowsurface.h + qxcbwindowsurface.h \ + qxcbnativeinterface.h contains(QT_CONFIG, opengl) { QT += opengl -- cgit v0.12 From b67d537070e88feb708d13b46cd1468e2c0dc0e8 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta <gunnar.sletta@nokia.com> Date: Thu, 10 Feb 2011 16:10:57 +1000 Subject: Allow using QPixmap outside GUI thread when using raster --- src/gui/image/qpixmap.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index f896572..b276180 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -98,12 +98,21 @@ static bool qt_pixmap_thread_test() qFatal("QPixmap: Must construct a QApplication before a QPaintDevice"); return false; } -#ifndef Q_WS_WIN - if (!QApplication::testAttribute(Qt::AA_X11InitThreads) && qApp->thread() != QThread::currentThread()) { - qWarning("QPixmap: It is not safe to use pixmaps outside the GUI thread"); - return false; - } + + if (qApp->thread() != QThread::currentThread()) { + bool fail = false; +#if defined (Q_WS_X11) + if (!QApplication::testAttribute(Qt::AA_X11InitThreads)) + fail = true; +#else + if (QApplicationPrivate::graphics_system_name != QLatin1String("raster")) + fail = true; #endif + if (fail) { + qWarning("QPixmap: It is not safe to use pixmaps outside the GUI thread"); + return false; + } + } return true; } -- cgit v0.12 From 327f4c8e3894ccf34e7629a8a840f92bd3ff8dd0 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta <gunnar.sletta@nokia.com> Date: Mon, 21 Feb 2011 12:57:34 +0100 Subject: added capabilites to QPlatformIntegration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Jørgen Lind --- src/gui/image/qpixmap.cpp | 9 +++++++++ src/gui/kernel/qplatformintegration_qpa.cpp | 10 ++++++++++ src/gui/kernel/qplatformintegration_qpa.h | 6 ++++++ src/plugins/platforms/cocoa/qcocoaintegration.h | 1 + src/plugins/platforms/cocoa/qcocoaintegration.mm | 12 +++++++++++- src/plugins/platforms/eglfs/qeglfsintegration.cpp | 8 ++++++++ src/plugins/platforms/eglfs/qeglfsintegration.h | 1 + src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp | 9 +++++++++ src/plugins/platforms/linuxfb/qlinuxfbintegration.h | 2 ++ src/plugins/platforms/minimal/qminimalintegration.cpp | 8 ++++++++ src/plugins/platforms/minimal/qminimalintegration.h | 2 ++ src/plugins/platforms/openkode/qopenkodeintegration.cpp | 9 +++++++++ src/plugins/platforms/openkode/qopenkodeintegration.h | 2 ++ src/plugins/platforms/vnc/qvncintegration.cpp | 9 +++++++++ src/plugins/platforms/vnc/qvncintegration.h | 1 + src/plugins/platforms/wayland/qwaylandintegration.cpp | 10 ++++++++-- src/plugins/platforms/wayland/qwaylandintegration.h | 1 + 17 files changed, 97 insertions(+), 3 deletions(-) diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index b276180..90d9a90 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -71,6 +71,10 @@ # include "private/qpixmap_mac_p.h" #endif +#ifdef Q_WS_QPA +# include "qplatformintegration_qpa.h" +#endif + #if defined(Q_WS_X11) # include "qx11info_x11.h" # include <private/qt_x11_p.h> @@ -104,6 +108,11 @@ static bool qt_pixmap_thread_test() #if defined (Q_WS_X11) if (!QApplication::testAttribute(Qt::AA_X11InitThreads)) fail = true; +#elif defined (Q_WS_QPA) + if (!QApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::ThreadedPixmaps)) { + printf("Lighthouse plugin does not support threaded pixmaps!\n"); + fail = true; + } #else if (QApplicationPrivate::graphics_system_name != QLatin1String("raster")) fail = true; diff --git a/src/gui/kernel/qplatformintegration_qpa.cpp b/src/gui/kernel/qplatformintegration_qpa.cpp index 9f62538..f43e141 100644 --- a/src/gui/kernel/qplatformintegration_qpa.cpp +++ b/src/gui/kernel/qplatformintegration_qpa.cpp @@ -216,4 +216,14 @@ QPlatformNativeInterface * QPlatformIntegration::nativeInterface() const QRect(x,y,width,height). */ + +bool QPlatformIntegration::hasCapability(Capability cap) const +{ + return false; +} + + + + + QT_END_NAMESPACE diff --git a/src/gui/kernel/qplatformintegration_qpa.h b/src/gui/kernel/qplatformintegration_qpa.h index f01d462..1d69af4 100644 --- a/src/gui/kernel/qplatformintegration_qpa.h +++ b/src/gui/kernel/qplatformintegration_qpa.h @@ -65,8 +65,14 @@ class QPlatformNativeInterface; class Q_GUI_EXPORT QPlatformIntegration { public: + enum Capability { + ThreadedPixmaps = 1, + }; + virtual ~QPlatformIntegration() { } + virtual bool hasCapability(Capability cap) const; + // GraphicsSystem functions virtual QPixmapData *createPixmapData(QPixmapData::PixelType type) const = 0; virtual QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId = 0) const = 0; diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.h b/src/plugins/platforms/cocoa/qcocoaintegration.h index e7ecf2a..b94bcb9 100644 --- a/src/plugins/platforms/cocoa/qcocoaintegration.h +++ b/src/plugins/platforms/cocoa/qcocoaintegration.h @@ -75,6 +75,7 @@ public: QCocoaIntegration(); ~QCocoaIntegration(); + bool hasCapability(QPlatformIntegration::Capability cap) const; QPixmapData *createPixmapData(QPixmapData::PixelType type) const; QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId = 0) const; QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const; diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm index 28e894c..a75b88c 100644 --- a/src/plugins/platforms/cocoa/qcocoaintegration.mm +++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm @@ -94,9 +94,19 @@ QCocoaIntegration::~QCocoaIntegration() delete mPool; } +bool QCocoaIntegration::hasCapability(QPlatformIntegration::Capability cap) const +{ + switch (cap) { + case ThreadedPixmaps: return true; + default: return QPlatformIntegration::hasCapability(cap); + } +} + + + QPixmapData *QCocoaIntegration::createPixmapData(QPixmapData::PixelType type) const { - return new QRasterPixmapData(type); + return new QRasterPixmapData(type); } QPlatformWindow *QCocoaIntegration::createPlatformWindow(QWidget *widget, WId winId) const diff --git a/src/plugins/platforms/eglfs/qeglfsintegration.cpp b/src/plugins/platforms/eglfs/qeglfsintegration.cpp index a48fde8..257490d 100644 --- a/src/plugins/platforms/eglfs/qeglfsintegration.cpp +++ b/src/plugins/platforms/eglfs/qeglfsintegration.cpp @@ -65,6 +65,14 @@ QEglFSIntegration::QEglFSIntegration() #endif } +bool QEglFSIntegration::hasCapability(QPlatformIntegration::Capability cap) const +{ + switch (cap) { + case ThreadedPixmaps: return true; + default: return QPlatformIntegration::hasCapability(cap); + } +} + QPixmapData *QEglFSIntegration::createPixmapData(QPixmapData::PixelType type) const { #ifdef QEGL_EXTRA_DEBUG diff --git a/src/plugins/platforms/eglfs/qeglfsintegration.h b/src/plugins/platforms/eglfs/qeglfsintegration.h index 0342539..ce231f2 100644 --- a/src/plugins/platforms/eglfs/qeglfsintegration.h +++ b/src/plugins/platforms/eglfs/qeglfsintegration.h @@ -56,6 +56,7 @@ class QEglFSIntegration : public QPlatformIntegration public: QEglFSIntegration(); + bool hasCapability(QPlatformIntegration::Capability cap) const; QPixmapData *createPixmapData(QPixmapData::PixelType type) const; QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId) const; QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const; diff --git a/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp b/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp index aa1d401..af5a337 100644 --- a/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp +++ b/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp @@ -782,6 +782,15 @@ void QLinuxFbIntegration::blank(bool on) d_ptr->blank = on; } +bool QLinuxFbIntegration::hasCapability(QPlatformIntegration::Capability cap) const +{ + switch (cap) { + case ThreadedPixmaps: return true; + default: return QPlatformIntegration::hasCapability(cap); + } +} + + QPixmapData *QLinuxFbIntegration::createPixmapData(QPixmapData::PixelType type) const { return new QRasterPixmapData(type); diff --git a/src/plugins/platforms/linuxfb/qlinuxfbintegration.h b/src/plugins/platforms/linuxfb/qlinuxfbintegration.h index e93495c..ddf8873 100644 --- a/src/plugins/platforms/linuxfb/qlinuxfbintegration.h +++ b/src/plugins/platforms/linuxfb/qlinuxfbintegration.h @@ -77,6 +77,8 @@ public: QLinuxFbIntegration(); ~QLinuxFbIntegration(); + bool hasCapability(QPlatformIntegration::Capability cap) const; + QPixmapData *createPixmapData(QPixmapData::PixelType type) const; QPlatformWindow *createPlatformWindow(QWidget *widget, WId WinId) const; QWindowSurface *createWindowSurface(QWidget *widget, WId WinId) const; diff --git a/src/plugins/platforms/minimal/qminimalintegration.cpp b/src/plugins/platforms/minimal/qminimalintegration.cpp index c90e92e..0f11edd 100644 --- a/src/plugins/platforms/minimal/qminimalintegration.cpp +++ b/src/plugins/platforms/minimal/qminimalintegration.cpp @@ -56,6 +56,14 @@ QMinimalIntegration::QMinimalIntegration() mScreens.append(mPrimaryScreen); } +bool QMinimalIntegration::hasCapability(QPlatformIntegration::Capability cap) const +{ + switch (cap) { + case ThreadedPixmaps: return true; + default: return QPlatformIntegration::hasCapability(cap); + } +} + QPixmapData *QMinimalIntegration::createPixmapData(QPixmapData::PixelType type) const { return new QRasterPixmapData(type); diff --git a/src/plugins/platforms/minimal/qminimalintegration.h b/src/plugins/platforms/minimal/qminimalintegration.h index 95b952e..aab6fe3 100644 --- a/src/plugins/platforms/minimal/qminimalintegration.h +++ b/src/plugins/platforms/minimal/qminimalintegration.h @@ -69,6 +69,8 @@ class QMinimalIntegration : public QPlatformIntegration public: QMinimalIntegration(); + bool hasCapability(QPlatformIntegration::Capability cap) const; + QPixmapData *createPixmapData(QPixmapData::PixelType type) const; QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId) const; QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const; diff --git a/src/plugins/platforms/openkode/qopenkodeintegration.cpp b/src/plugins/platforms/openkode/qopenkodeintegration.cpp index 763e69e..2d17f33 100644 --- a/src/plugins/platforms/openkode/qopenkodeintegration.cpp +++ b/src/plugins/platforms/openkode/qopenkodeintegration.cpp @@ -185,6 +185,15 @@ QOpenKODEIntegration::~QOpenKODEIntegration() delete mFontDb; } + +bool QOpenKODEIntegration::hasCapability(QPlatformIntegration::Capability cap) const +{ + switch (cap) { + case ThreadedPixmaps: return true; + default: return QPlatformIntegration::hasCapability(cap); + } +} + QPixmapData *QOpenKODEIntegration::createPixmapData(QPixmapData::PixelType type) const { return new QGLPixmapData(type); diff --git a/src/plugins/platforms/openkode/qopenkodeintegration.h b/src/plugins/platforms/openkode/qopenkodeintegration.h index a067491..2304f27 100644 --- a/src/plugins/platforms/openkode/qopenkodeintegration.h +++ b/src/plugins/platforms/openkode/qopenkodeintegration.h @@ -90,6 +90,8 @@ public: QOpenKODEIntegration(); ~QOpenKODEIntegration(); + bool hasCapability(QPlatformIntegration::Capability cap) const; + QPixmapData *createPixmapData(QPixmapData::PixelType type) const; QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId = 0) const; QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const; diff --git a/src/plugins/platforms/vnc/qvncintegration.cpp b/src/plugins/platforms/vnc/qvncintegration.cpp index b36ff33..56cbe4b 100644 --- a/src/plugins/platforms/vnc/qvncintegration.cpp +++ b/src/plugins/platforms/vnc/qvncintegration.cpp @@ -152,6 +152,15 @@ QVNCIntegration::QVNCIntegration(const QStringList& paramList) screen->setDirty(screenRect); } +bool QVNCIntegration::hasCapability(QPlatformIntegration::Capability cap) const +{ + switch (cap) { + case ThreadedPixmaps: return true; + default: return QPlatformIntegration::hasCapability(cap); + } +} + + QPixmapData *QVNCIntegration::createPixmapData(QPixmapData::PixelType type) const { return new QRasterPixmapData(type); diff --git a/src/plugins/platforms/vnc/qvncintegration.h b/src/plugins/platforms/vnc/qvncintegration.h index dfc0e6b..80338a1 100644 --- a/src/plugins/platforms/vnc/qvncintegration.h +++ b/src/plugins/platforms/vnc/qvncintegration.h @@ -81,6 +81,7 @@ class QVNCIntegration : public QPlatformIntegration public: QVNCIntegration(const QStringList& paramList); + bool hasCapability(QPlatformIntegration::Capability cap) const; QPixmapData *createPixmapData(QPixmapData::PixelType type) const; QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId) const; QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const; diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 7c0f69e..3383410 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -71,6 +71,14 @@ QWaylandIntegration::screens() const return mDisplay->screens(); } +bool QWaylandIntegration::hasCapability(QPlatformIntegration::Capability cap) const +{ + switch (cap) { + case ThreadedPixmaps: return true; + default: return QPlatformIntegration::hasCapability(cap); + } +} + QPixmapData *QWaylandIntegration::createPixmapData(QPixmapData::PixelType type) const { #ifdef QT_WAYLAND_GL_SUPPORT @@ -80,8 +88,6 @@ QPixmapData *QWaylandIntegration::createPixmapData(QPixmapData::PixelType type) return new QRasterPixmapData(type); } - - QPlatformWindow *QWaylandIntegration::createPlatformWindow(QWidget *widget, WId winId) const { Q_UNUSED(winId); diff --git a/src/plugins/platforms/wayland/qwaylandintegration.h b/src/plugins/platforms/wayland/qwaylandintegration.h index d707612..c3919ab 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.h +++ b/src/plugins/platforms/wayland/qwaylandintegration.h @@ -54,6 +54,7 @@ class QWaylandIntegration : public QPlatformIntegration public: QWaylandIntegration(bool useOpenGL = false); + bool hasCapability(QPlatformIntegration::Capability cap) const; QPixmapData *createPixmapData(QPixmapData::PixelType type) const; QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId) const; QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const; -- cgit v0.12 From adeec26e3bd67183e329cee4a0d1e8b7f6c454c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= <jorgen.lind@nokia.com> Date: Tue, 1 Mar 2011 12:32:24 +0100 Subject: Lighthouse: Native Interface, added graphicsDevice --- src/gui/kernel/qplatformnativeinterface_qpa.cpp | 14 ++++++++++---- src/gui/kernel/qplatformnativeinterface_qpa.h | 1 + 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/gui/kernel/qplatformnativeinterface_qpa.cpp b/src/gui/kernel/qplatformnativeinterface_qpa.cpp index 67406cd..8f128ee 100644 --- a/src/gui/kernel/qplatformnativeinterface_qpa.cpp +++ b/src/gui/kernel/qplatformnativeinterface_qpa.cpp @@ -43,25 +43,31 @@ QT_BEGIN_NAMESPACE -void * QPlatformNativeInterface::nativeDisplayForWidget(QWidget *widget) +void *QPlatformNativeInterface::nativeDisplayForWidget(QWidget *widget) { Q_UNUSED(widget); return 0; } -void * QPlatformNativeInterface::eglDisplayForWidget(QWidget *widget) +void *QPlatformNativeInterface::eglDisplayForWidget(QWidget *widget) { Q_UNUSED(widget); return 0; } -void * QPlatformNativeInterface::nativeConnectionForWidget(QWidget *widget) +void *QPlatformNativeInterface::nativeConnectionForWidget(QWidget *widget) { Q_UNUSED(widget); return 0; } -void * QPlatformNativeInterface::nativeScreenForWidget(QWidget *widget) +void *QPlatformNativeInterface::nativeScreenForWidget(QWidget *widget) +{ + Q_UNUSED(widget); + return 0; +} + +void *QPlatformNativeInterface::nativeGraphicsDeviceForWidget(QWidget *widget) { Q_UNUSED(widget); return 0; diff --git a/src/gui/kernel/qplatformnativeinterface_qpa.h b/src/gui/kernel/qplatformnativeinterface_qpa.h index d576297..80d6229 100644 --- a/src/gui/kernel/qplatformnativeinterface_qpa.h +++ b/src/gui/kernel/qplatformnativeinterface_qpa.h @@ -59,6 +59,7 @@ public: virtual void *eglDisplayForWidget(QWidget *widget); virtual void *nativeConnectionForWidget(QWidget *widget); virtual void *nativeScreenForWidget(QWidget *widget); + virtual void *nativeGraphicsDeviceForWidget(QWidget *widget); }; QT_END_NAMESPACE -- cgit v0.12 From 17a4f332f0d416af842145f0ebc7f2ebe7f33527 Mon Sep 17 00:00:00 2001 From: Chris Kawano <808christian@gmail.com> Date: Tue, 1 Mar 2011 13:12:37 +0100 Subject: Fix QTextStream::pos() causes buffer offset issues on large text files. When reading large files that are greater in size than the TEXTSTREAM_BUFFERSIZE buffer, calling pos() caused erroneous buffer positioning. The cause of this was QTextStreamPrivate::readBufferOffset value being updated, but QTextStreamPrivate::readConverterSavedStateOffset was not. Usually, if pos() is called, it is called multiple times. Since QTextStreamPrivate::readConverterSavedStateOffset was never reset, QTextStreamPrivate::readBufferOffset would accumulate the wrong position and QTextStreamPrivate::consume() will 'discard' the wrong number of bytes from the buffer. Task-number: QTBUG-9814 Merge-request: 2569 Reviewed-by: Olivier Goffart <olivier.goffart@nokia.com> --- src/corelib/io/qtextstream.cpp | 1 + tests/auto/qtextstream/tst_qtextstream.cpp | 36 ++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/src/corelib/io/qtextstream.cpp b/src/corelib/io/qtextstream.cpp index b630502..a5837cb 100644 --- a/src/corelib/io/qtextstream.cpp +++ b/src/corelib/io/qtextstream.cpp @@ -1264,6 +1264,7 @@ qint64 QTextStream::pos() const return qint64(-1); } thatd->readBufferOffset = oldReadBufferOffset; + thatd->readConverterSavedStateOffset = 0; // Return the device position. return d->device->pos(); diff --git a/tests/auto/qtextstream/tst_qtextstream.cpp b/tests/auto/qtextstream/tst_qtextstream.cpp index 99f2556..2d7c24d 100644 --- a/tests/auto/qtextstream/tst_qtextstream.cpp +++ b/tests/auto/qtextstream/tst_qtextstream.cpp @@ -208,6 +208,7 @@ private slots: void seek(); void pos(); void pos2(); + void pos3LargeFile(); void readStdin(); void readAllFromStdin(); void readLineFromStdin(); @@ -1502,6 +1503,41 @@ void tst_QTextStream::pos2() } // ------------------------------------------------------------------------------ +void tst_QTextStream::pos3LargeFile() +{ + { + QFile file(TestFileName); + file.open(QIODevice::WriteOnly | QIODevice::Text); + QTextStream out( &file ); + // NOTE: The unusual spacing is to ensure non-1-character whitespace. + QString lineString = " 0 1 2\t3 4\t \t5 6 7 8 9 \n"; + // Approximate 50kb text file + const int NbLines = (50*1024) / lineString.length() + 1; + for (int line = 0; line < NbLines; ++line) + out << lineString; + // File is automatically flushed and closed on destruction. + } + QFile file(TestFileName); + file.open(QIODevice::ReadOnly | QIODevice::Text); + QTextStream in( &file ); + const int testValues[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + int value; + while (true) { + in.pos(); + for ( int i = 0; i < 10; ++i ) { + in >> value; + if (in.status() != QTextStream::Ok) { + // End case, i == 0 && eof reached. + QCOMPARE(i, 0); + QCOMPARE(in.status(), QTextStream::ReadPastEnd); + return; + } + QCOMPARE(value, testValues[i]); + } + } +} + +// ------------------------------------------------------------------------------ void tst_QTextStream::readStdin() { #if defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN) -- cgit v0.12 From 124cc3c0dfe18c2e5027a0eee430ac03b48807c0 Mon Sep 17 00:00:00 2001 From: Olivier Goffart <olivier.goffart@nokia.com> Date: Tue, 1 Mar 2011 14:10:08 +0100 Subject: Wrap qPrintable inside QString QString() is a no-op if string is already a QString And it fixes the compilation if other types are use that do not have toLocal8Bit such as QStringBuilder. WebKit trunk has an instance of such usage. Reviewed-by: Joao --- src/corelib/global/qglobal.h | 2 +- tests/auto/qstringbuilder1/stringbuilder.cpp | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 67ccf4d..2ddb91d 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -1667,7 +1667,7 @@ inline void qUnused(T &x) { (void)x; } #endif #ifndef qPrintable -# define qPrintable(string) (string).toLocal8Bit().constData() +# define qPrintable(string) QString(string).toLocal8Bit().constData() #endif Q_CORE_EXPORT void qDebug(const char *, ...) /* print debug message */ diff --git a/tests/auto/qstringbuilder1/stringbuilder.cpp b/tests/auto/qstringbuilder1/stringbuilder.cpp index b4f6334..1ea7347 100644 --- a/tests/auto/qstringbuilder1/stringbuilder.cpp +++ b/tests/auto/qstringbuilder1/stringbuilder.cpp @@ -110,4 +110,6 @@ void runScenario() r = string P ba; QCOMPARE(r, r2); #endif + + QCOMPARE(QByteArray(qPrintable(string P string)), QByteArray(string.toLatin1() + string.toLatin1())); } -- cgit v0.12 From ccb623188369be7bf4b991ff8a1f81d27137984c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= <jorgen.lind@nokia.com> Date: Tue, 1 Mar 2011 13:58:53 +0100 Subject: Lighthouse: Make Native Interface slightly more agile We realised that we couldn't keep on adding virtual functions for all specific needs so we made one virtual function which takes a string parameter which enables the implementation to return anything. It seems a bit odd to have a virtual function as an accessor for a class with only 1 virtual function. But the idea is that we don't want a void * in the core lighthouse api. Also, the implementations should decleare more functions to do the heavy lifting of getting the handles Reviewed-by: paul --- src/gui/kernel/qplatformnativeinterface_qpa.cpp | 27 ++----------------------- src/gui/kernel/qplatformnativeinterface_qpa.h | 6 +----- 2 files changed, 3 insertions(+), 30 deletions(-) diff --git a/src/gui/kernel/qplatformnativeinterface_qpa.cpp b/src/gui/kernel/qplatformnativeinterface_qpa.cpp index 8f128ee..ace4a7b 100644 --- a/src/gui/kernel/qplatformnativeinterface_qpa.cpp +++ b/src/gui/kernel/qplatformnativeinterface_qpa.cpp @@ -43,32 +43,9 @@ QT_BEGIN_NAMESPACE -void *QPlatformNativeInterface::nativeDisplayForWidget(QWidget *widget) -{ - Q_UNUSED(widget); - return 0; -} - -void *QPlatformNativeInterface::eglDisplayForWidget(QWidget *widget) -{ - Q_UNUSED(widget); - return 0; -} - -void *QPlatformNativeInterface::nativeConnectionForWidget(QWidget *widget) -{ - Q_UNUSED(widget); - return 0; -} - -void *QPlatformNativeInterface::nativeScreenForWidget(QWidget *widget) -{ - Q_UNUSED(widget); - return 0; -} - -void *QPlatformNativeInterface::nativeGraphicsDeviceForWidget(QWidget *widget) +void *QPlatformNativeInterface::nativeResourceForWidget(const QByteArray &resource, QWidget *widget) { + Q_UNUSED(resource); Q_UNUSED(widget); return 0; } diff --git a/src/gui/kernel/qplatformnativeinterface_qpa.h b/src/gui/kernel/qplatformnativeinterface_qpa.h index 80d6229..5ea2c13 100644 --- a/src/gui/kernel/qplatformnativeinterface_qpa.h +++ b/src/gui/kernel/qplatformnativeinterface_qpa.h @@ -55,11 +55,7 @@ class QWidget; class Q_GUI_EXPORT QPlatformNativeInterface { public: - virtual void *nativeDisplayForWidget(QWidget *widget); - virtual void *eglDisplayForWidget(QWidget *widget); - virtual void *nativeConnectionForWidget(QWidget *widget); - virtual void *nativeScreenForWidget(QWidget *widget); - virtual void *nativeGraphicsDeviceForWidget(QWidget *widget); + virtual void *nativeResourceForWidget(const QByteArray &resource, QWidget *widget); }; QT_END_NAMESPACE -- cgit v0.12 From 53741ff1983a9d0085658b96743b125daaa5e680 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= <jorgen.lind@nokia.com> Date: Tue, 1 Mar 2011 14:01:43 +0100 Subject: Lighthouse: Implement the new Native Interface api in the xcb plugin --- src/plugins/platforms/xcb/qxcbconnection.cpp | 5 +- src/plugins/platforms/xcb/qxcbconnection.h | 2 + src/plugins/platforms/xcb/qxcbnativeinterface.cpp | 74 ++++++++++++++++++++--- src/plugins/platforms/xcb/qxcbnativeinterface.h | 22 +++++-- 4 files changed, 87 insertions(+), 16 deletions(-) diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index 06e4d13..a2f985e 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -447,13 +447,14 @@ void QXcbConnection::initializeDri2() return; } - QString dri2DeviceName = QString::fromLocal8Bit(xcb_dri2_connect_device_name (connect), + m_dri2_device_name = QByteArray(xcb_dri2_connect_device_name (connect), xcb_dri2_connect_device_name_length (connect)); delete connect; - int fd = open(qPrintable(dri2DeviceName), O_RDWR); + int fd = open(m_dri2_device_name.constData(), O_RDWR); if (fd < 0) { qDebug() << "InitializeDri2: Could'nt open device << dri2DeviceName"; + m_dri2_device_name = QByteArray(); return; } diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index 3aa36db..8a0f3d7 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -239,6 +239,7 @@ public: #ifdef XCB_USE_DRI2 bool hasSupportForDri2() const; void *egl_display() const { return m_egl_display; } + QByteArray dri2DeviceName() const { return m_dri2_device_name; } #endif private slots: @@ -272,6 +273,7 @@ private: bool m_dri2_support_probed; bool m_has_support_for_dri2; void *m_egl_display; + QByteArray m_dri2_device_name; #endif }; diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp index 859b6c3..f379580 100644 --- a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp +++ b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp @@ -3,8 +3,52 @@ #include "qxcbscreen.h" #include <QtGui/private/qapplication_p.h> +#include <QtCore/QMap> -QXcbScreen *QXcbNativeInterface::screenForWidget(QWidget *widget) +class QXcbResourceMap : public QMap<QByteArray, QXcbNativeInterface::ResourceType> +{ +public: + QXcbResourceMap() + :QMap<QByteArray, QXcbNativeInterface::ResourceType>() + { + insert("display",QXcbNativeInterface::Display); + insert("egldisplay",QXcbNativeInterface::EglDisplay); + insert("connection",QXcbNativeInterface::Connection); + insert("screen",QXcbNativeInterface::Screen); + insert("graphicsdevice",QXcbNativeInterface::GraphicsDevice); + } +}; + +Q_GLOBAL_STATIC(QXcbResourceMap, qXcbResourceMap) + +void *QXcbNativeInterface::nativeResourceForWidget(const QByteArray &resourceString, QWidget *widget) +{ + QByteArray lowerCaseResource = resourceString.toLower(); + ResourceType resource = qXcbResourceMap()->value(lowerCaseResource); + void *result = 0; + switch(resource) { + case Display: + result = displayForWidget(widget); + break; + case EglDisplay: + result = eglDisplayForWidget(widget); + break; + case Connection: + result = connectionForWidget(widget); + break; + case Screen: + result = qPlatformScreenForWidget(widget); + break; + case GraphicsDevice: + result = graphicsDeviceForWidget(widget); + break; + default: + result = 0; + } + return result; +} + +QXcbScreen *QXcbNativeInterface::qPlatformScreenForWidget(QWidget *widget) { QXcbScreen *screen; if (widget) { @@ -15,10 +59,10 @@ QXcbScreen *QXcbNativeInterface::screenForWidget(QWidget *widget) return screen; } -void * QXcbNativeInterface::nativeDisplayForWidget(QWidget *widget) +void *QXcbNativeInterface::displayForWidget(QWidget *widget) { #if defined(XCB_USE_XLIB) - QXcbScreen *screen = screenForWidget(widget); + QXcbScreen *screen = qPlatformScreenForWidget(widget); return screen->connection()->xlib_display(); #else Q_UNUSED(widget); @@ -26,10 +70,10 @@ void * QXcbNativeInterface::nativeDisplayForWidget(QWidget *widget) #endif } -void * QXcbNativeInterface::eglDisplayForWidget(QWidget *widget) +void *QXcbNativeInterface::eglDisplayForWidget(QWidget *widget) { #if defined(XCB_USE_DRI2) - QXcbScreen *screen = screenForWidget(widget); + QXcbScreen *screen = qPlatformScreenForWidget(widget); return screen->connection()->egl_display(); #else Q_UNUSED(widget) @@ -37,14 +81,26 @@ void * QXcbNativeInterface::eglDisplayForWidget(QWidget *widget) #endif } -void * QXcbNativeInterface::nativeConnectionForWidget(QWidget *widget) +void *QXcbNativeInterface::connectionForWidget(QWidget *widget) { - QXcbScreen *screen = screenForWidget(widget); + QXcbScreen *screen = qPlatformScreenForWidget(widget); return screen->xcb_connection(); } -void * QXcbNativeInterface::nativeScreenForWidget(QWidget *widget) +void *QXcbNativeInterface::screenForWidget(QWidget *widget) { - QXcbScreen *screen = screenForWidget(widget); + QXcbScreen *screen = qPlatformScreenForWidget(widget); return screen->screen(); } + +void *QXcbNativeInterface::graphicsDeviceForWidget(QWidget *widget) +{ +#if defined(XCB_USE_DRI2) + QXcbScreen *screen = qPlatformScreenForWidget(widget); + QByteArray deviceName = screen->connection()->dri2DeviceName(); + return deviceName.data(); +#else + return 0; +#endif + +} diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.h b/src/plugins/platforms/xcb/qxcbnativeinterface.h index fb48833..9815381 100644 --- a/src/plugins/platforms/xcb/qxcbnativeinterface.h +++ b/src/plugins/platforms/xcb/qxcbnativeinterface.h @@ -8,13 +8,25 @@ class QXcbScreen; class QXcbNativeInterface : public QPlatformNativeInterface { - void * nativeDisplayForWidget(QWidget *widget); - void * eglDisplayForWidget(QWidget *widget); - void * nativeConnectionForWidget(QWidget *widget); - void * nativeScreenForWidget(QWidget *widget); +public: + enum ResourceType { + Display, + EglDisplay, + Connection, + Screen, + GraphicsDevice + }; + + void *nativeResourceForWidget(const QByteArray &resourceString, QWidget *widget); + + void *displayForWidget(QWidget *widget); + void *eglDisplayForWidget(QWidget *widget); + void *connectionForWidget(QWidget *widget); + void *screenForWidget(QWidget *widget); + void *graphicsDeviceForWidget(QWidget *widget); private: - static QXcbScreen *screenForWidget(QWidget *widget); + static QXcbScreen *qPlatformScreenForWidget(QWidget *widget); }; #endif // QXCBNATIVEINTERFACE_H -- cgit v0.12 From 12573a8860d10cf023246e9d3d7f5739d83aabe4 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete <paul.tvete@nokia.com> Date: Wed, 2 Mar 2011 09:50:10 +0100 Subject: Build fixes for the Wayland plugin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add qmake.conf variables, and use the generic font plugin. Reviewed-by: Jørgen --- mkspecs/common/linux.conf | 5 +++++ src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 15 ++++++++++++--- src/plugins/platforms/wayland/qwaylandintegration.cpp | 4 ++-- src/plugins/platforms/wayland/wayland.pro | 10 ++++++---- 4 files changed, 25 insertions(+), 9 deletions(-) diff --git a/mkspecs/common/linux.conf b/mkspecs/common/linux.conf index e443be1..283cf83 100644 --- a/mkspecs/common/linux.conf +++ b/mkspecs/common/linux.conf @@ -35,6 +35,11 @@ QMAKE_LIBS_OPENGL_ES2 = -lGLESv2 QMAKE_LIBS_OPENVG = -lOpenVG QMAKE_LIBS_THREAD = -lpthread +QMAKE_CFLAGS_WAYLAND = +QMAKE_INCDIR_WAYLAND = +QMAKE_LIBS_WAYLAND = -lwayland-client -lxkbcommon +QMAKE_DEFINES_WAYLAND = + QMAKE_MOC = $$[QT_INSTALL_BINS]/moc QMAKE_UIC = $$[QT_INSTALL_BINS]/uic diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 102a213..47f9c91 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -52,8 +52,11 @@ #include <unistd.h> #include <fcntl.h> + +#ifndef QT_NO_WAYLAND_XKB #include <X11/extensions/XKBcommon.h> #include <X11/keysym.h> +#endif QWaylandInputDevice::QWaylandInputDevice(struct wl_display *display, uint32_t id) @@ -63,13 +66,13 @@ QWaylandInputDevice::QWaylandInputDevice(struct wl_display *display, , mKeyboardFocus(NULL) , mButtons(0) { - struct xkb_rule_names names; - wl_input_device_add_listener(mInputDevice, &inputDeviceListener, this); wl_input_device_set_user_data(mInputDevice, this); +#ifndef QT_NO_WAYLAND_XKB + struct xkb_rule_names names; names.rules = "evdev"; names.model = "pc105"; names.layout = "us"; @@ -77,6 +80,7 @@ QWaylandInputDevice::QWaylandInputDevice(struct wl_display *display, names.options = ""; mXkb = xkb_compile_keymap_from_rules(&names); +#endif } void QWaylandInputDevice::inputHandleMotion(void *data, @@ -135,6 +139,7 @@ void QWaylandInputDevice::inputHandleButton(void *data, inputDevice->mButtons); } +#ifndef QT_NO_WAYLAND_XKB static Qt::KeyboardModifiers translateModifiers(int s) { const uchar qt_alt_mask = XKB_COMMON_MOD1_MASK; @@ -201,11 +206,13 @@ static uint32_t translateKey(uint32_t sym, char *string, size_t size) return toupper(sym); } } +#endif void QWaylandInputDevice::inputHandleKey(void *data, struct wl_input_device *input_device, uint32_t time, uint32_t key, uint32_t state) { +#ifndef QT_NO_WAYLAND_XKB Q_UNUSED(input_device); QWaylandInputDevice *inputDevice = (QWaylandInputDevice *) data; QWaylandWindow *window = inputDevice->mKeyboardFocus; @@ -244,6 +251,7 @@ void QWaylandInputDevice::inputHandleKey(void *data, inputDevice->mModifiers, QString::fromLatin1(s)); } +#endif } void QWaylandInputDevice::inputHandlePointerFocus(void *data, @@ -280,6 +288,7 @@ void QWaylandInputDevice::inputHandleKeyboardFocus(void *data, struct wl_surface *surface, struct wl_array *keys) { +#ifndef QT_NO_WAYLAND_XKB Q_UNUSED(input_device); Q_UNUSED(time); QWaylandInputDevice *inputDevice = (QWaylandInputDevice *) data; @@ -303,7 +312,7 @@ void QWaylandInputDevice::inputHandleKeyboardFocus(void *data, inputDevice->mKeyboardFocus = NULL; QWindowSystemInterface::handleWindowActivated(0); } - +#endif } const struct wl_input_device_listener QWaylandInputDevice::inputDeviceListener = { diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 3383410..267a037 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -47,7 +47,7 @@ #include "qwaylandshmwindow.h" #include "qwaylandeglwindow.h" -#include "qfontconfigdatabase.h" +#include "qgenericunixfontdatabase.h" #include <QtGui/QWindowSystemInterface> #include <QtGui/QPlatformCursor> @@ -59,7 +59,7 @@ #endif QWaylandIntegration::QWaylandIntegration(bool useOpenGL) - : mFontDb(new QFontconfigDatabase()) + : mFontDb(new QGenericUnixFontDatabase()) , mDisplay(new QWaylandDisplay()) , mUseOpenGL(useOpenGL) { diff --git a/src/plugins/platforms/wayland/wayland.pro b/src/plugins/platforms/wayland/wayland.pro index 9faa59b..face860 100644 --- a/src/plugins/platforms/wayland/wayland.pro +++ b/src/plugins/platforms/wayland/wayland.pro @@ -4,6 +4,7 @@ include(../../qpluginbase.pri) QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforms DEFINES += Q_PLATFORM_WAYLAND +DEFINES += $$QMAKE_DEFINES_WAYLAND SOURCES = main.cpp \ qwaylandintegration.cpp \ @@ -27,8 +28,9 @@ HEADERS = qwaylandintegration.h \ qwaylandeglwindow.h \ qwaylandshmwindow.h -LIBS += -lwayland-client -LIBS += -lxkbcommon +INCLUDEPATH += $$QMAKE_INCDIR_WAYLAND +LIBS += $$QMAKE_LIBS_WAYLAND +QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_WAYLAND contains(QT_CONFIG, opengles2) { QT += opengl @@ -45,12 +47,12 @@ contains(QT_CONFIG, opengles2) { DEFINES += QT_WAYLAND_GL_SUPPORT } -unix { +unix:isEmpty(QMAKE_INCDIR_WAYLAND) { CONFIG += link_pkgconfig PKGCONFIG += libdrm } -include (../fontdatabases/fontconfig/fontconfig.pri) +include (../fontdatabases/genericunix/genericunix.pri) target.path += $$[QT_INSTALL_PLUGINS]/platforms INSTALLS += target -- cgit v0.12 From f37a9b29a4113e57da1756019935dd14d1c722bf Mon Sep 17 00:00:00 2001 From: Olivier Goffart <olivier.goffart@nokia.com> Date: Wed, 2 Mar 2011 11:18:36 +0100 Subject: Fix qstringbuilder test. when QT_NO_CAST_FROM_ASCII is not defined, the string is assigned to an string with more than ascii. So if the codecForLocale is not latin1, it would fail. --- tests/auto/qstringbuilder1/stringbuilder.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/auto/qstringbuilder1/stringbuilder.cpp b/tests/auto/qstringbuilder1/stringbuilder.cpp index 1ea7347..6faff35 100644 --- a/tests/auto/qstringbuilder1/stringbuilder.cpp +++ b/tests/auto/qstringbuilder1/stringbuilder.cpp @@ -111,5 +111,6 @@ void runScenario() QCOMPARE(r, r2); #endif + string = QString::fromLatin1(LITERAL); QCOMPARE(QByteArray(qPrintable(string P string)), QByteArray(string.toLatin1() + string.toLatin1())); } -- cgit v0.12 From 571946141df5428c08221381b2f18302e004825f Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete <paul.tvete@nokia.com> Date: Wed, 2 Mar 2011 15:31:28 +0100 Subject: Compile with glx MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Jørgen --- src/plugins/platforms/xlib/qglxintegration.cpp | 29 +++++++++++++------------ src/plugins/platforms/xlib/qxlibintegration.cpp | 2 +- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/src/plugins/platforms/xlib/qglxintegration.cpp b/src/plugins/platforms/xlib/qglxintegration.cpp index 5ba4f0d..89cd768 100644 --- a/src/plugins/platforms/xlib/qglxintegration.cpp +++ b/src/plugins/platforms/xlib/qglxintegration.cpp @@ -45,6 +45,7 @@ #include "qxlibwindow.h" #include "qxlibscreen.h" +#include "qxlibdisplay.h" #if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2) #include <X11/Xlib.h> @@ -122,7 +123,7 @@ GLXFBConfig QGLXContext::findConfig(const QXlibScreen *screen, const QPlatformWi QVector<int> spec = buildSpec(reducedFormat); int confcount = 0; GLXFBConfig *configs; - configs = glXChooseFBConfig(screen->display(),screen->xScreenNumber(),spec.constData(),&confcount); + configs = glXChooseFBConfig(screen->display()->nativeDisplay(),screen->xScreenNumber(),spec.constData(),&confcount); if (confcount) { for (int i = 0; i < confcount; i++) { @@ -130,7 +131,7 @@ GLXFBConfig QGLXContext::findConfig(const QXlibScreen *screen, const QPlatformWi // Make sure we try to get an ARGB visual if the format asked for an alpha: if (reducedFormat.alpha()) { int alphaSize; - glXGetFBConfigAttrib(screen->display(),configs[i],GLX_ALPHA_SIZE,&alphaSize); + glXGetFBConfigAttrib(screen->display()->nativeDisplay(),configs[i],GLX_ALPHA_SIZE,&alphaSize); if (alphaSize > 0) break; } else { @@ -152,7 +153,7 @@ GLXFBConfig QGLXContext::findConfig(const QXlibScreen *screen, const QPlatformWi XVisualInfo *QGLXContext::findVisualInfo(const QXlibScreen *screen, const QPlatformWindowFormat &format) { GLXFBConfig config = QGLXContext::findConfig(screen,format); - XVisualInfo *visualInfo = glXGetVisualFromFBConfig(screen->display(),config); + XVisualInfo *visualInfo = glXGetVisualFromFBConfig(screen->display()->nativeDisplay(),config); return visualInfo; } @@ -264,8 +265,8 @@ QGLXContext::QGLXContext(Window window, QXlibScreen *screen, const QPlatformWind shareGlxContext = static_cast<const QGLXContext*>(sharePlatformContext)->glxContext(); GLXFBConfig config = findConfig(screen,format); - m_context = glXCreateNewContext(screen->display(),config,GLX_RGBA_TYPE,shareGlxContext,TRUE); - m_windowFormat = QGLXContext::platformWindowFromGLXFBConfig(screen->display(),config,m_context); + m_context = glXCreateNewContext(screen->display()->nativeDisplay(),config,GLX_RGBA_TYPE,shareGlxContext,TRUE); + m_windowFormat = QGLXContext::platformWindowFromGLXFBConfig(screen->display()->nativeDisplay(),config,m_context); #ifdef MYX11_DEBUG qDebug() << "QGLXGLContext::create context" << m_context; @@ -282,7 +283,7 @@ QGLXContext::~QGLXContext() { if (m_context) { qDebug("Destroying GLX context 0x%p", m_context); - glXDestroyContext(m_screen->display(), m_context); + glXDestroyContext(m_screen->display()->nativeDisplay(), m_context); } } @@ -297,15 +298,15 @@ void QGLXContext::createDefaultSharedContex(QXlibScreen *screen) GLXContext context; GLXFBConfig config = findConfig(screen,format); if (config) { - XVisualInfo *visualInfo = glXGetVisualFromFBConfig(screen->display(),config); - Colormap cmap = XCreateColormap(screen->display(),screen->rootWindow(),visualInfo->visual,AllocNone); + XVisualInfo *visualInfo = glXGetVisualFromFBConfig(screen->display()->nativeDisplay(),config); + Colormap cmap = XCreateColormap(screen->display()->nativeDisplay(),screen->rootWindow(),visualInfo->visual,AllocNone); XSetWindowAttributes a; a.colormap = cmap; - Window sharedWindow = XCreateWindow(screen->display(), screen->rootWindow(),x, y, w, h, + Window sharedWindow = XCreateWindow(screen->display()->nativeDisplay(), screen->rootWindow(),x, y, w, h, 0, visualInfo->depth, InputOutput, visualInfo->visual, CWColormap, &a); - context = glXCreateNewContext(screen->display(),config,GLX_RGBA_TYPE,0,TRUE); + context = glXCreateNewContext(screen->display()->nativeDisplay(),config,GLX_RGBA_TYPE,0,TRUE); QPlatformGLContext *sharedContext = new QGLXContext(screen,sharedWindow,context); QPlatformGLContext::setDefaultSharedContext(sharedContext); } else { @@ -319,18 +320,18 @@ void QGLXContext::makeCurrent() #ifdef MYX11_DEBUG qDebug("QGLXGLContext::makeCurrent(window=0x%x, ctx=0x%x)", m_drawable, m_context); #endif - glXMakeCurrent(m_screen->display(), m_drawable, m_context); + glXMakeCurrent(m_screen->display()->nativeDisplay(), m_drawable, m_context); } void QGLXContext::doneCurrent() { QPlatformGLContext::doneCurrent(); - glXMakeCurrent(m_screen->display(), 0, 0); + glXMakeCurrent(m_screen->display()->nativeDisplay(), 0, 0); } void QGLXContext::swapBuffers() { - glXSwapBuffers(m_screen->display(), m_drawable); + glXSwapBuffers(m_screen->display()->nativeDisplay(), m_drawable); } void* QGLXContext::getProcAddress(const QString& procName) @@ -342,7 +343,7 @@ void* QGLXContext::getProcAddress(const QString& procName) if (resolved && !glXGetProcAddressARB) return 0; if (!glXGetProcAddressARB) { - QList<QByteArray> glxExt = QByteArray(glXGetClientString(m_screen->display(), GLX_EXTENSIONS)).split(' '); + QList<QByteArray> glxExt = QByteArray(glXGetClientString(m_screen->display()->nativeDisplay(), GLX_EXTENSIONS)).split(' '); if (glxExt.contains("GLX_ARB_get_proc_address")) { #if defined(Q_OS_LINUX) || defined(Q_OS_BSD4) void *handle = dlopen(NULL, RTLD_LAZY); diff --git a/src/plugins/platforms/xlib/qxlibintegration.cpp b/src/plugins/platforms/xlib/qxlibintegration.cpp index e3ebb13..c207eb2 100644 --- a/src/plugins/platforms/xlib/qxlibintegration.cpp +++ b/src/plugins/platforms/xlib/qxlibintegration.cpp @@ -135,7 +135,7 @@ bool QXlibIntegration::hasOpenGL() const #if !defined(QT_NO_OPENGL) #if !defined(QT_OPENGL_ES_2) QXlibScreen *screen = static_cast<const QXlibScreen *>(mScreens.at(0)); - return glXQueryExtension(screen->display(), 0, 0) != 0; + return glXQueryExtension(screen->display()->nativeDisplay(), 0, 0) != 0; #else static bool eglHasbeenInitialized = false; static bool wasEglInitialized = false; -- cgit v0.12 From 4ec935b3e738f79d76b708773c49471cffc46f65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= <jorgen.lind@nokia.com> Date: Wed, 2 Mar 2011 16:15:47 +0100 Subject: Lighthouse: Make wayland configure check use pkg-config Reviewed-by: paul --- config.tests/qpa/wayland/wayland.pro | 6 ++---- configure | 19 ++++++++++++++++--- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/config.tests/qpa/wayland/wayland.pro b/config.tests/qpa/wayland/wayland.pro index 266e4d6..0c2b899 100644 --- a/config.tests/qpa/wayland/wayland.pro +++ b/config.tests/qpa/wayland/wayland.pro @@ -1,6 +1,4 @@ SOURCES = wayland.cpp CONFIG -= qt - -QMAKE_CXXFLAGS += $$QT_CFLAGS_WAYLAND -LIBS += $$QT_LIBS_WAYLAND -lfreetype -lfontconfig -lwayland-client - +INCLUDEPATH += $$QMAKE_INCDIR_WAYLAND +LIBS += $$QMAKE_LIBS_WAYLAND diff --git a/configure b/configure index b95baab..664af92 100755 --- a/configure +++ b/configure @@ -6171,10 +6171,23 @@ if [ "$PLATFORM_QPA" = "yes" ]; then CFG_LIBFREETYPE=system fi - if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/qpa/wayland "Wayland" $L_FLAGS $I_FLAGS $l_FLAGS; then - QT_CONFIG="$QT_CONFIG wayland" - fi + fi + + if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists wayland-client 2>/dev/null; then + QMAKE_CFLAGS_WAYLAND=`$PKG_CONFIG --cflags wayland-client 2>/dev/null` + QMAKE_LIBS_WAYLAND=`$PKG_CONFIG --libs wayland-client 2>/dev/null` + QMAKE_INCDIR_WAYLAND=`$PKG_CONFIG --variable=includedir wayland-client 2>/dev/null` + fi + + # QMake variables set here override those in the mkspec. Therefore we only set the variables here if they are not zero. + if [ -n "$QMAKE_CFLAGS_WAYLAND" ] || [ -n "$QMAKE_LIBS_WAYLAND" ]; then + QMakeVar set QMAKE_CFLAGS_WAYLAND "$QMAKE_CFLAGS_WAYLAND" + QMakeVar set QMAKE_INCDIR_WAYLAND "$QMAKE_INCDIR_WAYLAND" + QMakeVar set QMAKE_LIBS_WAYLAND "$QMAKE_LIBS_WAYLAND" + fi + if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/qpa/wayland "Wayland" $L_FLAGS $I_FLAGS $l_FLAGS $QMAKE_CFLAGS_WAYLAND -I$QMAKE_INCDIR_WAYLAND $QMAKE_LIBS_WAYLAND; then + QT_CONFIG="$QT_CONFIG wayland" fi if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/mac/coreservices "CoreServices" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then -- cgit v0.12 From 2b9660c4cb264dc7b8abe4c753e31c48a50b92af Mon Sep 17 00:00:00 2001 From: Markus Goetz <Markus.Goetz@nokia.com> Date: Thu, 3 Mar 2011 11:47:48 +0100 Subject: SSL tests: Be more verbose in on-demand cert test --- .../tst_qsslsocket_onDemandCertificates_member.cpp | 2 +- .../tst_qsslsocket_onDemandCertificates_static.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/auto/qsslsocket_onDemandCertificates_member/tst_qsslsocket_onDemandCertificates_member.cpp b/tests/auto/qsslsocket_onDemandCertificates_member/tst_qsslsocket_onDemandCertificates_member.cpp index 2a1358d..abdd550 100644 --- a/tests/auto/qsslsocket_onDemandCertificates_member/tst_qsslsocket_onDemandCertificates_member.cpp +++ b/tests/auto/qsslsocket_onDemandCertificates_member/tst_qsslsocket_onDemandCertificates_member.cpp @@ -209,7 +209,7 @@ void tst_QSslSocket_onDemandCertificates_member::onDemandRootCertLoadingMemberMe QSslSocketPtr socket = newSocket(); this->socket = socket; socket->connectToHostEncrypted(host, 443); - QVERIFY(socket->waitForEncrypted()); + QVERIFY2(socket->waitForEncrypted(), qPrintable(socket->errorString())); // not using any root certs again -> should not work QSslSocketPtr socket3 = newSocket(); diff --git a/tests/auto/qsslsocket_onDemandCertificates_static/tst_qsslsocket_onDemandCertificates_static.cpp b/tests/auto/qsslsocket_onDemandCertificates_static/tst_qsslsocket_onDemandCertificates_static.cpp index 8259977..5003b5c 100644 --- a/tests/auto/qsslsocket_onDemandCertificates_static/tst_qsslsocket_onDemandCertificates_static.cpp +++ b/tests/auto/qsslsocket_onDemandCertificates_static/tst_qsslsocket_onDemandCertificates_static.cpp @@ -210,7 +210,7 @@ void tst_QSslSocket_onDemandCertificates_static::onDemandRootCertLoadingStaticMe QSslSocketPtr socket2 = newSocket(); this->socket = socket2; socket2->connectToHostEncrypted(host, 443); - QVERIFY(socket2->waitForEncrypted()); + QVERIFY2(socket2->waitForEncrypted(), qPrintable(socket2->errorString())); // not using any root certs again -> should not work QSslSocket::setDefaultCaCertificates(QList<QSslCertificate>()); -- cgit v0.12 From 61dfa74bb542f495eb5ff25e3f91b9065eb1cfdd Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko <denis.dzyubenko@nokia.com> Date: Mon, 21 Feb 2011 15:35:03 +0100 Subject: Do not handle posted events in QSplashScreen. When QSplashScreen waits for the window to be fully shown, we shouldn't re-enter the event loop by processing posted events. Reviewed-by: axis Reviewed-by: Olivier Goffart --- src/gui/kernel/qwidget_x11.cpp | 10 ++++++++-- src/gui/widgets/qsplashscreen.cpp | 4 ++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/gui/kernel/qwidget_x11.cpp b/src/gui/kernel/qwidget_x11.cpp index 4bff5ac..c6753fc 100644 --- a/src/gui/kernel/qwidget_x11.cpp +++ b/src/gui/kernel/qwidget_x11.cpp @@ -346,7 +346,7 @@ Q_GUI_EXPORT void qt_x11_enforce_cursor(QWidget * w) qt_x11_enforce_cursor(w, false); } -Q_GUI_EXPORT void qt_x11_wait_for_window_manager(QWidget* w) +void qt_x11_wait_for_window_manager(QWidget *w, bool sendPostedEvents) { if (!w || (!w->isWindow() && !w->internalWinId())) return; @@ -361,7 +361,8 @@ Q_GUI_EXPORT void qt_x11_wait_for_window_manager(QWidget* w) WId winid = w->internalWinId(); // first deliver events that are already in the local queue - QApplication::sendPostedEvents(); + if (sendPostedEvents) + QApplication::sendPostedEvents(); // the normal sequence is: // ... ConfigureNotify ... ReparentNotify ... MapNotify ... Expose @@ -396,6 +397,11 @@ Q_GUI_EXPORT void qt_x11_wait_for_window_manager(QWidget* w) } while(1); } +Q_GUI_EXPORT void qt_x11_wait_for_window_manager(QWidget *w) +{ + qt_x11_wait_for_window_manager(w, true); +} + void qt_change_net_wm_state(const QWidget* w, bool set, Atom one, Atom two = 0) { if (!w->isVisible()) // not managed by the window manager diff --git a/src/gui/widgets/qsplashscreen.cpp b/src/gui/widgets/qsplashscreen.cpp index 75280cb..9c486bf 100644 --- a/src/gui/widgets/qsplashscreen.cpp +++ b/src/gui/widgets/qsplashscreen.cpp @@ -223,8 +223,8 @@ void QSplashScreen::finish(QWidget *mainWin) { if (mainWin) { #if defined(Q_WS_X11) - extern void qt_x11_wait_for_window_manager(QWidget *mainWin); - qt_x11_wait_for_window_manager(mainWin); + extern void qt_x11_wait_for_window_manager(QWidget *mainWin, bool); + qt_x11_wait_for_window_manager(mainWin, false); #endif } close(); -- cgit v0.12 From 47e8fc1c237adb9742140f834226e9da9f60c2f2 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko <denis.dzyubenko@nokia.com> Date: Wed, 2 Mar 2011 17:21:12 +0100 Subject: Improve handling QByteArray with QStringBuilder Instead of relying on the old behavior of the deprecated QString(QByteArray) constructor which stops copying the byte array at the null termination character if there is one embedded in the array, we copy the whole provided QByteArray object into the QString when QStringBuilder is used. Reviewed-by: Harald Fernengel --- src/corelib/tools/qstringbuilder.cpp | 4 ++-- src/corelib/tools/qstringbuilder.h | 5 +++-- tests/auto/qstringbuilder1/stringbuilder.cpp | 26 +++++++++++++++++++++++++- 3 files changed, 30 insertions(+), 5 deletions(-) diff --git a/src/corelib/tools/qstringbuilder.cpp b/src/corelib/tools/qstringbuilder.cpp index 53368eb..7d75de7 100644 --- a/src/corelib/tools/qstringbuilder.cpp +++ b/src/corelib/tools/qstringbuilder.cpp @@ -150,8 +150,8 @@ QT_BEGIN_NAMESPACE void QAbstractConcatenable::convertFromAscii(const char *a, int len, QChar *&out) { #ifndef QT_NO_TEXTCODEC - if (QString::codecForCStrings) { - QString tmp = QString::fromAscii(a); + if (QString::codecForCStrings && len) { + QString tmp = QString::fromAscii(a, len > 0 ? len - 1 : -1); memcpy(out, reinterpret_cast<const char *>(tmp.constData()), sizeof(QChar) * tmp.size()); out += tmp.length(); return; diff --git a/src/corelib/tools/qstringbuilder.h b/src/corelib/tools/qstringbuilder.h index 8d9537c..d230d67 100644 --- a/src/corelib/tools/qstringbuilder.h +++ b/src/corelib/tools/qstringbuilder.h @@ -270,10 +270,11 @@ template <> struct QConcatenable<QByteArray> : private QAbstractConcatenable { typedef QByteArray type; enum { ExactSize = false }; - static int size(const QByteArray &ba) { return qstrnlen(ba.constData(), ba.size()); } + static int size(const QByteArray &ba) { return ba.size(); } static inline void appendTo(const QByteArray &ba, QChar *&out) { - QAbstractConcatenable::convertFromAscii(ba.constData(), -1, out); + // adding 1 because convertFromAscii expects the size including the null-termination + QAbstractConcatenable::convertFromAscii(ba.constData(), ba.size() + 1, out); } }; #endif diff --git a/tests/auto/qstringbuilder1/stringbuilder.cpp b/tests/auto/qstringbuilder1/stringbuilder.cpp index 6faff35..f3c0ea9 100644 --- a/tests/auto/qstringbuilder1/stringbuilder.cpp +++ b/tests/auto/qstringbuilder1/stringbuilder.cpp @@ -40,9 +40,13 @@ ****************************************************************************/ #define LITERAL "some literal" +#define LITERAL_LEN (sizeof(LITERAL)-1) +#define LITERAL_EXTRA "some literal" "EXTRA" // "some literal", but replacing all vocals by their umlauted UTF-8 string :) #define UTF8_LITERAL "s\xc3\xb6m\xc3\xab l\xc3\xaft\xc3\xabr\xc3\xa4l" +#define UTF8_LITERAL_LEN (sizeof(UTF8_LITERAL)-1) +#define UTF8_LITERAL_EXTRA "s\xc3\xb6m\xc3\xab l\xc3\xaft\xc3\xabr\xc3\xa4l" "EXTRA" //fix for gcc4.0: if the operator+ does not exist without QT_USE_FAST_OPERATOR_PLUS @@ -65,7 +69,6 @@ void runScenario() QLatin1Char achar('c'); QString r2(QLatin1String(LITERAL LITERAL)); QString r; - QByteArray ba(LITERAL); r = l1literal Q l1literal; QCOMPARE(r, r2); @@ -86,6 +89,15 @@ void runScenario() QCOMPARE(r, r2); r = LITERAL P string; QCOMPARE(r, r2); + + QByteArray ba = QByteArray(LITERAL); + r = ba P string; + QCOMPARE(r, r2); + r = string P ba; + QCOMPARE(r, r2); + + static const char badata[] = LITERAL_EXTRA; + ba = QByteArray::fromRawData(badata, LITERAL_LEN); r = ba P string; QCOMPARE(r, r2); r = string P ba; @@ -109,6 +121,18 @@ void runScenario() QCOMPARE(r, r2); r = string P ba; QCOMPARE(r, r2); + + ba = QByteArray::fromRawData(UTF8_LITERAL_EXTRA, UTF8_LITERAL_LEN); + r = ba P string; + QCOMPARE(r, r2); + r = string P ba; + QCOMPARE(r, r2); + + ba = QByteArray(); // empty + r = ba P string; + QCOMPARE(r, string); + r = string P ba; + QCOMPARE(r, string); #endif string = QString::fromLatin1(LITERAL); -- cgit v0.12 From d9f95d7c2635d99ede9ae5a4218b4a34808badf7 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko <denis.dzyubenko@nokia.com> Date: Thu, 3 Mar 2011 10:53:27 +0100 Subject: Fixed documentation for QByteArray The data returned by constData() will not be null-terminated if the QByteArray was created from an existing raw data with QByteArray::fromRawData(). Reviewed-by: Oswald Buddenhagen --- src/corelib/tools/qbytearray.cpp | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp index b281c1b..4799abd 100644 --- a/src/corelib/tools/qbytearray.cpp +++ b/src/corelib/tools/qbytearray.cpp @@ -687,12 +687,12 @@ QByteArray::Data QByteArray::shared_empty = { Q_BASIC_ATOMIC_INITIALIZER(1), values. To set all the bytes to a particular value, call fill(). To obtain a pointer to the actual character data, call data() or - constData(). These functions return a pointer to the beginning of - the data. The pointer is guaranteed to remain valid until a - non-const function is called on the QByteArray. It is also - guaranteed that the data ends with a '\\0' byte. This '\\0' byte - is automatically provided by QByteArray and is not counted in - size(). + constData(). These functions return a pointer to the beginning of the data. + The pointer is guaranteed to remain valid until a non-const function is + called on the QByteArray. It is also guaranteed that the data ends with a + '\\0' byte unless the QByteArray was created from a \l{fromRawData()}{raw + data}. This '\\0' byte is automatically provided by QByteArray and is not + counted in size(). QByteArray provides the following basic functions for modifying the byte data: append(), prepend(), insert(), replace(), and @@ -925,11 +925,13 @@ QByteArray &QByteArray::operator=(const char *str) Returns the number of bytes in this byte array. - The last byte in the byte array is at position size() - 1. In - addition, QByteArray ensures that the byte at position size() is - always '\\0', so that you can use the return value of data() and - constData() as arguments to functions that expect '\\0'-terminated - strings. + The last byte in the byte array is at position size() - 1. In addition, + QByteArray ensures that the byte at position size() is always '\\0', so + that you can use the return value of data() and constData() as arguments to + functions that expect '\\0'-terminated strings. If the QByteArray object + was created from a \l{fromRawData()}{raw data} that didn't include the + trailing null-termination character then QByteArray doesn't add it + automaticall unless the \l{deep copy} is created. Example: \snippet doc/src/snippets/code/src_corelib_tools_qbytearray.cpp 6 @@ -1060,10 +1062,11 @@ QByteArray &QByteArray::operator=(const char *str) /*! \fn const char *QByteArray::constData() const - Returns a pointer to the data stored in the byte array. The - pointer can be used to access the bytes that compose the array. - The data is '\\0'-terminated. The pointer remains valid as long - as the byte array isn't reallocated or destroyed. + Returns a pointer to the data stored in the byte array. The pointer can be + used to access the bytes that compose the array. The data is + '\\0'-terminated unless the QByteArray object was created from raw data. + The pointer remains valid as long as the byte array isn't reallocated or + destroyed. This function is mostly useful to pass a byte array to a function that accepts a \c{const char *}. @@ -1072,7 +1075,7 @@ QByteArray &QByteArray::operator=(const char *str) but most functions that take \c{char *} arguments assume that the data ends at the first '\\0' they encounter. - \sa data(), operator[]() + \sa data(), operator[](), fromRawData() */ /*! \fn void QByteArray::detach() -- cgit v0.12 From b2544e10f4b575b41ff91ad72d2d7186ac3109e5 Mon Sep 17 00:00:00 2001 From: axis <qt-info@nokia.com> Date: Thu, 3 Mar 2011 16:01:45 +0100 Subject: Disable capabilities example for symbian-gcce due to a bug in elf2e32 Phonon exports template instantiations. These exports get weak symbol binding, which is correct according to the C++ ABI, but the problem is that elf2e32 has a bug which does not transfer the weak symbols correctly to the dso file. Therefore, the example will work if you have a prebuilt Qt version and use GCCE, but not if you build Qt from scratch using GCCE. For normal non-template symbols it is not a problem since they get global bindings. RVCT also produces global bindings. RevBy: Shane Kearns --- examples/phonon/phonon.pro | 3 +++ 1 file changed, 3 insertions(+) diff --git a/examples/phonon/phonon.pro b/examples/phonon/phonon.pro index aa6ac13..c6a0bff 100644 --- a/examples/phonon/phonon.pro +++ b/examples/phonon/phonon.pro @@ -3,6 +3,9 @@ CONFIG += ordered SUBDIRS = qmusicplayer \ capabilities +# Disable capabilities example for symbian-gcce due to a bug in elf2e32. +symbian-gcce:SUBDIRS -= capabilities + # install target.path = $$[QT_INSTALL_EXAMPLES]/phonon sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS phonon.pro README -- cgit v0.12 From d585a66127f9ea13a07675e87fe0066037643df5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= <jorgen.lind@nokia.com> Date: Thu, 3 Mar 2011 16:24:23 +0100 Subject: Lighthouse: Make xcb backen usable for anyone else again --- src/plugins/platforms/xcb/xcb.pro | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/xcb/xcb.pro b/src/plugins/platforms/xcb/xcb.pro index 2237cee..fdbe2cd 100644 --- a/src/plugins/platforms/xcb/xcb.pro +++ b/src/plugins/platforms/xcb/xcb.pro @@ -26,10 +26,13 @@ HEADERS = \ contains(QT_CONFIG, opengl) { QT += opengl - DEFINES += XCB_USE_DRI2 +# DEFINES += XCB_USE_DRI2 contains(DEFINES, XCB_USE_DRI2) { LIBS += -lxcb-dri2 -lxcb-xfixes -lEGL + CONFIG += link_pkgconfig + PKGCONFIG += libdrm + HEADERS += qdri2context.h SOURCES += qdri2context.cpp -- cgit v0.12 From 85b3a869fd69cfe14d05edd1fd17f913ba73dd52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= <jorgen.lind@nokia.com> Date: Thu, 3 Mar 2011 18:40:42 +0100 Subject: Lighthouse: Add xkbcommon to pkg-config configuration of wayland --- configure | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configure b/configure index 664af92..1922728 100755 --- a/configure +++ b/configure @@ -6173,10 +6173,10 @@ if [ "$PLATFORM_QPA" = "yes" ]; then fi - if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists wayland-client 2>/dev/null; then - QMAKE_CFLAGS_WAYLAND=`$PKG_CONFIG --cflags wayland-client 2>/dev/null` - QMAKE_LIBS_WAYLAND=`$PKG_CONFIG --libs wayland-client 2>/dev/null` - QMAKE_INCDIR_WAYLAND=`$PKG_CONFIG --variable=includedir wayland-client 2>/dev/null` + if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists wayland-client xkbcommon 2>/dev/null; then + QMAKE_CFLAGS_WAYLAND=`$PKG_CONFIG --cflags wayland-client xkbcommon 2>/dev/null` + QMAKE_LIBS_WAYLAND=`$PKG_CONFIG --libs wayland-client xkbcommon 2>/dev/null` + QMAKE_INCDIR_WAYLAND=`$PKG_CONFIG --variable=includedir wayland-client xkbcommon 2>/dev/null` fi # QMake variables set here override those in the mkspec. Therefore we only set the variables here if they are not zero. -- cgit v0.12 From 6daa12f8bcc16947a059747ebd985934163068eb Mon Sep 17 00:00:00 2001 From: Benjamin Franzke <benjaminfranzke@googlemail.com> Date: Thu, 3 Mar 2011 17:01:01 +0100 Subject: Lighthouse: Fix a block for wayland with gl support The initialial readable iteration, needs to be done before initializing egl, or it will be done inside egl. The readable iteration after initialzing egl would block forever otherwise. --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index c3e87a1..d0a0725 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -185,7 +185,13 @@ QWaylandDisplay::QWaylandDisplay(void) #ifdef QT_WAYLAND_GL_SUPPORT mNativeEglDisplay = wl_egl_display_create(mDisplay); +#else + mNativeEglDisplay = 0; +#endif + + eventDispatcher(); +#ifdef QT_WAYLAND_GL_SUPPORT mEglDisplay = eglGetDisplay((EGLNativeDisplayType)mNativeEglDisplay); if (mEglDisplay == NULL) { qWarning("EGL not available"); @@ -196,12 +202,9 @@ QWaylandDisplay::QWaylandDisplay(void) } } #else - mNativeEglDisplay = 0; mEglDisplay = 0; #endif - eventDispatcher(); - int fd = wl_display_get_fd(mDisplay, sourceUpdate, this); mReadNotifier = new QSocketNotifier(fd, QSocketNotifier::Read, this); connect(mReadNotifier, -- cgit v0.12 From 8dbe38632307d6cbe07f95db929e42ec01304324 Mon Sep 17 00:00:00 2001 From: con <qtc-committer@nokia.com> Date: Mon, 21 Feb 2011 08:30:06 +0100 Subject: don't print debug output --- src/gui/text/qplatformfontdatabase_qpa.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/text/qplatformfontdatabase_qpa.cpp b/src/gui/text/qplatformfontdatabase_qpa.cpp index afe762a..136130f 100644 --- a/src/gui/text/qplatformfontdatabase_qpa.cpp +++ b/src/gui/text/qplatformfontdatabase_qpa.cpp @@ -214,7 +214,7 @@ QFontEngine *QPlatformFontDatabase::fontEngine(const QFontDef &fontDef, QUnicode Q_UNUSED(handle); QByteArray *fileDataPtr = static_cast<QByteArray *>(handle); QFontEngineQPA *engine = new QFontEngineQPA(fontDef,*fileDataPtr); - qDebug() << fontDef.pixelSize << fontDef.weight << fontDef.style << fontDef.stretch << fontDef.styleHint << fontDef.styleStrategy << fontDef.family << script; + //qDebug() << fontDef.pixelSize << fontDef.weight << fontDef.style << fontDef.stretch << fontDef.styleHint << fontDef.styleStrategy << fontDef.family << script; return engine; } -- cgit v0.12 From 0be49f7c6719d3cfafb7e73a33dfd3f86aa8fb7c Mon Sep 17 00:00:00 2001 From: con <qtc-committer@nokia.com> Date: Wed, 16 Feb 2011 10:27:08 +0100 Subject: Do not explicitly process events before running event loop integration. Processing posted Qt events before the event loop integration is started may lead to the process being killed for taking too long time before the native event loop is running. Since event loop integrations are required to install a timer that does processEvents anyhow, the Qt events will be processed even without doing it explicitly in advance. --- src/gui/kernel/qeventdispatcher_qpa.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/gui/kernel/qeventdispatcher_qpa.cpp b/src/gui/kernel/qeventdispatcher_qpa.cpp index 519d2a6..f75cc0d 100644 --- a/src/gui/kernel/qeventdispatcher_qpa.cpp +++ b/src/gui/kernel/qeventdispatcher_qpa.cpp @@ -172,7 +172,6 @@ public: { if (qApp && (qApp->thread() == QThread::currentThread())) { m_isEventLoopIntegrationRunning = true; - QCoreApplication::processEvents(QEventLoop::WaitForMoreEvents); eventLoopIntegration->startEventLoop(); } } -- cgit v0.12 From 4c06d1956cc072f5bc52ed8128cf19d4cd7f8715 Mon Sep 17 00:00:00 2001 From: axis <qt-info@nokia.com> Date: Fri, 4 Mar 2011 11:29:18 +0100 Subject: Moved the default dependency targets to default_post.prf. The file that they were in would not be parsed if CONFIG -= qt, but it always needs to be parsed, otherwise apps that don't use Qt will fail the sis file creation. RevBy: Miikka Heikkinen Conflicts: mkspecs/features/symbian/default_post.prf --- mkspecs/features/symbian/default_post.prf | 47 +++++++++++++++++++++++++++++++ mkspecs/features/symbian/qt.prf | 47 ------------------------------- 2 files changed, 47 insertions(+), 47 deletions(-) diff --git a/mkspecs/features/symbian/default_post.prf b/mkspecs/features/symbian/default_post.prf index 126981e..a17e760 100644 --- a/mkspecs/features/symbian/default_post.prf +++ b/mkspecs/features/symbian/default_post.prf @@ -53,6 +53,53 @@ isEmpty(TARGET.UID2) { } } +# Allow .pro files to specify include path(s) to be prepended to the list. +# +# This allows the project to override the default ordering, whereby paths +# relative to $$QMAKE_INCDIR_QT always come first. This ordering can cause +# problems when both the epoc32/include tree and a Qt include directory +# contain a header of the same name - in this case, the Qt header is always +# included by virtue of its path appearing first in the SYSTEMINCLUDE +# directives in the generated MMP file. +# +# To work around this situation, the following line can be added to the .pro +# file: +# PREPEND_INCLUDEPATH = /epoc32/include +# +INCLUDEPATH = $$PREPEND_INCLUDEPATH $$INCLUDEPATH + +# Add dependency to Qt package to all other projects besides Qt libs. +# Note: Qt libs package with full capabilities has UID3 of 0x2001E61C, +# while self-signed version typically has temporary UID3 of 0xE001E61C. +contains(CONFIG, qt):!contains(TARGET.UID3, 0x2001E61C):!contains(TARGET.UID3, 0xE001E61C):isEmpty(QT_LIBINFIX) { + qt_pkg_name = Qt + pkg_depends_qt += \ + "; Default dependency to Qt libraries" \ + "(0x2001E61C), $${QT_MAJOR_VERSION}, $${QT_MINOR_VERSION}, $${QT_PATCH_VERSION}, {$$addLanguageDependentPkgItem(qt_pkg_name)}" + + # Projects linking to webkit need dependency to webkit + contains(QT, webkit): { + # these can be overridden by mkspecs/modules/qt_webkit.pri + isEmpty(QT_WEBKIT_MAJOR_VERSION) { + QT_WEBKIT_MAJOR_VERSION = $${QT_MAJOR_VERSION} + QT_WEBKIT_MINOR_VERSION = $${QT_MINOR_VERSION} + QT_WEBKIT_PATCH_VERSION = $${QT_PATCH_VERSION} + } + + webkit_pkg_name = QtWebKit + pkg_depends_webkit += \ + "; Dependency to Qt Webkit" \ + "(0x200267C2), $${QT_WEBKIT_MAJOR_VERSION}, $${QT_WEBKIT_MINOR_VERSION}, $${QT_WEBKIT_PATCH_VERSION}, {$$addLanguageDependentPkgItem(webkit_pkg_name)}" + } else { + default_deployment.pkg_prerules -= pkg_depends_webkit + } +} else { + default_deployment.pkg_prerules -= pkg_depends_webkit pkg_depends_qt +} + +isEmpty(TARGET.EPOCSTACKSIZE):TARGET.EPOCSTACKSIZE = 0x14000 +isEmpty(TARGET.EPOCHEAPSIZE):TARGET.EPOCHEAPSIZE = 0x020000 0x800000 + # Supports Symbian^3 and Symbian^4 by default and also S60 3.1, 3.2, and 5.0 if built against any of those. platform_product_id = S60ProductID platform_product_id = $$addLanguageDependentPkgItem(platform_product_id) diff --git a/mkspecs/features/symbian/qt.prf b/mkspecs/features/symbian/qt.prf index c8f97aa..c376b64 100644 --- a/mkspecs/features/symbian/qt.prf +++ b/mkspecs/features/symbian/qt.prf @@ -6,53 +6,6 @@ CONFIG += qtmain load(qt) -# Allow .pro files to specify include path(s) to be prepended to the list. -# -# This allows the project to override the default ordering, whereby paths -# relative to $$QMAKE_INCDIR_QT always come first. This ordering can cause -# problems when both the epoc32/include tree and a Qt include directory -# contain a header of the same name - in this case, the Qt header is always -# included by virtue of its path appearing first in the SYSTEMINCLUDE -# directives in the generated MMP file. -# -# To work around this situation, the following line can be added to the .pro -# file: -# PREPEND_INCLUDEPATH = /epoc32/include -# -INCLUDEPATH = $$PREPEND_INCLUDEPATH $$INCLUDEPATH - -# Add dependency to Qt package to all other projects besides Qt libs. -# Note: Qt libs package with full capabilities has UID3 of 0x2001E61C, -# while self-signed version typically has temporary UID3 of 0xE001E61C. -contains(CONFIG, qt):!contains(TARGET.UID3, 0x2001E61C):!contains(TARGET.UID3, 0xE001E61C):isEmpty(QT_LIBINFIX) { - qt_pkg_name = Qt - pkg_depends_qt += \ - "; Default dependency to Qt libraries" \ - "(0x2001E61C), $${QT_MAJOR_VERSION}, $${QT_MINOR_VERSION}, $${QT_PATCH_VERSION}, {$$addLanguageDependentPkgItem(qt_pkg_name)}" - - # Projects linking to webkit need dependency to webkit - contains(QT, webkit): { - # these can be overridden by mkspecs/modules/qt_webkit.pri - isEmpty(QT_WEBKIT_MAJOR_VERSION) { - QT_WEBKIT_MAJOR_VERSION = $${QT_MAJOR_VERSION} - QT_WEBKIT_MINOR_VERSION = $${QT_MINOR_VERSION} - QT_WEBKIT_PATCH_VERSION = $${QT_PATCH_VERSION} - } - - webkit_pkg_name = QtWebKit - pkg_depends_webkit += \ - "; Dependency to Qt Webkit" \ - "(0x200267C2), $${QT_WEBKIT_MAJOR_VERSION}, $${QT_WEBKIT_MINOR_VERSION}, $${QT_WEBKIT_PATCH_VERSION}, {$$addLanguageDependentPkgItem(webkit_pkg_name)}" - } else { - default_deployment.pkg_prerules -= pkg_depends_webkit - } -} else { - default_deployment.pkg_prerules -= pkg_depends_webkit pkg_depends_qt -} - -isEmpty(TARGET.EPOCSTACKSIZE):TARGET.EPOCSTACKSIZE = 0x14000 -isEmpty(TARGET.EPOCHEAPSIZE):TARGET.EPOCHEAPSIZE = 0x020000 0x800000 - # Workaround for the fact that Gnupoc and Symbian chose different approaches to # the letter casing of headers. contains(CONFIG, is_using_gnupoc) { -- cgit v0.12 From 5db6d32c57bad7da554363bc7e1e71e24e05c2fa Mon Sep 17 00:00:00 2001 From: axis <qt-info@nokia.com> Date: Tue, 21 Dec 2010 10:46:26 +0100 Subject: Fixed PREPEND_INCLUDEPATH being executed too early. It used to be carried out inside qt.prf, but was moved to default_post.prf. However, since qt.prf is executed after default_post.prf, it would still prepend its own include paths at the very front, which is wrong. Fixed by introducing a new feature profile for PREPEND_INCLUDEPATH, which is run after qt.prf (features in $$CONFIG are executed in reverse order). RevBy: Miikka Heikkinen --- mkspecs/common/symbian/symbian.conf | 2 +- mkspecs/features/symbian/default_post.prf | 15 --------------- mkspecs/features/symbian/prepend_includepath.prf | 14 ++++++++++++++ 3 files changed, 15 insertions(+), 16 deletions(-) create mode 100644 mkspecs/features/symbian/prepend_includepath.prf diff --git a/mkspecs/common/symbian/symbian.conf b/mkspecs/common/symbian/symbian.conf index 0bb3a29..e733ade 100644 --- a/mkspecs/common/symbian/symbian.conf +++ b/mkspecs/common/symbian/symbian.conf @@ -3,7 +3,7 @@ # TEMPLATE = app -CONFIG += qt warn_on release incremental link_prl sis_targets run_on_phone +CONFIG += prepend_includepath qt warn_on release incremental link_prl sis_targets run_on_phone QT += core gui QMAKE_INCREMENTAL_STYLE = sublib diff --git a/mkspecs/features/symbian/default_post.prf b/mkspecs/features/symbian/default_post.prf index a17e760..a05ff25 100644 --- a/mkspecs/features/symbian/default_post.prf +++ b/mkspecs/features/symbian/default_post.prf @@ -53,21 +53,6 @@ isEmpty(TARGET.UID2) { } } -# Allow .pro files to specify include path(s) to be prepended to the list. -# -# This allows the project to override the default ordering, whereby paths -# relative to $$QMAKE_INCDIR_QT always come first. This ordering can cause -# problems when both the epoc32/include tree and a Qt include directory -# contain a header of the same name - in this case, the Qt header is always -# included by virtue of its path appearing first in the SYSTEMINCLUDE -# directives in the generated MMP file. -# -# To work around this situation, the following line can be added to the .pro -# file: -# PREPEND_INCLUDEPATH = /epoc32/include -# -INCLUDEPATH = $$PREPEND_INCLUDEPATH $$INCLUDEPATH - # Add dependency to Qt package to all other projects besides Qt libs. # Note: Qt libs package with full capabilities has UID3 of 0x2001E61C, # while self-signed version typically has temporary UID3 of 0xE001E61C. diff --git a/mkspecs/features/symbian/prepend_includepath.prf b/mkspecs/features/symbian/prepend_includepath.prf new file mode 100644 index 0000000..d9fd4fe --- /dev/null +++ b/mkspecs/features/symbian/prepend_includepath.prf @@ -0,0 +1,14 @@ +# Allow .pro files to specify include path(s) to be prepended to the list. +# +# This allows the project to override the default ordering, whereby paths +# relative to $$QMAKE_INCDIR_QT always come first. This ordering can cause +# problems when both the epoc32/include tree and a Qt include directory +# contain a header of the same name - in this case, the Qt header is always +# included by virtue of its path appearing first in the SYSTEMINCLUDE +# directives in the generated MMP file. +# +# To work around this situation, the following line can be added to the .pro +# file: +# PREPEND_INCLUDEPATH = /epoc32/include +# +INCLUDEPATH = $$PREPEND_INCLUDEPATH $$INCLUDEPATH -- cgit v0.12 From b83cbadc80b24107433709f4827e1619a0e7561b Mon Sep 17 00:00:00 2001 From: axis <qt-info@nokia.com> Date: Thu, 20 Jan 2011 16:39:41 +0100 Subject: Made the translations dependency work for shadow builds. RevBy: Miikka Heikkinen --- mkspecs/common/symbian/symbian.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkspecs/common/symbian/symbian.conf b/mkspecs/common/symbian/symbian.conf index e733ade..9a0287a 100644 --- a/mkspecs/common/symbian/symbian.conf +++ b/mkspecs/common/symbian/symbian.conf @@ -238,7 +238,7 @@ defineTest(matchSymbianLanguages) { language = $$replace(translation, "^(.*/)?[^/]+_(([^_]{2,3}_)?[^_]{2,3})\\.ts$", \\2) contains(SYMBIAN_SUPPORTED_LANGUAGES, $$language) { SYMBIAN_MATCHED_LANGUAGES += $$language - SYMBIAN_MATCHED_TRANSLATIONS += $$translation + SYMBIAN_MATCHED_TRANSLATIONS += $$_PRO_FILE_PWD_/$$translation } } -- cgit v0.12 From 2ad80c0149477a6ca7dd69a7243c2055d208c98d Mon Sep 17 00:00:00 2001 From: axis <qt-info@nokia.com> Date: Thu, 20 Jan 2011 10:41:11 +0100 Subject: Added Symbian deployment localization for makefile build system. This is a complement to the 16575f7aef840b6aae0dc767468ab713fbcfd7a6 commit, which adds localization based on TRANSLATIONS keywords for Raptor and abld. In addition, since the __PRODUCT_INCLUDE__ define was creating a lot of trouble regarding < and >, it was refactored into its own source file, which is automatically included before every source file. Task: QTBUG-15292 RevBy: Miikka Heikkinen --- mkspecs/common/symbian/symbian-makefile.conf | 12 ++- mkspecs/common/symbian/symbianincludes.h | 17 ++++ mkspecs/features/symbian/symbian_building.prf | 124 +++++++++++++++++--------- mkspecs/symbian-armcc/qmake.conf | 5 +- qmake/generators/symbian/symbiancommon.cpp | 3 +- 5 files changed, 108 insertions(+), 53 deletions(-) create mode 100644 mkspecs/common/symbian/symbianincludes.h diff --git a/mkspecs/common/symbian/symbian-makefile.conf b/mkspecs/common/symbian/symbian-makefile.conf index 899f8c2..f429c1a 100644 --- a/mkspecs/common/symbian/symbian-makefile.conf +++ b/mkspecs/common/symbian/symbian-makefile.conf @@ -25,9 +25,15 @@ QMAKE_PREFIX_STATICLIB = QMAKE_SYMBIAN_SHLIB = 1 is_using_gnupoc { - DEFINES *= __PRODUCT_INCLUDE__=\"<$${EPOCROOT}epoc32/include/variant/symbian_os.hrh>\" -} else { - DEFINES *= __PRODUCT_INCLUDE__=\"<$${EPOCROOT}epoc32/include/variant/Symbian_OS.hrh>\" + DEFINES *= __QT_PRODUCT_INCLUDE_IS_LOWERCASE__ +} +QMAKE_SYMBIAN_INCLUDES = $$[QT_INSTALL_DATA]/mkspecs/common/symbian/symbianincludes.h +symbian-armcc { + QMAKE_CFLAGS += --preinclude $$QMAKE_SYMBIAN_INCLUDES + QMAKE_CXXFLAGS += --preinclude $$QMAKE_SYMBIAN_INCLUDES +} else:symbian-gcce { + QMAKE_CFLAGS += -include $$QMAKE_SYMBIAN_INCLUDES + QMAKE_CXXFLAGS += -include $$QMAKE_SYMBIAN_INCLUDES } DEFINES *= \ __SYMBIAN32__ \ diff --git a/mkspecs/common/symbian/symbianincludes.h b/mkspecs/common/symbian/symbianincludes.h new file mode 100644 index 0000000..4c0ffa6 --- /dev/null +++ b/mkspecs/common/symbian/symbianincludes.h @@ -0,0 +1,17 @@ +#ifndef __PRODUCT_INCLUDE__ +# ifdef __QT_PRODUCT_INCLUDE_IS_LOWERCASE__ +# define __PRODUCT_INCLUDE__ <variant/symbian_os.hrh> +# else +# define __PRODUCT_INCLUDE__ <variant/Symbian_OS.hrh> +# endif +#endif + +#ifndef __QT_SYMBIAN_RESOURCE__ +# if defined(__ARMCC__) || defined(__CC_ARM) +# ifdef __QT_RVCT_HEADER_IS_2_2__ +# include <rvct2_2.h> +# else +# include <rvct.h> +# endif +# endif +#endif diff --git a/mkspecs/features/symbian/symbian_building.prf b/mkspecs/features/symbian/symbian_building.prf index 7f8570e..545cb81 100644 --- a/mkspecs/features/symbian/symbian_building.prf +++ b/mkspecs/features/symbian/symbian_building.prf @@ -242,6 +242,7 @@ symbian-armcc: { symbian_resources_INCLUDES = $$replace(symbian_resources_INCLUDES, ",", " -I") symbian_resources_INCLUDES += $$join(INCLUDEPATH, " -I", "-I") symbian_resources_DEFINES = $$join(DEFINES, " -D", "-D") +symbian_resources_DEFINES += -D__QT_SYMBIAN_RESOURCE__ symbian_resources_RCC_DIR = $$replace(RCC_DIR, "/$", "") symbian_resources_INCLUDES += "-I$$symbian_resources_RCC_DIR" @@ -256,6 +257,7 @@ for(symbian_resource, SYMBIAN_RESOURCES) { symbianresources.input = SYMBIAN_RESOURCES symbianresources.output = $$symbian_resources_RCC_DIR/${QMAKE_FILE_BASE}$${QT_LIBINFIX}.rsg symbianresources.commands = cpp -nostdinc -undef \ + -include $$QMAKE_SYMBIAN_INCLUDES \ $$symbian_resources_INCLUDES \ $$symbian_resources_DEFINES \ ${QMAKE_FILE_NAME} \ @@ -271,46 +273,79 @@ symbianresources.CONFIG = no_link target_predeps QMAKE_EXTRA_COMPILERS += symbianresources +# This section generates the rsg and rsc files for symbian. contains(TEMPLATE, "app"):!contains(CONFIG, "no_icon") { - # Make our own extra target in order to get dependencies for generated - # files right. This also avoids the warning about files not found. - symbianGenResource.target = $${symbian_resources_RCC_DIR}/$${baseTarget}.rsg - symbianGenResource.commands = cpp -nostdinc -undef \ - $$symbian_resources_INCLUDES \ - $$symbian_resources_DEFINES \ - $${baseTarget}.rss \ - > $${symbian_resources_RCC_DIR}/$${baseTarget}.rpp \ - && rcomp -u -m045,046,047 \ - -s$${symbian_resources_RCC_DIR}/$${baseTarget}.rpp \ - -o$${symbianDestdir}/$${baseTarget}.rsc \ - -h$${symbian_resources_RCC_DIR}/$${baseTarget}.rsg \ - -i$${baseTarget}.rss - silent:symbianGenResource.commands = @echo rcomp $${baseTarget}.rss && $$symbianGenResource.commands - symbianGenResource.depends = $${baseTarget}.rss - PRE_TARGETDEPS += $${symbian_resources_RCC_DIR}/$${baseTarget}.rsg - QMAKE_CLEAN += $${symbian_resources_RCC_DIR}/$${baseTarget}.rsg - QMAKE_CLEAN += $${symbian_resources_RCC_DIR}/$${baseTarget}.rpp - QMAKE_DISTCLEAN += $${baseTarget}.rss - QMAKE_DISTCLEAN += $${symbianDestdir}/$${baseTarget}.rsc - - symbianGenRegResource.target = $${symbian_resources_RCC_DIR}/$${baseTarget}_reg.rsg - symbianGenRegResource.commands = cpp -nostdinc -undef \ - $$symbian_resources_INCLUDES \ - $$symbian_resources_DEFINES \ - $${baseTarget}_reg.rss \ - > $${symbian_resources_RCC_DIR}/$${baseTarget}_reg.rpp \ - && rcomp -u -m045,046,047 \ - -s$${symbian_resources_RCC_DIR}/$${baseTarget}_reg.rpp \ - -o$${symbianDestdir}/$${baseTarget}_reg.rsc \ - -h$${symbian_resources_RCC_DIR}/$${baseTarget}_reg.rsg \ - -i$${baseTarget}_reg.rss - silent:symbianGenRegResource.commands = @echo rcomp $${baseTarget}_reg.rss && $$symbianGenRegResource.commands - symbianGenRegResource.depends = $${baseTarget}_reg.rss $${symbian_resources_RCC_DIR}/$${baseTarget}.rsg - PRE_TARGETDEPS += $${symbian_resources_RCC_DIR}/$${baseTarget}_reg.rsg - QMAKE_CLEAN += $${symbian_resources_RCC_DIR}/$${baseTarget}_reg.rsg - QMAKE_CLEAN += $${symbian_resources_RCC_DIR}/$${baseTarget}_reg.rpp - QMAKE_DISTCLEAN += $${baseTarget}_reg.rss - QMAKE_DISTCLEAN += $${symbianDestdir}/$${baseTarget}_reg.rsc + # Look for extra languages for the resources, and then generate a target for each one. + localize_deployment:symbianGenResourceLanguages = $$SYMBIAN_MATCHED_LANGUAGES default + else:symbianGenResourceLanguages = default + for(language, symbianGenResourceLanguages) { + # Special languages get their language number appended to the filename. + contains(language, default) { + symbianGenResource_DEFINES = $$symbian_resources_DEFINES + rpp = $${symbian_resources_RCC_DIR}/$${baseTarget}.rpp + rsc = $${symbianDestdir}/$${baseTarget}.rsc + rsg = $${symbian_resources_RCC_DIR}/$${baseTarget}.rsg + } else { + languageNo = $$eval(SYMBIAN_LANG.$$language) + symbianGenResource_DEFINES = $$symbian_resources_DEFINES -DLANGUAGE_$${languageNo} + rpp = $${symbian_resources_RCC_DIR}/$${baseTarget}_$${languageNo}.rpp + rsc = $${symbianDestdir}/$${baseTarget}.r$${languageNo} + rsg = $${symbian_resources_RCC_DIR}/$${baseTarget}_$${languageNo}.rsg + } + + # Make our own extra target in order to get dependencies for generated + # files right. This also avoids the warning about files not found. + eval(symbianGenResource_$${language}.target = $$rsg) + eval(symbianGenResource_$${language}.commands = cpp -nostdinc -undef \ + -include $$QMAKE_SYMBIAN_INCLUDES \ + $$symbian_resources_INCLUDES \ + $$symbianGenResource_DEFINES \ + $${baseTarget}.rss \ + > $$rpp \ + && rcomp -u -m045,046,047 \ + -s$$rpp \ + -o$$rsc \ + -h$$rsg \ + -i$${baseTarget}.rss) + silent:eval(symbianGenResource_$${language}.commands = @echo rcomp $${baseTarget}.rss && $$eval(symbianGenResource_$${language}.commands)) + eval(symbianGenResource_$${language}.depends = $${baseTarget}.rss) + PRE_TARGETDEPS += $$rsg + QMAKE_CLEAN += $$rsg $$rpp + QMAKE_DISTCLEAN += $$rsc + + QMAKE_EXTRA_TARGETS += symbianGenResource_$${language} + + # Note that we depend on the base rsg file, even if dealing with a specific language. + # hence we don't use $$rsg on the next line. + eval(symbianGenRegResource_$${language}.depends = $${baseTarget}_reg.rss $${symbian_resources_RCC_DIR}/$${baseTarget}.rsg) + contains(language, default) { + rpp = $${symbian_resources_RCC_DIR}/$${baseTarget}_reg.rpp + rsc = $${symbianDestdir}/$${baseTarget}_reg.rsc + rsg = $${symbian_resources_RCC_DIR}/$${baseTarget}_reg.rsg + } else { + rpp = $${symbian_resources_RCC_DIR}/$${baseTarget}_reg_$${languageNo}.rpp + rsc = $${symbianDestdir}/$${baseTarget}_reg.r$${languageNo} + rsg = $${symbian_resources_RCC_DIR}/$${baseTarget}_reg_$${languageNo}.rsg + } + eval(symbianGenRegResource_$${language}.target = $$rsg) + eval(symbianGenRegResource_$${language}.commands = cpp -nostdinc -undef \ + -include $$QMAKE_SYMBIAN_INCLUDES \ + $$symbian_resources_INCLUDES \ + $$symbianGenResource_DEFINES \ + $${baseTarget}_reg.rss \ + > $$rpp \ + && rcomp -u -m045,046,047 \ + -s$$rpp \ + -o$$rsc \ + -h$$rsg \ + -i$${baseTarget}_reg.rss) + silent:eval(symbianGenRegResource_$${language}.commands = @echo rcomp $${baseTarget}_reg.rss && $$eval(symbianGenRegResource_$${language}.commands)) + PRE_TARGETDEPS += $$rsg + QMAKE_CLEAN += $$rsg $$rpp + QMAKE_DISTCLEAN += $$rsc + + QMAKE_EXTRA_TARGETS += symbianGenRegResource_$${language} + } # Trick to get qmake to create the RCC_DIR for us. symbianRccDirCreation.input = SOURCES @@ -318,14 +353,15 @@ contains(TEMPLATE, "app"):!contains(CONFIG, "no_icon") { symbianRccDirCreation.output = $${symbian_resources_RCC_DIR}/symbian_resource_dummy symbianRccDirCreation.CONFIG = no_link combine - QMAKE_EXTRA_TARGETS += symbianGenResource symbianGenRegResource QMAKE_EXTRA_COMPILERS += symbianRccDirCreation - QMAKE_DISTCLEAN += $${baseTarget}.loc + QMAKE_DISTCLEAN += $${baseTarget}.rss \ + $${baseTarget}_reg.rss \ + $${baseTarget}.loc } # Generated pkg files -QMAKE_DISTCLEAN += $${baseTarget}_template.pkg -QMAKE_DISTCLEAN += $${baseTarget}_installer.pkg -QMAKE_DISTCLEAN += $${baseTarget}_stub.pkg +QMAKE_DISTCLEAN += $${baseTarget}_template.pkg \ + $${baseTarget}_installer.pkg \ + $${baseTarget}_stub.pkg diff --git a/mkspecs/symbian-armcc/qmake.conf b/mkspecs/symbian-armcc/qmake.conf index be6af39..77a1966 100644 --- a/mkspecs/symbian-armcc/qmake.conf +++ b/mkspecs/symbian-armcc/qmake.conf @@ -53,10 +53,7 @@ INCLUDEPATH = $${EPOCROOT}epoc32/include \ exists($${EPOCROOT}epoc32/include/rvct2_2) { INCLUDEPATH += $${EPOCROOT}epoc32/include/rvct2_2 - QMAKE_CFLAGS += --preinclude rvct2_2.h - QMAKE_CXXFLAGS += --preinclude rvct2_2.h + DEFINES *= __QT_RVCT_HEADER_IS_2_2__ } else { INCLUDEPATH += $${EPOCROOT}epoc32/include/rvct - QMAKE_CFLAGS += --preinclude rvct.h - QMAKE_CXXFLAGS += --preinclude rvct.h } diff --git a/qmake/generators/symbian/symbiancommon.cpp b/qmake/generators/symbian/symbiancommon.cpp index 96d7725..c0afaaf 100644 --- a/qmake/generators/symbian/symbiancommon.cpp +++ b/qmake/generators/symbian/symbiancommon.cpp @@ -394,8 +394,7 @@ void SymbianCommonGenerator::generatePkgFile(const QString &iconFile, t << manufacturerStr << endl; } - // ### FIXME: remove epocBuild check once makefile based mkspecs support localized resource generation - if (epocBuild && symbianLocalizationList.size()) { + if (symbianLocalizationList.size()) { // Add localized resources to DEPLOYMENT if default resource deployment is done addLocalizedResourcesToDeployment("default_resource_deployment.sources", symbianLocalizationList); addLocalizedResourcesToDeployment("default_reg_deployment.sources", symbianLocalizationList); -- cgit v0.12 From 38e094fd2b333e960ca76cf9c86429ec29a07a29 Mon Sep 17 00:00:00 2001 From: axis <qt-info@nokia.com> Date: Fri, 4 Mar 2011 11:35:54 +0100 Subject: Unified the usage of $${EPOCROOT} for symbian. RevBy: Miikka Heikkinen Conflicts: mkspecs/symbian-gcce/qmake.conf --- mkspecs/features/symbian/qt_config.prf | 2 +- mkspecs/symbian-gcce/qmake.conf | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/mkspecs/features/symbian/qt_config.prf b/mkspecs/features/symbian/qt_config.prf index 2f446dc..82c1862 100644 --- a/mkspecs/features/symbian/qt_config.prf +++ b/mkspecs/features/symbian/qt_config.prf @@ -3,7 +3,7 @@ load(qt_config) !contains(QMAKE_HOST.os, "Windows") { # Test for the existence of lower cased headers, a sign of using Gnupoc. # Note that the qmake "exists" test won't do because it is case insensitive. - system("test -f $${EPOCROOT}/epoc32/include/akndoc.h") { + system("test -f $${EPOCROOT}epoc32/include/akndoc.h") { CONFIG += is_using_gnupoc } } diff --git a/mkspecs/symbian-gcce/qmake.conf b/mkspecs/symbian-gcce/qmake.conf index 4b54421..5d0deb7 100644 --- a/mkspecs/symbian-gcce/qmake.conf +++ b/mkspecs/symbian-gcce/qmake.conf @@ -57,19 +57,19 @@ QMAKE_LFLAGS_APP += --entry=_E32Startup -u _E32Startup QMAKE_LFLAGS_SHLIB += -shared --default-symver --entry _E32Dll -u _E32Dll QMAKE_LFLAGS_PLUGIN += $$QMAKE_LFLAGS_SHLIB -gcceExtraFlags = --include=${EPOCROOT}/epoc32/include/gcce/gcce.h -march=armv5t -mapcs -mthumb-interwork -nostdinc -c -msoft-float -T script +gcceExtraFlags = --include=$${EPOCROOT}epoc32/include/gcce/gcce.h -march=armv5t -mapcs -mthumb-interwork -nostdinc -c -msoft-float -T script QMAKE_CFLAGS += $${gcceExtraFlags} QMAKE_CXXFLAGS += $${gcceExtraFlags} -x c++ -fexceptions -fno-unit-at-a-time -fvisibility-inlines-hidden #If we are not going to link to Qt or qtmain.lib, we need to include this at least once. isEmpty(QT):contains(TEMPLATE, app) { - QMAKE_CXXFLAGS += --include=${EPOCROOT}/epoc32/include/stdapis/staticlibinit_gcce.h + QMAKE_CXXFLAGS += --include=$${EPOCROOT}epoc32/include/stdapis/staticlibinit_gcce.h } QMAKE_LFLAGS += --target1-abs \ --no-undefined \ --nostdlib -QMAKE_LIBDIR += ${EPOCROOT}/epoc32/release/armv5/udeb/ +QMAKE_LIBDIR += $${EPOCROOT}epoc32/release/armv5/udeb/ # g++ knows the path to the gcc-shipped-libs, ld doesn't. So cache the full path in the generate Makefile QMAKE_GCC_SEARCH_DIRS =$$system($$QMAKE_CXX -print-search-dirs) @@ -83,11 +83,11 @@ for(line, QMAKE_GCC_SEARCH_DIRS) { } } -QMAKE_LIBDIR += $${EPOCROOT}/epoc32/release/armv5/lib +QMAKE_LIBDIR += $${EPOCROOT}epoc32/release/armv5/lib -INCLUDEPATH = ${EPOCROOT}/epoc32/include/ \ - $${EPOCROOT}/epoc32/include/variant \ - $${EPOCROOT}/epoc32/include/stdapis \ - $${EPOCROOT}/epoc32/include/gcce \ +INCLUDEPATH = $${EPOCROOT}epoc32/include/ \ + $${EPOCROOT}epoc32/include/variant \ + $${EPOCROOT}epoc32/include/stdapis \ + $${EPOCROOT}epoc32/include/gcce \ $$INCLUDEPATH -- cgit v0.12 From 3afec58f28a6fbe1cd23fc5bbb5a2f71844a0cfa Mon Sep 17 00:00:00 2001 From: axis <qt-info@nokia.com> Date: Fri, 28 Jan 2011 09:13:01 +0100 Subject: Added missing header. --- mkspecs/common/symbian/symbianincludes.h | 41 ++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/mkspecs/common/symbian/symbianincludes.h b/mkspecs/common/symbian/symbianincludes.h index 4c0ffa6..5d7f488 100644 --- a/mkspecs/common/symbian/symbianincludes.h +++ b/mkspecs/common/symbian/symbianincludes.h @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the mkspecs of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + #ifndef __PRODUCT_INCLUDE__ # ifdef __QT_PRODUCT_INCLUDE_IS_LOWERCASE__ # define __PRODUCT_INCLUDE__ <variant/symbian_os.hrh> -- cgit v0.12 From 5b3f54a344a6e228389989ecf4fc9e770287db3a Mon Sep 17 00:00:00 2001 From: axis <qt-info@nokia.com> Date: Thu, 23 Dec 2010 15:52:38 +0100 Subject: Fixed a bug in elf2e32_qtwrapper regarding spaces in def files. It would not parse the line correctly if a space was missing between the "@" and the ordinal number. RevBy: Trust me --- bin/elf2e32_qtwrapper.pl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/elf2e32_qtwrapper.pl b/bin/elf2e32_qtwrapper.pl index 4eeb098..64d485b 100755 --- a/bin/elf2e32_qtwrapper.pl +++ b/bin/elf2e32_qtwrapper.pl @@ -106,7 +106,7 @@ while (1) { $origDefLine = <$origDefFile>; if (defined($origDefLine)) { $origDefLine =~ s/[\n\r]//; - if ($origDefLine =~ /([a-z0-9_]+) +\@ ([0-9]+) (.*)/i) { + if ($origDefLine =~ /([a-z0-9_]+) +\@ *([0-9]+) (.*)/i) { $origSym = $1; $origOrdinal = $2; $origExtraData = $3; @@ -121,7 +121,7 @@ while (1) { if ($savedNewDefFileLine) { # This happens if the new def file was missing an entry. $newDefLine = $savedNewDefFileLine; - $newDefLine =~ /([a-z0-9_]+) +\@ ([0-9]+) (.*)/i or die("$0: Shouldn't happen"); + $newDefLine =~ /([a-z0-9_]+) +\@ *([0-9]+) (.*)/i or die("$0: Shouldn't happen"); $newSym = $1; $newOrdinal = $2; $newExtraData = $3; @@ -131,7 +131,7 @@ while (1) { $newDefLine = <$newDefFile>; if (defined($newDefLine)) { $newDefLine =~ s/[\n\r]//; - if ($newDefLine =~ /([a-z0-9_]+) +\@ ([0-9]+) (.*)/i) { + if ($newDefLine =~ /([a-z0-9_]+) +\@ *([0-9]+) (.*)/i) { $newSym = $1; $newOrdinal = $2; $newExtraData = $3; -- cgit v0.12 From dfa811b18b588b09ec7b5c648c7b143d54ddc825 Mon Sep 17 00:00:00 2001 From: axis <qt-info@nokia.com> Date: Tue, 19 Oct 2010 08:47:29 +0200 Subject: Fixed some tools definitions and properties in symbian profiles. This is needed for Symbian development on Windows using makefiles. RevBy: Trust me --- mkspecs/common/armcc.conf | 1 + mkspecs/common/symbian/symbian.conf | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/mkspecs/common/armcc.conf b/mkspecs/common/armcc.conf index 2c765bc..4f178d7 100644 --- a/mkspecs/common/armcc.conf +++ b/mkspecs/common/armcc.conf @@ -37,5 +37,6 @@ QMAKE_LFLAGS_PLUGIN += $$QMAKE_LFLAGS_SHLIB QMAKE_LFLAGS_THREAD += QMAKE_AR = armar --create +QMAKE_LIB = armar --create QMAKE_RANLIB = diff --git a/mkspecs/common/symbian/symbian.conf b/mkspecs/common/symbian/symbian.conf index 9a0287a..c59f751 100644 --- a/mkspecs/common/symbian/symbian.conf +++ b/mkspecs/common/symbian/symbian.conf @@ -117,11 +117,11 @@ contains(QMAKE_HOST.os,Windows) { } QMAKE_IDL = midl -QMAKE_LIB = ar -ru -QMAKE_RC = windres QMAKE_ZIP = zip -r -9 QMAKE_UNZIP = unzip -o +QMAKE_WRITE_DEFAULT_RC = 1 + QMAKE_TAR = tar -cf QMAKE_GZIP = gzip -9f -- cgit v0.12 From bd07beb56cda3d6c37c0d0f9204247f16586cd27 Mon Sep 17 00:00:00 2001 From: axis <qt-info@nokia.com> Date: Tue, 19 Oct 2010 08:51:04 +0200 Subject: Added Symbian makefile building support using MinGW backend. RevBy: Oswald Buddenhagen --- mkspecs/common/symbian/symbian-makefile.conf | 6 +++++- qmake/generators/metamakefile.cpp | 4 +++- qmake/generators/win32/mingw_make.h | 4 ++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/mkspecs/common/symbian/symbian-makefile.conf b/mkspecs/common/symbian/symbian-makefile.conf index f429c1a..4fc5812 100644 --- a/mkspecs/common/symbian/symbian-makefile.conf +++ b/mkspecs/common/symbian/symbian-makefile.conf @@ -2,7 +2,11 @@ # qmake configuration for makefile based symbian # -MAKEFILE_GENERATOR = SYMBIAN_UNIX +contains(QMAKE_HOST.os,Windows) { + MAKEFILE_GENERATOR = SYMBIAN_MINGW +} else { + MAKEFILE_GENERATOR = SYMBIAN_UNIX +} include(symbian.conf) diff --git a/qmake/generators/metamakefile.cpp b/qmake/generators/metamakefile.cpp index 6c43b6f..26d587d 100644 --- a/qmake/generators/metamakefile.cpp +++ b/qmake/generators/metamakefile.cpp @@ -488,6 +488,8 @@ MetaMakefileGenerator::createMakefileGenerator(QMakeProject *proj, bool noIO) mkfile = new SymbianSbsv2MakefileGenerator; } else if(gen == "SYMBIAN_UNIX") { mkfile = new SymbianMakefileTemplate<UnixMakefileGenerator>; + } else if(gen == "SYMBIAN_MINGW") { + mkfile = new SymbianMakefileTemplate<MingwMakefileGenerator>; } else { fprintf(stderr, "Unknown generator specified: %s\n", gen.toLatin1().constData()); } @@ -544,7 +546,7 @@ MetaMakefileGenerator::modesForGenerator(const QString &gen, } else if (gen == "PROJECTBUILDER" || gen == "XCODE") { *host_mode = Option::HOST_MACX_MODE; *target_mode = Option::TARG_MACX_MODE; - } else if (gen == "SYMBIAN_ABLD" || gen == "SYMBIAN_SBSV2" || gen == "SYMBIAN_UNIX") { + } else if (gen == "SYMBIAN_ABLD" || gen == "SYMBIAN_SBSV2" || gen == "SYMBIAN_UNIX" || gen == "SYMBIAN_MINGW") { #if defined(Q_OS_MAC) *host_mode = Option::HOST_MACX_MODE; #elif defined(Q_OS_UNIX) diff --git a/qmake/generators/win32/mingw_make.h b/qmake/generators/win32/mingw_make.h index 007b48b..5bc9c7b 100644 --- a/qmake/generators/win32/mingw_make.h +++ b/qmake/generators/win32/mingw_make.h @@ -54,17 +54,17 @@ public: protected: QString escapeDependencyPath(const QString &path) const; QString getLibTarget(); + bool writeMakefile(QTextStream &); + void init(); private: bool isWindowsShell() const; void writeMingwParts(QTextStream &); void writeIncPart(QTextStream &t); void writeLibsPart(QTextStream &t); void writeLibDirPart(QTextStream &t); - bool writeMakefile(QTextStream &); void writeObjectsPart(QTextStream &t); void writeBuildRulesPart(QTextStream &t); void writeRcFilePart(QTextStream &t); - void init(); void processPrlVariable(const QString &var, const QStringList &l); QStringList &findDependencies(const QString &file); -- cgit v0.12 From 153b79efac39c33e528650cca35f832e47f7302b Mon Sep 17 00:00:00 2001 From: axis <qt-info@nokia.com> Date: Tue, 19 Oct 2010 10:10:08 +0200 Subject: Added object script support to RVCT when using MinGW qmake generator. RevBy: Oswald Buddenhagen --- mkspecs/common/symbian/symbian-makefile.conf | 2 ++ qmake/generators/win32/mingw_make.cpp | 46 +++++++++++++++++++++++----- 2 files changed, 40 insertions(+), 8 deletions(-) diff --git a/mkspecs/common/symbian/symbian-makefile.conf b/mkspecs/common/symbian/symbian-makefile.conf index 4fc5812..cffc859 100644 --- a/mkspecs/common/symbian/symbian-makefile.conf +++ b/mkspecs/common/symbian/symbian-makefile.conf @@ -28,6 +28,8 @@ CONFIG *= no_plugin_name_prefix QMAKE_PREFIX_STATICLIB = QMAKE_SYMBIAN_SHLIB = 1 +QMAKE_LINK_OBJECT_SCRIPT = objects + is_using_gnupoc { DEFINES *= __QT_PRODUCT_INCLUDE_IS_LOWERCASE__ } diff --git a/qmake/generators/win32/mingw_make.cpp b/qmake/generators/win32/mingw_make.cpp index ea9e9e1..006a7d5 100644 --- a/qmake/generators/win32/mingw_make.cpp +++ b/qmake/generators/win32/mingw_make.cpp @@ -199,6 +199,23 @@ void createArObjectScriptFile(const QString &fileName, const QString &target, co } } +void createRvctObjectScriptFile(const QString &fileName, const QStringList &objList) +{ + QString filePath = Option::output_dir + QDir::separator() + fileName; + QFile file(filePath); + if (file.open(QIODevice::WriteOnly | QIODevice::Text)) { + QTextStream t(&file); + for (QStringList::ConstIterator it = objList.constBegin(); it != objList.constEnd(); ++it) { + if (QDir::isRelativePath(*it)) + t << "./" << *it << endl; + else + t << *it << endl; + } + t.flush(); + file.close(); + } +} + void MingwMakefileGenerator::writeMingwParts(QTextStream &t) { writeStandardParts(t); @@ -367,20 +384,33 @@ void MingwMakefileGenerator::writeObjectsPart(QTextStream &t) if (!var("BUILD_NAME").isEmpty()) { ar_script_file += "." + var("BUILD_NAME"); } - createArObjectScriptFile(ar_script_file, var("DEST_TARGET"), project->values("OBJECTS")); // QMAKE_LIB is used for win32, including mingw, whereas QMAKE_AR is used on Unix. - // Strip off any options since the ar commands will be read from file. - QString ar_cmd = var("QMAKE_LIB").section(" ", 0, 0);; - if (ar_cmd.isEmpty()) - ar_cmd = "ar"; - objectsLinkLine = ar_cmd + " -M < " + ar_script_file; + if (project->isActiveConfig("rvct_linker")) { + createRvctObjectScriptFile(ar_script_file, project->values("OBJECTS")); + QString ar_cmd = project->values("QMAKE_LIB").join(" "); + if (ar_cmd.isEmpty()) + ar_cmd = "armar --create"; + objectsLinkLine = ar_cmd + " " + var("DEST_TARGET") + " --via " + ar_script_file; + } else { + // Strip off any options since the ar commands will be read from file. + QString ar_cmd = var("QMAKE_LIB").section(" ", 0, 0);; + if (ar_cmd.isEmpty()) + ar_cmd = "ar"; + createArObjectScriptFile(ar_script_file, var("DEST_TARGET"), project->values("OBJECTS")); + objectsLinkLine = ar_cmd + " -M < " + ar_script_file; + } } else { QString ld_script_file = var("QMAKE_LINK_OBJECT_SCRIPT") + "." + var("TARGET"); if (!var("BUILD_NAME").isEmpty()) { ld_script_file += "." + var("BUILD_NAME"); } - createLdObjectScriptFile(ld_script_file, project->values("OBJECTS")); - objectsLinkLine = ld_script_file; + if (project->isActiveConfig("rvct_linker")) { + createRvctObjectScriptFile(ld_script_file, project->values("OBJECTS")); + objectsLinkLine = QString::fromLatin1("--via ") + ld_script_file; + } else { + createLdObjectScriptFile(ld_script_file, project->values("OBJECTS")); + objectsLinkLine = ld_script_file; + } } Win32MakefileGenerator::writeObjectsPart(t); } -- cgit v0.12 From 5624b39aff84ddde76a4f42ab6fad9d6a90d8526 Mon Sep 17 00:00:00 2001 From: axis <qt-info@nokia.com> Date: Thu, 23 Dec 2010 16:24:06 +0100 Subject: Fixed include in network module on Symbian. --- src/network/kernel/qnetworkinterface_symbian.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/network/kernel/qnetworkinterface_symbian.cpp b/src/network/kernel/qnetworkinterface_symbian.cpp index 03133d0..8e5db3c 100644 --- a/src/network/kernel/qnetworkinterface_symbian.cpp +++ b/src/network/kernel/qnetworkinterface_symbian.cpp @@ -43,7 +43,7 @@ #include "qnetworkinterface.h" #include "qnetworkinterface_p.h" -#include "../corelib/kernel/qcore_symbian_p.h" +#include <private/qcore_symbian_p.h> #ifndef QT_NO_NETWORKINTERFACE -- cgit v0.12 From a298545dfbd9bbfeac67ff17547d40acae8480a9 Mon Sep 17 00:00:00 2001 From: axis <qt-info@nokia.com> Date: Thu, 23 Dec 2010 16:24:57 +0100 Subject: Fixed a build library deployment issue in sqlite. Make did not understand that sqlite3.dso, which the link relies on, is the same as $$OBJECTS_DIR/sqlite3.dso, which is extracted by the profile. RevBy: Trust me --- src/plugins/sqldrivers/sqlite_symbian/sqlite_symbian.pri | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/plugins/sqldrivers/sqlite_symbian/sqlite_symbian.pri b/src/plugins/sqldrivers/sqlite_symbian/sqlite_symbian.pri index ebeccc9..b7a87f3 100644 --- a/src/plugins/sqldrivers/sqlite_symbian/sqlite_symbian.pri +++ b/src/plugins/sqldrivers/sqlite_symbian/sqlite_symbian.pri @@ -34,6 +34,12 @@ silent:symbian_sqlite3_dso.commands = @echo unzipping $@ && $$symbian_sqlite3_dso.commands QMAKE_EXTRA_COMPILERS += symbian_sqlite3_dso + # Workaround for the fact that make doesn't understand that sqlite3.dso + # is the same as $OBJECTS_DIR/sqlite3.dso + symbian_sqlite3_dso_standalone.target = sqlite3.dso + symbian_sqlite3_dso_standalone.depends = $$symbian_sqlite3_dso.output + QMAKE_EXTRA_TARGETS += symbian_sqlite3_dso_standalone + symbian_sqlite3_ver_dso.input = symbian_sqlite3_zip_file symbian_sqlite3_ver_dso.output = sqlite3{00060003}.dso !isEmpty(OBJECTS_DIR):symbian_sqlite3_ver_dso.output = $$OBJECTS_DIR/$$symbian_sqlite3_ver_dso.output -- cgit v0.12 From bc627fbe248c2efe9b05784182bf0da3b9c486d7 Mon Sep 17 00:00:00 2001 From: axis <qt-info@nokia.com> Date: Thu, 11 Nov 2010 13:52:28 +0100 Subject: Fixed a typo in src profile. RevBy: Trust me --- src/src.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/src.pro b/src/src.pro index 060f48b..868e22f 100644 --- a/src/src.pro +++ b/src/src.pro @@ -108,7 +108,7 @@ src_webkit_declarative.target = sub-webkitdeclarative src_phonon.depends = src_gui src_multimedia.depends = src_gui contains(QT_CONFIG, opengl):src_multimedia.depends += src_opengl - src_tools_activeqt.depends = src_tools_idc src_gui + src_activeqt.depends = src_tools_idc src_gui src_declarative.depends = src_gui src_script src_network src_plugins.depends = src_gui src_sql src_svg contains(QT_CONFIG, multimedia):src_plugins.depends += src_multimedia -- cgit v0.12 From c9704566aa9186369bfdabd835b0f6723839310b Mon Sep 17 00:00:00 2001 From: axis <qt-info@nokia.com> Date: Fri, 7 Jan 2011 07:39:08 +0100 Subject: Stopped honoring the RVCT22INC variable on symbian-armcc mkspec. This usually points to the RVCT include directory, but those headers are not appropriate for Symbian. RevBy: Trust me --- mkspecs/features/symbian/symbian_building.prf | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/mkspecs/features/symbian/symbian_building.prf b/mkspecs/features/symbian/symbian_building.prf index 545cb81..28046b4 100644 --- a/mkspecs/features/symbian/symbian_building.prf +++ b/mkspecs/features/symbian/symbian_building.prf @@ -1,6 +1,11 @@ symbian-armcc { QMAKE_CFLAGS += $$QMAKE_CFLAGS.ARMCC QMAKE_CXXFLAGS += $$QMAKE_CXXFLAGS.ARMCC + # This is to prevent inclusion of the shipped RVCT headers, which are often in the + # environment variable RVCTxxINC by default. -J prevents the searching of that location, + # but needs a path, so just specify somewhere guaranteed not to contain header files. + QMAKE_CFLAGS += -J$${EPOCROOT}epoc32/ignore_this_path + QMAKE_CXXFLAGS += -J$${EPOCROOT}epoc32/ignore_this_path } else:symbian-gcce { QMAKE_CFLAGS += $$QMAKE_CFLAGS.GCCE QMAKE_CXXFLAGS += $$QMAKE_CXXFLAGS.GCCE @@ -235,12 +240,7 @@ contains(TEMPLATE, app):!contains(QMAKE_LINK, "^@:.*") { } # Symbian resource files -symbian-armcc: { - SYMBIAN_RVCT22INC=$$(RVCT22INC) - !isEmpty(SYMBIAN_RVCT22INC):symbian_resources_INCLUDES = -I$${SYMBIAN_RVCT22INC} -} -symbian_resources_INCLUDES = $$replace(symbian_resources_INCLUDES, ",", " -I") -symbian_resources_INCLUDES += $$join(INCLUDEPATH, " -I", "-I") +symbian_resources_INCLUDES = $$join(INCLUDEPATH, " -I", "-I") symbian_resources_DEFINES = $$join(DEFINES, " -D", "-D") symbian_resources_DEFINES += -D__QT_SYMBIAN_RESOURCE__ symbian_resources_RCC_DIR = $$replace(RCC_DIR, "/$", "") -- cgit v0.12 From 775f98e2fe20cf381f9df3a4ff3aca3910c7d05c Mon Sep 17 00:00:00 2001 From: axis <qt-info@nokia.com> Date: Fri, 7 Jan 2011 07:47:12 +0100 Subject: Added .lib/.dso dependency tracking to Symbian with MinGW generator. This is just a mirror of the way the UNIX generator does it. See commits aaf189b084f52 and bdff51768dfe. RevBy: Oswald Buddenhagen --- qmake/generators/win32/mingw_make.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/qmake/generators/win32/mingw_make.cpp b/qmake/generators/win32/mingw_make.cpp index 006a7d5..fc8cfa0 100644 --- a/qmake/generators/win32/mingw_make.cpp +++ b/qmake/generators/win32/mingw_make.cpp @@ -218,6 +218,12 @@ void createRvctObjectScriptFile(const QString &fileName, const QStringList &objL void MingwMakefileGenerator::writeMingwParts(QTextStream &t) { + if (!project->isEmpty("QMAKE_SYMBIAN_SHLIB")) { + t << "vpath %.dso " << project->values("QMAKE_LIBDIR").join(";") << endl; + t << "vpath %.lib " << project->values("QMAKE_LIBDIR").join(";") << endl; + t << "\n\n"; + } + writeStandardParts(t); if (!preCompHeaderOut.isEmpty()) { -- cgit v0.12 From 7dacac5ad465fe5c3aea8e2e09d7910a1ed58079 Mon Sep 17 00:00:00 2001 From: axis <qt-info@nokia.com> Date: Fri, 7 Jan 2011 07:53:13 +0100 Subject: Avoided some MinGW specific codepaths when building Symbian libs. RevBy: Trust me --- qmake/generators/win32/mingw_make.cpp | 4 ++-- qmake/generators/win32/winmakefile.cpp | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/qmake/generators/win32/mingw_make.cpp b/qmake/generators/win32/mingw_make.cpp index fc8cfa0..a772b38 100644 --- a/qmake/generators/win32/mingw_make.cpp +++ b/qmake/generators/win32/mingw_make.cpp @@ -290,7 +290,7 @@ void MingwMakefileGenerator::init() if(configs.indexOf("qt") == -1) configs.append("qt"); - if(project->isActiveConfig("dll")) { + if(project->isActiveConfig("dll") && project->values("QMAKE_SYMBIAN_SHLIB").isEmpty()) { QString destDir = ""; if(!project->first("DESTDIR").isEmpty()) destDir = Option::fixPathToTargetOS(project->first("DESTDIR") + Option::dir_sep, false, false); @@ -299,7 +299,7 @@ void MingwMakefileGenerator::init() project->values("QMAKE_LFLAGS").append(QString("-Wl,--out-implib,") + project->first("MINGW_IMPORT_LIB")); } - if(!project->values("DEF_FILE").isEmpty()) + if(!project->values("DEF_FILE").isEmpty() && project->values("QMAKE_SYMBIAN_SHLIB").isEmpty()) project->values("QMAKE_LFLAGS").append(QString("-Wl,") + project->first("DEF_FILE")); MakefileGenerator::init(); diff --git a/qmake/generators/win32/winmakefile.cpp b/qmake/generators/win32/winmakefile.cpp index d92eb69..f2bf7d4 100644 --- a/qmake/generators/win32/winmakefile.cpp +++ b/qmake/generators/win32/winmakefile.cpp @@ -303,7 +303,8 @@ void Win32MakefileGenerator::processVars() // TARGET_VERSION_EXT will be used to add a version number onto the target name if (project->values("TARGET_VERSION_EXT").isEmpty() - && !project->values("VER_MAJ").isEmpty()) + && !project->values("VER_MAJ").isEmpty() + && project->values("QMAKE_SYMBIAN_SHLIB").isEmpty()) project->values("TARGET_VERSION_EXT").append(project->values("VER_MAJ").first()); if(project->isEmpty("QMAKE_COPY_FILE")) -- cgit v0.12 From 85005fb1ee135b33ef2e97396d469112845f3e6c Mon Sep 17 00:00:00 2001 From: axis <qt-info@nokia.com> Date: Fri, 7 Jan 2011 07:56:19 +0100 Subject: Added support for rvct_linker config in qmake's MinGW generator. RevBy: Trust me --- qmake/generators/win32/mingw_make.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/qmake/generators/win32/mingw_make.cpp b/qmake/generators/win32/mingw_make.cpp index a772b38..f1043bc 100644 --- a/qmake/generators/win32/mingw_make.cpp +++ b/qmake/generators/win32/mingw_make.cpp @@ -368,17 +368,25 @@ void MingwMakefileGenerator::writeLibsPart(QTextStream &t) t << "LIBS = "; if(!project->values("QMAKE_LIBDIR").isEmpty()) writeLibDirPart(t); - t << var("QMAKE_LIBS").replace(QRegExp("(\\slib|^lib)")," -l") << ' ' - << var("QMAKE_LIBS_PRIVATE").replace(QRegExp("(\\slib|^lib)")," -l") << endl; + if (project->isActiveConfig("rvct_linker")) { + t << var("QMAKE_LIBS") << ' ' + << var("QMAKE_LIBS_PRIVATE") << endl; + } else { + t << var("QMAKE_LIBS").replace(QRegExp("(\\slib|^lib)")," -l") << ' ' + << var("QMAKE_LIBS_PRIVATE").replace(QRegExp("(\\slib|^lib)")," -l") << endl; + } } } void MingwMakefileGenerator::writeLibDirPart(QTextStream &t) { QStringList libDirs = project->values("QMAKE_LIBDIR"); + QString libArg = QString::fromLatin1("-L"); + if (project->isActiveConfig("rvct_linker")) + libArg = QString::fromLatin1("--userlibpath "); for (int i = 0; i < libDirs.size(); ++i) libDirs[i].remove("\""); - t << valGlue(libDirs,"-L"+quote,quote+" -L" +quote,quote) << " "; + t << valGlue(libDirs, libArg+quote, quote+" "+libArg+quote, quote) << " "; } void MingwMakefileGenerator::writeObjectsPart(QTextStream &t) -- cgit v0.12 From 7caa55505704cd907bbd19a2e79fb9e604a86675 Mon Sep 17 00:00:00 2001 From: axis <qt-info@nokia.com> Date: Fri, 7 Jan 2011 08:09:01 +0100 Subject: Added support for various special compiler/linker flags on MinGW. This enables you to use QMAKE_xxx_yyy, where xxx is either CFLAGS, CXXFLAGS or LFLAGS, and yyy is either APP, SHLIB or PLUGIN. It is basically the same as the one in the UNIX generator. RevBy: Oswald Buddenhagen --- qmake/generators/win32/winmakefile.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/qmake/generators/win32/winmakefile.cpp b/qmake/generators/win32/winmakefile.cpp index f2bf7d4..7f81b54 100644 --- a/qmake/generators/win32/winmakefile.cpp +++ b/qmake/generators/win32/winmakefile.cpp @@ -332,6 +332,24 @@ void Win32MakefileGenerator::processVars() if(!(*libDir_it).isEmpty()) (*libDir_it) = Option::fixPathToTargetOS((*libDir_it), false, false); } + + if (project->values("TEMPLATE").contains("app")) { + project->values("QMAKE_CFLAGS") += project->values("QMAKE_CFLAGS_APP"); + project->values("QMAKE_CXXFLAGS") += project->values("QMAKE_CXXFLAGS_APP"); + project->values("QMAKE_LFLAGS") += project->values("QMAKE_LFLAGS_APP"); + } else if (project->values("TEMPLATE").contains("lib") && project->isActiveConfig("dll")) { + if(!project->isActiveConfig("plugin") || !project->isActiveConfig("plugin_no_share_shlib_cflags")) { + project->values("QMAKE_CFLAGS") += project->values("QMAKE_CFLAGS_SHLIB"); + project->values("QMAKE_CXXFLAGS") += project->values("QMAKE_CXXFLAGS_SHLIB"); + } + if (project->isActiveConfig("plugin")) { + project->values("QMAKE_CFLAGS") += project->values("QMAKE_CFLAGS_PLUGIN"); + project->values("QMAKE_CXXFLAGS") += project->values("QMAKE_CXXFLAGS_PLUGIN"); + project->values("QMAKE_LFLAGS") += project->values("QMAKE_LFLAGS_PLUGIN"); + } else { + project->values("QMAKE_LFLAGS") += project->values("QMAKE_LFLAGS_SHLIB"); + } + } } void Win32MakefileGenerator::fixTargetExt() -- cgit v0.12 From dbbf06e51eafe25d63cf2d0d21a1d92bde5475cc Mon Sep 17 00:00:00 2001 From: axis <qt-info@nokia.com> Date: Fri, 7 Jan 2011 08:24:41 +0100 Subject: Added MinGW support for adding lib prefix and extension via profile. RevBy: Oswald Buddenhagen --- mkspecs/win32-g++/qmake.conf | 2 ++ qmake/generators/win32/mingw_make.cpp | 5 +---- qmake/generators/win32/winmakefile.cpp | 22 +++++++++++++++++----- qmake/generators/win32/winmakefile.h | 1 + 4 files changed, 21 insertions(+), 9 deletions(-) diff --git a/mkspecs/win32-g++/qmake.conf b/mkspecs/win32-g++/qmake.conf index 2d9833b..e5e4996 100644 --- a/mkspecs/win32-g++/qmake.conf +++ b/mkspecs/win32-g++/qmake.conf @@ -62,6 +62,8 @@ QMAKE_LFLAGS_WINDOWS = -Wl,-subsystem,windows QMAKE_LFLAGS_DLL = -shared QMAKE_LINK_OBJECT_MAX = 10 QMAKE_LINK_OBJECT_SCRIPT= object_script +QMAKE_PREFIX_STATICLIB = lib +QMAKE_EXTENSION_STATICLIB = a QMAKE_LIBS = diff --git a/qmake/generators/win32/mingw_make.cpp b/qmake/generators/win32/mingw_make.cpp index f1043bc..9eea98f 100644 --- a/qmake/generators/win32/mingw_make.cpp +++ b/qmake/generators/win32/mingw_make.cpp @@ -335,12 +335,9 @@ void MingwMakefileGenerator::init() void MingwMakefileGenerator::fixTargetExt() { if (project->isActiveConfig("staticlib") && project->first("TEMPLATE") == "lib") { - project->values("TARGET_EXT").append(".a"); project->values("QMAKE_LFLAGS").append("-static"); - project->values("TARGET").first() = "lib" + project->first("TARGET"); - } else { - Win32MakefileGenerator::fixTargetExt(); } + Win32MakefileGenerator::fixTargetExt(); } void MingwMakefileGenerator::writeIncPart(QTextStream &t) diff --git a/qmake/generators/win32/winmakefile.cpp b/qmake/generators/win32/winmakefile.cpp index 7f81b54..bfe3e09 100644 --- a/qmake/generators/win32/winmakefile.cpp +++ b/qmake/generators/win32/winmakefile.cpp @@ -57,6 +57,14 @@ Win32MakefileGenerator::Win32MakefileGenerator() : MakefileGenerator() { } +void Win32MakefileGenerator::init() +{ + if (project->isEmpty("QMAKE_EXTENSION_STATICLIB")) + project->values("QMAKE_EXTENSION_STATICLIB").append("lib"); + if (project->isEmpty("QMAKE_EXTENSION_SHLIB")) + project->values("QMAKE_EXTENSION_SHLIB").append("lib"); +} + int Win32MakefileGenerator::findHighestVersion(const QString &d, const QString &stem, const QString &ext) { @@ -354,12 +362,16 @@ void Win32MakefileGenerator::processVars() void Win32MakefileGenerator::fixTargetExt() { - if (!project->values("QMAKE_APP_FLAG").isEmpty()) + if (!project->values("QMAKE_APP_FLAG").isEmpty()) { project->values("TARGET_EXT").append(".exe"); - else if (project->isActiveConfig("shared")) - project->values("TARGET_EXT").append(project->first("TARGET_VERSION_EXT") + ".dll"); - else - project->values("TARGET_EXT").append(".lib"); + } else if (project->isActiveConfig("shared")) { + project->values("TARGET_EXT").append(project->first("TARGET_VERSION_EXT") + "." + + project->first("QMAKE_EXTENSION_SHLIB")); + project->values("TARGET").first() = project->first("QMAKE_PREFIX_SHLIB") + project->first("TARGET"); + } else { + project->values("TARGET_EXT").append("." + project->first("QMAKE_EXTENSION_STATICLIB")); + project->values("TARGET").first() = project->first("QMAKE_PREFIX_STATICLIB") + project->first("TARGET"); + } } void Win32MakefileGenerator::processRcFileVar() diff --git a/qmake/generators/win32/winmakefile.h b/qmake/generators/win32/winmakefile.h index fa3f292..7f7d2f3 100644 --- a/qmake/generators/win32/winmakefile.h +++ b/qmake/generators/win32/winmakefile.h @@ -59,6 +59,7 @@ class Win32MakefileGenerator : public MakefileGenerator public: Win32MakefileGenerator(); ~Win32MakefileGenerator(); + void init(); protected: virtual QString defaultInstall(const QString &); virtual void writeCleanParts(QTextStream &t); -- cgit v0.12 From 728f0f7d5c1c84ca713cfb34c3d32b65018028d4 Mon Sep 17 00:00:00 2001 From: axis <qt-info@nokia.com> Date: Fri, 28 Jan 2011 10:27:33 +0100 Subject: Fixed GCCE libdir handling if the paths have spaces in them. RevBy: Trust me --- mkspecs/symbian-gcce/qmake.conf | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/mkspecs/symbian-gcce/qmake.conf b/mkspecs/symbian-gcce/qmake.conf index 5d0deb7..e83f435 100644 --- a/mkspecs/symbian-gcce/qmake.conf +++ b/mkspecs/symbian-gcce/qmake.conf @@ -72,16 +72,16 @@ QMAKE_LFLAGS += --target1-abs \ QMAKE_LIBDIR += $${EPOCROOT}epoc32/release/armv5/udeb/ # g++ knows the path to the gcc-shipped-libs, ld doesn't. So cache the full path in the generate Makefile -QMAKE_GCC_SEARCH_DIRS =$$system($$QMAKE_CXX -print-search-dirs) -for(line, QMAKE_GCC_SEARCH_DIRS) { - contains(line, "libraries:") { - foundIt="1" - } else { - contains(foundIt, "1") { - QMAKE_LFLAGS += $$replace(line, "[=:]", " -L") - } - } +QMAKE_GCC_SEARCH_DIRS = $$system($$QMAKE_CXX -print-search-dirs) +QMAKE_GCC_SEARCH_DIRS = "$$join(QMAKE_GCC_SEARCH_DIRS, " ")" +QMAKE_GCC_SEARCH_DIRS = $$replace(QMAKE_GCC_SEARCH_DIRS, ".*libraries: *", "") +QMAKE_GCC_SEARCH_DIRS = $$replace(QMAKE_GCC_SEARCH_DIRS, "=", "") +contains(QMAKE_HOST.os,Windows) { + QMAKE_GCC_SEARCH_DIRS = $$split(QMAKE_GCC_SEARCH_DIRS, ;) +} else { + QMAKE_GCC_SEARCH_DIRS = $$split(QMAKE_GCC_SEARCH_DIRS, :) } +for(line, QMAKE_GCC_SEARCH_DIRS):QMAKE_LIBDIR += $$line QMAKE_LIBDIR += $${EPOCROOT}epoc32/release/armv5/lib -- cgit v0.12 From 7a53c676479c5531880793f79f0fb2e74b31fae1 Mon Sep 17 00:00:00 2001 From: axis <qt-info@nokia.com> Date: Fri, 28 Jan 2011 10:28:23 +0100 Subject: Made qmake strip trailing \ from libdirs. This was done because trailing \ would confuse the command line parser if the path was also quoted. RevBy: Oswald Buddenhagen --- qmake/generators/win32/mingw_make.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/qmake/generators/win32/mingw_make.cpp b/qmake/generators/win32/mingw_make.cpp index 9eea98f..6064080 100644 --- a/qmake/generators/win32/mingw_make.cpp +++ b/qmake/generators/win32/mingw_make.cpp @@ -381,8 +381,11 @@ void MingwMakefileGenerator::writeLibDirPart(QTextStream &t) QString libArg = QString::fromLatin1("-L"); if (project->isActiveConfig("rvct_linker")) libArg = QString::fromLatin1("--userlibpath "); - for (int i = 0; i < libDirs.size(); ++i) + for (int i = 0; i < libDirs.size(); ++i) { libDirs[i].remove("\""); + if (libDirs[i].endsWith("\\")) + libDirs[i].chop(1); + } t << valGlue(libDirs, libArg+quote, quote+" "+libArg+quote, quote) << " "; } -- cgit v0.12 From 9ca5cdd1242deaba10bd1005bcd0774da35d9779 Mon Sep 17 00:00:00 2001 From: axis <qt-info@nokia.com> Date: Mon, 31 Jan 2011 14:39:23 +0100 Subject: Fixed win32-msvc2008 build regression. We needed to move the code in the init() function to the fixTargetExt() function, which is where the variables are actually used. The reason is that fixTargetExt() runs before init(). RevBy: Miikka Heikkinen --- qmake/generators/win32/winmakefile.cpp | 13 +++++-------- qmake/generators/win32/winmakefile.h | 1 - 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/qmake/generators/win32/winmakefile.cpp b/qmake/generators/win32/winmakefile.cpp index bfe3e09..fd20452 100644 --- a/qmake/generators/win32/winmakefile.cpp +++ b/qmake/generators/win32/winmakefile.cpp @@ -57,14 +57,6 @@ Win32MakefileGenerator::Win32MakefileGenerator() : MakefileGenerator() { } -void Win32MakefileGenerator::init() -{ - if (project->isEmpty("QMAKE_EXTENSION_STATICLIB")) - project->values("QMAKE_EXTENSION_STATICLIB").append("lib"); - if (project->isEmpty("QMAKE_EXTENSION_SHLIB")) - project->values("QMAKE_EXTENSION_SHLIB").append("lib"); -} - int Win32MakefileGenerator::findHighestVersion(const QString &d, const QString &stem, const QString &ext) { @@ -362,6 +354,11 @@ void Win32MakefileGenerator::processVars() void Win32MakefileGenerator::fixTargetExt() { + if (project->isEmpty("QMAKE_EXTENSION_STATICLIB")) + project->values("QMAKE_EXTENSION_STATICLIB").append("lib"); + if (project->isEmpty("QMAKE_EXTENSION_SHLIB")) + project->values("QMAKE_EXTENSION_SHLIB").append("dll"); + if (!project->values("QMAKE_APP_FLAG").isEmpty()) { project->values("TARGET_EXT").append(".exe"); } else if (project->isActiveConfig("shared")) { diff --git a/qmake/generators/win32/winmakefile.h b/qmake/generators/win32/winmakefile.h index 7f7d2f3..fa3f292 100644 --- a/qmake/generators/win32/winmakefile.h +++ b/qmake/generators/win32/winmakefile.h @@ -59,7 +59,6 @@ class Win32MakefileGenerator : public MakefileGenerator public: Win32MakefileGenerator(); ~Win32MakefileGenerator(); - void init(); protected: virtual QString defaultInstall(const QString &); virtual void writeCleanParts(QTextStream &t); -- cgit v0.12 From 1d80690e9e52c5dff1392bf7694abf65dd51a3b8 Mon Sep 17 00:00:00 2001 From: axis <qt-info@nokia.com> Date: Thu, 24 Feb 2011 13:46:01 +0100 Subject: Fixed incorrect referral to an include file. Better to make it relative to the profile. That way it is always found, regardless of where Qt is located. RevBy: Liang Qi --- mkspecs/common/symbian/symbian-makefile.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkspecs/common/symbian/symbian-makefile.conf b/mkspecs/common/symbian/symbian-makefile.conf index cffc859..b248117 100644 --- a/mkspecs/common/symbian/symbian-makefile.conf +++ b/mkspecs/common/symbian/symbian-makefile.conf @@ -33,7 +33,7 @@ QMAKE_LINK_OBJECT_SCRIPT = objects is_using_gnupoc { DEFINES *= __QT_PRODUCT_INCLUDE_IS_LOWERCASE__ } -QMAKE_SYMBIAN_INCLUDES = $$[QT_INSTALL_DATA]/mkspecs/common/symbian/symbianincludes.h +QMAKE_SYMBIAN_INCLUDES = $$IN_PWD/symbianincludes.h symbian-armcc { QMAKE_CFLAGS += --preinclude $$QMAKE_SYMBIAN_INCLUDES QMAKE_CXXFLAGS += --preinclude $$QMAKE_SYMBIAN_INCLUDES -- cgit v0.12 From 156b4810dd39c14c16c604ba24b36a1f641d3891 Mon Sep 17 00:00:00 2001 From: axis <qt-info@nokia.com> Date: Thu, 24 Feb 2011 17:28:56 +0100 Subject: Corrected a mismerge in GCCE link parameters. RevBy: Trust me --- mkspecs/symbian-gcce/qmake.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkspecs/symbian-gcce/qmake.conf b/mkspecs/symbian-gcce/qmake.conf index e83f435..2c90a00 100644 --- a/mkspecs/symbian-gcce/qmake.conf +++ b/mkspecs/symbian-gcce/qmake.conf @@ -54,7 +54,7 @@ DEFINES += __GCCE__ \ UNICODE QMAKE_LFLAGS_APP += --entry=_E32Startup -u _E32Startup -QMAKE_LFLAGS_SHLIB += -shared --default-symver --entry _E32Dll -u _E32Dll +QMAKE_LFLAGS_SHLIB += -shared --default-symver --entry=_E32Dll -u _E32Dll QMAKE_LFLAGS_PLUGIN += $$QMAKE_LFLAGS_SHLIB gcceExtraFlags = --include=$${EPOCROOT}epoc32/include/gcce/gcce.h -march=armv5t -mapcs -mthumb-interwork -nostdinc -c -msoft-float -T script -- cgit v0.12 From 2e0fab04343cdc938d7870520b8c92631a0abc87 Mon Sep 17 00:00:00 2001 From: axis <qt-info@nokia.com> Date: Fri, 25 Feb 2011 10:24:58 +0100 Subject: Removed javascript-jit from default symbian-gcce build. It fails the build anyway. RevBy: Liang Qi --- configure | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configure b/configure index fb1ee4c..c1099f7 100755 --- a/configure +++ b/configure @@ -6434,6 +6434,8 @@ if [ "$CFG_JAVASCRIPTCORE_JIT" = "yes" ] || [ "$CFG_JAVASCRIPTCORE_JIT" = "auto" if [ $? != "0" ]; then CFG_JAVASCRIPTCORE_JIT=no fi + elif [ "$XPLATFORM" = "symbian-gcce" ]; then + CFG_JAVASCRIPTCORE_JIT=no fi fi -- cgit v0.12 From edca06ea839bf17cbadad3daddc00e636d38addb Mon Sep 17 00:00:00 2001 From: axis <qt-info@nokia.com> Date: Fri, 25 Feb 2011 13:31:27 +0100 Subject: Fixed mkspec detection for Symbian. RevBy: Liang Qi --- configure | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/configure b/configure index c1099f7..163ebc4 100755 --- a/configure +++ b/configure @@ -7115,11 +7115,10 @@ EOF canBuildWebKit="no" canBuildQtConcurrent="no" ;; - symbian/*-gcce) + symbian-gcce) canBuildWebKit="no" canBuildQtConcurrent="no" - ;; - symbian/*-armcc) + symbian-armcc) canBuildQtConcurrent="no" ;; esac -- cgit v0.12 From e05e6802a6873f1ba48148ed3b9cc8cfcbeb3d83 Mon Sep 17 00:00:00 2001 From: axis <qt-info@nokia.com> Date: Mon, 28 Feb 2011 08:45:10 +0100 Subject: Readded a ';;' that was removed by mistake. RevBy: Trust me --- configure | 1 + 1 file changed, 1 insertion(+) diff --git a/configure b/configure index 163ebc4..d064240 100755 --- a/configure +++ b/configure @@ -7118,6 +7118,7 @@ EOF symbian-gcce) canBuildWebKit="no" canBuildQtConcurrent="no" + ;; symbian-armcc) canBuildQtConcurrent="no" ;; -- cgit v0.12 From 0d9cf6f4f4b1b9c51102773ba705aa0b68bb5f7f Mon Sep 17 00:00:00 2001 From: axis <qt-info@nokia.com> Date: Thu, 3 Mar 2011 16:01:45 +0100 Subject: Disable capabilities example for symbian-gcce due to a bug in elf2e32 Phonon exports template instantiations. These exports get weak symbol binding, which is correct according to the C++ ABI, but the problem is that elf2e32 has a bug which does not transfer the weak symbols correctly to the dso file. Therefore, the example will work if you have a prebuilt Qt version and use GCCE, but not if you build Qt from scratch using GCCE. For normal non-template symbols it is not a problem since they get global bindings. RVCT also produces global bindings. RevBy: Shane Kearns --- examples/phonon/phonon.pro | 3 +++ 1 file changed, 3 insertions(+) diff --git a/examples/phonon/phonon.pro b/examples/phonon/phonon.pro index aa6ac13..c6a0bff 100644 --- a/examples/phonon/phonon.pro +++ b/examples/phonon/phonon.pro @@ -3,6 +3,9 @@ CONFIG += ordered SUBDIRS = qmusicplayer \ capabilities +# Disable capabilities example for symbian-gcce due to a bug in elf2e32. +symbian-gcce:SUBDIRS -= capabilities + # install target.path = $$[QT_INSTALL_EXAMPLES]/phonon sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS phonon.pro README -- cgit v0.12 From 7458c4bb9a0f6f925cb6002d3b664bbbc21e75ef Mon Sep 17 00:00:00 2001 From: Martin Petersson <martin.petersson@nokia.com> Date: Fri, 4 Mar 2011 12:13:20 +0100 Subject: QNAM HTTP: Fix the ioPostToHttpFromSocket auto test Introduced a ClosingState for the channel to better track the state of the socket. Reviewed-by: Markus Goetz --- src/network/access/qhttpnetworkconnection.cpp | 2 +- src/network/access/qhttpnetworkconnectionchannel.cpp | 20 +++++++++++++++----- src/network/access/qhttpnetworkconnectionchannel_p.h | 3 ++- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp index 3502113..35c3a67 100644 --- a/src/network/access/qhttpnetworkconnection.cpp +++ b/src/network/access/qhttpnetworkconnection.cpp @@ -765,7 +765,7 @@ void QHttpNetworkConnectionPrivate::_q_startNextRequest() //resend the necessary ones. for (int i = 0; i < channelCount; ++i) { - if (channels[i].resendCurrent) { + if (channels[i].resendCurrent && (channels[i].state != QHttpNetworkConnectionChannel::ClosingState)) { channels[i].resendCurrent = false; channels[i].state = QHttpNetworkConnectionChannel::IdleState; diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp index 41bc64a..60094b0 100644 --- a/src/network/access/qhttpnetworkconnectionchannel.cpp +++ b/src/network/access/qhttpnetworkconnectionchannel.cpp @@ -145,10 +145,12 @@ void QHttpNetworkConnectionChannel::init() void QHttpNetworkConnectionChannel::close() { - socket->blockSignals(true); + if (socket->state() == QAbstractSocket::UnconnectedState) + state = QHttpNetworkConnectionChannel::IdleState; + else + state = QHttpNetworkConnectionChannel::ClosingState; + socket->close(); - socket->blockSignals(false); - state = QHttpNetworkConnectionChannel::IdleState; } @@ -679,7 +681,8 @@ void QHttpNetworkConnectionChannel::allDone() reconnectAttempts = 2; // now the channel can be seen as free/idle again, all signal emissions for the reply have been done - this->state = QHttpNetworkConnectionChannel::IdleState; + if (state != QHttpNetworkConnectionChannel::ClosingState) + state = QHttpNetworkConnectionChannel::IdleState; // if it does not need to be sent again we can set it to 0 // the previous code did not do that and we had problems with accidental re-sending of a @@ -729,7 +732,8 @@ void QHttpNetworkConnectionChannel::allDone() QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection); } else if (alreadyPipelinedRequests.isEmpty()) { if (connectionCloseEnabled) - close(); + if (socket->state() != QAbstractSocket::UnconnectedState) + close(); if (qobject_cast<QHttpNetworkConnection*>(connection)) QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection); } @@ -936,6 +940,12 @@ void QHttpNetworkConnectionChannel::_q_bytesWritten(qint64 bytes) void QHttpNetworkConnectionChannel::_q_disconnected() { + if (state == QHttpNetworkConnectionChannel::ClosingState) { + state = QHttpNetworkConnectionChannel::IdleState; + QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection); + return; + } + // read the available data before closing if (isSocketWaiting() || isSocketReading()) { if (reply) { diff --git a/src/network/access/qhttpnetworkconnectionchannel_p.h b/src/network/access/qhttpnetworkconnectionchannel_p.h index 8cbc689..893d75e 100644 --- a/src/network/access/qhttpnetworkconnectionchannel_p.h +++ b/src/network/access/qhttpnetworkconnectionchannel_p.h @@ -95,7 +95,8 @@ public: WritingState = 2, // writing the data WaitingState = 4, // waiting for reply ReadingState = 8, // reading the reply - BusyState = (ConnectingState|WritingState|WaitingState|ReadingState) + ClosingState = 16, + BusyState = (ConnectingState|WritingState|WaitingState|ReadingState|ClosingState) }; QAbstractSocket *socket; bool ssl; -- cgit v0.12 From 206b614f2e9623d792e6f398bf11765a44c272f5 Mon Sep 17 00:00:00 2001 From: Peter Hartmann <peter.hartmann@nokia.com> Date: Tue, 1 Mar 2011 16:58:30 +0100 Subject: SSL backend: check at runtime for the right OpenSSL version for SNI SNI = Server Name Indication. The function "SSL_ctrl()" has been there since always in OpenSSL, but not with the specific enum SSL_CTRL_SET_TLSEXT_HOSTNAME, so let's avoid the call for older versions. Additionally, fix the resolving of SSL_CTX_load_verify_locations for Symbian (is not used in Symbian yet). Reviewed-by: Markus Goetz --- src/network/ssl/qsslsocket_openssl.cpp | 5 +++-- src/network/ssl/qsslsocket_openssl_p.h | 1 + src/network/ssl/qsslsocket_openssl_symbols.cpp | 5 ++++- src/network/ssl/qsslsocket_openssl_symbols_p.h | 1 + 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp index 455a49f1..646889c 100644 --- a/src/network/ssl/qsslsocket_openssl.cpp +++ b/src/network/ssl/qsslsocket_openssl.cpp @@ -393,14 +393,15 @@ init_context: } #if OPENSSL_VERSION_NUMBER >= 0x0090806fL && !defined(OPENSSL_NO_TLSEXT) - if (client) { + if (client && q_SSLeay() >= 0x00090806fL) { // Set server hostname on TLS extension. RFC4366 section 3.1 requires it in ACE format. QString tlsHostName = verificationPeerName.isEmpty() ? q->peerName() : verificationPeerName; if (tlsHostName.isEmpty()) tlsHostName = hostName; QByteArray ace = QUrl::toAce(tlsHostName); if (!ace.isEmpty()) { - q_SSL_ctrl(ssl, SSL_CTRL_SET_TLSEXT_HOSTNAME, TLSEXT_NAMETYPE_host_name, ace.constData()); + if (!q_SSL_ctrl(ssl, SSL_CTRL_SET_TLSEXT_HOSTNAME, TLSEXT_NAMETYPE_host_name, ace.constData())) + qWarning("could not set SSL_CTRL_SET_TLSEXT_HOSTNAME, Server Name Indication disabled"); } } #endif diff --git a/src/network/ssl/qsslsocket_openssl_p.h b/src/network/ssl/qsslsocket_openssl_p.h index 02d70f9..ca49fab 100644 --- a/src/network/ssl/qsslsocket_openssl_p.h +++ b/src/network/ssl/qsslsocket_openssl_p.h @@ -79,6 +79,7 @@ #include <openssl/x509_vfy.h> #include <openssl/dsa.h> #include <openssl/rsa.h> +#include <openssl/crypto.h> #if OPENSSL_VERSION_NUMBER >= 0x0090806fL && !defined(OPENSSL_NO_TLSEXT) #include <openssl/tls1.h> #endif diff --git a/src/network/ssl/qsslsocket_openssl_symbols.cpp b/src/network/ssl/qsslsocket_openssl_symbols.cpp index 732fc86..b1310cc 100644 --- a/src/network/ssl/qsslsocket_openssl_symbols.cpp +++ b/src/network/ssl/qsslsocket_openssl_symbols.cpp @@ -266,6 +266,7 @@ DEFINEFUNC3(DSA *, d2i_DSAPrivateKey, DSA **a, a, unsigned char **b, b, long c, DEFINEFUNC(void, OPENSSL_add_all_algorithms_noconf, void, DUMMYARG, return, DUMMYARG) DEFINEFUNC(void, OPENSSL_add_all_algorithms_conf, void, DUMMYARG, return, DUMMYARG) DEFINEFUNC3(int, SSL_CTX_load_verify_locations, SSL_CTX *ctx, ctx, const char *CAfile, CAfile, const char *CApath, CApath, return 0, return) +DEFINEFUNC(long, SSLeay, void, DUMMYARG, return 0, return) #ifdef Q_OS_SYMBIAN #define RESOLVEFUNC(func, ordinal, lib) \ @@ -606,6 +607,7 @@ bool q_resolveOpenSslSymbols() RESOLVEFUNC(SSLv3_server_method, 197, libs.first ) RESOLVEFUNC(SSLv23_server_method, 191, libs.first ) RESOLVEFUNC(TLSv1_server_method, 200, libs.first ) + RESOLVEFUNC(SSL_CTX_load_verify_locations, 34, libs.first ) RESOLVEFUNC(X509_NAME_oneline, 1830, libs.second ) RESOLVEFUNC(X509_PUBKEY_get, 1844, libs.second ) RESOLVEFUNC(X509_STORE_free, 1939, libs.second ) @@ -637,7 +639,7 @@ bool q_resolveOpenSslSymbols() #endif RESOLVEFUNC(OPENSSL_add_all_algorithms_noconf, 1153, libs.second ) RESOLVEFUNC(OPENSSL_add_all_algorithms_conf, 1152, libs.second ) - RESOLVEFUNC(SSL_CTX_load_verify_locations, 34, libs.second ) + RESOLVEFUNC(SSLeay, 1504, libs.second ) #else // Q_OS_SYMBIAN #ifdef SSLEAY_MACROS RESOLVEFUNC(ASN1_dup) @@ -766,6 +768,7 @@ bool q_resolveOpenSslSymbols() RESOLVEFUNC(OPENSSL_add_all_algorithms_noconf) RESOLVEFUNC(OPENSSL_add_all_algorithms_conf) RESOLVEFUNC(SSL_CTX_load_verify_locations) + RESOLVEFUNC(SSLeay) #endif // Q_OS_SYMBIAN symbolsResolved = true; delete libs.first; diff --git a/src/network/ssl/qsslsocket_openssl_symbols_p.h b/src/network/ssl/qsslsocket_openssl_symbols_p.h index 5aab8d7..49830ac 100644 --- a/src/network/ssl/qsslsocket_openssl_symbols_p.h +++ b/src/network/ssl/qsslsocket_openssl_symbols_p.h @@ -416,6 +416,7 @@ DSA *q_d2i_DSAPrivateKey(DSA **a, unsigned char **pp, long length); void q_OPENSSL_add_all_algorithms_noconf(); void q_OPENSSL_add_all_algorithms_conf(); int q_SSL_CTX_load_verify_locations(SSL_CTX *ctx, const char *CAfile, const char *CApath); +long q_SSLeay(); // Helper function class QDateTime; -- cgit v0.12 From 8238ca7f3d89d409221c96706eeae196199109c6 Mon Sep 17 00:00:00 2001 From: con <qtc-committer@nokia.com> Date: Thu, 3 Mar 2011 15:21:56 +0100 Subject: Inconsistency between ini case sensitivity between OS_MAC and WS_QPA. QPA sets CaseSensitive unconditionally, so if OS_MAC tries to use CaseInsensitive QSettings will assert. The patch leaves the non-QPA case unchanged. --- src/corelib/io/qsettings.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp index 92f7636..b084ca5 100644 --- a/src/corelib/io/qsettings.cpp +++ b/src/corelib/io/qsettings.cpp @@ -1004,7 +1004,7 @@ void QConfFileSettingsPrivate::initFormat() readFunc = 0; writeFunc = 0; #if defined(Q_OS_MAC) - caseSensitivity = (format == QSettings::NativeFormat) ? Qt::CaseSensitive : Qt::CaseInsensitive; + caseSensitivity = (format == QSettings::NativeFormat) ? Qt::CaseSensitive : IniCaseSensitivity; #else caseSensitivity = IniCaseSensitivity; #endif -- cgit v0.12 From d45c67d01ce28f4fb85eace1116ca751a8f02827 Mon Sep 17 00:00:00 2001 From: axis <qt-info@nokia.com> Date: Fri, 4 Mar 2011 13:13:40 +0100 Subject: Removed reference to nonexistant profile. Probably this was a result of backporting symbian-gcce support from 4.8 to 4.7. RevBy: Liang Qi --- mkspecs/symbian-gcce/qmake.conf | 1 - 1 file changed, 1 deletion(-) diff --git a/mkspecs/symbian-gcce/qmake.conf b/mkspecs/symbian-gcce/qmake.conf index 2c90a00..62a079b 100644 --- a/mkspecs/symbian-gcce/qmake.conf +++ b/mkspecs/symbian-gcce/qmake.conf @@ -4,7 +4,6 @@ include(../common/symbian/symbian-makefile.conf) -include(../common/gcc-base.conf) include(../common/g++.conf) QMAKE_CC = arm-none-symbianelf-gcc -- cgit v0.12 From cf264556fdea0d434e329e36c07a0ae6fa974f8b Mon Sep 17 00:00:00 2001 From: con <qtc-committer@nokia.com> Date: Fri, 4 Mar 2011 17:10:47 +0100 Subject: Fix 7ea1dd46966ae7cfa07fa18c001704e3c981b669 for Mac desktop builds. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cocoa.h can't be included after qscroller_p.h, but we need to have Q_WS_MAC defined before the ifdef. Reviewed-by: Morten Johan Sørvig --- src/gui/util/qscroller_mac.mm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gui/util/qscroller_mac.mm b/src/gui/util/qscroller_mac.mm index d85a51b..37756d7 100644 --- a/src/gui/util/qscroller_mac.mm +++ b/src/gui/util/qscroller_mac.mm @@ -39,13 +39,14 @@ ** ****************************************************************************/ - -#include "qscroller_p.h" +#include <QtCore/qglobal.h> #ifdef Q_WS_MAC #import <Cocoa/Cocoa.h> +#include "qscroller_p.h" + QPointF QScrollerPrivate::realDpi(int screen) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; -- cgit v0.12 From d9afcf0e84e438f89c1a8c5e26da51b06d8f61d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= <jorgen.lind@nokia.com> Date: Mon, 7 Mar 2011 17:29:24 +0100 Subject: Lighthouse: Adding Native interface to getting the native eglcontext in xcbplugin. I also reoredered how eglInitialize was executed, (its not so lazy anymore) --- .../eglconvenience/qeglplatformcontext.cpp | 5 +++ .../platforms/eglconvenience/qeglplatformcontext.h | 2 ++ src/plugins/platforms/xcb/qdri2context.cpp | 6 ++++ src/plugins/platforms/xcb/qdri2context.h | 2 ++ src/plugins/platforms/xcb/qxcbconnection.cpp | 16 +++++++++ src/plugins/platforms/xcb/qxcbconnection.h | 15 +++++--- src/plugins/platforms/xcb/qxcbintegration.cpp | 12 +------ src/plugins/platforms/xcb/qxcbnativeinterface.cpp | 40 +++++++++++++++++++++- src/plugins/platforms/xcb/qxcbnativeinterface.h | 4 ++- 9 files changed, 85 insertions(+), 17 deletions(-) diff --git a/src/plugins/platforms/eglconvenience/qeglplatformcontext.cpp b/src/plugins/platforms/eglconvenience/qeglplatformcontext.cpp index 4b83a22..22e1bdc 100644 --- a/src/plugins/platforms/eglconvenience/qeglplatformcontext.cpp +++ b/src/plugins/platforms/eglconvenience/qeglplatformcontext.cpp @@ -155,3 +155,8 @@ QPlatformWindowFormat QEGLPlatformContext::platformWindowFormat() const { return m_windowFormat; } + +EGLContext QEGLPlatformContext::eglContext() const +{ + return m_eglContext; +} diff --git a/src/plugins/platforms/eglconvenience/qeglplatformcontext.h b/src/plugins/platforms/eglconvenience/qeglplatformcontext.h index ac53559..9f3aea7 100644 --- a/src/plugins/platforms/eglconvenience/qeglplatformcontext.h +++ b/src/plugins/platforms/eglconvenience/qeglplatformcontext.h @@ -59,6 +59,8 @@ public: void makeDefaultSharedContext(); QPlatformWindowFormat platformWindowFormat() const; + + EGLContext eglContext() const; private: EGLContext m_eglContext; EGLDisplay m_eglDisplay; diff --git a/src/plugins/platforms/xcb/qdri2context.cpp b/src/plugins/platforms/xcb/qdri2context.cpp index 44b8fc2..10c9417 100644 --- a/src/plugins/platforms/xcb/qdri2context.cpp +++ b/src/plugins/platforms/xcb/qdri2context.cpp @@ -222,3 +222,9 @@ xcb_dri2_dri2_buffer_t * QDri2Context::backBuffer() return buffers; } + +void * QDri2Context::eglContext() const +{ + Q_D(QDri2Context); + return d->eglContext; +} diff --git a/src/plugins/platforms/xcb/qdri2context.h b/src/plugins/platforms/xcb/qdri2context.h index 5646565..8e4ac89 100644 --- a/src/plugins/platforms/xcb/qdri2context.h +++ b/src/plugins/platforms/xcb/qdri2context.h @@ -24,6 +24,8 @@ public: QPlatformWindowFormat platformWindowFormat() const; + void *eglContext() const; + protected: xcb_dri2_dri2_buffer_t *backBuffer(); QScopedPointer<QDri2ContextPrivate> d_ptr; diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index a2f985e..da60311 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -58,6 +58,10 @@ #include <X11/Xlib-xcb.h> #endif +#ifdef XCB_USE_EGL //dont pull in eglext prototypes +#include <EGL/egl.h> +#endif + #ifdef XCB_USE_DRI2 #include <xcb/dri2.h> #include <xcb/xfixes.h> @@ -87,6 +91,13 @@ QXcbConnection::QXcbConnection(const char *displayName) m_connection = XGetXCBConnection(dpy); XSetEventQueueOwner(dpy, XCBOwnsEventQueue); m_xlib_display = dpy; +#ifdef XCB_USE_EGL + EGLDisplay eglDisplay = eglGetDisplay(dpy); + m_egl_display = eglDisplay; + EGLint major, minor; + eglBindAPI(EGL_OPENGL_ES_API); + m_has_egl = eglInitialize(eglDisplay,&major,&minor); +#endif //XCB_USE_EGL #else m_connection = xcb_connect(m_displayName.constData(), &primaryScreen); @@ -432,6 +443,11 @@ void QXcbConnection::initializeAllAtoms() { m_allAtoms[i] = xcb_intern_atom_reply(xcb_connection(), cookies[i], 0)->atom; } +bool QXcbConnection::hasEgl() const +{ + return m_has_egl; +} + #ifdef XCB_USE_DRI2 void QXcbConnection::initializeDri2() { diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index 8a0f3d7..a7fa7fd 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -238,9 +238,14 @@ public: #ifdef XCB_USE_DRI2 bool hasSupportForDri2() const; - void *egl_display() const { return m_egl_display; } 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) + void *egl_display() const { return m_egl_display; } +#endif private slots: void eventDispatcher(); @@ -272,15 +277,17 @@ private: uint32_t m_dri2_minor; bool m_dri2_support_probed; bool m_has_support_for_dri2; - void *m_egl_display; QByteArray m_dri2_device_name; #endif - +#if defined(XCB_USE_EGL) || defined(XCB_USE_DRI2) + void *m_egl_display; + bool m_has_egl; +#endif }; #define DISPLAY_FROM_XCB(object) ((Display *)(object->connection()->xlib_display())) -#ifdef XCB_USE_DRI2 +#if defined(XCB_USE_DRI2) || defined(XCB_USE_EGL) #define EGL_DISPLAY_FROM_XCB(object) ((EGLDisplay)(object->connection()->egl_display())) #endif //endifXCB_USE_DRI2 diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp index b6df550..0981655 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.cpp +++ b/src/plugins/platforms/xcb/qxcbintegration.cpp @@ -127,17 +127,7 @@ bool QXcbIntegration::hasOpenGL() const #if defined(XCB_USE_GLX) return true; #elif defined(XCB_USE_EGL) - static bool eglHasbeenInitialized = false; - static bool wasEglInitialized = false; - if (!eglHasbeenInitialized) { - eglHasbeenInitialized = true; - const QXcbScreen *screen = static_cast<const QXcbScreen *>(m_screens.at(0)); - EGLint major, minor; - eglBindAPI(EGL_OPENGL_ES_API); - EGLDisplay disp = eglGetDisplay((Display*)screen->connection()->xlib_display()); - wasEglInitialized = eglInitialize(disp,&major,&minor); - } - return wasEglInitialized; + return m_connection->hasEgl(); #elif defined(XCB_USE_DRI2) if (m_connection->hasSupportForDri2()) { return true; diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp index f379580..8b6678b 100644 --- a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp +++ b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp @@ -5,6 +5,14 @@ #include <QtGui/private/qapplication_p.h> #include <QtCore/QMap> +#include <QtCore/QDebug> + +#if defined(XCB_USE_EGL) +#include "../eglconvenience/qeglplatformcontext.h" +#elif defined (XCB_USE_DRI2) +#include "qdri2context.h" +#endif + class QXcbResourceMap : public QMap<QByteArray, QXcbNativeInterface::ResourceType> { public: @@ -16,6 +24,7 @@ public: insert("connection",QXcbNativeInterface::Connection); insert("screen",QXcbNativeInterface::Screen); insert("graphicsdevice",QXcbNativeInterface::GraphicsDevice); + insert("eglcontext",QXcbNativeInterface::EglContext); } }; @@ -42,6 +51,9 @@ void *QXcbNativeInterface::nativeResourceForWidget(const QByteArray &resourceStr case GraphicsDevice: result = graphicsDeviceForWidget(widget); break; + case EglContext: + result = eglContextForWidget(widget); + break; default: result = 0; } @@ -72,7 +84,7 @@ void *QXcbNativeInterface::displayForWidget(QWidget *widget) void *QXcbNativeInterface::eglDisplayForWidget(QWidget *widget) { -#if defined(XCB_USE_DRI2) +#if defined(XCB_USE_DRI2) || defined(XCB_USE_EGL) QXcbScreen *screen = qPlatformScreenForWidget(widget); return screen->connection()->egl_display(); #else @@ -100,7 +112,33 @@ void *QXcbNativeInterface::graphicsDeviceForWidget(QWidget *widget) QByteArray deviceName = screen->connection()->dri2DeviceName(); return deviceName.data(); #else + Q_UNUSED(widget); return 0; #endif } + +void * QXcbNativeInterface::eglContextForWidget(QWidget *widget) +{ + Q_ASSERT(widget); + if (!widget->platformWindow()) { + qDebug() << "QPlatformWindow does not exist for widget" << widget + << "cannot return EGLContext"; + return 0; + } + QPlatformGLContext *platformContext = widget->platformWindow()->glContext(); + if (!platformContext) { + qDebug() << "QPlatformWindow" << widget->platformWindow() << "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 +} diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.h b/src/plugins/platforms/xcb/qxcbnativeinterface.h index 9815381..72c27d5 100644 --- a/src/plugins/platforms/xcb/qxcbnativeinterface.h +++ b/src/plugins/platforms/xcb/qxcbnativeinterface.h @@ -14,7 +14,8 @@ public: EglDisplay, Connection, Screen, - GraphicsDevice + GraphicsDevice, + EglContext }; void *nativeResourceForWidget(const QByteArray &resourceString, QWidget *widget); @@ -24,6 +25,7 @@ public: void *connectionForWidget(QWidget *widget); void *screenForWidget(QWidget *widget); void *graphicsDeviceForWidget(QWidget *widget); + void *eglContextForWidget(QWidget *widget); private: static QXcbScreen *qPlatformScreenForWidget(QWidget *widget); -- cgit v0.12 From d65cb0bbb17d21cce2823ace521dea9e53fe4988 Mon Sep 17 00:00:00 2001 From: Janne Hamalainen <janne.a.hamalainen@nokia.com> Date: Thu, 10 Mar 2011 10:09:08 +0200 Subject: Added Harmattan specific debian files to master branch. Debian packaging files added to Master branch. One translation file was removed as it was a left over from an old commit. Reference to it was removed from rules file. Similar commit is done for Harmattan as well. Task: BACKEND-564 Reviewed-by: Adrian Constantin --- config.profiles/harmattan/QMLViewer.desktop | 9 + config.profiles/harmattan/QMLViewer.png | Bin 0 -> 7150 bytes config.profiles/harmattan/README.source | 58 + config.profiles/harmattan/api | 120 ++ config.profiles/harmattan/changelog | 2039 ++++++++++++++++++++ config.profiles/harmattan/collection/qtdemo.qhc.uu | 231 +++ config.profiles/harmattan/compat | 1 + config.profiles/harmattan/configure-pulse.sh | 81 + config.profiles/harmattan/control | 648 +++++++ config.profiles/harmattan/libqt4-core.lintian | 1 + config.profiles/harmattan/libqt4-dbus-dbg.lintian | 1 + config.profiles/harmattan/libqt4-dbus.install | 3 + config.profiles/harmattan/libqt4-dbus.lintian | 2 + .../harmattan/libqt4-declarative-dbg.lintian | 1 + .../harmattan/libqt4-declarative-dev.lintian | 1 + .../harmattan/libqt4-declarative.install | 4 + .../harmattan/libqt4-declarative.lintian | 2 + config.profiles/harmattan/libqt4-dev.dirs | 1 + config.profiles/harmattan/libqt4-dev.install | 85 + config.profiles/harmattan/libqt4-dev.links | 13 + config.profiles/harmattan/libqt4-dev.lintian | 17 + config.profiles/harmattan/libqt4-dev.manpages | 5 + config.profiles/harmattan/libqt4-dev.postinst | 21 + config.profiles/harmattan/libqt4-dev.prerm | 16 + config.profiles/harmattan/libqt4-doc.install | 1 + config.profiles/harmattan/libqt4-doc.lintian | 1 + config.profiles/harmattan/libqt4-gui-tests.lintian | 64 + config.profiles/harmattan/libqt4-gui.lintian | 1 + config.profiles/harmattan/libqt4-help-dbg.lintian | 1 + config.profiles/harmattan/libqt4-help.install | 4 + config.profiles/harmattan/libqt4-help.lintian | 2 + config.profiles/harmattan/libqt4-meego-dbg.lintian | 1 + config.profiles/harmattan/libqt4-meego-dev.lintian | 1 + config.profiles/harmattan/libqt4-meego.lintian | 2 + .../harmattan/libqt4-meegographicssystem.install | 1 + .../libqt4-meegographicssystemhelper-dev.install | 3 + .../libqt4-meegographicssystemhelper.install | 1 + .../harmattan/libqt4-multimedia-dbg.lintian | 1 + .../harmattan/libqt4-multimedia.install | 1 + .../harmattan/libqt4-multimedia.lintian | 2 + .../harmattan/libqt4-network-dbg.lintian | 1 + config.profiles/harmattan/libqt4-network.install | 2 + config.profiles/harmattan/libqt4-network.lintian | 2 + .../harmattan/libqt4-opengl-dbg.lintian | 1 + .../harmattan/libqt4-opengl-dev.lintian | 1 + config.profiles/harmattan/libqt4-opengl.install | 2 + config.profiles/harmattan/libqt4-opengl.lintian | 3 + .../harmattan/libqt4-phonon-dbg.lintian | 1 + config.profiles/harmattan/libqt4-phonon.install | 2 + config.profiles/harmattan/libqt4-phonon.lintian | 2 + .../harmattan/libqt4-script-dbg.lintian | 1 + config.profiles/harmattan/libqt4-script.install | 3 + config.profiles/harmattan/libqt4-script.lintian | 2 + config.profiles/harmattan/libqt4-sql-dbg.lintian | 1 + .../harmattan/libqt4-sql-sqlite-dbg.lintian | 1 + .../harmattan/libqt4-sql-sqlite.install | 2 + .../harmattan/libqt4-sql-sqlite.lintian | 1 + config.profiles/harmattan/libqt4-sql.install | 2 + config.profiles/harmattan/libqt4-sql.lintian | 2 + config.profiles/harmattan/libqt4-svg-dbg.lintian | 1 + config.profiles/harmattan/libqt4-svg.install | 4 + config.profiles/harmattan/libqt4-svg.lintian | 2 + config.profiles/harmattan/libqt4-test-dbg.lintian | 1 + config.profiles/harmattan/libqt4-test.install | 2 + config.profiles/harmattan/libqt4-test.lintian | 2 + config.profiles/harmattan/libqt4-webkit.lintian | 1 + config.profiles/harmattan/libqt4-xml-dbg.lintian | 1 + config.profiles/harmattan/libqt4-xml.install | 1 + config.profiles/harmattan/libqt4-xml.lintian | 2 + .../harmattan/libqt4-xmlpatterns-dbg.lintian | 1 + .../harmattan/libqt4-xmlpatterns.install | 3 + .../harmattan/libqt4-xmlpatterns.lintian | 2 + config.profiles/harmattan/libqt4.lintian | 1 + config.profiles/harmattan/libqtcore4-dbg.lintian | 1 + config.profiles/harmattan/libqtcore4.install | 6 + config.profiles/harmattan/libqtcore4.lintian | 2 + config.profiles/harmattan/libqtgui4-dbg.lintian | 1 + config.profiles/harmattan/libqtgui4.install | 7 + config.profiles/harmattan/libqtgui4.lintian | 2 + config.profiles/harmattan/manpages/lrelease.1 | 89 + config.profiles/harmattan/manpages/lupdate.1 | 95 + config.profiles/harmattan/manpages/moc.1 | 449 +++++ config.profiles/harmattan/manpages/qmake.1 | 106 + config.profiles/harmattan/manpages/qtconfig.1 | 34 + config.profiles/harmattan/manpages/uic.1 | 136 ++ .../harmattan/mkspecs/linux-g++-cross/qmake.conf | 54 + .../mkspecs/linux-g++-cross/qplatformdefs.h | 42 + config.profiles/harmattan/not-installed | 18 + .../harmattan/patches/default_widget_size.diff | 13 + .../harmattan/patches/glshadercache.diff | 1003 ++++++++++ config.profiles/harmattan/patches/icu.diff | 732 +++++++ .../patches/no_read_pro_from_quilt_dir.diff | 13 + .../patches/pinch_gesture_sent_twice.diff | 56 + .../harmattan/patches/qgltexturecache.diff | 23 + config.profiles/harmattan/patches/qwidget_x11.diff | 39 + .../harmattan/patches/qwidget_x11_mapping.diff | 17 + .../patches/runtime-window-geometry-revert.diff | 12 + config.profiles/harmattan/patches/series | 14 + .../harmattan/patches/signon_authenticator4.diff | 230 +++ config.profiles/harmattan/patches/temppath.diff | 28 + .../harmattan/patches/tst_qprogressbar.diff | 19 + .../harmattan/patches/tst_qscrollbar.diff | 12 + .../harmattan/patches/tst_qvariant.diff | 21 + .../harmattan/qt4-acceptance-tests.lintian | 6 + .../harmattan/qt4-declarative-qmlviewer.install | 3 + .../harmattan/qt4-declarative-qmlviewer.lintian | 1 + config.profiles/harmattan/qt4-doc-html.doc-base | 11 + config.profiles/harmattan/qt4-doc-html.install | 2 + config.profiles/harmattan/qt4-doc-html.links | 2 + config.profiles/harmattan/qt4-doc.install | 3 + .../harmattan/qt4-linguist-tools.install | 4 + .../harmattan/qt4-linguist-tools.lintian | 4 + .../harmattan/qt4-linguist-tools.postinst | 16 + config.profiles/harmattan/qt4-linguist-tools.prerm | 16 + .../harmattan/qt4-maemo-auto-tests.lintian | 41 + config.profiles/harmattan/readdir-hppa-test.c | 25 + config.profiles/harmattan/rules | 404 ++++ config.profiles/harmattan/source.lintian-overrides | 5 + config.profiles/harmattan/source/format | 1 + config.profiles/harmattan/tests/create_tests_xml | 174 ++ .../harmattan/tests/libqt4-gui-tests.pro | 64 + config.profiles/harmattan/tests/maemo_tests.prf | 57 + .../harmattan/tests/qt4-acceptance-tests.pro | 6 + .../harmattan/tests/qt4-maemo-auto-tests.pro | 44 + config.profiles/harmattan/tests/tests.xml | 320 +++ config.profiles/harmattan/tests/testset.txt | 11 + .../harmattan/tests/testsuite_footer.txt | 2 + .../harmattan/tests/testsuite_header.txt | 4 + 128 files changed, 8003 insertions(+) create mode 100644 config.profiles/harmattan/QMLViewer.desktop create mode 100644 config.profiles/harmattan/QMLViewer.png create mode 100644 config.profiles/harmattan/README.source create mode 100644 config.profiles/harmattan/api create mode 100644 config.profiles/harmattan/changelog create mode 100644 config.profiles/harmattan/collection/qtdemo.qhc.uu create mode 100644 config.profiles/harmattan/compat create mode 100755 config.profiles/harmattan/configure-pulse.sh create mode 100644 config.profiles/harmattan/control create mode 100644 config.profiles/harmattan/libqt4-core.lintian create mode 100644 config.profiles/harmattan/libqt4-dbus-dbg.lintian create mode 100644 config.profiles/harmattan/libqt4-dbus.install create mode 100644 config.profiles/harmattan/libqt4-dbus.lintian create mode 100644 config.profiles/harmattan/libqt4-declarative-dbg.lintian create mode 100644 config.profiles/harmattan/libqt4-declarative-dev.lintian create mode 100644 config.profiles/harmattan/libqt4-declarative.install create mode 100644 config.profiles/harmattan/libqt4-declarative.lintian create mode 100644 config.profiles/harmattan/libqt4-dev.dirs create mode 100644 config.profiles/harmattan/libqt4-dev.install create mode 100644 config.profiles/harmattan/libqt4-dev.links create mode 100644 config.profiles/harmattan/libqt4-dev.lintian create mode 100644 config.profiles/harmattan/libqt4-dev.manpages create mode 100644 config.profiles/harmattan/libqt4-dev.postinst create mode 100644 config.profiles/harmattan/libqt4-dev.prerm create mode 100644 config.profiles/harmattan/libqt4-doc.install create mode 100644 config.profiles/harmattan/libqt4-doc.lintian create mode 100644 config.profiles/harmattan/libqt4-gui-tests.lintian create mode 100644 config.profiles/harmattan/libqt4-gui.lintian create mode 100644 config.profiles/harmattan/libqt4-help-dbg.lintian create mode 100644 config.profiles/harmattan/libqt4-help.install create mode 100644 config.profiles/harmattan/libqt4-help.lintian create mode 100644 config.profiles/harmattan/libqt4-meego-dbg.lintian create mode 100644 config.profiles/harmattan/libqt4-meego-dev.lintian create mode 100644 config.profiles/harmattan/libqt4-meego.lintian create mode 100644 config.profiles/harmattan/libqt4-meegographicssystem.install create mode 100644 config.profiles/harmattan/libqt4-meegographicssystemhelper-dev.install create mode 100644 config.profiles/harmattan/libqt4-meegographicssystemhelper.install create mode 100644 config.profiles/harmattan/libqt4-multimedia-dbg.lintian create mode 100644 config.profiles/harmattan/libqt4-multimedia.install create mode 100644 config.profiles/harmattan/libqt4-multimedia.lintian create mode 100644 config.profiles/harmattan/libqt4-network-dbg.lintian create mode 100644 config.profiles/harmattan/libqt4-network.install create mode 100644 config.profiles/harmattan/libqt4-network.lintian create mode 100644 config.profiles/harmattan/libqt4-opengl-dbg.lintian create mode 100644 config.profiles/harmattan/libqt4-opengl-dev.lintian create mode 100644 config.profiles/harmattan/libqt4-opengl.install create mode 100644 config.profiles/harmattan/libqt4-opengl.lintian create mode 100644 config.profiles/harmattan/libqt4-phonon-dbg.lintian create mode 100644 config.profiles/harmattan/libqt4-phonon.install create mode 100644 config.profiles/harmattan/libqt4-phonon.lintian create mode 100644 config.profiles/harmattan/libqt4-script-dbg.lintian create mode 100644 config.profiles/harmattan/libqt4-script.install create mode 100644 config.profiles/harmattan/libqt4-script.lintian create mode 100644 config.profiles/harmattan/libqt4-sql-dbg.lintian create mode 100644 config.profiles/harmattan/libqt4-sql-sqlite-dbg.lintian create mode 100644 config.profiles/harmattan/libqt4-sql-sqlite.install create mode 100644 config.profiles/harmattan/libqt4-sql-sqlite.lintian create mode 100644 config.profiles/harmattan/libqt4-sql.install create mode 100644 config.profiles/harmattan/libqt4-sql.lintian create mode 100644 config.profiles/harmattan/libqt4-svg-dbg.lintian create mode 100644 config.profiles/harmattan/libqt4-svg.install create mode 100644 config.profiles/harmattan/libqt4-svg.lintian create mode 100644 config.profiles/harmattan/libqt4-test-dbg.lintian create mode 100644 config.profiles/harmattan/libqt4-test.install create mode 100644 config.profiles/harmattan/libqt4-test.lintian create mode 100644 config.profiles/harmattan/libqt4-webkit.lintian create mode 100644 config.profiles/harmattan/libqt4-xml-dbg.lintian create mode 100644 config.profiles/harmattan/libqt4-xml.install create mode 100644 config.profiles/harmattan/libqt4-xml.lintian create mode 100644 config.profiles/harmattan/libqt4-xmlpatterns-dbg.lintian create mode 100644 config.profiles/harmattan/libqt4-xmlpatterns.install create mode 100644 config.profiles/harmattan/libqt4-xmlpatterns.lintian create mode 100644 config.profiles/harmattan/libqt4.lintian create mode 100644 config.profiles/harmattan/libqtcore4-dbg.lintian create mode 100644 config.profiles/harmattan/libqtcore4.install create mode 100644 config.profiles/harmattan/libqtcore4.lintian create mode 100644 config.profiles/harmattan/libqtgui4-dbg.lintian create mode 100644 config.profiles/harmattan/libqtgui4.install create mode 100644 config.profiles/harmattan/libqtgui4.lintian create mode 100644 config.profiles/harmattan/manpages/lrelease.1 create mode 100644 config.profiles/harmattan/manpages/lupdate.1 create mode 100644 config.profiles/harmattan/manpages/moc.1 create mode 100644 config.profiles/harmattan/manpages/qmake.1 create mode 100644 config.profiles/harmattan/manpages/qtconfig.1 create mode 100644 config.profiles/harmattan/manpages/uic.1 create mode 100644 config.profiles/harmattan/mkspecs/linux-g++-cross/qmake.conf create mode 100644 config.profiles/harmattan/mkspecs/linux-g++-cross/qplatformdefs.h create mode 100644 config.profiles/harmattan/not-installed create mode 100644 config.profiles/harmattan/patches/default_widget_size.diff create mode 100644 config.profiles/harmattan/patches/glshadercache.diff create mode 100644 config.profiles/harmattan/patches/icu.diff create mode 100644 config.profiles/harmattan/patches/no_read_pro_from_quilt_dir.diff create mode 100644 config.profiles/harmattan/patches/pinch_gesture_sent_twice.diff create mode 100644 config.profiles/harmattan/patches/qgltexturecache.diff create mode 100644 config.profiles/harmattan/patches/qwidget_x11.diff create mode 100644 config.profiles/harmattan/patches/qwidget_x11_mapping.diff create mode 100644 config.profiles/harmattan/patches/runtime-window-geometry-revert.diff create mode 100644 config.profiles/harmattan/patches/series create mode 100644 config.profiles/harmattan/patches/signon_authenticator4.diff create mode 100644 config.profiles/harmattan/patches/temppath.diff create mode 100644 config.profiles/harmattan/patches/tst_qprogressbar.diff create mode 100644 config.profiles/harmattan/patches/tst_qscrollbar.diff create mode 100644 config.profiles/harmattan/patches/tst_qvariant.diff create mode 100644 config.profiles/harmattan/qt4-acceptance-tests.lintian create mode 100644 config.profiles/harmattan/qt4-declarative-qmlviewer.install create mode 100644 config.profiles/harmattan/qt4-declarative-qmlviewer.lintian create mode 100644 config.profiles/harmattan/qt4-doc-html.doc-base create mode 100644 config.profiles/harmattan/qt4-doc-html.install create mode 100644 config.profiles/harmattan/qt4-doc-html.links create mode 100644 config.profiles/harmattan/qt4-doc.install create mode 100644 config.profiles/harmattan/qt4-linguist-tools.install create mode 100644 config.profiles/harmattan/qt4-linguist-tools.lintian create mode 100644 config.profiles/harmattan/qt4-linguist-tools.postinst create mode 100644 config.profiles/harmattan/qt4-linguist-tools.prerm create mode 100644 config.profiles/harmattan/qt4-maemo-auto-tests.lintian create mode 100644 config.profiles/harmattan/readdir-hppa-test.c create mode 100755 config.profiles/harmattan/rules create mode 100644 config.profiles/harmattan/source.lintian-overrides create mode 100644 config.profiles/harmattan/source/format create mode 100755 config.profiles/harmattan/tests/create_tests_xml create mode 100644 config.profiles/harmattan/tests/libqt4-gui-tests.pro create mode 100644 config.profiles/harmattan/tests/maemo_tests.prf create mode 100644 config.profiles/harmattan/tests/qt4-acceptance-tests.pro create mode 100644 config.profiles/harmattan/tests/qt4-maemo-auto-tests.pro create mode 100644 config.profiles/harmattan/tests/tests.xml create mode 100644 config.profiles/harmattan/tests/testset.txt create mode 100644 config.profiles/harmattan/tests/testsuite_footer.txt create mode 100644 config.profiles/harmattan/tests/testsuite_header.txt diff --git a/config.profiles/harmattan/QMLViewer.desktop b/config.profiles/harmattan/QMLViewer.desktop new file mode 100644 index 0000000..0f96731 --- /dev/null +++ b/config.profiles/harmattan/QMLViewer.desktop @@ -0,0 +1,9 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Name=QMLViewer +Exec=/usr/bin/qmlviewer -graphicssystem meego +Icon=/usr/share/icons/hicolor/64x64/apps/QMLViewer.png +Categories=X-MeeGo; +OnlyShowIn=X-MeeGo; diff --git a/config.profiles/harmattan/QMLViewer.png b/config.profiles/harmattan/QMLViewer.png new file mode 100644 index 0000000..a209cd0 Binary files /dev/null and b/config.profiles/harmattan/QMLViewer.png differ diff --git a/config.profiles/harmattan/README.source b/config.profiles/harmattan/README.source new file mode 100644 index 0000000..5dde0bf --- /dev/null +++ b/config.profiles/harmattan/README.source @@ -0,0 +1,58 @@ +This package uses quilt to manage all modifications to the upstream +source. Changes are stored in the source package as diffs in +debian/patches and applied during the build. + +To configure quilt to use debian/patches instead of patches, you want +either to export QUILT_PATCHES=debian/patches in your environment +or use this snippet in your ~/.quiltrc: + + for where in ./ ../ ../../ ../../../ ../../../../ ../../../../../; do + if [ -e ${where}debian/rules -a -d ${where}debian/patches ]; then + export QUILT_PATCHES=debian/patches + break + fi + done + +To get the fully patched source after unpacking the source package, cd to +the root level of the source package and run: + + quilt push -a + +The last patch listed in debian/patches/series will become the current +patch. + +To add a new set of changes, first run quilt push -a, and then run: + + quilt new <patch> + +where <patch> is a descriptive name for the patch, used as the filename in +debian/patches. Then, for every file that will be modified by this patch, +run: + + quilt add <file> + +before editing those files. You must tell quilt with quilt add what files +will be part of the patch before making changes or quilt will not work +properly. After editing the files, run: + + quilt refresh + +to save the results as a patch. + +Alternately, if you already have an external patch and you just want to +add it to the build system, run quilt push -a and then: + + quilt import -P <patch> /path/to/patch + quilt push -a + +(add -p 0 to quilt import if needed). <patch> as above is the filename to +use in debian/patches. The last quilt push -a will apply the patch to +make sure it works properly. + +To remove an existing patch from the list of patches that will be applied, +run: + + quilt delete <patch> + +You may need to run quilt pop -a to unapply patches first before running +this command. diff --git a/config.profiles/harmattan/api b/config.profiles/harmattan/api new file mode 100644 index 0000000..43ede3d --- /dev/null +++ b/config.profiles/harmattan/api @@ -0,0 +1,120 @@ +interface: Phonon +type: library +libs-pkg: libqt4-phonon +dev-pkg: libqt4-dev +state: stable +scope: Nokia MeeGo +headers: /usr/include/qt4/phonon/* + +interface: QtCore +type: library +libs-pkg: libqtcore4 +dev-pkg: libqt4-dev +state: stable +scope: Nokia MeeGo +headers: /usr/include/qt4/QtCore/* + +interface: QtDBus +type: library +libs-pkg: libqt4-dbus +dev-pkg: libqt4-dev +state: stable +scope: Nokia MeeGo +headers: /usr/include/qt4/QtDBus/* + +interface: QtDeclarative +type: library +libs-pkg: libqt4-declarative +dev-pkg: libqt4-dev +state: stable +scope: Nokia MeeGo +headers: /usr/include/qt4/QtDeclarative/* + +interface: QtGui +type: library +libs-pkg: libqtgui4 +dev-pkg: libqt4-dev +state: stable +scope: Nokia MeeGo +headers: /usr/include/qt4/QtGui/* + +interface: QtHelp +type: library +libs-pkg: libqt4-help +dev-pkg: libqt4-dev +state: stable +scope: Nokia MeeGo +headers: /usr/include/qt4/QtHelp/* + +interface: QtMultimedia +type: library +libs-pkg: libqt4-multimedia +dev-pkg: libqt4-dev +state: stable +scope: Nokia MeeGo +headers: /usr/include/qt4/QtMultimedia/* + +interface: QtNetwork +type: library +libs-pkg: libqt4-network +dev-pkg: libqt4-dev +state: stable +scope: Nokia MeeGo +headers: /usr/include/qt4/QtNetwork/* + +interface: QtOpenGL +type: library +libs-pkg: libqt4-opengl +dev-pkg: libqt4-dev libqt4-opengl-dev +state: stable +scope: Nokia MeeGo +headers: /usr/include/qt4/QtOpenGL/* + +interface: QtScript +type: library +libs-pkg: libqt4-script +dev-pkg: libqt4-dev +state: stable +scope: Nokia MeeGo +headers: /usr/include/qt4/QtScript/* + +interface: QtSql +type: library +libs-pkg: libqt4-sql-sqlite libqt4-sql +dev-pkg: libqt4-dev +state: stable +scope: Nokia MeeGo +headers: /usr/include/qt4/QtSql/* + +interface: QtSvg +type: library +libs-pkg: libqt4-svg +dev-pkg: libqt4-dev +state: stable +scope: Nokia MeeGo +headers: /usr/include/qt4/QtSvg/* + +interface: QtTest +type: library +libs-pkg: libqt4-test +dev-pkg: libqt4-dev +state: stable +scope: Nokia MeeGo +headers: /usr/include/qt4/QtTest/* + +interface: QtXml +type: library +libs-pkg: libqt4-xml +dev-pkg: libqt4-dev +state: stable +scope: Nokia MeeGo +headers: /usr/include/qt4/QtXml/* + +interface: QtXmlPatterns +type: library +libs-pkg: libqt4-xmlpatterns +dev-pkg: libqt4-dev +state: stable +scope: Nokia MeeGo +headers: /usr/include/qt4/QtXmlPatterns/* + diff --git a/config.profiles/harmattan/changelog b/config.profiles/harmattan/changelog new file mode 100644 index 0000000..b04d788 --- /dev/null +++ b/config.profiles/harmattan/changelog @@ -0,0 +1,2039 @@ +qt4-x11 (4.7.2~git20110302-0maemo1) unstable; urgency=low + + * Pull from upstream + * Fixes: NB#226454 - QDeclarativeTextInput::mousePressEvent() doesn't + call QInputContext::mouseHandler() + * Fixes: NB#220280 - QImage forever loops on SVG + * Fixes: NB#222060 - PIN UI freezes if "Continue offline" dialog is + shown before PIN query + * Fixes: NB#230591 - Regression from QFuture change + + -- Petri Latvala <ext-petri.latvala@nokia.com> Wed, 02 Mar 2011 12:06:31 +0200 + +qt4-x11 (4.7.2~git20110221-0maemo1) unstable; urgency=low + + * Pull from upstream + * Fixes: NB#227660 - QFuture uses internally QTime, instead of + QElapsedTimer + * Fixes: NB#226474 - imMicroFocus query on QML TextInput returns the + start of preedit instead of cursor position + * Fixes: NB#208927 - X dithering looks better than meego + graphicssystem one + * Fixes: NB#224327 - Malformed windows icons cause out of bounds + writes + * Fixes: NB#224413 - XPM files crash QImage (write) + + -- Petri Latvala <ext-petri.latvala@nokia.com> Mon, 21 Feb 2011 14:15:37 +0200 + +qt4-x11 (4.7.2~git20110215-0maemo1) unstable; urgency=low + + * Pull from upstream + * Fixes: NB#224314 - malformed bmp's cause QImage to write out of + bounds + * Fixes: NB#225732 - QGraphicsItem::ItemStopsClickFocusPropagation + doesn't stop propagation + * Fixes: NB#221924 - Morpheus crashes when network connection is lost + * Fixes: NB#218317 - All capital "i" in turkish is wrong inside of + buttons. + + -- Petri Latvala <ext-petri.latvala@nokia.com> Thu, 17 Feb 2011 11:50:12 +0200 + +qt4-x11 (4.7.2~git20110208-0maemo1) unstable; urgency=low + + * Pull from upstream + * Fixes: NB#217912 - Deadlock after changes in qprocess_unix + * Fixes: NB#217850 - floating point compiler optimization has no + effect + * Fixes: NB#226130 - QtQuick 1.1 integration + * Fixes: NB#226478 - TextEdit and TextInput need text selection modes + * Fixes: NB#226484 - TextInput selectWord() on word's first letter + often selects two words + + -- Petri Latvala <ext-petri.latvala@nokia.com> Wed, 09 Feb 2011 15:54:33 +0200 + +qt4-x11 (4.7.2~git20110203-0maemo1) unstable; urgency=low + + * Pull from upstream + * Fixes: NB#215586 - Qt make unnecessary X calls on each mouse move + event QETWidget::translateXI2Event + * Fixes: NB#210752 - Text in QML application disappears after + application is restored from task switcher + * Fixes: NB#221806 - Subsequent signal networkAccessibleChanged + emitting problem of class QNetworkAccessManager + * Fixes: NB#218404 - Memory leaks in qx11embed_x11.cpp + * Fixes: NB#218410 - Fix error case in getNetWmState() in + qwidget_x11.cpp + * Fixes: NB#225875 - Integrate + 1137379e98cab8cc67fac70b31c97001c4473eb0 + + -- Petri Latvala <ext-petri.latvala@nokia.com> Tue, 08 Feb 2011 10:13:03 +0200 + +qt4-x11 (4.7.2~git20110119-0maemo2) unstable; urgency=low + + * Fixes: NB#221230 - libqt4-meegographicssystemhelper needs to depend + on libqt4-meegographicssystem instead of recommends + + -- Petri Latvala <ext-petri.latvala@nokia.com> Mon, 24 Jan 2011 10:08:26 +0200 + +qt4-x11 (4.7.2~git20110119-0maemo1) unstable; urgency=low + + * Pull from upstream + * Fixes: NB#212758 - creating a QPixmap triggers creation of the + qt_gl_share_widget + * Fixes: NB#219685 - QSystemSemaphore and QSharedMemory are influenced + by TMPDIR + * Fixes: NB#188780 - Items in larger layout are not centered + * Fixes: NB#218317 - All capital "i" in turkish is wrong inside of + buttons. + * Fixes: NB#216667 - libqt4-meego-dev is not available for i386 at all + * Fixes: NB#214064 - Latest focus changes break some platform + components + + -- Petri Latvala <ext-petri.latvala@nokia.com> Wed, 19 Jan 2011 17:06:16 +0200 + +qt4-x11 (4.7.2~git20110111-0maemo1) unstable; urgency=low + + * Pull from upstream + * Fixes: NB#205680 - meego graphicssystem clears scene even if + Qt::WA_OpaquePaintEvent is set + * Fixes: NB#215368 - QMeeGoSwitchEvent's eventNumber() is not static + and the class is not exported + * Fixes: NB#211573 - Qt not configured with -dbus-linked + * Fixes: NB#211951 - Qt unnecessary build dependency to libxcursor-dev + * Fixes: NB#214064 - Latest focus changes break some platform + components + * Fixes: NB#216968 - QHostInfoCache should use QElapsedTimer instead + of QTime + + -- Petri Latvala <ext-petri.latvala@nokia.com> Wed, 12 Jan 2011 12:23:50 +0200 + +qt4-x11 (4.7.2~git20101231-0maemo1) unstable; urgency=low + + * Pull from upstream + * Fixes: NB#213183 - Ensure two Qt raster fixes are released. + * Fixes: NB#215639 - Need to repopulate texture glyph cache after + recreating GL context + * Fixes: NB#212887 - would be possible to open these descriptors on- + demand + * Fixes: NB#195919 - Check whether shader compilation can be improved + * Fixes: NB#195442 - OpenGL paint engine produces artifacts with big + images + * Fixes: NB#186988 - opengl render Chinese text: fast change text, + text become black block. + + -- Petri Latvala <ext-petri.latvala@nokia.com> Mon, 03 Jan 2011 13:50:51 +0200 + +qt4-x11 (4.7.2~git20101209-0maemo1) unstable; urgency=low + + * Pull from upstream + * Fixes: NB#205593 - Any app using meegotouch prints to console when started + * Fixes: NB#206111 - Sometimes MLabels apppear empty even if the text is set + * Fixes: NB#208617 - QtProxyFactory does not return correct (any) proxy data + * Fixes: NB#209473 - <UninitVar> qgraphicslayoutitem.cpp:143 + * Fixes: NB#209863 - Qt tries to use id of a destroyed window + * Fixes: NB#210024 - MGS should provide translucency on a per-window basis + * Fixes: NB#210594 - Integration of focus change fixes + * Fixes: NB#210599 - QDeclarativeEngine object ownership issues + * Fixes: NB#210416 - Framerate in portrait is significantly lower than + in landscape + * Fixes: NB#199755 - Network session error when attempting to open + network session + * Fixes: NB#201619 - Synchronization is stuck in the progress + indicator screen when the internet is interrupted while sync + * Fixes: NB#209996 - Backup options view:Text inside the text box not + displayed properly in potrait mode + * Fixes: NB#194987 - Not all the synced contacts with S60 (N97 mini) + have an avatar + * Fixes: NB#206740 - Event handling in x11EventSourceDispatch is slow + * Fixes: NB#207115 - Qt calls eglSwapBuffers when no painting happened + * Fixes: NB#206119 - QSizePolicy causes the performance slow down + + -- Petri Latvala <ext-petri.latvala@nokia.com> Thu, 16 Dec 2010 12:22:45 +0200 + +qt4-x11 (4.7.2~git20101130-0maemo6) unstable; urgency=low + + * Fixes: NB#198573 - Need for Signals from Qt indicating aboutToSwich and swiched state + * Fixes: NB#194509 - Network access from a Qt app makes dbus daemon consume tons of cpu + * Fixes: NB#165283 - artificial emboldening doesn't work + + -- Petri Latvala <ext-petri.latvala@nokia.com> Tue, 07 Dec 2010 15:31:57 +0200 + +qt4-x11 (4.7.2~git20101130-0maemo4) unstable; urgency=low + + * Fixes: NB#205453 - Qt Update cause blocker performance drop in browser. + + -- Petri Latvala <ext-petri.latvala@nokia.com> Fri, 10 Dec 2010 13:21:07 +0200 + +qt4-x11 (4.7.1~git20101130.really.4.7.1~git20101118-0maemo3) unstable; urgency=low + + * Revert to previous release. + + -- Petri Latvala <ext-petri.latvala@nokia.com> Fri, 03 Dec 2010 11:24:03 +0200 + +qt4-x11 (4.7.1~git20101118-0maemo2) unstable; urgency=low + + * Proper workaround for bug 196954. + + -- Petri Latvala <ext-petri.latvala@nokia.com> Mon, 29 Nov 2010 14:05:44 +0200 + +qt4-x11 (4.7.1~git20101118-0maemo1) unstable; urgency=low + + * Pull from upstream + * Enable using OpenGL scissor test + * Fixes: NB#188174 - The effect of filling massive amount of html <div> elements with color ... + * Fixes: NB#194032 - Gallery crashed random while slideshow is going on + * Fixes: NB#193247 - Slider widget crashes WG in a given scenario + * Fixes: NB#199790 - Qt sends touch point update event too late on release. + * Fixes: NB#200091 - Random crashes observed when trying to paste value + * Fixes: NB#163620 - QtTest headers prevent compilation with -Wshadow -Werror + * Fixes: NB#189468 - <Safety> Invalid read reported by valgrind in libX11 when analysing accounts-ui application + * Fixes: NB#191811 - <Safety> Invalid read frequently reported in scratchbox + * Fixes: NB#193881 - Image format autodetection causes unnecessary lseeks + * Fixes: NB#198023 - GLib >= 2.22 requires use of g_main_context_push_thread_default in QEventDispatcher when a QThread is created + * Fixes: NB#202866 - MeeGo graphicssystem dithering for textures with alpha channel looks crappy + * Fixes: NB#204234 - obsolete driver work-around + * Fixes: NB#204890 - device lock prompt keeps reappearing + * Fixes: NB#194345 - CoreWeb: 950 coredumps with stacktrace ending in QGestureManager::deliverEvents() + * Fixes: NB#204098 - qstrtod does not reset errno + * Fixes: NB#161439 - Using optimizations causes trouble + * Fixes: NB#186988 - opengl render Chinese text: fast change text, text become black block + * Fixes: NB#193505 - after maximizing applications fonts are sometimes corrupted + * Fixes: 204443 - Pinch gesture semantics change + + -- Petri Latvala <ext-petri.latvala@nokia.com> Mon, 22 Nov 2010 12:05:12 +0200 + +qt4-x11 (4.7.1~git20101111.really.4.7.1~git20101103-0maemo2) unstable; urgen + + * Revert to previous released version + + -- Petri Latvala <ext-petri.latvala@nokia.com> Fri, 19 Nov 2010 10:50:40 + + +qt4-x11 (4.7.1~git20101103-0maemo1) unstable; urgency=low + + * Pull from upstream + * Provide menu link and icon for QMLViewer + * Remove backported QScroller patch, it is to be used externally + * Fixes: NB#196806 - <MemLeak> Memory leak in feednamespacepluginmanager.cpp + * Fixes: NB#164431 - Blocking dialog doesn't work correctly + * Fixes: NB#170001 - QTouchEvent::touchpoint's isPrimary -method returns always false + * Fixes: NB#191116 - <MemLeak> Memory leak reported by valgrind on device, in XIQueryPointer.c + * Fixes: NB#198833 - Qt forgets to initialize members of QSharedPointer and its helpers + * Fixes: NB#200433 - cannot compile QMeeGoLivePixmap::livePixmapWithSize + + -- Petri Latvala <ext-petri.latvala@nokia.com> Thu, 04 Nov 2010 12:14:46 +0200 + +qt4-x11 (4.7.1~git20101021-0maemo1) unstable; urgency=low + + * Pull from upstream + * Previous problem with the experimental client decorations are + * now fixed, enable them again. + * Fixes: NB#195540 - libqt4-doc has extra <tr> tags + * Fixes: NB#198766 - MeeGo graphicssystem does not create proper deep copies of QPixmaps + * Fixes: NB#194397 - /usr/lib/qt4/imports/Qt/labs/ missing from packages + + -- Petri Latvala <ext-petri.latvala@nokia.com> Thu, 21 Oct 2010 16:01:33 +0300 + +qt4-x11 (4.7.1~git20101008-0maemo2) unstable; urgency=low + + * Disable experimental client decorations again + * Fixes: NB#196543 - libQtMeeGoGraphicsSystemHelper not shipped with latest packages + * Fixes: NB#196712 - SVG and PNG data URIs don't work in offline mode + * Fixes: NB#197530 - Missing menu items from ui-file + + -- Petri Latvala <ext-petri.latvala@nokia.com> Fri, 15 Oct 2010 11:49:02 +0300 + +qt4-x11 (4.7.1~git20101008-0maemo1) unstable; urgency=low + + * Pull from upstream + * Backport QScroller from 4.8 + * Fixes: NB#184580 - QGraphicsItem::setCacheMode(DeviceCoordinateCache) unefficient in portrait mode + * Fixes: NB#191792 - QML: clickable items in GridView intermittently unresponsive on B2 hardware + * Fixes: NB#189797 - Qt build-depends circular dependency + * Fixes: NB#183846 - VKB adds and accumulates _NET_WM_STATE atoms when ever it's shown + * Fixes: 192385 - QML: runtime.orientation doesn't change when device orientation changes + * Fixes: NB#197181 - host binaries in libqt4-dev do not work in x86 target + + -- Petri Latvala <ext-petri.latvala@nokia.com> Fri, 08 Oct 2010 14:14:42 +0300 + +qt4-x11 (4.7.1~git20101001-0maemo1) unstable; urgency=low + + * Pull from upstream + * Cross-compile Qt and install both host and native binaries + * of build tools + * Enable experimental client decorations + * Fixes: NB#191476 - Wrong reordering of Bidi Text in Labels + * Fixes: NB#186087 - QGraphicsItem never gets focusOutEvent on hide + * Fixes: NB#186988 - opengl render Chinese text: fast change text, text become black block + * Fixes: NB#189686 - connecting to dbus slows down MApplication c'tor creation by ~80ms + * Fixes: NB#188145 - Network interface doesn't go down after last client disconnects + * Fixes: NB#189001 - Qt4.7 bearer management icd plugin uses embedded libconninet + + -- Petri Latvala <ext-petri.latvala@nokia.com> Fri, 01 Oct 2010 12:44:54 +0300 + +qt4-x11 (4.7.0~git20100917-0maemo1) unstable; urgency=low + + * Pull from upstream + * Fixes: NB#187981 - Device hangs up when region is set to Arabic language. + * Fixes: NB#163798 - QRasterPaintEnginePrivate::drawImage using memcpy instead of ARM optimized implementation + * Fixes: NB#187851 - Font rendering issues with Nokia font + * Fixes: NB#190817 - libqt4-doc has extra </div> and <tr> tags + * Fixes: NB#191880 - QPixmap::size() should return 0x0 when there is no data + * Fixes: NB#193700 - Pinching in calendar weekly view regression + + -- Petri Latvala <ext-petri.latvala@nokia.com> Tue, 21 Sep 2010 10:48:49 +0300 + +qt4-x11 (4.7.0~git20100827-0maemo1) unstable; urgency=low + + * Pull from upstream + * Fixes: NB#189487 - qt4-x11 fails to build due to problems with opening data base file doc/qch/qt.qch + * Fixes: NB#174335 - Pinch gesture events are sent twice to application + * Fixes: NB#175685 - QTextDocument setTextDirection without QStaticText is not obeyed in Qt 4.7 + * Fixes: NB#185563 - QTouchEvents are not correctly delivered to widgets + + -- Bojan Radakovic <bojan.radakovic@nokia.com> Mon, 06 Sep 2010 16:48:24 +0300 + +qt4-x11 (4.7.0~git20100823-0maemo2) unstable; urgency=low + + * Fixes: NB#178358 - Qt doc package missing + * Stop building QtWebKit library from Qt source tree. QtWebKit will + * be delivered as an independent package. + + -- Bojan Radakovic <bojan.radakovic@nokia.com> Tue, 31 Aug 2010 10:10:15 +0300 + +qt4-x11 (4.7.0~git20100823-0maemo1) unstable; urgency=low + + * Pull from upstream + * Fixes: NB#178358 - Qt doc package missing + * Fixes: NB#183896 - QAuthenticator need to be patched to enable signon usage for authentication + * Fixes: NB#176070 - QNetworkAccessManager can't be used in QThreads + * Fixes: NB#176651 - Height for Width in QGraphicsLayout + * Fixes: NB#174429 - Qt source packages are missing API files + + -- Stefano Pironato <stefano.pironato@nokia.com> Tue, 24 Aug 2010 14:11:00 +0300 + +qt4-x11 (4.7.0~git20100811-0maemo1) unstable; urgency=low + + * Pull from upstream + * Fixes: NB#165683 - QGraphicsGridLayout::setColumnSpacing is used even after item has been removed + * Fixes: NB#172554 - POP: Random fenix crash @ "QAbstractSocket::writeData" when move to option selected + * Fixes: NB#175618 - qDrawBorderPixmap is not executing correctly when borders are too thick + * Fixes: NB#176643 - Segmentation fault occurs while using networking + * Fixes: NB#180034 - we need QTBUG-11213 fixed in Harmattan - QUuid::createUuid() is not random at all + * Fixes: NB#182005 - Unable to build libmcontentwidgets package with libqt4 4.7.0~git20100716-0maemo1+0m6 + + -- Bojan Radakovic <bojan.radakovic@nokia.com> Wed, 11 Aug 2010 11:03:15 +0200 + +qt4-x11 (4.7.0~git20100716-0maemo1) unstable; urgency=low + + * Pull from upstream + * Fixes: NB#176070 - QNetworkAccessManager can't be used in QThreads + * Fixes: NB#180047 - Call UI gets shrunken while calling any number + * Fixes: NB#174856 - QNetworkAccessManager broken in 4.7.0~git20100609-0maemo1+0m6 + * Fixes: NB#179240 - QFile::read does not advance the stream + * Fixes: NB#173119 - Bidirectional Text Rendering in Arabic language is broken with Latin characters + * Fixes: NB#161897 - DuiInfoBanner's setBodyText ignores <br/> tag + * Fixes: NB#177478 - QAuthenticator should have property map + + -- Janne Hamalainen <janne.a.hamalainen@nokia.com> Thu, 22 Jul 2010 11:19:09 +0200 + +qt4-x11 (4.7.0~git20100704-0maemo1) unstable; urgency=low + + * Fixes: NB#172773 - celluid process is causing the wakeups in idle mode + * Fixes: NB#175064 - QNetworkSession signals wrong state after calling stop() + + -- Adrian Constantin <adrian.constantin@nokia.com> Mon, 5 Jul 2010 14:39:09 +0200 + +qt4-x11 (4.7.0~git20100614-0maemo2) unstable; urgency=low + + * Fixes: NB#167514 - [browser-blocker] Multitouch events don't work if application is launched during device start-up + * Fixes: NB#175383 - qt4-acceptance-tests fail during ART Execution + + -- Adrian Constantin <adrian.constantin@nokia.com> Mon, 5 Jul 2010 14:39:09 +0200 + +qt4-x11 (4.7.0~git20100614-0maemo1) unstable; urgency=low + + * Pull from upstream + * Fixes: NB#172906 - Majority of applications crashing on exit + * Fixes: NB#173866 - Data added to HTML5 database doesn't get flushed/persisted to database + * Fixes: NB#173250 - QGLContext can create end up creating a QWidget during the QApplication destructor, leading to crash + + -- Adrian Constantin <adrian.constantin@nokia.com> Tue, 15 Jun 2010 11:14:33 +0200 + +qt4-x11 (4.7.0~git20100609-0maemo1) unstable; urgency=low + + * Pull from upstream + * Fixes: NB#170006 - Qt 4.7 singleShot timer calls function immediately instead of at the next event loop + * Fixes: NB#167058 - TapGesture not working + * Fixes: NB#173089 - The Qt 4.7 does not compile icd bearermanagement network plugin + * Fixes: NB#172749 - If grabGesture() called QGraphicsWidget will crash in deletion + * Fixes: NB#155179 - (QTBUG-9707) qpainter->drawTiledPixmap cause slow call of QX11PixmapData::toImage. + + -- Bojan Radakovic <bojan.radakovic@nokia.com> Thu, 10 Jun 2010 16:46:15 +0200 + +qt4-x11 (4.6.3~git20100602.0.4.7-0maemo1) unstable; urgency=low + + * Release Qt 4.7. The version still keeps the 4.6.3 package version, + * in order to allow for emergency rollback to Qt 4.6. + * Fixes: NB#161556 - [METABUG] Integrate Qt 4.7 into Harmattan + * Fixes: NB#151100 - (QT-2948) The Qt Reg-Exp engine sometimes gives false positive empty match + * Fixes: NB#157450 - Frequent use of QTime in animation related routines causes bad performance + * Fixes: NB#156908 - Qt's QTime::currentTime is slow + * Fixes: NB#166193 - MDialog crashes with ~40% likelihood + * Fixes: NB#170944 - Gesture not delivered to a QGraphicsWidget, asserts inside Qt + + -- Adrian Constantin <adrian.constantin@nokia.com> Wed, 4 Jun 2010 12:46:15 +0300 + +qt4-x11 (4.6.3~git20100521-0maemo2) unstable; urgency=low + + * Pull from upstream + * Fixes: NB#169433 - when freeing a QQLWidget not all memory is actually freed + * Fixes: NB#165175 - a class inherited from QDBusInterface can't invoke a method + + -- Janne Hamalainen <janne.a.hamalainen@nokia.com> Tue, 25 May 2010 10:13:31 +0300 + +qt4-x11 (4.6.3~git20100514-0maemo2) unstable; urgency=low + + * Pull from upstream + * Fixes: NB#164183 - Random gestureEvent crashes + + -- Bojan Radakovic <bojan.radakovic@nokia.com> Tue, 18 May 2010 12:57:30 +0300 + +qt4-x11 (4.6.3~git20100411-0maemo1) unstable; urgency=low + + * Pull from upstream + * Fixes: NB#162327 unlocking the device causes a segfault in any app open in foreground + * Fixes: NB#163414 Crash when hiding VKB and keep finger on screen. + * Fixes: NB#160270 <MemLeak> valgrind report shows memory leak for QImage::save() + + -- Bojan Radakovic <bojan.radakovic@nokia.com> Mon, 12 Apr 2010 13:51:00 +2000 + +qt4-x11 (4.6.3~git20100319-0maemo1) unstable; urgency=low + + * Pull from upstream + * Multi-touch support + * Fixes: NB#159993 Qt is freezing application for 2 seconds when calling showFullScreen + * Fixes: NB#155384 Make drawGlyphs API public + + -- Stefano Pironato <stefano.pironato@nokia.com> Fri, 19 Mar 2010 15:31:00 +2000 + +qt4-x11 (4.6.3~git20100310-0maemo1) unstable; urgency=low + + * Pull from upstream + * Fixes: NB#146992 Double tap doesn't get recognized in MAFW test gui + * Fixes: NB#134295 QDBusInterface::callWithCallback deadlocks if called from the callWithCallback error callback + + -- Bojan Radakovic <bojan.radakovic@nokia.com> Mon, 15 Mar 2010 12:34:26 +2000 + +qt4-x11 (4.6.3~git20100224-0maemo1) unstable; urgency=low + + * Pull from upstream + * Remove Qt3Support + * Add lconvert + * Fixes: NB#154800 Using -opensource configuration in maemo6 + * Fixes: NB#158708 Googleplugin crashes while configuring google account + * Fixes: NB#158242 all unit tests for quillimagefilter-tests are core dumped + * Fixes: NB#157696 QDBusServiceWatcher watches only one service at a time + + -- Janne Hamalainen <janne.a.hamalainen@nokia.com> Wed, 24 Feb 2010 11:34:26 +2000 + +qt4-x11 (4.6.2~git20100205-0maemo1) unstable; urgency=low + + * Pull from upstream + * Fixes: NB#142357 - (#QT-2307) Using QDBus::CallMode other than + * QDBus::Block produces invalid reply + * Fixes: NB#138587 - QGraphicsGridLayout row span feature is not working properly + * Fixes: NB#153726 - QtMultimedia module is not packaged + + -- Adrian Constantin <adrian.constantin@nokia.com> Fri, 12 Feb 2010 12:20:26 +2000 + +qt4-x11 (4.6.1~git20091228.4-0maemo1) unstable; urgency=low + + * Turn off the HW multi-touch implementation using kernel device API. + * Removed Qt Assistant and Designer packages. + * Fixes: NB#148497 - Devel package missing requires for some libraries + * Fixes: NB#151088 - Packaging of the Qt4.6 developer tools + + -- Adrian Constantin <adrian.constantin@nokia.com> Thu, 14 Jan 2010 12:43:37 +2000 + +qt4-x11 (4.6.1~git20091228.2-0maemo1) unstable; urgency=low + + * Fixes: NB#144690 - Please cherrypick ConsumeEventHint patch (Gesture) + * Fixes: NB#143903 - Application not working in none gui mode -> The KDE libs cannot be installed. + * Fixes: NB#143427 - Qt 4.6 - lrelease does not accept empty <source> + * Fixes: NB#147283 - All DUI application crash in scratchbox + * Fixes: NB#147461 - QVariant::isNull() == true after QVariant::setValue() + * Fixes: NB#149547 - With latest Qt 20091127 Clock application is closing on setting alarm operation + * Fixes: NB#117725 - sb2 cannot build camera-ui + * Fixes: NB#148359 - webkit traverse fixture links against phonon but it is not in package dependencies + * Fixes: NB#148082 - Performance of the graphics view drops when text element is rotated + * Fixes: NB#142507 - QTimeLine's signals are not sent while an object is being dragged with mouseMoveEvent() + * Fixes: NB#147744 - Translucent QGLWidgets no longer works + * Fixes: NB#150790 - QWebKit based application crashes when executing SunSpider + * Fixes: NB#150808 - Loading a web page from network to qwebview fails on columbus + + -- Stefano Pironato <stefano.pironato@nokia.com> Tue, 05 Jan 2010 11:10:00 +2000 + +qt4-x11 (4.6.0~git20091030.2-0maemo1) unstable; urgency=low + + * Fixes: NB#129594 - Qt compiled without compiler optimization + * The X org package does not support the MIT SHM extension anymore, + so the MIT SHM option is removed from Qt configuration also. + + -- Adrian Constantin <adrian.constantin@nokia.com> Fri, 20 Nov 2009 16:59:11 +2000 + +qt4-x11 (4.6.0~git20091030-0maemo1) unstable; urgency=low + + * Pull from upstream + * Fixes: NB#134295 - QDBusInterface::callWithCallback deadlocks if called from the callWithCallback error callback + * Fixes: NB#133005 - enabling accessibility while building Qt + * Fixes: NB#144501 - Application launcher does not start with the new Qt 4.6 versions + * Fixes: NB#129494 - Qt compiled without compiler optimization + + -- Adrian Constantin <adrian.constantin@nokia.com> Fri, 30 Oct 2009 15:13:18 +1000 + +qt4-x11 (4.6.0~git20091012-0maemo1) unstable; urgency=low + + * Fixes: NB#141280 - libqt4-dev.postinst rules for Qt4.6 wrong + * Fixes: NB#133500 - libqt4-dev postinst is broken by update-alternatives from dpkg 1.15 + * Fixes: NB#142136 - Error in satisfying dependencies for qt4-x11 + + -- Stefano Pironato <stefano.pironato@nokia.com> Thu, 12 Oct 2009 10:30:00 +0300 + +qt4-x11 (4.6.0~git20091008-0maemo1) unstable; urgency=low + + * Fixes NB#141891: - Compiling a library which uses QStateMachine doesn't work + * Modify rpath-link options to adapt to armel scratchbox environment + + -- Adrian Constantin <adrian.constantin@nokia.com> Wed, 08 Oct 2009 11:18:37 +0300 + +qt4-x11 (4.6.0~git20091002-0maemo1) unstable; urgency=low + + * Pull from upstream + * Fixes: NB#141550 - Error in qdatastream.h in libqt4-dev 4.6.0~git20091001-0maemo1+0m6 + * Fixes: NB#140293 - applet titles in applet library are not shown properly - added PATCH in qt changing glyph cache + * Fixes: NB#140727 - Enable multitouch support on device + * Fixes: NB#123012 - QPainter::drawTiledPixmap does not work properly with + non-power-of-two pixmaps when used in a DuiWidgetView + + -- Stefano Pironato <stefano.pironato@nokia.com> Thu, 01 Oct 2009 15:08:32 +0300 + +qt4-x11 (4.6.0~git20090925-0maemo1) unstable; urgency=low + + * Pull from upstream + * Fixes: NB#140735 - QtGui 4.6 should have dependency to EGL + * Fixes: NB#139269 - qmake CONFIG=debug does not add -g + + -- Adrian Constantin <adrian.constantin@nokia.com> Fri, 25 Sep 2009 15:48:32 +0300 + +qt4-x11 (4.6.0~git20090911-0maemo1) unstable; urgency=low + + * Pull from upstream + * Fixes: NB#111282 - Homescreen rotation takes too long + * Fixes: NB#110604 - DuiLayouts using DuiFlowLayoutPolicy don't resize properly + * Fixes: NB#121054 - Items being not painted until update()/paint() explicitly called + + -- Adrian Constantin <adrian.constantin@nokia.com> Fri, 11 Sep 2009 15:17:33 +0300 + +qt4-x11 (4.6.0~git20090909-0maemo1) unstable; urgency=low + + * Fixes: NB#137778 - qt macro causing build error when using -pedantic + * Fixes: NB#137775 - qt debian packaking installing a missing file + + -- Adrian Constantin <adrian.constantin@nokia.com> Wed, 09 Aug 2009 15:52:51 +0300 + +qt4-x11 (4.6.0~git20090907-0maemo1) unstable; urgency=low + + * Pull from upstream. + * Fixes: NB#104827 - DuiLabel truncate arabic string and renders replaces the MEDIAL form character into FINAL on the point of truncation + + -- Shane Bradley <shane.bradley@nokia.com> Tue, 08 Aug 2009 15:17:24 +1000 + +qt4-x11 (4.6.0~git20090828-0maemo1) unstable; urgency=low + + * Pull from upstream. + + -- Shane Bradley <shane.bradley@nokia.com> Mon, 24 Aug 2009 15:47:37 +1000 + +qt4-x11 (4.6.0~git20090824-0maemo1) unstable; urgency=low + + * Pull from upstream. + * Fixes: NB#127429 - QtOpenGL public header refers to non-existant qglshaderprogram.h + + -- Shane Bradley <shane.bradley@nokia.com> Mon, 24 Aug 2009 15:47:37 +1000 + +qt4-x11 (4.6.0~git20090820-0maemo1) unstable; urgency=low + + * Pull from upstream. + + -- Shane Bradley <shane.bradley@nokia.com> Thu, 20 Aug 2009 16:16:14 +1000 + +qt4-x11 (4.6.0~git20090819-0maemo1) unstable; urgency=low + + * Pull from upstream. + * Fixes: NB#132164 - libqt4-webkit package is broken + + -- Shane Bradley <shane.bradley@nokia.com> Wed, 19 Aug 2009 15:32:21 +1000 + +qt4-x11 (4.6.0~git20090728-0maemo1) unstable; urgency=low + + * Pull from upstream. + * Fixes: NB#129594 - Qt compiled without compiler optimization + * Fixes: NB#127404 - Rendering errors with OpenGL in Qt 4.6 + + -- Shane Bradley <shane.bradley@nokia.com> Thu, 30 Jul 2009 14:02:24 +1000 + +qt4-x11 (4.6.0~git20090717-0maemo1) unstable; urgency=low + + * Fixes: NB#117929 - Qt mkspecs use -Wl,--rpath by default causing warnings in Debian packaging + + -- Shane Bradley <shane.bradley@nokia.com> Wed, 15 Jul 2009 10:32:20 +1000 + +qt4-x11 (4.6.0~git20090717-0maemo1) unstable; urgency=low + + * Pull from upstream + * Partial fix for 127404. + + -- Shane Bradley <shane.bradley@nokia.com> Wed, 15 Jul 2009 10:32:20 +1000 + +qt4-x11 (4.6.0~git20090706-0maemo1) unstable; urgency=low + + * Switch to using 4.6. + + -- Shane Bradley <shane.bradley@nokia.com> Wed, 07 Jul 2009 10:32:20 +1000 + +qt4-x11 (4.5.2~git20090701-0maemo1) unstable; urgency=low + + * Fixes: NB#122175 - Qt debugging symbols issues + * Pull from upstream. + + -- Shane Bradley <shane.bradley@nokia.com> Wed, 07 Jul 2009 10:32:20 +1000 + +qt4-x11 (4.5.2~git20090605-0maemo1) unstable; urgency=low + + * Pull from upstream. + + -- Gareth Pethig <gareth.pethig@nokia.com> Fri, 05 Jun 2009 19:46:34 +1000 + +qt4-x11 (4.5.2~git20090601-0maemo1) unstable; urgency=low + + * Pull from upstream. + + -- Gareth Pethig <gareth.pethig@nokia.com> Mon, 01 Jun 2009 17:01:23 +1000 + +qt4-x11 (4.5.2~git20090525-0maemo1) unstable; urgency=low + + * Pull from upstream. + + -- Gareth Pethig <gareth.pethig@nokia.com> Mon, 25 May 2009 15:30:34 +1000 + +qt4-x11 (4.5.2~git20090515-0maemo1) unstable; urgency=low + + * Pull from upstream. + + -- Gareth Pethig <gareth.pethig@nokia.com> Fri, 15 May 2009 20:01:16 +1000 + +qt4-x11 (4.5.2~git20090508-0maemo2) unstable; urgency=low + + * Changed control file as per Maemo patch. + + -- Gareth Pethig <gareth.pethig@nokia.com> Mon, 11 May 2009 18:49:23 +1000 + +qt4-x11 (4.5.2~git20090508-0maemo1) unstable; urgency=low + + * Pull from upstream. + + -- Gareth Pethig <gareth.pethig@nokia.com> Fri, 08 May 2009 17:51:46 +1000 + +qt4-x11 (4.5.2~git20090506-0maemo1) unstable; urgency=low + + * Removed -lxcb-xlib referance from mkspec. + + -- Gareth Pethig <gareth.pethig@nokia.com> Wed, 06 May 2009 19:01:22 +1000 + +qt4-x11 (4.5.2~git20090505-0maemo2) unstable; urgency=low + + * Removed old EGL config patch. + + -- Gareth Pethig <gareth.pethig@nokia.com> Wed, 06 May 2009 14:42:35 +1000 + +qt4-x11 (4.5.2~git20090505-0maemo1) unstable; urgency=low + + * Pull from upstream. + * Added gles translucency patch + + -- Gareth Pethig <gareth.pethig@nokia.com> Tue, 05 May 2009 21:32:21 +1000 + +qt4-x11 (4.5.2~git20090424-0maemo1) unstable; urgency=low + + * Pull from upstream. + + -- Gareth Pethig <gareth.pethig@nokia.com> Fri, 24 Apr 2009 18:32:37 +1000 + +qt4-x11 (4.5.1~git20090422-0maemo1) unstable; urgency=low + + * Pull from upstream. + + -- Shane Bradley <shane.bradley@nokia.com> Wed, 22 Apr 2009 17:20:12 +1000 + +qt4-x11 (4.5.1~git20090417-0maemo1) unstable; urgency=low + + * Pull from upstream. + * Fixes: NB#110528 - int QTest::qExec() returns always 0... + + -- Gareth Pethig <gareth.pethig@nokia.com> Fri, 17 Apr 2009 13:30:20 +1000 + +qt4-x11 (4.5.1~git20090403-0maemo1) unstable; urgency=low + + * Pull from upstream. + * Fixes: NB#109352 - libqt4-dev is missing libQtUiTools.a + + -- Shane Bradley <shane.bradley@nokia.com> Fri, 03 Apr 2009 17:04:40 +1000 + +qt4-x11 (4.5.1~git20090331-0maemo2) unstable; urgency=low + + * Move QtClucene from the core package to the help package. This is only + used by assistant. + + -- Shane Bradley <shane.bradley@nokia.com> Wed, 01 Apr 2009 16:44:52 +1000 + +qt4-x11 (4.5.1~git20090331-0maemo1) unstable; urgency=low + + * Pull from upstream. + + -- Shane Bradley <shane.bradley@nokia.com> Tue, 31 Mar 2009 10:35:50 +1000 + +qt4-x11 (4.5.1~git20090326-0maemo1) unstable; urgency=low + + * Pull from upstream. + * Add qdoc3 binary to qt4-dev-tools package. + + -- Shane Bradley <shane.bradley@nokia.com> Thu, 26 Mar 2009 14:17:39 +1000 + +qt4-x11 (4.5.1~git20090324-0maemo1) unstable; urgency=low + + * Pull from upstream. + + -- Shane Bradley <shane.bradley@nokia.com> Tue, 24 Mar 2009 10:39:35 +1000 + +qt4-x11 (4.5.1~git20090317-0maemo1) unstable; urgency=low + + * Pull from upstream. + * Fixes: NB#105936 + + -- Shane Bradley <shane.bradley@nokia.com> Tue, 17 Mar 2009 14:15:30 +1000 + +qt4-x11 (4.5.1~git20090316-0maemo1) unstable; urgency=low + + * Pull from upstream. + * Fixes: NB#103601 + + -- Shane Bradley <shane.bradley@nokia.com> Mon, 16 Mar 2009 13:14:17 +1000 + +qt4-x11 (4.5.0-0maemo2) unstable; urgency=low + + * Fixes: NB#103953, NB#103601 + * Add additional dependencies for the phonon package. + + -- Shane Bradley <shane.bradley@nokia.com> Thu, 05 Mar 2009 16:53:23 +1000 + +qt4-x11 (4.5.0-0maemo1) unstable; urgency=low + + * Pull from upstream for 4.5.0 release. + * Fixes: NB#99812 + + -- Shane Bradley <shane.bradley@nokia.com> Thu, 27 Feb 2009 18:37:27 +1000 + +qt4-x11 (4.5.0~git20090219-0maemo1) unstable; urgency=low + + * Removed subversion files and disabled patches. + + -- Shane Bradley <shane.bradley@nokia.com> Thu, 19 Feb 2009 16:09:14 +1000 + +qt4-x11 (4.5.0~git20090219-maemo1) unstable; urgency=low + + * Migrated to new repository. + * Merged with upstream. + + -- Shane Bradley <shane.bradley@nokia.com> Thu, 19 Feb 2009 14:24:45 +1000 + +qt4-x11 (4.5.0~git20090212-maemo2) unstable; urgency=low + + * Removed include/Qt/qpixmapfilter.h from debian/libqt4-dev.install + + -- Mohammad Anwari <mohammad.anwari@nokia.com> Fri, 13 Feb 2009 09:50:33 +0200 + +qt4-x11 (4.5.0~git20090212-maemo1) unstable; urgency=low + + * Merged with upstream. + + -- Mohammad Anwari <Mohammad.Anwari@nokia.com> Thu, 12 Feb 2009 13:45:11 +0200 + +qt4-x11 (4.5.0~git20090122-maemo6) unstable; urgency=low + + * Added patch 102_egl_config.diff + + -- Mohammad Anwari <Mohammad.Anwari@nokia.com> Thu, 12 Feb 2009 12:53:25 +0200 + +qt4-x11 (4.5.0~git20090122-maemo5) unstable; urgency=low + + * Removed old Ubuntu patches + * Added patch 101_multiple-translation.diff to series file + + -- Tobias Koch <ext-tobias.koch@nokia.com> Mon, 26 Jan 2009 18:48:50 +0200 + +qt4-x11 (4.5.0~git20090122-maemo4) unstable; urgency=low + + * Multiple translation variant patch was added + * Shader patch was removed + + -- Tobias Koch <ext-tobias.koch@nokia.com> Mon, 26 Jan 2009 17:38:50 +0200 + +qt4-x11 (4.5.0~git20090122-maemo2) unstable; urgency=low + + * Removed configure switch -no-tablet + + -- Tobias Koch <ext-tobias.koch@nokia.com> Thu, 22 Jan 2009 18:14:50 +0200 + +qt4-x11 (4.5.0~git20090122-maemo1) unstable; urgency=low + + * Merged from upstream + + -- Tobias Koch <ext-tobias.koch@nokia.com> Thu, 22 Jan 2009 17:51:34 +0200 + +qt4-x11 (4.5.0~git20090108-maemo2) unstable; urgency=low + + * Fixes for lintian errors + * Fixes in install files + + -- Tobias Koch <ext-tobias.koch@nokia.com> Thu, 15 Jan 2009 11:00:17 +0200 + +qt4-x11 (4.5.0~git20090108-maemo1) unstable; urgency=low + + * Merged from upstream + + -- Tobias Koch <ext-tobias.koch@nokia.com> Thu, 08 Jan 2009 19:19:29 +0200 + +qt4-x11 (4.5.0~git20081217-maemo2) unstable; urgency=low + + * Debug packages available again + + -- Tobias Koch <ext-tobias.koch@nokia.com> Wed, 07 Jan 2009 16:55:53 +0200 + +qt4-x11 (4.5.0~git20081217-maemo1) unstable; urgency=low + + * Quilt works again + * Merged from upstream + + -- Tobias Koch <ext-tobias.koch@nokia.com> Tue, 17 Dec 2008 10:21:47 +0200 + +qt4-x11 (4.5.0~git20081216-maemo1) unstable; urgency=low + + * Applied patch 100_glconfig_shader.diff until I have + figured out, why quilt won't run. + + -- Tobias Koch <ext-tobias.koch@nokia.com> Tue, 16 Dec 2008 12:51:47 +0200 + +qt4-x11 (4.5.0~git20081215-maemo1) unstable; urgency=low + + * added patch 100_glconfig_shader.diff submitted by <mohammad.anwari@nokia.com>: + * enable running Qt+GL in newer images of R***r + * solved the compilation of TextFragmentShader which failed because lacking of a precision of a vec4 + + -- Tobias Koch <ext-tobias.koch@nokia.com> Mon, 15 Dec 2008 14:43:56 +0200 + +qt4-x11 (4.5.0~git20081209-maemo1) unstable; urgency=low + + * Merge with upstream + + -- Mohammad Anwari <Mohammad.Anwari@nokia.com> Tue, 09 Dec 2008 10:31:45 +0200 + +qt4-x11 (4.5.0~git20081202-maemo3) unstable; urgency=low + + * Removed libglu-dev from libqt4-opengl-dev + + -- Mohammad Anwari <Mohammad.Anwari@nokia.com> Fri, 05 Dec 2008 00:31:36 +0200 + +qt4-x11 (4.5.0~git20081202-maemo2) unstable; urgency=low + + * Split opengl packages + + -- Mohammad Anwari <Mohammad.Anwari@nokia.com> Tue, 02 Dec 2008 16:35:31 +0200 + +qt4-x11 (4.5.0~git20081202-maemo1) unstable; urgency=low + + * Pull from upstream + + -- Mohammad Anwari <Mohammad.Anwari@nokia.com> Tue, 02 Dec 2008 09:33:02 +0200 + +qt4-x11 (4.5.0~git20081129-maemo1) unstable; urgency=low + + * Copied to DUI's git + + -- Mohammad Anwari <Mohammad.Anwari@nokia.com> Sat, 29 Nov 2008 00:00:04 +0700 + +qt4-x11 (4.5.0-maemo1-11142008) unstable; urgency=low + + * pull from upstream + + -- Jani Mikkonen <ext-jani.3.mikkonen@nokia.com> Fri, 14 Nov 2008 15:00:00 +0200 + + +qt4-x11 (4.5.0-maemo1) unstable; urgency=low + + * new upstream version with gles2 support + * removed nonfunctional patches + + -- Jani Mikkonen <ext-jani.3.mikkonen@nokia.com> Tue, 11 Nov 2008 18:00:00 +0200 + +qt4-x11 (4.4.0-2maemo5) unstable; urgency=low + + * Enabled Exceptions + * Added QT3 support libraries + * Added xml-patterns + + -- Jani Mikkonen <ext-jani.3.mikkonen@nokia.com> Tue, 28 Oct 2008 12:00:00 +0200 + +qt4-x11 (4.4.0-2maemo4) unstable; urgency=low + + * testing tag, minor changes + + -- Jani Mikkonen <ext-jani.3.mikkonen@nokia.com> Tue, 9 Sep 2008 16:00:00 +0300 + +qt4-x11 (4.4.0-2maemo3) unstable; urgency=low + + * libreadline dependency, no opengl + + -- Arsi Antila <ext-arsi.antila@nokia.com> Wed, 9 Jul 2008 15:36:34 +0300 + + +qt4-x11 (4.4.0-2maemo2) unstable; urgency=low + + * No interbase support for i386 + + -- Jussi Hakala <ext-jussi.hakala@nokia.com> Wed, 18 Jun 2008 11:59:27 +0300 + +qt4-x11 (4.4.0-2maemo1) unstable; urgency=low + + * Configuration for maemo environment + * Workarounds for find/delete inside sbox environment + * Adjusted the control file to behave with etch dpkg + + -- Jussi Hakala <ext-jussi.hakala@nokia.com> Thu, 12 Jun 2008 13:57:49 +0300 + +qt4-x11 (4.4.0-2) unstable; urgency=low + + +++ Changes by Fathi Boudra: + + * Split html documentation in qt4-doc-html package. + * Merge Ubuntu patches: + * Add lpia architecture in trusted dpkg-arch over uname. + * Add sqlite3 workaround in config tests fixes. + * Add qt-copy patch: + * 0227-qdatastream-regression + Fix a bug that causes all Qt3/2 applications to crash or hang under KDE4. + + +++ Changes by Modestas Vainius: + + * Add 16_qsortfilterproxymodel_invalidate_noscroll.diff patch which stops + scrolling to the current item/index on QSortFilterProxyModel::invalidate() + This patch has been scheduled for Qt 4.4.1 (TT #204403). + * Add missing Replaces: + - libqt4-opengl-dev replaces libqt4-dev (<< 4.4.0-2) due to obvious + reasons. + - libqt4-dev replaces libqt4-opengl-dev (<< 4.4.0-2) (due to qglobal.h + misplace). + + -- Debian Qt/KDE Maintainers <debian-qt-kde@lists.debian.org> Fri, 09 May 2008 23:35:16 +0300 + +qt4-x11 (4.4.0-1) unstable; urgency=low + + * New upstream release. + + +++ Changes by Modestas Vainius: + + * Split OpenGL headers from libqt4-dev to libqt4-opengl-dev: + - Update install files. + - Make libqt4-opengl-dev depend on X OpenGL headers, hence remove the + latter from libqt4-dev Recommends. + - Add libqt4-opengl-dev to libqt4-dev Recommends. + - Remove libq4-opengl from libqt4-dev Depends. + * Explicitly add libqtcore4 to libqt4-dev (was implicit before). + * Rename libqt4-gui to libqtgui4 (new package). + * Make libqt4-gui a transitional package (Closes: #478694) depending on + libqtgui4, libqt4-opengl (Closes: #478264), libqt4-sql, libqt4-designer, + libqt4-assistant. + * Use ${binary:Version} instead of ${source:Version} in dependencies of + libqt4-core and libqt4-gui transitional packages. + * Require just libqtcore4 to install libqt4-dbg instead of libqt4-gui. + * Resync patches: + - 05_append_qt4_target.diff - fix offsets. + - 11_qdbus_to_dbus_fix.diff - remove, merged upstream. + - Revert to "runtime" configuration for xcursor, xinerama, xfixes and drop + 16_always_init_qt_x11data_ptrx.diff patch. Fixed upstream. + + +++ Changes by Fathi Boudra: + + * Update libqt4-dev and libqt4-opengl-dev install to use complete files + list instead of wildcard. + * Update installed files: new qt help and assistant translations. + * Add qt-copy patch: + * 0226-qtreeview-column_resize_when_needed + This patch assures that if no header is shown, or if we only have one + column (so no other columns become shrinked), the contents will be + visible. + + -- Debian Qt/KDE Maintainers <debian-qt-kde@lists.debian.org> Tue, 06 May 2008 17:37:49 +0200 + +qt4-x11 (4.4.0~rc1-5) unstable; urgency=high + + +++ Changes by Fathi Boudra: + + * Add libqt4-sql-sqlite dependency to qt4-dev-tools. Qt Assistant and + qhelpgenerator use the sqlite plugin. (Closes: #476986) + * Remove qt-copy patches 0191 and 0192. The relevant code has changed + such that neither patch seems to have any effect (although listviews + still do not use active/inactive roles correctly). + * Add qt-copy patches: + * 0223-fix-qpixmap-hasalpha + Fix a performance regression in QPixmap::hasAlpha() in Qt 4.4. + * 0224-fast-qpixmap-fill + This patch avoids the expensive image->pixmap conversion by discarding + the old pixmap, creating a new one with the correct format, and doing + the fill server side. + * 0225-invalidate-tabbar-geometry-on-refresh + Fix problem where Konsole's tab bar is not shown immediately on startup. + + +++ Changes by Modestas Vainius: + + * Downgrade libqt4-dev *gl*-dev dependencies to Recommends. + They pull in half of X11 development headers and are rarely needed. + What's more, OpenGL apps will probably depend on them explicitly anyway. + * Add development packages of the SQL plugins to libqt4-dev Suggests. + * Make libqt4-sql recommend its plugins. Depends does not do us any good + because we don't know which plugin a user is going to use anyway. Moreover + installation of the libqt4-sql package does not necessarily imply usage of + the specific plugin(s). Finally, this resolves circular dependencies among + libqt4-sql and its plugins. + * Add myself to Uploaders. + * Add 16_always_init_qt_x11data_ptrx.diff, which ensures that X11->ptrX* + are properly initialized when Xcursor, Xinerama, Xfixes are not available + in default "runtime" configuration (Closes: #476608). + * Pass -xfixes -xcursor -xinerama to configure because default "runtime" + configuration requires a user to have libxfixes-dev, libxcursor-dev and + libxinerama-dev installed to enable features requires respective X + libraries (QLibrary simply searches for "lib*.so"). This change in + configuration makes 16 patch irrelevant for Debian, but I'm leaving it + as it's still the fix for the crashes which might occur on default Qt 4.4 + configutions. + * Optimize qmake: pass -optimized-qmake to configure. + + -- Debian Qt/KDE Maintainers <debian-qt-kde@lists.debian.org> Sun, 27 Apr 2008 04:15:28 +0300 + +qt4-x11 (4.4.0~rc1-4) unstable; urgency=low + + +++ Changes by Sune Vuorela: + + * Have libqt4-dev conflict/replace libqtwebkit-dev. + * Fix qmake to generate a bit better pkg-config files. Those should usually + not be generated - as it ends up being crackful. After a bit of patching + they are a bit less crackful though. (Closes: 457570) + * Postprocess prl files to remove the same crack as in the pc files. + (Closes: 470572) + * Do a bit nicer linking when needed instead of relying on crackfulness from + prl and pc files. + * Add a disabled patch to generate better prl files, but unfortunately too + much of qt4 build process relies on on it and is not yet fixed, but it is + saved for later use. + * Fix qmake makefile generation - should not add double slashes to + makefiles. + * Make libqt4-core transitional package arch:any. It doesn't bloat the + archive too much, but it helps on installability. + + +++ Changes by Matthew Rosewarne: + + * Add Recommends: qt4-doc to qt4-demos. + * Add watch file. + + -- Debian Qt/KDE Maintainers <debian-qt-kde@lists.debian.org> Tue, 15 Apr 2008 23:48:31 +0200 + +qt4-x11 (4.4.0~rc1-3) unstable; urgency=low + + +++ Changes by Sune Vuorela: + + * Clean up a bit in the dependencies of libqt4-dev. Removed dependencies: + libqt4-sql-mysql, libqt4-sql-odbc, libqt4-sql-psql, libqt4-sql-sqlite, + libqt4-sql-sqlite2, libqt4-sql-ibase, firebird2.0-dev, libaudio-dev, + libcupsys2-dev, libdbus-1-dev, libfreetype6-dev, libglib2.0-dev, + libice-dev, libiodbc2-dev, libjpeg62-dev, libmng-dev, libmysqlclient15-dev, + libpam0g-dev, libpng12-dev, libpq-dev, libreadline5-dev, libsm-dev, + libsqlite0-dev, libsqlite3-dev, libtiff4-dev, libx11-dev, libxcursor-dev, + libxext-dev, libxft-dev, libxi-dev, libxinerama-dev, libxmu-dev, + libxrandr-dev, libxrender-dev, libxslt1-dev, libxt-dev, x11proto-core-dev, + zlib1g-dev + + +++ Changes by Fathi Boudra: + + * Add libqt4-svg dependency to libqt4-gui. It helps for the transition as + libQtSvg.so.4 was previously in libqt4-gui package. (Closes: #475324) + * Replace libqcncodecs.so in libqt4-gui (<< 4.4.0~beta1-1). (Closes: #475340) + * Update 20_mips_atomic_ops patch. Qt4.4 introduced two new atomic operations + without the necessary assembler .set directives. + Thanks to Thiemo Seufer. (Closes: #475402) + + -- Fathi Boudra <fabo@debian.org> Sat, 12 Apr 2008 07:48:37 +0200 + +qt4-x11 (4.4.0~rc1-2) unstable; urgency=low + + * Add patch for Explicit template specialization cannot have a storage class + with gcc-4.3. Specializations of templates cannot explicitly specify + a storage class, and have the same storage as the primary template. + + -- Fathi Boudra <fabo@debian.org> Wed, 09 Apr 2008 09:40:00 +0200 + +qt4-x11 (4.4.0~rc1-1) unstable; urgency=low + + * New upstream release. (Closes: #469783) + + +++ Changes by Modestas Vainius: + + * Refresh qt-copy patches: + * 0167-fix-group-reading.diff - adjust offsets. + * 0180-window-role.diff - adjust offsets. + * 0195-compositing-properties.diff - adjust offsets. + * 0203-qtexthtmlparser-link-color.diff - adjust offsets. + * 0209-prevent-qt-mixing.diff - adjust offsets. + * 0214-fix-qgraphicsproxywidget-tab-crash.diff - adjust offsets. + * 0216-allow-isystem-for-headers.diff - adjust offsets. + * Remove qt-copy patches: + * 0172-prefer-xrandr-over-xinerama.diff - merged upstream. + * 0178-transparency-window-types.diff - merged upstream. + * 0215-compile-with-Xcursor-linkage.diff - merged upstream. + * 0217-qurl-isempty-regression.diff - merged upstream. + * 0218-qassert-macro-fix.diff - merged upstream. + * fix-qt_bootstrapped-typo.diff - merged upstream. + * Add qt-copy patches: + * 0220-no-x-recursion-in-xerrhandler.diff - adjust offsets. + * Refresh Debian patches: + * 02_launch_assistant-qt4.diff - adjust offsets. + * 05_append_qt4_target.diff - adopt to upstream changes. lrelease and + lupdate have been moved to tools/linguist/, adjust offsets. + * 50_kfreebsd_build_fix.diff - adjust offsets. + * 80_hurd_max_path.diff - adjust offsets. + * Remove Debian patches: + * 08_load_ssl.diff - different fix applied upstream. + * Update *.install files: + * qt4-dev-tools.install: a few renames of the language files, + s/assistant-qt3/assistant-qt4/, add usr/bin/xmlpatterns + * Add libqt4-core transitional package. (Closes: #473658) + * Add debian/not-installed to document files which are deliberately not + installed + * Avoid calling ./configure repeatedly during build/install: tie ./configure + to config.status + + +++ Changes by Fathi Boudra: + + * Re-introduce LD_LIBRARY_PATH workaround to use lrelease. + * Remove Conflicts against libqt4-core. + * Reorder libqt4-sql dependencies to have packages available on all + architectures listed first. (Closes: #473348) + * Add architectures availability list to libqt4-sql-ibase package. + (Closes: #473348) + * Add patch to fix unaligned access on hppa. Thanks to Bernhard R. Link. + (Closes: #458133) + * Add patch to replace remaining qdbus by dbus. Fix libqtscriptdbus build. + * Update configure options: + * Replace -qdbus by -dbus. + * Add -svg. + + +++ Changes by Matthew Rosewarne: + + * Rewrite clean rule to remove remaining build cruft. + + -- Debian Qt/KDE Maintainers <debian-qt-kde@lists.debian.org> Mon, 07 Apr 2008 01:36:54 -0400 + +qt4-x11 (4.4.0~beta1-1) experimental; urgency=low + + * New upstream release. + + * Add build dependencies: doxygen, firebird2.0-dev, libiodbc2-dev, + libpam0g-dev, libreadline5-dev, libxslt1-dev. + * Split libqt4-gui and libqt4-core packages. + * Create package for each Qt module. + * Enable all SQL drivers as plugins and add related packages: + libqt4-sql-ibase, libqt4-sql-mysql, libqt4-sql-odbc, libqt4-sql-psql, + libqt4-sql-sqlite, libqt4-sql-sqlite2. + * Add packages: libqt4-assistant, libqt4-dbus, libqt4-designer, libqt4-help, + libqt4-network, libqt4-opengl, libqt4-script, libqt4-svg, libqt4-test, + libqt4-webkit, libqt4-xml, libqt4-xmlpatterns and qt4-demos. + * Replace libqt4-core by libqtcore4 package. + * Rename libqt4-debug to libqt4-dbg like other debug packages in Debian. + * Update .lintian override files. + * Update .install files. + * Move translations files in their respective packages. + * Disable DEB_INSTALL_CHANGELOGS_ALL. + * Build ibase sql plugin on supported architectures only. + * Enable demos, examples, WebKit and XmlPatterns. + * Enable exceptions. It is a dependency to XmlPatterns module. + * Add qtdemo help collection file. + * Split WebKit and XmlPatterns debug packages from libqt4-dbg. + * Generate Doxygen tagfile in libqt4-dev. Thanks to Matthew Rosewarne. + * Examples and Demos are not shipped compressed anymore. + * Refresh qt-copy patches: + * 0167-fix-group-reading + * 0172-prefer-xrandr-over-xinerama + * 0178-transparency-window-types + * 0180-window-role + * 0191-listview-alternate-row-colors + * 0192-itemdelegate-palette-state + * 0195-compositing-properties + * 0203-qtexthtmlparser-link-color + * 0209-prevent-qt-mixing + * 0210-fix-crash-q3stylesheet-font-size + * Remove qt-copy patches: + * 0175-fix-s390-qatomic + * 0176-coverity-fixes + * 0179-transient-hack + * 0187-fix-font-fixed-pitch + * 0194-fix-moveonly-dnd-in-itemviews + * 0200-fix-qsslsocket-waitfor + * 0205-fast-qpixmap-fill + * 0211-q3action-crash + * Add qt-copy patches: + * 0214-fix-qgraphicsproxywidget-tab-crash + * 0215-compile-with-Xcursor-linkage + * 0216-allow-isystem-for-headers + * 0217-qurl-isempty-regression + * 0218-qassert-macro-fix + * fix-qt_bootstrapped-typo + * Refresh Debian patches: + * 01_qmake_for_debian + * 02_launch_assistant-qt4 + * 03_launch_moc-qt4 + * 04_launch_uic-qt4 + * 05_append_qt4_target + * 08_load_ssl + * 10_config_tests_fixes + * 40_alpha_ice + * 41_disable_opengl_visibility + * 50_kfreebsd_build_fix + * 60_m68k_inotify_fix + * 80_hurd_max_path + * Remove Debian patches: + * 06_qtdemo_destdir. Useless as we ship qtdemo again. + * 30_arm_ftbfs_fixes. Merged upstream. + * 31_arm_eabi_fix. Upstream changed arm architecture handling. + This patch doesn't apply as it is. + * 91_qmake_lflags_no-undefined. Merged upstream. + + -- Fathi Boudra <fabo@debian.org> Thu, 13 Mar 2008 22:34:45 +0100 + +qt4-x11 (4.3.4-2) unstable; urgency=low + + * Add patches: + * 09_qmake_lflags_as-needed + workaround as LDFLAGS isn't honored by configure script. + we set --as-needed flag for Qt build only. + * 10_config_tests_fixes.diff + configuration test fixes for Interbase/Firebird and ODBC sql drivers. + * Update 01_qmake_for_debian patch: + * re-introduce link_prl and drop QT_SHARED workaround. + * Update rules: + * Remove exported LDFLAGS. + * Remove DEB_CONFIGURE_SCRIPT_ENV. + * Exclude debug files from dh_shlibdeps using DEB_DH_SHLIBDEPS_ARGS_ALL. + * Update configure options to use libtiff from system. + * Remove debug configure option to build with -02. + * Update common-install-arch target to fix wrong path in pkconfig and prl files. + * Add libtiff4-dev build dependency. + * Update libqt4-dev dependencies. + + -- Fathi Boudra <fabo@debian.org> Sat, 08 Mar 2008 10:09:02 +0100 + +qt4-x11 (4.3.4-1) unstable; urgency=low + + * New upstream release: + * This version adds the GNU General Public License (GPL) version 3 + to all Qt Open Source editions. The GPL Exception version 1.1 + applies to both versions of the GPL license. + + * Add qt-copy patches: + * 0205-fast-qpixmap-fill + Fix a performance issue in QPixmap::fill() + * 0209-prevent-qt-mixing + This patch changes QObjectPrivateVersion, thus preventing mixing parts + of upstream Qt and qt-copy. + * 0210-fix-crash-q3stylesheet-font-size + This patch fixes crashs in q3stylesheet + (it was possible to use a qfont size < 1) + * 0211-q3action-crash + During porting qt3to4 port QGroupAction to Q3GroupAction but not QAction + to Q3Action (which is logical) But it crashs when it's not a q3action. + * Refresh and enable 0172-prefer-xrandr-over-xinerama patch. + * Remove 0204-fix-tulip-aliasing patch. Merged upstream. + * Remove 90_qmake_cxxflags_fpermissive patch. + * Add ${shlibs:Depends} to libqt4-dev. See missing shared library + dependencies thread on debian-devel mailing list. + * Add catalan translation. Thanks to Javier Serrano Polo. (Closes: #459822) + * Update copyright file. Add GPL version 3. + * Remove -fpermissive. + + -- Fathi Boudra <fabo@debian.org> Tue, 26 Feb 2008 18:38:27 +0100 + +qt4-x11 (4.3.3-2) unstable; urgency=low + + * Update 0203-qtexthtmlparser-link-color qt-copy patch: + Add qt-bugs@ issue and Trolltech task ID. + * Add 0204-fix-tulip-aliasing qt-copy patch: + Fix KDE4 RC2 crashing on startup due to Qt 4.3.3 update. + * Downgrade libqt4-dev dependency to qt4-dev-tools from Recommends to + Suggests. + * Add semicolon at the end of the MimeType key. Thanks to Pino Toscano. + * Remove 91_qmake_ldflags_as-needed patch: + It breaks other packages. (Closes: #457038, #457284) + * Add 91_qmake_lflags_no-undefined patch: + By default, qmake adds --no-undefined linker flag. + + -- Fathi Boudra <fabo@debian.org> Sun, 30 Dec 2007 23:29:09 +0100 + +qt4-x11 (4.3.3-1) unstable; urgency=low + + * New upstream release. + + [Adeodato SimĂ³] + + * Do not depend or build-depend on the transitional package xlibmesa-gl-dev, + but on libgl1-mesa-dev instead. Ditto for libglu1-xorg-dev/libglu1-mesa-dev. + + [Fathi Boudra] + + * Bump Standards-Version to 3.7.3. + * Fix description contains homepage lintian warning. + * Merge Kubuntu load ssl patch. Thanks to Jonathan Riddell. + * Add CDDL exception to debian/copyright. + * Add 21_assume_no_fpu_for_embedded_devices patch. Thanks to Thiemo Seufer + and Bradley Hughes. Not Enabled yet: It breaks ABI on mips. + We will keep it for later (> 4.3.3-1). + * Add 91_qmake_ldflags_as-needed patch. Build with --as-needed linker flag. + * Remove qt-copy patches: + * 0163-fix-gcc43-support. + * 0185-fix-format-strings. + * 0188-fix-moc-parser-same-name-header. + * 0189-fix-q3toolbar-qcombobox-signal-slot. + * 0193-qtreeview-division-by-zero.diff. + * Add qt-copy patches: + * 0200-fix-qsslsocket-waitfor. + Fixes some QSslSocket::waitFor$X methods. + * 0203-qtexthtmlparser-link-color. + Links are assigned a foreground color according to the system current + color scheme. + + -- Fathi Boudra <fabo@debian.org> Thu, 06 Dec 2007 22:06:46 +0100 + +qt4-x11 (4.3.2-1) unstable; urgency=low + + * New upstream release. + + [Fathi Boudra] + * Update desktop files categories. + * Add desktop files icons. (Closes: #433581) + * Update patches to Qt4.3.2. + * Add 90_qmake_cxxflags_fpermissive patch. + * Remove 0186-fix-component-alpha-text patch. Merged upstream. + * Add qt-copy patches: + * 0188-fix-moc-parser-same-name-header + * 0189-fix-q3toolbar-qcombobox-signal-slot + * 0191-listview-alternate-row-colors + * 0192-itemdelegate-palette-state + * 0193-qtreeview-division-by-zero + * 0194-fix-moveonly-dnd-in-itemviews + * 0195-compositing-properties + * Update qt4-dev-tools long description. + * Update copyright: + * Update Trolltech GPL exception to v1.1. + * Add Trolltech GPL exception addenum. + * Update rules: + * Build with -fpermissive. + * Introduce QTVERSION. + * Fix qt4-config menu section. (Closes: 444896) + + [Sune Vuorela] + * Have strict interdependencies between packages with a shlibs.local file. + (Closes: #438746) + * Don't trust uname in generating the qt build key. This has bitten us in + qt3, but will soon bite us in qt4 as qt4 becomes more popular. + + [Ana Beatriz Guerrero Lopez] + * Add desktop files icons uuencoded and update rules to install them uudecoded. + * Add sharutils build dependency. + + -- Debian Qt/KDE Maintainers <debian-qt-kde@lists.debian.org> Sat, 06 Oct 2007 07:00:54 +0200 + +qt4-x11 (4.3.1-2) unstable; urgency=low + + * There is a large difference between 8 spaces and a tab. + + -- Sune Vuorela <debian@pusling.com> Fri, 10 Aug 2007 22:20:45 +0200 + +qt4-x11 (4.3.1-1) unstable; urgency=low + + * New upstream release. + + [Fathi Boudra] + * Switch to quilt patch system. + * Update copyright. Add Trolltech GPL Exception. + * Update section in Debian menu files. + * Update patches for Qt4.3.1. + * Remove 51_kfreebsd_mkspecs patch. Moved in rules. + * Add 0187-fix-font-fixed-pitch patch: + This patch works around broken QFontInfo::fixedPitch by always using a + glyph metrics comparison test to guess the information. This has the + property of both ignoring (bad) and not relying on (good) any information + that might be provided by the OS's font facility. For Mac OS X only. + * Remove patches merged upstream: + * 0177-qurl-clear-fix + * 0183-qprocess-corruption + * 42_alpha_fetch_and_add + * Disable: + * 0172-prefer-xrandr-over-xinerama patch. (Closes: #433931) + * 0181-qdnd-x11-fix patch. + + [Sune Vuorela] + * Add a quick and dirty test to make build on hppa fail if a current + getdents kernel bug is detected. + + -- Fathi Boudra <fboudra@free.fr> Wed, 08 Aug 2007 15:08:11 +0200 + +qt4-x11 (4.3.0-5) unstable; urgency=low + + [Fathi Boudra] + * Update 01_qmake_for_debian patch. Add DEFINES += QT_SHARED in qmake.conf + along with the removal of link_prl. (Closes: #434019) + * Apply qt-copy patches: + * 00_0185-fix-format-strings: This patch fixes various code issues with + handling format strings. None of them seem to be exceptionally bad, + but its better safe than sorry. It is related to CVE-2007-3388. + TT claims the problem is not present in any version of Qt 4. Dirk Muller + disagrees and believes that some of them are possible to exploit. + * 00_0186-fix-component-alpha-text: This patch fixes component alpha + (LCD hinted) text when it's drawn on a non-opaque background. Qt doesn't + initialize the alpha channel in the glyph masks, which causes problems + in Konsole when transparency is enabled, and in other situations where + the background isn't fully opaque. + + -- Fathi Boudra <fboudra@free.fr> Mon, 30 Jul 2007 21:36:25 +0200 + +qt4-x11 (4.3.0-4) unstable; urgency=low + + [Fathi Boudra] + * Add 42_alpha_fetch_and_add patch to fix broken threading on alpha, hangs + uselessly on startup. fetch-and-add is supposed to return the original + value before the addition. Thanks to Steve Langasek and Bradley Hughes. + (Closes: #433031) + * Update control: Replace ${source:Version} by ${binary:Version}. + Make the package binNMU safe. Thanks to Lior Kaplan. (Closes: #433548) + + -- Fathi Boudra <fboudra@free.fr> Mon, 16 Jul 2007 21:32:01 +0200 + +qt4-x11 (4.3.0-3) unstable; urgency=low + + [Fathi Boudra] + * Update control: Replace deprecated ${Source-Version} by ${source:Version}. + * Update rules: + * Add bindir and libdir configure options. + * Replace common-install-arch target. Replaced by build system patches and + a fix for pkgconfig files. (Closes: #401807) + * Add patches: + * 04_launch_uic-qt4: call uic-qt4 binary. + * 05_append_qt4_target: append -qt4 when needed. It fixes moc-location and + uic_location are properly in pkgconfig files. (See bug #401807) + * 06_qtdemo_destdir: remove QT_BUILD_TREE in qtdemo DESTDIR target. + (Closes: #408639) + * Revert Qt handling argb visuals on X11 patch. There are dependencies + not fixed in Qt. They cause a few regressions when this patch is applied. + (Closes: #430907, #431436, #431943) + * Update Qt support for new window types used for compositing patch. + Fix crashes when 'w' is null. (Closes: #431322) + * Apply qt-copy patches: + * 00_0172-prefer-xrandr-over-xinerama: only trust libxinerama if it is not + the emulated information coming from xrandr 1.2. + * 00_0177-qurl-clear-fix: fix QUrl::clear(). Applied upstream. + * 00_0183-qprocess-corruption: fix plain data loss bug. Applied Upstream. + + -- Fathi Boudra <fboudra@free.fr> Fri, 29 Jun 2007 08:15:23 +0200 + +qt4-x11 (4.3.0-2) unstable; urgency=low + + [Brian Nelson] + * Changed dist back to unstable. + * Tightened qt4-dev-tools's dependency on libqt4-core to + (= ${Source-Version}), since it uses internal (non-public) classes in + Qt whose ABI can change. (Closes: #429817) + * Added a build-dependency on libxi-dev to enable tablet support. + * Constrict the hack to clean all binary files to the bin, config.tests, + and qmake directories to drastically improve its speed + + [Fathi Boudra] + * Qt4 demos builds properly in Qt4.3. (Closes: #408639) + * Apply qt-copy patches: + * 00_0178-transparency-window-types: adds Qt support for new window types + used for compositing. + * 00_0179-transient-hack: workaround that makes setting of WM_TRANSIENT_FOR + work with some window types. + * 00_0180-window-role: several problems with Qt's support for the + WM_WINDOW_ROLE property. + * 00_0181-qdnd-x11-fix: makes the find_child algorithm in qdnd look at + _all_ widgets that contain the QPoint. + * 00_0182-argb-visuals-default: Qt handling argb visuals on X11. + + -- Brian Nelson <pyro@debian.org> Wed, 27 Jun 2007 00:02:07 -0400 + +qt4-x11 (4.3.0-1) experimental; urgency=low + + * New upstream release. + * Fixes a QListView issue. (Closes: #419654) + + * Update uploaders. Add Ana, Sune and Fathi. + + [Sune Vuorela] + * Remove 04_utf8_bug_fix: Merged upstream. + * Update libqt4-dev.install. Upstream installs pkgconfig files the right place. + * Update libqt4-core.install. Add libQtScript. + * Update rules: + * Add utils.mk to use list-missing. + * Cleaning seems to fail a bit. Trying to hack around that in clean:: + target. + + [Fathi Boudra] + * Redo 30_arm_ftbfs_fixes to fix another FTBFS. Add arm target to configure + script. Thanks to Sune Vuorela and Aurelien Jarno. (Closes: #426129) + * Remove 71_hppa_inotify_fix: Merged upstream. + * Update patches: + * 02_launch_assistant-qt4 + * 03_launch_moc-qt4 + * 50_kfreebsd_build_fix + * 80_hurd_max_path + * Apply qt-copy patches: + * 00_0163-fix-gcc43-support: Various fixes to get Qt 4.3 without hundreds + of warnings compiling. + * 00_0167-fix-group-reading: In big user environments, getgrgid_r() needs + more memory than sysconf() returns. + * 00_0175-fix-s390-qatomic: Fix s390(x) build. + * 00_0176-coverity-fixes: Fix various obvious memory leaks. + * Rename disable opengl visibility patch. It is not alpha architecture only. + * Add desktop files to support Desktop Environments. (Closes: #378915) + * Update qt4-dev-tools.install. Add qdbusviewer and pixeltool. + Thanks to Benjamin Meyer for the reminder. + * Update libqt4-dev.install. Remove qtdemo binary as we provide a tarball of the + demos directory. qtdemo is useless, it can't launch anything without demos + builded. It can only show screenshots and short description of demos, + users have it in Qt assistant. + * Update rules: + * Remove -debug-and-release option. Deprecated. + * Add configure options: + * -no-exceptions + * -debug + * -qdbus + * -pch + * -nomake examples + * -nomake demos + + -- Debian Qt/KDE Maintainers <debian-qt-kde@lists.debian.org> Sat, 09 Jun 2007 00:25:41 +0200 + +qt4-x11 (4.2.3-1) unstable; urgency=low + + * New upstream release + - Fixes build failures when QT_NO_DEBUG_OUTPUT defined + (Closes: #418832) + - Fixes broken signal/slot connection in QSvgRenderer + (Closes: #411292) + + -- Brian Nelson <pyro@debian.org> Thu, 12 Apr 2007 12:38:06 -0400 + +qt4-x11 (4.2.2-2) unstable; urgency=high + + * debian/patches/04_utf8_bug_fix.dpatch: new patch to fix the "UTF-8 + overlong sequence decoding vulnerability" [CVE-2007-0242] + + -- Brian Nelson <pyro@debian.org> Fri, 30 Mar 2007 11:04:20 -0400 + +qt4-x11 (4.2.2-1) unstable; urgency=low + + * New upstream release (Closes: #410862) + + * debian/rules: set the sysconfdir to /etc/xdg instead of /etc/qt4 to + match the QSettings documentation (Closes: #407297) + + * Added Riku Voipio's patch for ARM EABI (Closes: #408813) + + * debian/patches/22_launch_moc-qt4.dpatch: new patch to ensure the Qt4 + version of moc is launched by qdbuscpp2xml (Closes: #399049) + + * Added a doc-base file for qt4-doc (Closes: #403290) + + * debian/qt4-designer.links: added a link /usr/share/qt4/bin/designer -> + /usr/bin/designer-qt4 (Closes: #410885) + + * Re-arranged patches to group them by arch so that they're easier to + deal with + + * Applied new patches for kFreeBSD and Hurd support + (Closes: #380097, #402007) + + * debian/libqt4-gui.install: added the codecs plugins, somehow these got + accidentally dropped (Closes: #409228) + + -- Brian Nelson <pyro@debian.org> Sun, 4 Mar 2007 13:50:39 -0500 + +qt4-x11 (4.2.1-2) unstable; urgency=low + + * debian/patches/20_hppa_inotify_fix.dpatch: new patch that should fix + the FTBFS on hppa due to missing defines (Closes: #394953) + + * Added patches for hurd support (Closes: #380097) + + * debian/patches/10_qmake_for_debian.dpatch: restored the modification + to remove link_prl from the CONFIG line, which fixes problems with + unnecessary linkage (Closes: #394836) + + -- Brian Nelson <pyro@debian.org> Tue, 31 Oct 2006 02:42:02 -0500 + +qt4-x11 (4.2.1-1) unstable; urgency=high + + * New upstream release + - Fixes integer overflow in pixmap handling [CVE-2006-4811] + (Closes: #394192) + + * Install the libqtaccessiblecompatwidgets.so plugin into + libqt4-qt3support, so that libqt4-gui does not circularly depend on + libqt4-qt3support (Closes: #394351, #394629) + + -- Brian Nelson <pyro@debian.org> Mon, 23 Oct 2006 11:59:52 -0400 + +qt4-x11 (4.2.0-2) unstable; urgency=low + + * debian/control: added a dependency on libglib2.0-dev for libqt4-dev + (Closes: #392797, #392173) + + * Added a bunch of plugins and their debugging symbols to be installed + + * debian/patches/19_m68k_inotify_fix.dpatch: new patch to fix FTBFS on + m68k (Closes: #391902) + + * Imported Ubuntu fixes, thanks to Jonathan Riddell for the tip + - Fix typo in debian/rules -qt-sql-slite to -qt-sql-sqlite + (Closes: #392808) + - Install usr/bin/qdbus usr/bin/qdbusxml2cpp and usr/bin/qdbuscpp2xml + (Closes: #391726) + + * debian/control: added a libqt4-dev dependency on libsqlite0-dev + (Closes: #392558) + + -- Brian Nelson <pyro@debian.org> Tue, 17 Oct 2006 23:44:31 -0400 + +qt4-x11 (4.2.0-1) unstable; urgency=low + + * New upstream release + - No longer includes "CONFIG = ... debug" in the mkspecs/qconfig.pri + (Closes: #357136) + - Fixes QFontDialog assert() failures (Closes: #380418) + + * debian/control: made libqt4-gui conflict/replace libqt4-designer, to + ensure that old package is removed (Closes: #380253) + + * Enable Qt's new support for using the system's SQLite 3 library + (Closes: #382238) + + * debian/rules: removed the PostgreSQL and MySQL include hacks from the + configure arguments, since the configure script now autodetects them + itself + + * debian/patches/10_qmake_for_debian.dpatch: updated for new upstream + + * debian/patches/13_arm_ftbfs_fixes.dpatch: updated for new upstream + + * debian/patches/19_s390_atomic.dpatch: removed, since it appears to be + obsolete + + * debian/libqt4-debug.install: changed the wildcards to match the new + debug lib names. What was once *_debug.so.* is now *.debug. Ick. + + * debian/control: removed libqt4-debug-dev since now that the _debug + libs have been removed and debugging symbols are shipped in their + place, this package is no longer needed + + * Tar up the demos directory and include it in qt4-doc. Also added the + qtdemo binary to libqt4-dev. (Closes: #390925) + + * debian/rules: add -DQT_QLOCALE_USES_FCVT to the configure arguments + when building on arm, like Qt3, to fix a uic problem (Closes: #386460) + + * debian/libqt4-gui.install: added usr/lib/libQtAssistantClient.so.*, + since it's now shipped as a shared library; previously it was a static + library + + * Added build-deps on libdbus-1-dev and libglib2.0-dev, and added + libQtDBus to the libqt4-core package + + -- Brian Nelson <pyro@debian.org> Fri, 6 Oct 2006 23:16:46 -0400 + +qt4-x11 (4.1.4-1.1) unstable; urgency=medium + + * Non-maintainer upload. + * Reintroduce the libpq-dev dependency, which seems to have been removed by + mistake in 4.1.0-2. (Closes: #327618) + + -- Steinar H. Gunderson <sesse@debian.org> Tue, 29 Aug 2006 01:10:59 +0200 + +qt4-x11 (4.1.4-1) unstable; urgency=low + + * New upstream release (Closes: #378443) + + * Moved usr/lib/libQtDesigner.so.* and + usr/lib/libQtDesignerComponents.so.* from qt4-designer to libqt4-gui + so there the libqt4-dev package won't contain dangling symlinks + (Closes: #374612) + + -- Brian Nelson <pyro@debian.org> Sun, 16 Jul 2006 15:39:29 -0700 + +qt4-x11 (4.1.3-3) unstable; urgency=low + + * debian/patches/19_s390_atomic: patch from Bastian Blank to fix + including of s390 specific atomic header. (Closes: #370241) + + * debian/patches/18_disable_opengl_visibility.dpatch: regenerated so + that it applies correctly for me + + -- Brian Nelson <pyro@debian.org> Sun, 25 Jun 2006 11:42:57 -0700 + +qt4-x11 (4.1.3-2) unstable; urgency=high + + * patches/18_disable_opengl_visibility: disable -fvisibility-inlines-hidden + for src/opengl/opengl.pro as it makes gcc ICE on alpha. + (Closes: #368883) + + * urgency set to high so that qt4-x11 stops blocking half of unstable out of + testing. + + -- Pierre Habouzit <madcoder@debian.org> Mon, 5 Jun 2006 10:28:29 +0200 + +qt4-x11 (4.1.3-1) unstable; urgency=high + + * New upstream release + + * debian/patches/16_hppa_ldcw_fix.dpatch: new patch from Ubuntu to + properly support hppa + + * debian/patches/17_alpha_ice.dpatch: new patch from Steve Langasek to + fix FTBFS on alpha (Closes: #368883) + (urgency set to high for that fix). + + * Dropped the .la files since they pull in too many unneeded + dependencies (Closes: #360802) + + * debian/libqt4-debug.install: removed + usr/lib/qt4/plugins/codecs/*_debug.so since those aren't included + upstream anymore + + * Increased standards version to 3.7.2 + + -- Brian Nelson <pyro@debian.org> Sat, 3 Jun 2006 17:56:32 -0700 + +qt4-x11 (4.1.2-2) unstable; urgency=low + + * debian/libqt4-debug-dev.install, debian/libqt4-dev.install: added + wildcards to install .a static libraries so that the libQtUiTools and + libQtAssistantClient libraries are included (Closes: #358224, #355902) + + -- Brian Nelson <pyro@debian.org> Sun, 14 May 2006 10:03:40 -0700 + +qt4-x11 (4.1.2-1) unstable; urgency=low + + * New upstream release + + * debian/control: removed dependencies on xlibs-static-dev and + xlibs-static-pic to transition to building against modular X + (Closes: #362262) + + * debian/control: changed x-dev dependencies to x11proto-core-dev, for + modular X transition (Closes: #362053) + + -- Brian Nelson <pyro@debian.org> Thu, 13 Apr 2006 10:35:28 -0700 + +qt4-x11 (4.1.1-1) unstable; urgency=low + + * New upstream release + - Fixes the broken debug-and-release build and a load of resulting + bugs (Closes: #337764, #337847, #341807, #338380, #354993, #347251) + - debian/patches/15_alpha_ftbfs_fix.dpatch: removed, integrated upstream + + * debian/control: updated libqt4-debug-dev priority to match that of the + override file + + * debian/libqt4-dev.links: added a symlink /usr/share/qt4/bin/rcc to + /usr/bin/rcc (Closes: #349438) + + * debian/libqt4-gui.install: added libqmng.so and libqgif.so plugins + (Closes: #354266) + + -- Brian Nelson <pyro@debian.org> Mon, 6 Mar 2006 10:20:47 -0800 + +qt4-x11 (4.1.0-3) unstable; urgency=low + + * Moved *_debug.prl and *_debug.la support files to the libqt4-debug-dev + package + + * Updated to debhelper v5 compatibility + + * debian/qt4-dev-tools.install: removed the /usr/share/qt4/templates + entry, which no longer contains anything + + * Added gif support (Closes: #348092) + + * debian/patches/12_mips_atomic_ops.dpatch: applied fixes from Isaac + Clerencia <isaac@debian.org>, as the last patch was not good enough to + fix the FTBFS bug (Closes: #335831) + + -- Brian Nelson <pyro@debian.org> Tue, 17 Jan 2006 09:49:11 -0800 + +qt4-x11 (4.1.0-2) unstable; urgency=low + + * debian/patches/12_mips_atomic_ops.dpatch: Updated patch to account for + 2 new functions, q_atomic_test_and_set_acquire_int and + q_atomic_test_and_set_release_int, that were added in this release. + This should again fix the build failures on mips. (Closes: #335831) + + * debian/patches/13_arm_ftbfs_fixes.dpatch: renamed, added a fix for the + new build failure due to a poorly defined qreal (Closes: #347360) + + * debian/control: build against libmysqlclient15, and updated all + dependencies to libmysqlclient15-dev (Closes: #346586) + + * debian/control: added explicit dependencies for libqt4-dev on the + Source-Version packages libqt4-core, libqt4-gui, libqt4-sql, and + libqt4-qt3support. These dependencies were accidentally dropped in + the last version. Also removed some unneeded dependencies. + + * Split the *_debug.so symlinks out of libqt4-dev and into a separate + libqt4-debug-dev package. Made the libqt4-debug-dev package depend on + the Source-Version of libqt4-debug. This way, the symlinks won't be + dangling if libqt4-debug isn't installed and prevents failed linking + due to version mismatches. (Closes: #346603, #346605) + + * Re-enabled sqlite3 support. It's still statically linked, however, + but that'll have to do because I really don't want to futz with the + build system. (Closes: #330976) + + * Enabled sqlite2 support + + * debian/patches/15_alpha_ftbfs_fix.dpatch: new patch to rename + q_atomic_test_and_set_release_ptr to q_atomic_test_and_set_ptr, as + suggested by Isaac Clerencia <isaac@debian.org>, to fix a FTBFS on + alpha. (Closes: #347353) + + * debian/patches/10_qmake_for_debian: renamed from + 10_qmake_use_qt4_tools, and updated to remove the "link_prl" from the + default qmake CONFIG line. This disables the recursive linkage + against all indirectly-used libraries. (Closes: #343190) + + -- Brian Nelson <pyro@debian.org> Tue, 10 Jan 2006 19:29:52 -0800 + +qt4-x11 (4.1.0-1) unstable; urgency=low + + * New upstream release + - Fixes missing QBitArray operators (Closes: #341658) + - Fixes qmake problem with including bad build path (Closes: #327359) + + * Added the new QTestLib unit testing framework to the libqt4-core + package + + * Added the new QtSvg module to the libqt4-gui package + + * debian/patches/13_arm_gcc4.dpatch: new patch from Jeremy Laine to fix + FTBFS on arm (Closes: #343176) + + * debian/patches/14_kfreebsd_build_fix.dpatch: new patch from Petr + Salinger to fix FTBFS on GNU/kFreeBSD (Closes: #343191) + + * Split the qtconfig tool out of libqt4-gui and into a separate + qt4-qtconfig package, due to its linkage against libqt4-qt3support and + hence ridiculous dependency chain. + + * debian/rules: improved/cleaned up the clean target + + -- Brian Nelson <pyro@debian.org> Wed, 4 Jan 2006 12:56:23 -0800 + +qt4-x11 (4.0.1-6) unstable; urgency=low + + * Added a target to automatically install lintian overrides, stolen from + debian-qt-kde.mk + + * Added a bunch of lintian overrides for stuff that should be ignored + + -- Brian Nelson <pyro@debian.org> Sat, 19 Nov 2005 01:17:03 -0800 + +qt4-x11 (4.0.1-5) unstable; urgency=low + + * debian/control: made libqt4-gui replace libqt4-core (<< 4.0.1-3), for + the plugins move (Closes: #336492) + + * debian/control: removed the mention of a qt4-examples package that + doesn't actually exist from the qt4-doc package description + + * debian/rules: remove all *.so files under + examples/tools/plugandpaint/plugins/ in the clean target + (Closes: #339674) + + * Removed the menu entry for designer-qt4 from qt4-dev-tools.menu, and + added it to a new qt4-designer.menu + + * Added a tarball of the examples to qt4-doc (Closes: #336832) + + -- Brian Nelson <pyro@debian.org> Fri, 18 Nov 2005 10:27:03 -0800 + +qt4-x11 (4.0.1-4) unstable; urgency=low + + * debian/control: changed qt4-designer's section to "devel" + + * Added a patch from Thiemo Seufer to fix the FTBFS on mips/mipsel + (Closes: #335831) + + -- Brian Nelson <pyro@debian.org> Wed, 26 Oct 2005 00:13:40 -0700 + +qt4-x11 (4.0.1-3) unstable; urgency=low + + * debian/libqt4-core.install: only install the non-debug codecs, since + the debug ones pull in a gratuitous dependency on libqt4-debug + (Closes: #328913) + + * debian/libqt4-debug.install: install the debug codecs here instead + + * debian/control: replaced obsolete xlibs-dev dependency with the + required split packages (Closes: #329302) + + * Completely disabled SQLite support since it's too fubar in this + version to be usable. The build fails with SQLite2 support, and + SQLite3 is only supported by linking staticly with a version + distributed in the Qt source. Meh. + + * Renamed libqt4-designer to qt4-designer, merged in the designer binary + from qt4-dev-tools, and added a dependency on libqt4-dev + (Closes: #330094) + + * Moved the plugins installed in libqt4-core to libqt4-gui, since they + link against the GUI library. Otherwise a circular libqt4-core <-> + libqt4-gui dependency results. + + -- Brian Nelson <pyro@debian.org> Fri, 21 Oct 2005 00:28:53 -0700 + +qt4-x11 (4.0.1-2) unstable; urgency=low + + * debian/patches/10_qmake_use_qt4_tools.dpatch: new patch that modifies + qmake.conf so that qmake generates Makefiles that use the -qt4 tools. + This way, it can cope with systems that have alternatives set to use + the -qt3 versions. + + * Increased the conflicting Qt3 package versions to <= 3.3.4-7, since + the Qt3 packages still don't use the alternatives system as needed to + coexist with Qt4. + + * debian/libqt4-core.install: added /usr/lib/qt4/plugins/codecs + + * debian/patches/11_launch_assistant-qt4: new patch that modifies the + QAssistantClient class to launch Qt Assistant as "assistant-qt4" to + cope with the alternatives system (Closes: #327294) + + * debian/control: Upgraded libqt4-dev's dependencies on the modules + libqt4-sql and libqt4-qt3support from suggests to depends, and added + libpq-dev and libmysqlclient14-dev | libmysqlclient-dev as + dependencies. These dependencies are apparently required to make + building pkg-config-using packages happy. (Closes: #327618) + + * debian/control: corrected libqt4-sql to suggest libmysqlclient14-dev, + not libmysqlclient12-dev which is deprecated + + * debian/copyright: updated FSF snailmail address + + * debian/libqt4-debug.install: removed the libqt3supportwidgets_debug.so + designer plugin, since for some reason having this installed breaks + designer (Closes: #325782) + + -- Brian Nelson <pyro@debian.org> Mon, 12 Sep 2005 12:32:53 -0700 + +qt4-x11 (4.0.1-1) unstable; urgency=low + + * New upstream release + + * Install changes-4.0.1 as upstream changelog + + * debian/manpages/assistant-qt4.1: new manpage written from scratch + based on the output of "assistant -help" + + * debian/manpages/designer-qt4.1, debian/manpages/linguist-qt4.1: + manpages stolen from the Qt3 packages and trivially adapted for Qt4 + (Closes: #322403) + + * debian/manpages/moc-qt4.1: escape some '-' characters + + * debian/qt4-dev-tools.manpages: install the new assistant-qt4.1, + designer-qt4.1, and linguist-qt4.1 manpages + + * debian/control: made qt4-dev-tools recommend qt4-doc, since assisant + needs it to be useful (Closes: #323251) + + * Removed the FAQ from qt4-doc.docs, since it's no longer included in + 4.0.1, and was useless anyway + + * Build-depend on libmysqlclient14-dev since libmysqlclient12-dev is + scheduled to be removed + + * debian/libqt4-dev.install: work around TT's broken "install" target in + this release so that the pkgconfig files are installed in + /usr/lib/pkgconfig instead of directly in /usr/lib. Grrrr. + + -- Brian Nelson <pyro@debian.org> Thu, 25 Aug 2005 19:28:35 -0700 + +qt4-x11 (4.0.0-3) unstable; urgency=low + + * debian/control: changed the xlibs-pic dependency to xlibs-static-pic + for the X.org transition (Closes: #319586) + + * Added manpages for lrelease, lupdate, moc, qtconfig, and uic, stolen + from the Qt3 upstream tarball, and wrote a manpage for qmake from + scratch. Since now manpages are included for all executables using + the alternatives, the symlinks to them no longer dangle. + (Closes: #319456) + + * debian/libqt4-core.install: added + usr/lib/qt4/plugins/imageformats/libqjpeg.so to include the jpeg + plugin (Closes: #321582) + + * debian/libqt4-debug.install: added the libqjpeg_debug.so plugin + + * debian/rules: don't hardcode the /usr/include/postgresql/8.0 path, + instead of the output of `pg_config --includedir`, stolen from Qt3 + packages + + * debian/libqt4-gui.install: added the OpenGL module library so that it + actually gets included in a package (Closes: #321874) + + * debian/control: updated the package descriptions to note that the + Network and XML modules are included in the libqt4-core package, and + the OpenGL module is included in the libqt4-gui package + + -- Brian Nelson <pyro@debian.org> Mon, 8 Aug 2005 08:58:10 -0700 + +qt4-x11 (4.0.0-2) unstable; urgency=low + + * libqt4-dev: added /usr/bin/uic3 (Closes: #318451) + + * Transition to the new X.org packages: + + (Build-)depend on libglu1-xorg-dev instead of xlibmesa-gl-dev + + (Build-)depend on libxinerama-dev (Closes: #318682) + + -- Brian Nelson <pyro@debian.org> Tue, 19 Jul 2005 21:28:19 -0700 + +qt4-x11 (4.0.0-1) unstable; urgency=low + + * Initial release (Closes: #306694) + + -- Brian Nelson <pyro@debian.org> Tue, 5 Jul 2005 19:42:18 -0700 diff --git a/config.profiles/harmattan/collection/qtdemo.qhc.uu b/config.profiles/harmattan/collection/qtdemo.qhc.uu new file mode 100644 index 0000000..4e4898e --- /dev/null +++ b/config.profiles/harmattan/collection/qtdemo.qhc.uu @@ -0,0 +1,231 @@ +begin 644 qtdemo.qhc +M4U%,:71E(&9O<FUA="`S``0``0$`0"`@````%@````````````````````8` +M```!```````````````"```````````````````````````````````````` +M``````````````4````!`_L`````"`/[```````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````&`PT````"`MT``X$" +MW0`````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M``"!(0(%`'6!76,`;P!M`"X`=`!R`&\`;`!L`'0`90!C`&@`+@!D`&4`<P!I +M`&<`;@!E`'(`+@`T`#0`,``N`"X`+P`N`"X`+P`N`"X`+P`N`"X`+P!S`&@` +M80!R`&4`+P!Q`'0`-``O`&0`;P!C`"\`:`!T`&T`;``M`&0`90!S`&D`9P!N +M`&4`<@`O`&0`90!S`&D`9P!N`&4`<@`N`'$`8P!H`'T!!0!=@2UC`&\`;0`N +M`'0`<@!O`&P`;`!T`&4`8P!H`"X`<0!T`"X`-``T`#``+@`N`"\`+@`N`"\` +M+@`N`"\`+@`N`"\`<P!H`&$`<@!E`"\`<0!T`#0`+P!D`&\`8P`O`&@`=`!M +M`&P`+0!Q`'0`+P!Q`'0`+@!Q`&,`:``-`````@/B``/Q`^(````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M````````````````````````````````````#0($``$=`G$`9`!O`&,`#0$$ +M``$=`7$`9`!O`&,`#0````4#KP`#]P/H`],#Q`.O```````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M`````````````!,%`P`M9`!E`',`:0!G`&X`90!R``T$`P`A=`!O`&\`;`!S +M`!,#`P`M<0!T`'(`90!F`&0`;P!C``T"`P`A-``N`#0`+@`P``<!`P`5<0!T +M``T````"`\(``^L#P@`````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M````````````````````````)P(#`%51`'0`(`!$`&4`<P!I`&<`;@!E`'(` +M(`!-`&$`;@!U`&$`;``3`0,`+5$`=``@`#0`+@`T`"X`,``-`````P$_``$_ +M`BH##P`````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M````````````````````````````````````````````````````@6@!!R%% +M10&"270`80!B`&P`90!.`&$`;0!E`',`<`!A`&,`90!4`&$`8@!L`&4`3@!A +M`&T`90!S`'``80!C`&4`5`!A`&(`;`!E``)#`%(`10!!`%0`10`@`%0`00!" +M`$P`10`@`$X`80!M`&4`<P!P`&$`8P!E`%0`80!B`&P`90`@`"@`20!D`"`` +M20!.`%0`10!'`$4`4@`@`%``4@!)`$T`00!2`%D`(`!+`$4`60`L`"``3@!A +M`&T`90`@`%0`10!8`%0`+``@`$8`:0!L`&4`4`!A`'0`:``@`%0`10!8`%0` +M(``I`(%B`@<A.3D!@E5T`&$`8@!L`&4`1@!O`&P`9`!E`'(`5`!A`&(`;`!E +M`$8`;P!L`&0`90!R`%0`80!B`&P`90`#0P!2`$4`00!4`$4`(`!4`$$`0@!, +M`$4`(`!&`&\`;`!D`&4`<@!4`&$`8@!L`&4`(``H`$D`9``@`$D`3@!4`$4` +M1P!%`%(`(`!0`%(`20!-`$$`4@!9`"``2P!%`%D`+``@`$X`80!M`&4`<P!P +M`&$`8P!E`$D`9``@`$D`3@!4`$4`1P!%`%(`+``@`$X`80!M`&4`(`!4`$4` +M6`!4`"``*0"!;@,'(5U=`8(E=`!A`&(`;`!E`$8`:0!L`'0`90!R`$$`=`!T +M`'(`:0!B`'4`=`!E`%0`80!B`&P`90!&`&D`;`!T`&4`<@!!`'0`=`!R`&D` +M8@!U`'0`90!4`&$`8@!L`&4`!$,`4@!%`$$`5`!%`"``5`!!`$(`3`!%`"`` +M1@!I`&P`=`!E`'(`00!T`'0`<@!I`&(`=0!T`&4`5`!A`&(`;`!E`"``*`!) +M`&0`(`!)`$X`5`!%`$<`10!2`"``4`!2`$D`30!!`%(`60`@`$L`10!9`"P` +M(`!.`&$`;0!E`"``5`!%`%@`5``@`"D`#0````4#W0`#^0/R`^L#Y`/=```` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````%!0,!`0(%!00#`0$"!`4#`P$!`@$% +M`@,!`0$"!0$#`0$!`0T"7@`$`2L``F(#-0$K`?`````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M````````````````````````````````````````````````````````@4(& +M!R%!00&"!70`80!B`&P`90!3`&4`=`!T`&D`;@!G`',`5`!A`&(`;`!E`%,` +M90!T`'0`:0!N`&<`<P!4`&$`8@!L`&4`"4,`4@!%`$$`5`!%`"``5`!!`$(` +M3`!%`"``4P!E`'0`=`!I`&X`9P!S`%0`80!B`&P`90`@`"@`2P!E`'D`(`!4 +M`$4`6`!4`"``4`!2`$D`30!!`%(`60`@`$L`10!9`"P`(`!6`&$`;`!U`&4` +M(`!"`$P`3P!"`"``*0!L!P<A@0U!`0!I`&X`9`!E`'@`<P!Q`&P`:0!T`&4` +M7P!A`'4`=`!O`&D`;@!D`&4`>`!?`%,`90!T`'0`:0!N`&<`<P!4`&$`8@!L +M`&4`7P`Q`%,`90!T`'0`:0!N`&<`<P!4`&$`8@!L`&4`"@````2!4`0'(4E) +M`8(1=`!A`&(`;`!E`$8`:0!L`'0`90!R`$X`80!M`&4`5`!A`&(`;`!E`$8` +M:0!L`'0`90!R`$X`80!M`&4`5`!A`&(`;`!E``5#`%(`10!!`%0`10`@`%0` +M00!"`$P`10`@`$8`:0!L`'0`90!R`$X`80!M`&4`5`!A`&(`;`!E`"``*`!) +M`&0`(`!)`$X`5`!%`$<`10!2`"``4`!2`$D`30!!`%(`60`@`$L`10!9`"P` +M(`!.`&$`;0!E`"``5`!%`%@`5``@`"D`@4@%!R$Y.0&"(70`80!B`&P`90!& +M`&D`;`!T`&4`<@!4`&$`8@!L`&4`1@!I`&P`=`!E`'(`5`!A`&(`;`!E``=# +M`%(`10!!`%0`10`@`%0`00!"`$P`10`@`$8`:0!L`'0`90!R`%0`80!B`&P` +M90`@`"@`3@!A`&T`90!)`&0`(`!)`$X`5`!%`$<`10!2`"P`(`!&`&D`;`!T +M`&4`<@!!`'0`=`!R`&D`8@!U`'0`90!)`&0`(`!)`$X`5`!%`$<`10!2`"`` +M*0`-``````0````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M````````````````````````````````````````````````"@`````$```` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +9```````````````````````````````````` +` +end diff --git a/config.profiles/harmattan/compat b/config.profiles/harmattan/compat new file mode 100644 index 0000000..7f8f011 --- /dev/null +++ b/config.profiles/harmattan/compat @@ -0,0 +1 @@ +7 diff --git a/config.profiles/harmattan/configure-pulse.sh b/config.profiles/harmattan/configure-pulse.sh new file mode 100755 index 0000000..c683705 --- /dev/null +++ b/config.profiles/harmattan/configure-pulse.sh @@ -0,0 +1,81 @@ +#/bin/sh + +# Fail on error +set -e +# We will assume that if TOOLCHAIN_PATH is not set, that other required actions have not been done either +# so advise the user - N.B.: PATH & PKG_CONFIG_PATH may already be set to system values so we can't +# simply check for them being unset. +if [ -z "$TOOLCHAIN_PATH" ]; then + echo + echo "TOOLCHAIN_PATH must be set to the path of the columbus toolchain, e.g.:" 1>&2 + echo " export TOOLCHAIN_PATH=/opt/toolchains/columbus/cs2007q3-glibc2.5-arm7" 1>&2 + echo "PATH should have the path to toolchain's bin dir at beginning, e.g.:" 1>&2 + echo " export PATH=\$TOOLCHAIN_PATH/bin:\$PATH" 1>&2 + echo "PKG_CONFIG_PREFIX should have the prefix for pkg config, e.g.:" 1>&2 + echo " export PKG_CONFIG_PREFIX=\$TOOLCHAIN_PATH/arm-none-linux-gnueabi" 1>&2 + echo "PKG_CONFIG_PATH must be set to the path(s) to pkg config .pc file location(s), e.g.:" 1>&2 + echo " export PKG_CONFIG_PATH=\$PKG_CONFIG_PREFIX/libc/lib/pkgconfig:\$PKG_CONFIG_PREFIX/libc/usr/lib/pkgconfig" 1>&2 + echo + exit 1 +fi + +# We assume the current dir is the depot and we are not shadow building +# Blast the mkspec we use, if it exists, and copy it out of debian dir +rm -rf mkspecs/linux-g++-cross +cp -a debian/mkspecs/linux-g++-cross mkspecs/ + +# maemo does the next two lines, no idea why, left them for referance +# rm -rf mkspecs/glibc-g++ +# cp -a mkspecs/linux-g++ mkspecs/glibc-g++ + +# Run configure - we take extra arguments if given +exec ./configure -nokia-developer \ + -prefix "/usr" \ + -bindir "/usr/bin" \ + -libdir "/usr/lib" \ + -docdir "/usr/share/qt4/doc" \ + -headerdir "/usr/include/qt4" \ + -datadir "/usr/share/qt4" \ + -plugindir "/usr/lib/qt4/plugins" \ + -translationdir "/usr/share/qt4/translations" \ + -sysconfdir "/etc/xdg" \ + -arch arm \ + -xplatform linux-g++-cross \ + -fast \ + -mitshm \ + -no-optimized-qmake \ + -reduce-relocations \ + -no-separate-debug-info \ + -system-zlib \ + -system-libtiff \ + -system-libpng \ + -system-libjpeg \ + -no-nas-sound \ + -qt-gif \ + -no-qt3support \ + -no-libmng \ + -opengl es2 \ + -no-accessibility \ + -nomake examples \ + -nomake demos \ + -little-endian \ + -I${TOOLCHAIN_PATH}/libc/usr/include/freetype2 \ + -lfontconfig \ + -no-cups \ + -no-gtkstyle \ + -exceptions \ + -no-xinerama \ + -dbus \ + -glib \ + -no-pch \ + -gstreamer \ + -svg \ + -webkit \ + -no-sql-ibase \ + -xmlpatterns \ + -system-sqlite \ + -plugin-sql-sqlite \ + -openssl \ + -DQT_QLOCALE_USES_FCVT \ + "$@" +# End of Script diff --git a/config.profiles/harmattan/control b/config.profiles/harmattan/control new file mode 100644 index 0000000..13908a9 --- /dev/null +++ b/config.profiles/harmattan/control @@ -0,0 +1,648 @@ +Source: qt4-x11 +Section: libs +Priority: optional +Maintainer: Petri Latvala <ext-petri.latvala@nokia.com> +Build-Depends: cdbs, debhelper (>= 7), flex, quilt, sharutils, + libdbus-1-dev, libfreetype6-dev, libglib2.0-dev, libice-dev, libjpeg62-dev, + libpng12-dev, libreadline5-dev | libreadline4-dev, libsm-dev, libtiff4-dev, libx11-dev, + libxext-dev, libxft-dev, libxi-dev, libxmu-dev, + libxrandr-dev, libxrender-dev, libxslt1-dev, libxt-dev, x11proto-core-dev, + zlib1g-dev, libgstreamer-plugins-base0.10-dev, libgstreamer0.10-dev, libicu-dev, + libgles2-sgx-img-dev [arm armel] | libgles2-dev [arm armel], libgles2 [arm armel], + opengles-sgx-img-common-dev [arm armel], opengles-sgx-img-common [arm armel], + libgl-dev [i386], libgl1 [i386], + libxau-dev, libxcb1-dev, libxdmcp-dev, libexpat1-dev, + libsqlite3-dev, libsqlite3-0, libssl-dev, libasound2-dev, libxv-dev, + icd2-dev, icd2-osso-ic-dev, osso-wlan-dev, libconnsettings0-dev +Standards-Version: 3.9.1.0 + +Package: libqtcore4 +Architecture: any +Section: libs +Depends: ${shlibs:Depends}, ${misc:Depends} +Replaces: libqt4-core (<< 4.4.0~beta1-1), libqt4-gui (<< 4.4.0~beta1-1) +Description: Qt 4 core module + Qt is a cross-platform C++ application framework. Qt's primary feature + is its rich set of widgets that provide standard GUI functionality. + . + The QtCore module contains core non-GUI functionality. + +Package: libqtcore4-dbg +Priority: extra +Architecture: any +Section: debug +Depends: libqtcore4 (= ${binary:Version}), ${misc:Depends} +Description: Qt 4 library debugging symbols + Qt is a cross-platform C++ application framework. Qt's primary feature + is its rich set of widgets that provide standard GUI functionality. + . + This package contains the debugging symbols for the Qt 4 Core libraries. + +Package: libqt4-core +Architecture: any +Section: libs +Depends: ${shlibs:Depends}, ${misc:Depends}, libqtcore4 (= ${binary:Version}), libqt4-network (= ${binary:Version}), libqt4-script (= ${binary:Version}), libqt4-xml (= ${binary:Version}), libqt4-dbus (= ${binary:Version}) +Description: transitional package for Qt 4 core non-GUI runtime libraries + Qt is a cross-platform C++ application framework. Qt's primary feature + is its rich set of widgets that provide standard GUI functionality. + . + This is a dummy transitional package to enable installation of other Debian + packages linked against Qt 4.3 or earlier Qt 4 releases previously shipped + in Debian. + +Package: libqtgui4 +Architecture: any +Section: libs +Depends: ${shlibs:Depends}, ${misc:Depends}, libqtcore4 (= ${binary:Version}), fontconfig, opengles-sgx-img-common [arm armel], libgles2 [arm armel] +Conflicts: libqt4-designer (<< 4.4.0~beta1-1) +Replaces: libqt4-core (<< 4.0.1-3), libqt4-gui (<< 4.4.0), + qt4-designer (<< 4.1.4), libqt4-designer (<< 4.4.0~beta1-1) +Description: Qt 4 GUI module + Qt is a cross-platform C++ application framework. Qt's primary feature + is its rich set of widgets that provide standard GUI functionality. + . + The QtGui module extends QtCore with GUI functionality. + +Package: libqtgui4-dbg +Priority: extra +Architecture: any +Section: debug +Depends: libqtgui4 (= ${binary:Version}), ${misc:Depends} +Description: Qt 4 library debugging symbols + Qt is a cross-platform C++ application framework. Qt's primary feature + is its rich set of widgets that provide standard GUI functionality. + . + This package contains the debugging symbols for the Qt 4 GUI libraries. + +Package: libqt4-gui +Architecture: any +Section: libs +Depends: ${shlibs:Depends}, ${misc:Depends}, libqtgui4 (= ${binary:Version}), libqt4-svg (= ${binary:Version}) +Description: transitional package for Qt 4 GUI runtime libraries + Qt is a cross-platform C++ application framework. Qt's primary feature + is its rich set of widgets that provide standard GUI functionality. + . + This is a dummy transitional package depending on the Qt4 GUI library + packages which the package of the same name used to provide in Qt 4.3.4 + and earlier Debian packages of Qt4. + +Package: libqt4-network +Architecture: any +Section: libs +Depends: ${shlibs:Depends}, ${misc:Depends}, libqtcore4 (= ${binary:Version}) +Replaces: libqt4-core (<< 4.4.0~beta1-1) +Description: Qt 4 network module + Qt is a cross-platform C++ application framework. Qt's primary feature + is its rich set of widgets that provide standard GUI functionality. + . + The QtNetwork module offers classes that allow you to write TCP/IP clients and + servers. It provides classes to make network programming easier and portable. + +Package: libqt4-network-dbg +Priority: extra +Architecture: any +Section: debug +Depends: libqt4-network (= ${binary:Version}), ${misc:Depends} +Description: Qt 4 library debugging symbols + Qt is a cross-platform C++ application framework. Qt's primary feature + is its rich set of widgets that provide standard GUI functionality. + . + This package contains the debugging symbols for the Qt 4 Network libraries. + +Package: libqt4-script +Architecture: any +Section: libs +Depends: ${shlibs:Depends}, ${misc:Depends}, libqt4-dbus (= ${binary:Version}), libqtcore4 (= ${binary:Version}) +Replaces: libqt4-core (<< 4.4.0~beta1-1) +Description: Qt 4 script module + Qt is a cross-platform C++ application framework. Qt's primary feature + is its rich set of widgets that provide standard GUI functionality. + . + The QtScript module provides classes for making Qt applications scriptable. + +Package: libqt4-script-dbg +Priority: extra +Architecture: any +Section: debug +Depends: libqt4-script (= ${binary:Version}), ${misc:Depends} +Description: Qt 4 library debugging symbols + Qt is a cross-platform C++ application framework. Qt's primary feature + is its rich set of widgets that provide standard GUI functionality. + . + This package contains the debugging symbols for the Qt 4 Script libraries. + +Package: libqt4-sql +Architecture: any +Section: libs +Depends: ${shlibs:Depends}, ${misc:Depends}, libqtcore4 (= ${binary:Version}) +Recommends: libqt4-sql-sqlite +Suggests: libqt4-dev +Description: Qt 4 SQL module + Qt is a cross-platform C++ application framework. Qt's primary feature + is its rich set of widgets that provide standard GUI functionality. + . + The QtSql module helps you provide seamless database integration to your Qt + applications. + . + If you wish to use the SQL module for development, you should install the + libqt4-dev package. + +Package: libqt4-sql-dbg +Priority: extra +Architecture: any +Section: debug +Depends: libqt4-sql (= ${binary:Version}), ${misc:Depends} +Description: Qt 4 library debugging symbols + Qt is a cross-platform C++ application framework. Qt's primary feature + is its rich set of widgets that provide standard GUI functionality. + . + This package contains the debugging symbols for the Qt 4 SQL libraries. + +Package: libqt4-sql-sqlite +Architecture: any +Section: libs +Depends: ${shlibs:Depends}, ${misc:Depends}, libqt4-sql (= ${binary:Version}) +Description: Qt 4 SQLite plugin + Qt is a cross-platform C++ application framework. Qt's primary feature + is its rich set of widgets that provide standard GUI functionality. + +Package: libqt4-sql-sqlite-dbg +Priority: extra +Architecture: any +Section: debug +Depends: libqt4-sql-sqlite (= ${binary:Version}), ${misc:Depends} +Description: Qt 4 library debugging symbols + Qt is a cross-platform C++ application framework. Qt's primary feature + is its rich set of widgets that provide standard GUI functionality. + . + This package contains the debugging symbols for the Qt 4 SQL SQLite plugin. + +Package: libqt4-svg +Architecture: any +Section: libs +Depends: ${shlibs:Depends}, ${misc:Depends}, libqtcore4 (= ${binary:Version}), libqtgui4 (= ${binary:Version}) +Conflicts: libqt4-gui (<< 4.4.0~beta1-1) +Replaces: libqt4-gui (<< 4.4.0~beta1-1) +Description: Qt 4 SVG module + Qt is a cross-platform C++ application framework. Qt's primary feature + is its rich set of widgets that provide standard GUI functionality. + . + The QtSvg module provides classes for displaying the contents of SVG files. + . + Scalable Vector Graphics (SVG) is a language for describing two-dimensional + graphics and graphical applications in XML. + +Package: libqt4-svg-dbg +Priority: extra +Architecture: any +Section: debug +Depends: libqt4-svg (= ${binary:Version}), ${misc:Depends} +Description: Qt 4 library debugging symbols + Qt is a cross-platform C++ application framework. Qt's primary feature + is its rich set of widgets that provide standard GUI functionality. + . + This package contains the debugging symbols for the Qt 4 SVG libraries. + +Package: libqt4-webkit +Architecture: any +Section: libs +Depends: ${shlibs:Depends}, ${misc:Depends}, libqtwebkit4 (>= 2.0~) +Description: Qt 4 WebKit module + Qt is a cross-platform C++ application framework. Qt's primary feature + is its rich set of widgets that provide standard GUI functionality. + . + This is a dummy transitional package to enable installation of other packages + linked against Qt WebKit 4.4 - 4.7 releases previously shipped from Qt source. + +Package: libqt4-xml +Architecture: any +Section: libs +Depends: ${shlibs:Depends}, ${misc:Depends}, libqtcore4 (= ${binary:Version}) +Replaces: libqt4-core (<< 4.4.0~beta1-1) +Description: Qt 4 XML module + Qt is a cross-platform C++ application framework. Qt's primary feature + is its rich set of widgets that provide standard GUI functionality. + . + The QtXml module provides a stream reader and writer for XML documents, + and C++ implementations of SAX and DOM. + +Package: libqt4-xml-dbg +Priority: extra +Architecture: any +Section: debug +Depends: libqt4-xml (= ${binary:Version}), ${misc:Depends} +Description: Qt 4 library debugging symbols + Qt is a cross-platform C++ application framework. Qt's primary feature + is its rich set of widgets that provide standard GUI functionality. + . + This package contains the debugging symbols for the Qt 4 XML libraries. + +Package: libqt4-xmlpatterns +Architecture: any +Section: libs +Depends: ${shlibs:Depends}, ${misc:Depends}, libqtcore4 (= ${binary:Version}), libqt4-xml (= ${binary:Version}) +Replaces: libqt4-core (<< 4.4.0~beta1-1) +Description: Qt 4 XML Patterns module + lorem ipsum + . + and all that + +Package: libqt4-xmlpatterns-dbg +Priority: extra +Architecture: any +Section: debug +Depends: libqt4-xmlpatterns (= ${binary:Version}), ${misc:Depends} +Description: Qt 4 XML patterns library debugging symbols + Qt is a cross-platform C++ application framework. Qt's primary feature + is its rich set of widgets that provide standard GUI functionality. + . + This package contains the debugging symbols for the Qt 4 XML patterns + library. + +Package: libqt4-dbus +Architecture: any +Section: libs +Depends: ${shlibs:Depends}, ${misc:Depends}, libqt4-xml (= ${binary:Version}), libqtcore4 (= ${binary:Version}) +Replaces: libqt4-core (<< 4.4.0~beta1-1) +Description: Qt 4 D-Bus module + Qt is a cross-platform C++ application framework. Qt's primary feature + is its rich set of widgets that provide standard GUI functionality. + . + The QtDBus module is a Unix-only library that you can use to make Inter-Process + Communication using the D-Bus protocol. + . + Applications using the QtDBus module can provide services to other, remote + applications by exporting objects, as well as use services exported by those + applications by placing calls and accessing properties. + +Package: libqt4-dbus-dbg +Priority: extra +Architecture: any +Section: debug +Depends: libqt4-dbus (= ${binary:Version}), ${misc:Depends} +Description: Qt 4 library debugging symbols + Qt is a cross-platform C++ application framework. Qt's primary feature + is its rich set of widgets that provide standard GUI functionality. + . + This package contains the debugging symbols for the Qt 4 DBus libraries. + +Package: libqt4-help +Architecture: any +Section: libs +Depends: ${shlibs:Depends}, ${misc:Depends}, libqt4-sql (= ${binary:Version}), libqtcore4 (= ${binary:Version}), libqtgui4 (= ${binary:Version}) +Description: Qt 4 help module + Qt is a cross-platform C++ application framework. Qt's primary feature + is its rich set of widgets that provide standard GUI functionality. + . + The QtHelp module provides classes for integrating online documentation in + applications. + +Package: libqt4-help-dbg +Priority: extra +Architecture: any +Section: debug +Depends: libqt4-help (= ${binary:Version}), ${misc:Depends} +Description: Qt 4 library debugging symbols + Qt is a cross-platform C++ application framework. Qt's primary feature + is its rich set of widgets that provide standard GUI functionality. + . + This package contains the debugging symbols for the Qt 4 Help libraries. + +Package: libqt4-test +Architecture: any +Section: libs +Depends: ${shlibs:Depends}, ${misc:Depends}, libqtcore4 (= ${binary:Version}) +Replaces: libqt4-core (<< 4.4.0~beta1-1) +Description: Qt 4 test module + Qt is a cross-platform C++ application framework. Qt's primary feature + is its rich set of widgets that provide standard GUI functionality. + . + The QtTest module provides classes for unit testing Qt applications and + libraries. + +Package: libqt4-test-dbg +Priority: extra +Architecture: any +Section: debug +Depends: libqt4-test (= ${binary:Version}), ${misc:Depends} +Description: Qt 4 library debugging symbols + Qt is a cross-platform C++ application framework. Qt's primary feature + is its rich set of widgets that provide standard GUI functionality. + . + This package contains the debugging symbols for the Qt 4 Test libraries. + +Package: libqt4-dev +Architecture: any +Section: libdevel +Depends: ${shlibs:Depends}, ${misc:Depends}, + libqt4-dbus (= ${binary:Version}), + libqt4-xml (= ${binary:Version}), libqtcore4 (= ${binary:Version}), + libqt4-network (= ${binary:Version}), libqtgui4 (= ${binary:Version}), + libqt4-svg (= ${binary:Version}), libqt4-sql (= ${binary:Version}), + libqt4-script (= ${binary:Version}), libqt4-help (= ${binary:Version}), + libqt4-test (= ${binary:Version}), libqt4-phonon (= ${binary:Version}), + libqt4-xmlpatterns (= ${binary:Version}), + libqt4-multimedia (= ${binary:Version}), libqt4-opengl (= ${binary:Version}), + libqt4-declarative (= ${binary:Version}), qt4-linguist-tools (= ${binary:Version}), + libqt4-meegographicssystemhelper-dev (= ${binary:Version}) [arm armel], + libgl-dev [i386], libgles2-sgx-img-dev [arm armel], + opengles-sgx-img-common-dev [arm armel], libxv-dev, libc6-dev +Conflicts: qt3-dev-tools (<= 3:3.3.4-7) +Replaces: libqt4-opengl-dev (<< 4.4.0-2) +Suggests: libmysqlclient15-dev, libsqlite0-dev, libsqlite3-dev, libpq-dev, libiodbc2-dev, firebird2.0-dev +Description: Qt 4 development files + Qt is a cross-platform C++ application framework. Qt's primary feature + is its rich set of widgets that provide standard GUI functionality. + . + This package contains the header development files and development programs + such as qmake used for building Qt4 applications. + +Package: qt4-linguist-tools +Architecture: any +Section: libdevel +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: Qt 4 development files + Qt is a cross-platform C++ application framework. Qt's primary feature + is its rich set of widgets that provide standard GUI functionality. + . + This package contains the Qt Linguist development tool + such as lrelease used for building Qt4 applications. + +Package: libqt4 +Architecture: any +Section: libs +Depends: libqt4-core (= ${binary:Version}), ${misc:Depends} +Description: Qt 4 dummy package + This is a dummy alias-package. + +Package: libqt4-phonon +Architecture: any +Section: libs +Depends: ${shlibs:Depends}, ${misc:Depends}, libqtcore4 (= ${binary:Version}), libqt4-xml (= ${binary:Version}), libqtgui4 (= ${binary:Version}), libqt4-opengl (= ${binary:Version}), libqt4-dbus (= ${binary:Version}) +Replaces: libqt4-core (<< 4.4.0~beta1-1) +Description: Qt 4 Phonon Libraries + Qt 4 media playing libraries + +Package: libqt4-phonon-dbg +Priority: extra +Architecture: any +Section: debug +Depends: libqt4-phonon (= ${binary:Version}), ${misc:Depends} +Description: Qt 4 phonon module + Qt is a cross-platform C++ application framework. Qt's primary feature + is its rich set of widgets that provide standard GUI functionality. + . + This package contains the debugging symbol for the Qt phonon library. + +Package: libqt4-multimedia +Architecture: any +Section: libs +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: Qt 4 Multimedia Libraries + Qt 4 media playing libraries + +Package: libqt4-multimedia-dbg +Priority: extra +Architecture: any +Section: debug +Depends: libqt4-multimedia (= ${binary:Version}), ${misc:Depends} +Description: Qt 4 multimedia module + Qt is a cross-platform C++ application framework. Qt's primary feature + is its rich set of widgets that provide standard GUI functionality. + . + This package contains the debugging symbol for the Qt multimedia library. + +Package: libqt4-opengl +Architecture: any +Section: libs +Depends: libqtcore4 (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}, opengles-sgx-img-common [arm armel], libgles2 [arm armel], libgl1 [i386] +Replaces: libqt4-core (<< 4.4.0~beta1-1) +Description: Qt 4 OpenGL module + Qt is a cross-platform C++ application framework. Qt's primary feature + is its rich set of widgets that provide standard GUI functionality. + . + The QtOpenGL module offers classes that make it easy to use OpenGL in Qt + applications. + . + OpenGL is a standard API for rendering 3D graphics. OpenGL only deals with 3D + rendering and provides little or no support for GUI programming issues. + . + Qt is a cross-platform C++ application framework. Qt's primary feature + is its rich set of widgets that provide standard GUI functionality. + . + This package contains the development files needed to build Qt 4 applications + using QtOpenGL library. + +Package: libqt4-opengl-dbg +Priority: extra +Architecture: any +Section: debug +Depends: libqt4-opengl (= ${binary:Version}), ${misc:Depends} +Description: Qt 4 library debugging symbols + Qt is a cross-platform C++ application framework. Qt's primary feature + is its rich set of widgets that provide standard GUI functionality. + . + This package contains the debugging symbols for the Qt 4 OpenGL libraries. + +Package: libqt4-opengl-dev +Architecture: any +Section: libdevel +Depends: libqt4-dev (= ${binary:Version}), ${misc:Depends} +Replaces: libqt4-dev (<< 4.4.0~beta1-1) +Description: Qt 4 OpenGL library development files + Qt is a cross-platform C++ application framework. Qt's primary feature + is its rich set of widgets that provide standard GUI functionality. + . + This is a transitional package for libqt4-opengl-dev, and can be safely removed + after the installation is complete. + +Package: qt4-acceptance-tests +Section: libdevel +Priority: optional +Architecture: any +Depends: ci-testing, ${shlibs:Depends}, ${misc:Depends} +XB-Maemo-CI-Packages: libqtcore4 +XB-Maemo-CI-Stage: staging, acceptance +Description: Tests for libqtcore4 + Qt is a cross-platform C++ application framework. Qt's primary feature + is its rich set of widgets that provide standard GUI functionality. + . + This package contains selected autotest cases for CI testing. + +Package: qt4-maemo-auto-tests +Section: libdevel +Priority: optional +Architecture: any +Depends: ci-testing, ${shlibs:Depends}, ${misc:Depends} +XB-Maemo-CI-Packages: libqtcore4 +XB-Maemo-CI-Stage: staging +Description: Tests for Qt4 + Qt is a cross-platform C++ application framework. Qt's primary feature + is its rich set of widgets that provide standard GUI functionality. + . + This package contains selected autotest cases for CI testing. + +Package: libqt4-declarative +Architecture: any +Section: libs +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: Qt 4 declarative module + Qt is a cross-platform C++ application framework. Qt's primary feature + is its rich set of widgets that provide standard GUI functionality. + . + The QtDeclarative module contains declarative UI functionality. + +Package: libqt4-declarative-dbg +Priority: extra +Architecture: any +Section: debug +Depends: libqt4-declarative (= ${binary:Version}), ${misc:Depends} +Description: Qt 4 library debugging symbols + Qt is a cross-platform C++ application framework. Qt's primary feature + is its rich set of widgets that provide standard GUI functionality. + . + This package contains the debugging symbols for the Qt 4 Declarative + libraries. + +Package: libqt4-declarative-dev +Architecture: any +Section: libdevel +Depends: libqt4-dev (>= ${binary:Version}), ${misc:Depends} +Description: Qt 4 Declarative development files + Qt is a cross-platform C++ application framework. Qt's primary feature + is its rich set of widgets that provide standard GUI functionality. + . + This is a transitional package for libqt4-declarative-dev, and can be + safely removed after the installation is complete. + +Package: qt4-declarative-qmlviewer +Architecture: any +Section: devel +Depends: libqt4-declarative (=${binary:Version}), ${shlibs:Depends}, ${misc:Depends} +Description: Qt 4 declarative module + Qt is a cross-platform C++ application framework. Qt's primary feature + is its rich set of widgets that provide standard GUI functionality. + . + The QtDeclarative viewer allows viewing QML files + +Package: libqt4-gui-tests +Section: libdevel +Priority: optional +Architecture: any +Depends: ci-testing, ${shlibs:Depends}, ${misc:Depends} +XB-Maemo-CI-Packages: libqtgui4 +XB-Maemo-CI-Stage: staging +Description: Tests for Qt4 + Qt is a cross-platform C++ application framework. Qt's primary feature + is its rich set of widgets that provide standard GUI functionality. + . + This package contains selected autotest cases for CI testing. + +Package: libqt4-doc +Section: doc +Priority: optional +Architecture: all +Depends: ${misc:Depends} +Description: Qt 4 documentation + Qt is a cross-platform C++ application framework. Qt's primary feature + is its rich set of widgets that provide standard GUI functionality. + . + This package contains the documentation for Qt 4. + +Package: libqt4-meegographicssystem +Architecture: arm armel +Section: libs +Depends: ${shlibs:Depends}, ${misc:Depends}, libqt4-meegographicssystemhelper +Conflicts: libqt4-meego (<< 4.7.2~git20110119) +Replaces: libqt4-meego (<< 4.7.2~git20110119) +Description: Qt 4 MeeGo graphics system plugin + Qt is a cross-platform C++ application framework. Qt's primary feature + is its rich set of widgets that provide standard GUI functionality. + . + This package contains the MeeGo graphics system plugin. + +Package: libqt4-meegographicssystemhelper +Architecture: any +Section: libs +Depends: ${shlibs:Depends}, ${misc:Depends}, libqt4-meegographicssystem [arm armel] +Conflicts: libqt4-meego (<< 4.7.2~git20110119) +Replaces: libqt4-meego (<< 4.7.2~git20110119) +Provides: libqt4-meego +Description: Qt 4 MeeGo graphics system helper + Qt is a cross-platform C++ application framework. Qt's primary feature + is its rich set of widgets that provide standard GUI functionality. + . + This package contains the MeeGo graphics system helper library. + +Package: libqt4-meegographicssystemhelper-dev +Architecture: any +Section: libdevel +Depends: libqt4-meegographicssystemhelper (= ${binary:Version}), ${misc:Depends} +Conflicts: libqt4-meego-dev (<< 4.7.2~git20110119) +Replaces: libqt4-meego-dev (<< 4.7.2~git20110119) +Provides: libqt4-meego-dev +Description: Qt 4 MeeGo graphics system development libraries and headers + Qt is a cross-platform C++ application framework. Qt's primary feature + is its rich set of widgets that provide standard GUI functionality. + . + This package contains the MeeGo graphics system header files and + development libraries. + +Package: libqt4-meegographicssystemhelper-dbg +Priority: extra +Architecture: any +Section: debug +Depends: libqt4-meegographicssystemhelper (= ${binary:Version}), ${misc:Depends} +Conflicts: libqt4-meego-dbg (<< 4.7.2~git20110119) +Replaces: libqt4-meego-dbg (<< 4.7.2~git20110119) +Description: Qt 4 library debugging symbols + Qt is a cross-platform C++ application framework. Qt's primary feature + is its rich set of widgets that provide standard GUI functionality. + . + This package provides the debugging symbols for the MeeGo support + libraries. + +Package: libqt4-meegographicssystem-dbg +Priority: extra +Architecture: arm armel +Section: debug +Depends: libqt4-meegographicssystem (= ${binary:Version}), ${misc:Depends} +Conflicts: libqt4-meego-dbg (<< 4.7.2~git20110119) +Replaces: libqt4-meego-dbg (<< 4.7.2~git20110119) +Description: Qt 4 library debugging symbols + Qt is a cross-platform C++ application framework. Qt's primary feature + is its rich set of widgets that provide standard GUI functionality. + . + This package provides the debugging symbols for the MeeGo graphics + system plugin. + +Package: libqt4-meego +Architecture: all +Section: oldlibs +Depends: libqt4-meegographicssystemhelper, libqt4-meegographicssystem [arm armel] +Description: Qt 4 MeeGo support libraries transitional package + Qt is a cross-platform C++ application framework. Qt's primary feature + is its rich set of widgets that provide standard GUI functionality. + . + This package is for transitioning purposes only and can be removed. + +Package: libqt4-meego-dev +Architecture: all +Section: oldlibs +Depends: libqt4-meegographicssystemhelper-dev +Description: Qt 4 MeeGo support libraries transitional package + Qt is a cross-platform C++ application framework. Qt's primary feature + is its rich set of widgets that provide standard GUI functionality. + . + This package is for transitioning purposes only and can be removed. + +Package: libqt4-meego-dbg +Priority: extra +Architecture: all +Section: debug +Depends: libqt4-meegographicssystemhelper-dbg, libqt4-meegographicssystem-dbg [arm armel] +Description: Qt 4 MeeGo support libraries transitional package + Qt is a cross-platform C++ application framework. Qt's primary feature + is its rich set of widgets that provide standard GUI functionality. + . + This package is for transitioning purposes only and can be removed. diff --git a/config.profiles/harmattan/libqt4-core.lintian b/config.profiles/harmattan/libqt4-core.lintian new file mode 100644 index 0000000..bd6e1f7 --- /dev/null +++ b/config.profiles/harmattan/libqt4-core.lintian @@ -0,0 +1 @@ +libqt4-core: unknown-control-file digsigsums diff --git a/config.profiles/harmattan/libqt4-dbus-dbg.lintian b/config.profiles/harmattan/libqt4-dbus-dbg.lintian new file mode 100644 index 0000000..aa4fa15 --- /dev/null +++ b/config.profiles/harmattan/libqt4-dbus-dbg.lintian @@ -0,0 +1 @@ +libqt4-dbus-dbg: unknown-control-file digsigsums diff --git a/config.profiles/harmattan/libqt4-dbus.install b/config.profiles/harmattan/libqt4-dbus.install new file mode 100644 index 0000000..2242fb3 --- /dev/null +++ b/config.profiles/harmattan/libqt4-dbus.install @@ -0,0 +1,3 @@ +usr/lib/libQtDBus.so.* +usr/bin/qdbus + diff --git a/config.profiles/harmattan/libqt4-dbus.lintian b/config.profiles/harmattan/libqt4-dbus.lintian new file mode 100644 index 0000000..c6a37b7 --- /dev/null +++ b/config.profiles/harmattan/libqt4-dbus.lintian @@ -0,0 +1,2 @@ +libqt4-dbus: package-name-doesnt-match-sonames libQtDBus4 +libqt4-dbus: unknown-control-file digsigsums diff --git a/config.profiles/harmattan/libqt4-declarative-dbg.lintian b/config.profiles/harmattan/libqt4-declarative-dbg.lintian new file mode 100644 index 0000000..3d16d1e --- /dev/null +++ b/config.profiles/harmattan/libqt4-declarative-dbg.lintian @@ -0,0 +1 @@ +libqt4-declarative-dbg: unknown-control-file digsigsums diff --git a/config.profiles/harmattan/libqt4-declarative-dev.lintian b/config.profiles/harmattan/libqt4-declarative-dev.lintian new file mode 100644 index 0000000..1045808 --- /dev/null +++ b/config.profiles/harmattan/libqt4-declarative-dev.lintian @@ -0,0 +1 @@ +libqt4-declarative-dev: unknown-control-file digsigsums diff --git a/config.profiles/harmattan/libqt4-declarative.install b/config.profiles/harmattan/libqt4-declarative.install new file mode 100644 index 0000000..7b71d87 --- /dev/null +++ b/config.profiles/harmattan/libqt4-declarative.install @@ -0,0 +1,4 @@ +usr/lib/libQtDeclarative.so.* +usr/lib/qt4/imports/Qt/labs/folderlistmodel +usr/lib/qt4/imports/Qt/labs/gestures +usr/lib/qt4/imports/Qt/labs/particles diff --git a/config.profiles/harmattan/libqt4-declarative.lintian b/config.profiles/harmattan/libqt4-declarative.lintian new file mode 100644 index 0000000..70dd96f --- /dev/null +++ b/config.profiles/harmattan/libqt4-declarative.lintian @@ -0,0 +1,2 @@ +libqt4-declarative: unknown-control-file digsigsums +libqt4-declarative: package-name-doesnt-match-sonames libQtDeclarative4 diff --git a/config.profiles/harmattan/libqt4-dev.dirs b/config.profiles/harmattan/libqt4-dev.dirs new file mode 100644 index 0000000..944cf06 --- /dev/null +++ b/config.profiles/harmattan/libqt4-dev.dirs @@ -0,0 +1 @@ +usr/share/qt4/doc/html diff --git a/config.profiles/harmattan/libqt4-dev.install b/config.profiles/harmattan/libqt4-dev.install new file mode 100644 index 0000000..e7edbcb --- /dev/null +++ b/config.profiles/harmattan/libqt4-dev.install @@ -0,0 +1,85 @@ +usr/bin/native-moc +usr/bin/qdbuscpp2xml +usr/bin/qdbusxml2cpp +usr/bin/native-qmake +usr/bin/qt3to4 +usr/bin/native-rcc +usr/bin/native-uic +usr/bin/host-moc +usr/bin/host-qmake +usr/bin/host-rcc +usr/bin/host-uic +usr/include/qt4/QtUiTools +usr/include/qt4/QtSvg +usr/include/qt4/QtXml +usr/include/qt4/QtGui +usr/include/qt4/phonon +usr/include/qt4/QtScript +usr/include/qt4/QtScriptTools +usr/include/qt4/QtSql +usr/include/qt4/QtXmlPatterns +usr/include/qt4/QtDBus +usr/include/qt4/QtTest +usr/include/qt4/QtHelp +usr/include/qt4/Qt +usr/include/qt4/QtCore +usr/include/qt4/QtNetwork +usr/include/qt4/QtMultimedia +usr/include/qt4/QtOpenGL +usr/include/qt4/QtDeclarative +usr/lib/libphonon.prl +usr/lib/libphonon.so +usr/lib/libQtCLucene.prl +usr/lib/libQtCLucene.so +usr/lib/libQtCore.prl +usr/lib/libQtCore.so +usr/lib/libQtDBus.prl +usr/lib/libQtDBus.so +usr/lib/libQtGui.prl +usr/lib/libQtGui.so +usr/lib/libQtHelp.prl +usr/lib/libQtHelp.so +usr/lib/libQtNetwork.prl +usr/lib/libQtNetwork.so +usr/lib/libQtScript.prl +usr/lib/libQtScript.so +usr/lib/libQtScriptTools.prl +usr/lib/libQtScriptTools.so +usr/lib/libQtSql.prl +usr/lib/libQtSql.so +usr/lib/libQtSvg.prl +usr/lib/libQtSvg.so +usr/lib/libQtTest.prl +usr/lib/libQtTest.so +usr/lib/libQtUiTools.prl +usr/lib/libQtUiTools.a +usr/lib/libQtXmlPatterns.prl +usr/lib/libQtXmlPatterns.so +usr/lib/libQtXml.prl +usr/lib/libQtXml.so +usr/lib/libQtMultimedia.prl +usr/lib/libQtMultimedia.so +usr/lib/libQtOpenGL.prl +usr/lib/libQtOpenGL.so +usr/lib/libQtDeclarative.so +usr/lib/libQtDeclarative.prl +usr/lib/pkgconfig/phonon.pc +usr/lib/pkgconfig/QtCLucene.pc +usr/lib/pkgconfig/QtCore.pc +usr/lib/pkgconfig/QtDBus.pc +usr/lib/pkgconfig/QtGui.pc +usr/lib/pkgconfig/QtHelp.pc +usr/lib/pkgconfig/QtNetwork.pc +usr/lib/pkgconfig/QtScript.pc +usr/lib/pkgconfig/QtScriptTools.pc +usr/lib/pkgconfig/QtSql.pc +usr/lib/pkgconfig/QtSvg.pc +usr/lib/pkgconfig/QtTest.pc +usr/lib/pkgconfig/QtUiTools.pc +usr/lib/pkgconfig/QtXmlPatterns.pc +usr/lib/pkgconfig/QtXml.pc +usr/lib/pkgconfig/QtMultimedia.pc +usr/lib/pkgconfig/QtOpenGL.pc +usr/lib/pkgconfig/QtDeclarative.pc +usr/share/qt4/q3porting.xml +usr/share/qt4/mkspecs diff --git a/config.profiles/harmattan/libqt4-dev.links b/config.profiles/harmattan/libqt4-dev.links new file mode 100644 index 0000000..0624825 --- /dev/null +++ b/config.profiles/harmattan/libqt4-dev.links @@ -0,0 +1,13 @@ +usr/include/qt4 usr/share/qt4/include +usr/bin/lrelease usr/share/qt4/bin/lrelease +usr/bin/lupdate usr/share/qt4/bin/lupdate +usr/bin/moc usr/share/qt4/bin/moc +usr/bin/qmake usr/share/qt4/bin/qmake +usr/bin/uic usr/share/qt4/bin/uic +usr/bin/lrelease usr/bin/lrelease-qt4 +usr/bin/lupdate usr/bin/lupdate-qt4 +usr/bin/moc usr/bin/moc-qt4 +usr/bin/qmake usr/bin/qmake-qt4 +usr/bin/uic usr/bin/uic-qt4 +usr/bin/rcc usr/share/qt4/bin/rcc +usr/lib/qt4/plugins usr/share/qt4/plugins diff --git a/config.profiles/harmattan/libqt4-dev.lintian b/config.profiles/harmattan/libqt4-dev.lintian new file mode 100644 index 0000000..c4c242a --- /dev/null +++ b/config.profiles/harmattan/libqt4-dev.lintian @@ -0,0 +1,17 @@ +libqt4-dev: executable-not-elf-or-script ./usr/share/qt4/mkspecs/macx-pbuilder/Info.plist.app +libqt4-dev: executable-not-elf-or-script ./usr/share/qt4/mkspecs/macx-xcode/Info.plist.app +libqt4-dev: executable-not-elf-or-script ./usr/share/qt4/mkspecs/macx-xcode/qmake.conf +libqt4-dev: executable-not-elf-or-script ./usr/share/qt4/mkspecs/macx-pbuilder/qmake.conf +libqt4-dev: unknown-control-file digsigsums +libqt4-dev: binary-from-other-architecture ./usr/bin/host-moc +libqt4-dev: binary-or-shlib-defines-rpath ./usr/bin/host-moc /scratchbox/host_shared/lib +libqt4-dev: binary-or-shlib-defines-rpath ./usr/bin/host-moc /host_usr/lib +libqt4-dev: binary-from-other-architecture ./usr/bin/host-qmake +libqt4-dev: binary-or-shlib-defines-rpath ./usr/bin/host-qmake /scratchbox/host_shared/lib +libqt4-dev: binary-or-shlib-defines-rpath ./usr/bin/host-qmake /host_usr/lib +libqt4-dev: binary-from-other-architecture ./usr/bin/host-rcc +libqt4-dev: binary-or-shlib-defines-rpath ./usr/bin/host-rcc /scratchbox/host_shared/lib +libqt4-dev: binary-or-shlib-defines-rpath ./usr/bin/host-rcc /host_usr/lib +libqt4-dev: binary-from-other-architecture ./usr/bin/host-uic +libqt4-dev: binary-or-shlib-defines-rpath ./usr/bin/host-uic /scratchbox/host_shared/lib +libqt4-dev: binary-or-shlib-defines-rpath ./usr/bin/host-uic /host_usr/lib diff --git a/config.profiles/harmattan/libqt4-dev.manpages b/config.profiles/harmattan/libqt4-dev.manpages new file mode 100644 index 0000000..1e9423a --- /dev/null +++ b/config.profiles/harmattan/libqt4-dev.manpages @@ -0,0 +1,5 @@ +debian/manpages/lrelease.1 +debian/manpages/lupdate.1 +debian/manpages/moc.1 +debian/manpages/qmake.1 +debian/manpages/uic.1 diff --git a/config.profiles/harmattan/libqt4-dev.postinst b/config.profiles/harmattan/libqt4-dev.postinst new file mode 100644 index 0000000..2ab29ff --- /dev/null +++ b/config.profiles/harmattan/libqt4-dev.postinst @@ -0,0 +1,21 @@ +#!/bin/sh + +set -e + +SPECDIR=/usr/share/qt4/mkspecs + +rm -f ${SPECDIR}/default +ln -s ${SPECDIR}/#PLATFORM_ARG# ${SPECDIR}/default + +PREFIX=native +if [ -f /targets/links/scratchbox.config ]; then + PREFIX=host +fi + +BINARIES="qmake moc rcc uic" + +for bin in $BINARIES; do + ln -sf "/usr/bin/${PREFIX}-${bin}" "/usr/bin/${bin}" +done + +#DEBHELPER# diff --git a/config.profiles/harmattan/libqt4-dev.prerm b/config.profiles/harmattan/libqt4-dev.prerm new file mode 100644 index 0000000..0a078be --- /dev/null +++ b/config.profiles/harmattan/libqt4-dev.prerm @@ -0,0 +1,16 @@ +#!/bin/sh + +set -e + +BINARIES="qmake moc rcc uic" + +case "$1" in + upgrade) ;; + remove|failed-upgrade|deconfigure) + for bin in $BINARIES; do + rm -f "/usr/bin/${bin}" + done + ;; +esac + +#DEBHELPER# diff --git a/config.profiles/harmattan/libqt4-doc.install b/config.profiles/harmattan/libqt4-doc.install new file mode 100644 index 0000000..badafd2 --- /dev/null +++ b/config.profiles/harmattan/libqt4-doc.install @@ -0,0 +1 @@ +usr/share/qt4/doc/html/* diff --git a/config.profiles/harmattan/libqt4-doc.lintian b/config.profiles/harmattan/libqt4-doc.lintian new file mode 100644 index 0000000..e701359 --- /dev/null +++ b/config.profiles/harmattan/libqt4-doc.lintian @@ -0,0 +1 @@ +libqt4-doc: unknown-control-file digsigsums diff --git a/config.profiles/harmattan/libqt4-gui-tests.lintian b/config.profiles/harmattan/libqt4-gui-tests.lintian new file mode 100644 index 0000000..0139465 --- /dev/null +++ b/config.profiles/harmattan/libqt4-gui-tests.lintian @@ -0,0 +1,64 @@ +libqt4-gui-tests: unknown-control-file digsigsums +libqt4-gui-tests: file-in-unusual-dir usr/tests/qt4/tst_modeltest +libqt4-gui-tests: file-in-unusual-dir usr/tests/qt4/tst_qabstractbutton +libqt4-gui-tests: file-in-unusual-dir usr/tests/qt4/tst_qabstractitemmodel +libqt4-gui-tests: file-in-unusual-dir usr/tests/qt4/tst_qabstractprintdialog +libqt4-gui-tests: file-in-unusual-dir usr/tests/qt4/tst_qabstractproxymodel +libqt4-gui-tests: file-in-unusual-dir usr/tests/qt4/tst_qabstractslider +libqt4-gui-tests: file-in-unusual-dir usr/tests/qt4/tst_qabstractspinbox +libqt4-gui-tests: file-in-unusual-dir usr/tests/qt4/tst_qabstracttextdocumentlayout +libqt4-gui-tests: file-in-unusual-dir usr/tests/qt4/tst_qabstractvideobuffer +libqt4-gui-tests: file-in-unusual-dir usr/tests/qt4/tst_qabstractvideosurface +libqt4-gui-tests: file-in-unusual-dir usr/tests/qt4/tst_qaction +libqt4-gui-tests: file-in-unusual-dir usr/tests/qt4/tst_qboxlayout +libqt4-gui-tests: file-in-unusual-dir usr/tests/qt4/tst_qfileiconprovider +libqt4-gui-tests: file-in-unusual-dir usr/tests/qt4/tst_qfocusframe +libqt4-gui-tests: file-in-unusual-dir usr/tests/qt4/tst_qfont +libqt4-gui-tests: file-in-unusual-dir usr/tests/qt4/tst_qfontmetrics +libqt4-gui-tests: file-in-unusual-dir usr/tests/qt4/tst_qformlayout +libqt4-gui-tests: file-in-unusual-dir usr/tests/qt4/tst_qgraphicslayout +libqt4-gui-tests: file-in-unusual-dir usr/tests/qt4/tst_qnetworkcachemetadata +libqt4-gui-tests: file-in-unusual-dir usr/tests/qt4/tst_qpaintengine +libqt4-gui-tests: file-in-unusual-dir usr/tests/qt4/tst_qpalette +libqt4-gui-tests: file-in-unusual-dir usr/tests/qt4/tst_qparallelanimationgroup +libqt4-gui-tests: file-in-unusual-dir usr/tests/qt4/tst_qpauseanimation +libqt4-gui-tests: file-in-unusual-dir usr/tests/qt4/tst_qpicture +libqt4-gui-tests: file-in-unusual-dir usr/tests/qt4/tst_qplaintextedit +libqt4-gui-tests: file-in-unusual-dir usr/tests/qt4/tst_qpointer +libqt4-gui-tests: file-in-unusual-dir usr/tests/qt4/tst_qprinterinfo +libqt4-gui-tests: file-in-unusual-dir usr/tests/qt4/tst_qprogressbar +libqt4-gui-tests: file-in-unusual-dir usr/tests/qt4/tst_qprogressdialog +libqt4-gui-tests: file-in-unusual-dir usr/tests/qt4/tst_qpropertyanimation +libqt4-gui-tests: file-in-unusual-dir usr/tests/qt4/tst_qradiobutton +libqt4-gui-tests: file-in-unusual-dir usr/tests/qt4/tst_qregexpvalidator +libqt4-gui-tests: file-in-unusual-dir usr/tests/qt4/tst_qscriptenginedebugger +libqt4-gui-tests: file-in-unusual-dir usr/tests/qt4/tst_qscrollarea +libqt4-gui-tests: file-in-unusual-dir usr/tests/qt4/tst_qscrollbar +libqt4-gui-tests: file-in-unusual-dir usr/tests/qt4/tst_qsharedpointer_and_qwidget +libqt4-gui-tests: file-in-unusual-dir usr/tests/qt4/tst_qsignalmapper +libqt4-gui-tests: file-in-unusual-dir usr/tests/qt4/tst_qslider +libqt4-gui-tests: file-in-unusual-dir usr/tests/qt4/tst_qsortfilterproxymodel +libqt4-gui-tests: file-in-unusual-dir usr/tests/qt4/tst_qspinbox +libqt4-gui-tests: file-in-unusual-dir usr/tests/qt4/tst_qstackedlayout +libqt4-gui-tests: file-in-unusual-dir usr/tests/qt4/tst_qstackedwidget +libqt4-gui-tests: file-in-unusual-dir usr/tests/qt4/tst_qstandarditem +libqt4-gui-tests: file-in-unusual-dir usr/tests/qt4/tst_qstandarditemmodel +libqt4-gui-tests: file-in-unusual-dir usr/tests/qt4/tst_qstatemachine +libqt4-gui-tests: file-in-unusual-dir usr/tests/qt4/tst_qstringlistmodel +libqt4-gui-tests: file-in-unusual-dir usr/tests/qt4/tst_qstyleoption +libqt4-gui-tests: file-in-unusual-dir usr/tests/qt4/tst_qsyntaxhighlighter +libqt4-gui-tests: file-in-unusual-dir usr/tests/qt4/tst_qtextblock +libqt4-gui-tests: file-in-unusual-dir usr/tests/qt4/tst_qtextcursor +libqt4-gui-tests: file-in-unusual-dir usr/tests/qt4/tst_qtextformat +libqt4-gui-tests: file-in-unusual-dir usr/tests/qt4/tst_qtextlist +libqt4-gui-tests: file-in-unusual-dir usr/tests/qt4/tst_qtextobject +libqt4-gui-tests: file-in-unusual-dir usr/tests/qt4/tst_qtextscriptengine +libqt4-gui-tests: file-in-unusual-dir usr/tests/qt4/tst_qtexttable +libqt4-gui-tests: file-in-unusual-dir usr/tests/qt4/tst_qtoolbox +libqt4-gui-tests: file-in-unusual-dir usr/tests/qt4/tst_qtoolbutton +libqt4-gui-tests: file-in-unusual-dir usr/tests/qt4/tst_qtreewidgetitemiterator +libqt4-gui-tests: file-in-unusual-dir usr/tests/qt4/tst_qundogroup +libqt4-gui-tests: file-in-unusual-dir usr/tests/qt4/tst_qundostack +libqt4-gui-tests: file-in-unusual-dir usr/tests/qt4/tst_qvideosurfaceformat +libqt4-gui-tests: file-in-unusual-dir usr/tests/qt4/tst_qwidgetaction +libqt4-gui-tests: non-standard-dir-in-usr usr/tests/ diff --git a/config.profiles/harmattan/libqt4-gui.lintian b/config.profiles/harmattan/libqt4-gui.lintian new file mode 100644 index 0000000..ea3c04b --- /dev/null +++ b/config.profiles/harmattan/libqt4-gui.lintian @@ -0,0 +1 @@ +libqt4-gui: unknown-control-file digsigsums diff --git a/config.profiles/harmattan/libqt4-help-dbg.lintian b/config.profiles/harmattan/libqt4-help-dbg.lintian new file mode 100644 index 0000000..06fd248 --- /dev/null +++ b/config.profiles/harmattan/libqt4-help-dbg.lintian @@ -0,0 +1 @@ +libqt4-help-dbg: unknown-control-file digsigsums diff --git a/config.profiles/harmattan/libqt4-help.install b/config.profiles/harmattan/libqt4-help.install new file mode 100644 index 0000000..2e06a51 --- /dev/null +++ b/config.profiles/harmattan/libqt4-help.install @@ -0,0 +1,4 @@ +usr/lib/libQtHelp.so.* +usr/lib/libQtCLucene.so.* +usr/share/qt4/translations/qt_help_de.qm +usr/share/qt4/translations/qt_help_pl.qm diff --git a/config.profiles/harmattan/libqt4-help.lintian b/config.profiles/harmattan/libqt4-help.lintian new file mode 100644 index 0000000..44aad04 --- /dev/null +++ b/config.profiles/harmattan/libqt4-help.lintian @@ -0,0 +1,2 @@ +libqt4-help: package-name-doesnt-match-sonames libQtCLucene4 libQtHelp4 +libqt4-help: unknown-control-file digsigsums diff --git a/config.profiles/harmattan/libqt4-meego-dbg.lintian b/config.profiles/harmattan/libqt4-meego-dbg.lintian new file mode 100644 index 0000000..939f381 --- /dev/null +++ b/config.profiles/harmattan/libqt4-meego-dbg.lintian @@ -0,0 +1 @@ +libqt4-meego-dbg: unknown-control-file digsigsums diff --git a/config.profiles/harmattan/libqt4-meego-dev.lintian b/config.profiles/harmattan/libqt4-meego-dev.lintian new file mode 100644 index 0000000..36c9ee8 --- /dev/null +++ b/config.profiles/harmattan/libqt4-meego-dev.lintian @@ -0,0 +1 @@ +libqt4-meego-dev: unknown-control-file digsigsums diff --git a/config.profiles/harmattan/libqt4-meego.lintian b/config.profiles/harmattan/libqt4-meego.lintian new file mode 100644 index 0000000..2f7b3f6 --- /dev/null +++ b/config.profiles/harmattan/libqt4-meego.lintian @@ -0,0 +1,2 @@ +libqt4-meego: unknown-control-file digsigsums +libqt4-meego: package-name-doesnt-match-sonames libQtMeeGoGraphicsSystemHelper4 diff --git a/config.profiles/harmattan/libqt4-meegographicssystem.install b/config.profiles/harmattan/libqt4-meegographicssystem.install new file mode 100644 index 0000000..41bf9a0 --- /dev/null +++ b/config.profiles/harmattan/libqt4-meegographicssystem.install @@ -0,0 +1 @@ +usr/lib/qt4/plugins/graphicssystems/libqmeegographicssystem.so diff --git a/config.profiles/harmattan/libqt4-meegographicssystemhelper-dev.install b/config.profiles/harmattan/libqt4-meegographicssystemhelper-dev.install new file mode 100644 index 0000000..848d6ff --- /dev/null +++ b/config.profiles/harmattan/libqt4-meegographicssystemhelper-dev.install @@ -0,0 +1,3 @@ +usr/include/qt4/QtMeeGoGraphicsSystemHelper +usr/lib/libQtMeeGoGraphicsSystemHelper.so +usr/lib/libQtMeeGoGraphicsSystemHelper.prl diff --git a/config.profiles/harmattan/libqt4-meegographicssystemhelper.install b/config.profiles/harmattan/libqt4-meegographicssystemhelper.install new file mode 100644 index 0000000..4eb904d --- /dev/null +++ b/config.profiles/harmattan/libqt4-meegographicssystemhelper.install @@ -0,0 +1 @@ +usr/lib/libQtMeeGoGraphicsSystemHelper.so.* diff --git a/config.profiles/harmattan/libqt4-multimedia-dbg.lintian b/config.profiles/harmattan/libqt4-multimedia-dbg.lintian new file mode 100644 index 0000000..e35e83e --- /dev/null +++ b/config.profiles/harmattan/libqt4-multimedia-dbg.lintian @@ -0,0 +1 @@ +libqt4-multimedia-dbg: unknown-control-file digsigsums diff --git a/config.profiles/harmattan/libqt4-multimedia.install b/config.profiles/harmattan/libqt4-multimedia.install new file mode 100644 index 0000000..2f6f97d --- /dev/null +++ b/config.profiles/harmattan/libqt4-multimedia.install @@ -0,0 +1 @@ +usr/lib/libQtMultimedia.so.* diff --git a/config.profiles/harmattan/libqt4-multimedia.lintian b/config.profiles/harmattan/libqt4-multimedia.lintian new file mode 100644 index 0000000..ef410a2 --- /dev/null +++ b/config.profiles/harmattan/libqt4-multimedia.lintian @@ -0,0 +1,2 @@ +libqt4-multimedia: unknown-control-file digsigsums +libqt4-multimedia: package-name-doesnt-match-sonames libQtMultimedia4 diff --git a/config.profiles/harmattan/libqt4-network-dbg.lintian b/config.profiles/harmattan/libqt4-network-dbg.lintian new file mode 100644 index 0000000..8cae7f3 --- /dev/null +++ b/config.profiles/harmattan/libqt4-network-dbg.lintian @@ -0,0 +1 @@ +libqt4-network-dbg: unknown-control-file digsigsums diff --git a/config.profiles/harmattan/libqt4-network.install b/config.profiles/harmattan/libqt4-network.install new file mode 100644 index 0000000..1681282 --- /dev/null +++ b/config.profiles/harmattan/libqt4-network.install @@ -0,0 +1,2 @@ +usr/lib/libQtNetwork.so.* +usr/lib/qt4/plugins/bearer/libqicdbearer.so diff --git a/config.profiles/harmattan/libqt4-network.lintian b/config.profiles/harmattan/libqt4-network.lintian new file mode 100644 index 0000000..11a2284 --- /dev/null +++ b/config.profiles/harmattan/libqt4-network.lintian @@ -0,0 +1,2 @@ +libqt4-network: package-name-doesnt-match-sonames libQtNetwork4 +libqt4-network: unknown-control-file digsigsums diff --git a/config.profiles/harmattan/libqt4-opengl-dbg.lintian b/config.profiles/harmattan/libqt4-opengl-dbg.lintian new file mode 100644 index 0000000..fb470cd --- /dev/null +++ b/config.profiles/harmattan/libqt4-opengl-dbg.lintian @@ -0,0 +1 @@ +libqt4-opengl-dbg: unknown-control-file digsigsums diff --git a/config.profiles/harmattan/libqt4-opengl-dev.lintian b/config.profiles/harmattan/libqt4-opengl-dev.lintian new file mode 100644 index 0000000..da53f96 --- /dev/null +++ b/config.profiles/harmattan/libqt4-opengl-dev.lintian @@ -0,0 +1 @@ +libqt4-opengl-dev: unknown-control-file digsigsums diff --git a/config.profiles/harmattan/libqt4-opengl.install b/config.profiles/harmattan/libqt4-opengl.install new file mode 100644 index 0000000..fc0a7a6 --- /dev/null +++ b/config.profiles/harmattan/libqt4-opengl.install @@ -0,0 +1,2 @@ +usr/lib/libQtOpenGL.so.* +usr/lib/qt4/plugins/graphicssystems/libqglgraphicssystem.so diff --git a/config.profiles/harmattan/libqt4-opengl.lintian b/config.profiles/harmattan/libqt4-opengl.lintian new file mode 100644 index 0000000..8f49420 --- /dev/null +++ b/config.profiles/harmattan/libqt4-opengl.lintian @@ -0,0 +1,3 @@ +libqt4-opengl: package-name-doesnt-match-sonames libQtOpenGL4 +libqt4-opengl: package-relation-with-self depends +libqt4-opengl: unknown-control-file digsigsums diff --git a/config.profiles/harmattan/libqt4-phonon-dbg.lintian b/config.profiles/harmattan/libqt4-phonon-dbg.lintian new file mode 100644 index 0000000..7ce2877 --- /dev/null +++ b/config.profiles/harmattan/libqt4-phonon-dbg.lintian @@ -0,0 +1 @@ +libqt4-phonon-dbg: unknown-control-file digsigsums diff --git a/config.profiles/harmattan/libqt4-phonon.install b/config.profiles/harmattan/libqt4-phonon.install new file mode 100644 index 0000000..3fdc018 --- /dev/null +++ b/config.profiles/harmattan/libqt4-phonon.install @@ -0,0 +1,2 @@ +usr/lib/libphonon.so.* +usr/lib/qt4/plugins/phonon_backend/libphonon_*.so diff --git a/config.profiles/harmattan/libqt4-phonon.lintian b/config.profiles/harmattan/libqt4-phonon.lintian new file mode 100644 index 0000000..a1a46b9 --- /dev/null +++ b/config.profiles/harmattan/libqt4-phonon.lintian @@ -0,0 +1,2 @@ +libqt4-phonon: package-name-doesnt-match-sonames libphonon4 +libqt4-phonon: unknown-control-file digsigsums diff --git a/config.profiles/harmattan/libqt4-script-dbg.lintian b/config.profiles/harmattan/libqt4-script-dbg.lintian new file mode 100644 index 0000000..9290ace --- /dev/null +++ b/config.profiles/harmattan/libqt4-script-dbg.lintian @@ -0,0 +1 @@ +libqt4-script-dbg: unknown-control-file digsigsums diff --git a/config.profiles/harmattan/libqt4-script.install b/config.profiles/harmattan/libqt4-script.install new file mode 100644 index 0000000..f8cc5c4 --- /dev/null +++ b/config.profiles/harmattan/libqt4-script.install @@ -0,0 +1,3 @@ +usr/lib/libQtScript.so.* +usr/lib/libQtScriptTools.so.* +usr/lib/qt4/plugins/script/libqtscriptdbus.so diff --git a/config.profiles/harmattan/libqt4-script.lintian b/config.profiles/harmattan/libqt4-script.lintian new file mode 100644 index 0000000..51b6944 --- /dev/null +++ b/config.profiles/harmattan/libqt4-script.lintian @@ -0,0 +1,2 @@ +libqt4-script: package-name-doesnt-match-sonames libQtScript4 libQtScriptTools4 +libqt4-script: unknown-control-file digsigsums diff --git a/config.profiles/harmattan/libqt4-sql-dbg.lintian b/config.profiles/harmattan/libqt4-sql-dbg.lintian new file mode 100644 index 0000000..5f4f189 --- /dev/null +++ b/config.profiles/harmattan/libqt4-sql-dbg.lintian @@ -0,0 +1 @@ +libqt4-sql-dbg: unknown-control-file digsigsums diff --git a/config.profiles/harmattan/libqt4-sql-sqlite-dbg.lintian b/config.profiles/harmattan/libqt4-sql-sqlite-dbg.lintian new file mode 100644 index 0000000..6e53ab6 --- /dev/null +++ b/config.profiles/harmattan/libqt4-sql-sqlite-dbg.lintian @@ -0,0 +1 @@ +libqt4-sql-sqlite-dbg: unknown-control-file digsigsums diff --git a/config.profiles/harmattan/libqt4-sql-sqlite.install b/config.profiles/harmattan/libqt4-sql-sqlite.install new file mode 100644 index 0000000..6590079 --- /dev/null +++ b/config.profiles/harmattan/libqt4-sql-sqlite.install @@ -0,0 +1,2 @@ +usr/lib/qt4/plugins/sqldrivers/libqsqlite.so + diff --git a/config.profiles/harmattan/libqt4-sql-sqlite.lintian b/config.profiles/harmattan/libqt4-sql-sqlite.lintian new file mode 100644 index 0000000..a6eb651 --- /dev/null +++ b/config.profiles/harmattan/libqt4-sql-sqlite.lintian @@ -0,0 +1 @@ +libqt4-sql-sqlite: unknown-control-file digsigsums diff --git a/config.profiles/harmattan/libqt4-sql.install b/config.profiles/harmattan/libqt4-sql.install new file mode 100644 index 0000000..5ff4a1f --- /dev/null +++ b/config.profiles/harmattan/libqt4-sql.install @@ -0,0 +1,2 @@ +usr/lib/libQtSql.so.* + diff --git a/config.profiles/harmattan/libqt4-sql.lintian b/config.profiles/harmattan/libqt4-sql.lintian new file mode 100644 index 0000000..b20d867 --- /dev/null +++ b/config.profiles/harmattan/libqt4-sql.lintian @@ -0,0 +1,2 @@ +libqt4-sql: package-name-doesnt-match-sonames libQtSql4 +libqt4-sql: unknown-control-file digsigsums diff --git a/config.profiles/harmattan/libqt4-svg-dbg.lintian b/config.profiles/harmattan/libqt4-svg-dbg.lintian new file mode 100644 index 0000000..171ee74 --- /dev/null +++ b/config.profiles/harmattan/libqt4-svg-dbg.lintian @@ -0,0 +1 @@ +libqt4-svg-dbg: unknown-control-file digsigsums diff --git a/config.profiles/harmattan/libqt4-svg.install b/config.profiles/harmattan/libqt4-svg.install new file mode 100644 index 0000000..21289f8 --- /dev/null +++ b/config.profiles/harmattan/libqt4-svg.install @@ -0,0 +1,4 @@ +usr/lib/libQtSvg.so.* +usr/lib/qt4/plugins/iconengines/libqsvgicon.so +usr/lib/qt4/plugins/imageformats/libqsvg.so + diff --git a/config.profiles/harmattan/libqt4-svg.lintian b/config.profiles/harmattan/libqt4-svg.lintian new file mode 100644 index 0000000..31b3b15 --- /dev/null +++ b/config.profiles/harmattan/libqt4-svg.lintian @@ -0,0 +1,2 @@ +libqt4-svg: package-name-doesnt-match-sonames libQtSvg4 +libqt4-svg: unknown-control-file digsigsums diff --git a/config.profiles/harmattan/libqt4-test-dbg.lintian b/config.profiles/harmattan/libqt4-test-dbg.lintian new file mode 100644 index 0000000..587353e --- /dev/null +++ b/config.profiles/harmattan/libqt4-test-dbg.lintian @@ -0,0 +1 @@ +libqt4-test-dbg: unknown-control-file digsigsums diff --git a/config.profiles/harmattan/libqt4-test.install b/config.profiles/harmattan/libqt4-test.install new file mode 100644 index 0000000..7883dee --- /dev/null +++ b/config.profiles/harmattan/libqt4-test.install @@ -0,0 +1,2 @@ +usr/lib/libQtTest.so.* + diff --git a/config.profiles/harmattan/libqt4-test.lintian b/config.profiles/harmattan/libqt4-test.lintian new file mode 100644 index 0000000..db7b2a6 --- /dev/null +++ b/config.profiles/harmattan/libqt4-test.lintian @@ -0,0 +1,2 @@ +libqt4-test: package-name-doesnt-match-sonames libQtTest4 +libqt4-test: unknown-control-file digsigsums diff --git a/config.profiles/harmattan/libqt4-webkit.lintian b/config.profiles/harmattan/libqt4-webkit.lintian new file mode 100644 index 0000000..9c70f48 --- /dev/null +++ b/config.profiles/harmattan/libqt4-webkit.lintian @@ -0,0 +1 @@ +libqt4-webkit: unknown-control-file digsigsums diff --git a/config.profiles/harmattan/libqt4-xml-dbg.lintian b/config.profiles/harmattan/libqt4-xml-dbg.lintian new file mode 100644 index 0000000..8df20db --- /dev/null +++ b/config.profiles/harmattan/libqt4-xml-dbg.lintian @@ -0,0 +1 @@ +libqt4-xml-dbg: unknown-control-file digsigsums diff --git a/config.profiles/harmattan/libqt4-xml.install b/config.profiles/harmattan/libqt4-xml.install new file mode 100644 index 0000000..6366cb3 --- /dev/null +++ b/config.profiles/harmattan/libqt4-xml.install @@ -0,0 +1 @@ +usr/lib/libQtXml.so.* diff --git a/config.profiles/harmattan/libqt4-xml.lintian b/config.profiles/harmattan/libqt4-xml.lintian new file mode 100644 index 0000000..bd61725 --- /dev/null +++ b/config.profiles/harmattan/libqt4-xml.lintian @@ -0,0 +1,2 @@ +libqt4-xml: package-name-doesnt-match-sonames libQtXml4 +libqt4-xml: unknown-control-file digsigsums diff --git a/config.profiles/harmattan/libqt4-xmlpatterns-dbg.lintian b/config.profiles/harmattan/libqt4-xmlpatterns-dbg.lintian new file mode 100644 index 0000000..aafa724 --- /dev/null +++ b/config.profiles/harmattan/libqt4-xmlpatterns-dbg.lintian @@ -0,0 +1 @@ +libqt4-xmlpatterns-dbg: unknown-control-file digsigsums diff --git a/config.profiles/harmattan/libqt4-xmlpatterns.install b/config.profiles/harmattan/libqt4-xmlpatterns.install new file mode 100644 index 0000000..1997474 --- /dev/null +++ b/config.profiles/harmattan/libqt4-xmlpatterns.install @@ -0,0 +1,3 @@ +usr/lib/libQtXmlPatterns.so.* +usr/bin/xmlpatterns + diff --git a/config.profiles/harmattan/libqt4-xmlpatterns.lintian b/config.profiles/harmattan/libqt4-xmlpatterns.lintian new file mode 100644 index 0000000..785b999 --- /dev/null +++ b/config.profiles/harmattan/libqt4-xmlpatterns.lintian @@ -0,0 +1,2 @@ +libqt4-xmlpatterns: package-name-doesnt-match-sonames libQtXmlPatterns4 +libqt4-xmlpatterns: unknown-control-file digsigsums diff --git a/config.profiles/harmattan/libqt4.lintian b/config.profiles/harmattan/libqt4.lintian new file mode 100644 index 0000000..2eb0928 --- /dev/null +++ b/config.profiles/harmattan/libqt4.lintian @@ -0,0 +1 @@ +libqt4: unknown-control-file digsigsums diff --git a/config.profiles/harmattan/libqtcore4-dbg.lintian b/config.profiles/harmattan/libqtcore4-dbg.lintian new file mode 100644 index 0000000..8dfcc0c --- /dev/null +++ b/config.profiles/harmattan/libqtcore4-dbg.lintian @@ -0,0 +1 @@ +libqtcore4-dbg: unknown-control-file digsigsums diff --git a/config.profiles/harmattan/libqtcore4.install b/config.profiles/harmattan/libqtcore4.install new file mode 100644 index 0000000..1c8fc57 --- /dev/null +++ b/config.profiles/harmattan/libqtcore4.install @@ -0,0 +1,6 @@ +usr/lib/libQtCore.so.* +usr/lib/qt4/plugins/codecs/lib*.so +usr/share/qt4/translations/qt_??.qm +usr/share/qt4/translations/qt_??_??.qm +usr/share/qt4/translations/qvfb_*.qm + diff --git a/config.profiles/harmattan/libqtcore4.lintian b/config.profiles/harmattan/libqtcore4.lintian new file mode 100644 index 0000000..1c14b59 --- /dev/null +++ b/config.profiles/harmattan/libqtcore4.lintian @@ -0,0 +1,2 @@ +libqtcore4: package-name-doesnt-match-sonames libQtCLucene4 libQtCore4 +libqtcore4: unknown-control-file digsigsums diff --git a/config.profiles/harmattan/libqtgui4-dbg.lintian b/config.profiles/harmattan/libqtgui4-dbg.lintian new file mode 100644 index 0000000..d166ea8 --- /dev/null +++ b/config.profiles/harmattan/libqtgui4-dbg.lintian @@ -0,0 +1 @@ +libqtgui4-dbg: unknown-control-file digsigsums diff --git a/config.profiles/harmattan/libqtgui4.install b/config.profiles/harmattan/libqtgui4.install new file mode 100644 index 0000000..4b4fa9c --- /dev/null +++ b/config.profiles/harmattan/libqtgui4.install @@ -0,0 +1,7 @@ +usr/lib/libQtGui.so.* +usr/lib/qt4/plugins/imageformats/libqgif.so +usr/lib/qt4/plugins/imageformats/libqico.so +usr/lib/qt4/plugins/imageformats/libqjpeg.so +usr/lib/qt4/plugins/imageformats/libqtiff.so +usr/lib/qt4/plugins/inputmethods/libqimsw-multi.so +usr/lib/qt4/plugins/accessible/libqtaccessiblewidgets.so diff --git a/config.profiles/harmattan/libqtgui4.lintian b/config.profiles/harmattan/libqtgui4.lintian new file mode 100644 index 0000000..e9d4ec9 --- /dev/null +++ b/config.profiles/harmattan/libqtgui4.lintian @@ -0,0 +1,2 @@ +libqtgui4: package-name-doesnt-match-sonames libQtGui4 +libqtgui4: unknown-control-file digsigsums diff --git a/config.profiles/harmattan/manpages/lrelease.1 b/config.profiles/harmattan/manpages/lrelease.1 new file mode 100644 index 0000000..174d40c --- /dev/null +++ b/config.profiles/harmattan/manpages/lrelease.1 @@ -0,0 +1,89 @@ +.TH lrelease 1 "18 October 2001" "Trolltech AS" \" -*- nroff -*- +.\" +.\" Copyright 2001 Trolltech AS. All rights reserved. +.\" +.\" This file may be distributed and/or modified under the terms of the +.\" GNU General Public License version 2 as published by the Free Software +.\" Foundation and appearing in the file LICENSE.GPL included in the +.\" packaging of this file. +.\" +.\" This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +.\" WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +.\" +.\" See http://www.trolltech.com/gpl/ for GPL licensing information. +.\" +.\" Contact info@trolltech.com if any conditions of this licensing are +.\" not clear to you. +.\" +.SH NAME +lrelease \- generate Qt message files from Qt Linguist translation files +.SH SYNOPSIS +.B lrelease +.RI "[ " options " ] " project-file +.br +.B lrelease +.RI "[ " options " ] " ts-files " [ -qm " qm-file " ]" +.SH DESCRIPTION +This page documents the +.B Qt Linguist Release +tool for the Qt GUI toolkit. +.B Lrelease +reads a qmake/tmake project file (.pro file) and converts the +translation files (.ts files) specified in it into Qt message files +(.qm files) used by the application to translate. +.PP +The .qm file format is a compact binary format that provides +extremely fast lookups for translations and that is used by Qt. +.SH OPTIONS +.TP +.I "-help" +Display the usage and exit. +.TP +.I "-nocompress" +Do not compress the .qm files. +.TP +.I "-verbose" +Explain what is being done. +.TP +.I "-version" +Display the version of +.B lrelease +and exit. +.SH USAGE +Here is an example .pro file that can be given to +.B lrelease: +.PP +.in +4 +.nf +HEADERS = funnydialog.h \\ + wackywidget.h +SOURCES = funnydialog.cpp \\ + main.cpp \\ + wackywidget.cpp +FORMS = fancybox.ui +TRANSLATIONS = gnomovision_dk.ts \\ + gnomovision_fi.ts \\ + gnomovision_no.ts \\ + gnomovision_se.ts +.fi +.in -4 +.PP +When running +.B lrelease +on this project file, the Qt message files gnomovision_dk.qm, +gnomovision_fi.qm, gnomovision_no.qm and gnomovision_se.qm will be +generated from gnomovision_dk.ts, gnomovision_fi.ts, +gnomovision_no.ts and gnomovision_se.ts, respectively. +.PP +.B Lrelease +can also be invoked with a list of .ts files to convert: +.PP +.in +4 +.nf +lrelease gnomovision_*.ts +.fi +.in -4 +.SH "SEE ALSO" +.BR lupdate (1) +and +.BR http://doc.trolltech.com/i18n.html diff --git a/config.profiles/harmattan/manpages/lupdate.1 b/config.profiles/harmattan/manpages/lupdate.1 new file mode 100644 index 0000000..722657d --- /dev/null +++ b/config.profiles/harmattan/manpages/lupdate.1 @@ -0,0 +1,95 @@ +.TH lupdate 1 "18 October 2001" "Trolltech AS" \" -*- nroff -*- +.\" +.\" Copyright 2001 Trolltech AS. All rights reserved. +.\" +.\" This file may be distributed and/or modified under the terms of the +.\" GNU General Public License version 2 as published by the Free Software +.\" Foundation and appearing in the file LICENSE.GPL included in the +.\" packaging of this file. +.\" +.\" This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +.\" WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +.\" +.\" See http://www.trolltech.com/gpl/ for GPL licensing information. +.\" +.\" Contact info@trolltech.com if any conditions of this licensing are +.\" not clear to you. +.\" +.SH NAME +lupdate \- update Qt Linguist translation files +.SH SYNOPSIS +.B lupdate +.RI "[ " options " ] " project-file +.br +.B lupdate +.RI "[ " options " ] " source-files " -ts " ts-files +.SH DESCRIPTION +This page documents the +.B Qt Linguist Update +tool for the Qt GUI toolkit. +.B Lupdate +reads a qmake/tmake project file (.pro file), finds the translatable +strings in the specified source, header and interface files, and +updates the translation files (.ts files) specified in it. The +translation files are given to the translator who uses +.B Qt Linguist +to read the files and insert the translations. +.PP +The .ts file format is a simple human-readable XML format that can be +used with version control systems if required. +.PP +.SH OPTIONS +.TP +.I "-help" +Display the usage and exit. +.TP +.I "-noobsolete" +Drop all obsolete strings. +.TP +.I "-verbose" +Explain what is being done. +.TP +.I "-version" +Display the version of +.B lupdate +and exit. +.SH USAGE +Here is an example .pro file that can be given to +.B lupdate: +.PP +.in +4 +.nf +HEADERS = funnydialog.h \\ + wackywidget.h +SOURCES = funnydialog.cpp \\ + main.cpp \\ + wackywidget.cpp +FORMS = fancybox.ui +TRANSLATIONS = gnomovision_dk.ts \\ + gnomovision_fi.ts \\ + gnomovision_no.ts \\ + gnomovision_se.ts +.fi +.in -4 +.PP +When running +.B lupdate +on this project file, the translatable strings in all the files +listed in the HEADERS, SOURCES and FORMS entries will be put in +the translation files listed in the TRANSLATIONS entry. Previous +translations will be reused as far as possible, and translated +strings that have vanished from the source files are marked obsolete. +.PP +.B Lupdate +can also be invoked with a list of C++ source files, .ui files +and .ts files: +.PP +.in +4 +.nf +lupdate *.cpp *.h *.ui -ts gnomovision_dk.ts +.fi +.in -4 +.SH "SEE ALSO" +.BR lrelease (1) +and +.BR http://doc.trolltech.com/i18n.html diff --git a/config.profiles/harmattan/manpages/moc.1 b/config.profiles/harmattan/manpages/moc.1 new file mode 100644 index 0000000..131827a --- /dev/null +++ b/config.profiles/harmattan/manpages/moc.1 @@ -0,0 +1,449 @@ +.TH moc 1 "24 June 2001" "Trolltech AS" \" -*- nroff -*- +.\" +.\" $Id: qt/moc.1 3.3.4 edited May 27 2003 $ +.\" +.\" Copyright 1992-2002 Trolltech AS. All rights reserved. +.\" +.\" This file is part of Qt and may be distributed and used according to +.\" the terms and conditions described in the LICENSE file. +.\" +.nh +.SH NAME +moc \- generate Qt meta object support code +.SH SYNOPSIS +.B moc +[\-o file] [\-i] [\-f] [\-k] [\-ldbg] [\-nw] [\-p path] [\-q path] [\-v] file +.SH DESCRIPTION +This page documents the +.B Meta Object Compiler +for the Qt GUI application framework. The +.B moc +reads one or more C++ class declarations from a C++ header or source +file and generates one C++ source file containing meta object +information for the classes. The C++ source file generated by the +.B moc +must be compiled and linked with the implementation of the class (or it +can be #included into the class's source file). +.PP +If you use +.B qmake +to create your Makefiles, build rules will be included that call the +.B moc +when required, so you will not need to use the +.B moc +directly. +.PP +In brief, the meta object system is a structure used by Qt (see +.BR http://doc.trolltech.com ")" +for component programming and run time type information. It adds +properties and inheritance information to (some) classes and +provides a new type of communication between those instances of those +classes, signal\-slot +connections. +.SH OPTIONS +.TP +.I "\-o file" +Write output to +.I file +rather than to stdout. +.TP +.I \-f +Force the generation of an #include statement in the output. +This is the default for files whose name matches the regular +expression .[hH][^.]* (i.e. the extension starts with +.B H +or +.B h +). This +option is only useful if you have header files that do not follow the +standard naming conventions. +.TP +.I "\-i" +Do not generate an #include statement in the output. This may be used +to run +.B moc +on a C++ file containing one or more class declarations. You should then +#include the meta object code in the .cpp file (see USAGE below). If both +.I \-f +and +.I \-i +are present, the last one wins. +.TP +.I "\-nw" +Do not generate any warnings. Not recommended. +.TP +.I "\-ldbg" +Write a flood of lex debug information to stdout. +.TP +.I "\-p path" +Makes +.B moc +prepend +.IR path / +to the file name in the generated #include statement (if one is generated). +.TP +.I "\-q path" +Makes +.B moc +prepend +.IR path / +to the file name of qt #include files in the generated code. +.TP +.I "\-v" +Displays the version of +.B moc +and Qt. +.PP +You can explicitly tell the +.B moc +not to parse parts of a header +file. It recognizes any C++ comment (//) that contains the substrings +MOC_SKIP_BEGIN or MOC_SKIP_END. They work as you would expect and you +can have several levels of them. The net result as seen by the +.B moc +is as if you had removed all lines between a MOC_SKIP_BEGIN and a +MOC_SKIP_END +.SH USAGE +.B moc +is almost always invoked by +.BR make (1), +not by hand. +.PP +.B moc +is typically used with an input file containing class declarations +like this: +.PP +.in +4 +.nf +class YourClass : public QObject { + Q_OBJECT + Q_PROPERTY( ... ) + Q_CLASSINFO( ... ) + +public: + YourClass( QObject * parent=0, const char * name=0 ); + ~YourClass(); + +signals: + +public slots: + +}; +.fi +.in -4 +.PP +Here is a useful makefile rule if you only use GNU make: +.PP +.in +4 +.nf +m%.cpp: %.h + moc $< -o $@ +.fi +.in -4 +.PP +If you want to write portably, you can use individual rules of the +following form: +.PP +.in +4 +.nf +mNAME.cpp: NAME.h + moc $< -o $@ +.fi +.in -4 +.PP +You must also remember to add +.I mNAME.cpp +to your SOURCES (substitute your favorite name) variable and +.I mNAME.o +to your OBJECTS variable. +.PP +(While we prefer to name our C++ source files .cpp, the +.B moc +doesn't know that, so you can use .C, .cc, .CC, .cxx or even .c++ if +you prefer.) +.PP +If you have class declarations in C++ files, we recommend that you use +a makefile rule like this: +.PP +.in +4 +.nf +NAME.o: mNAME.cpp + +mNAME.cpp: NAME.cpp + moc -i $< -o $@ +.fi +.in -4 +.PP +This guarantees that +.BR make (1) +will run the +.B moc +before it compiles +.IR NAME.cpp . +You can then put +.PP +.ti +4 +#include "nNAME.cpp" +.PP +at the end of +.IR NAME.cpp , +where all the classes declared in that file are fully known. +.SH DIAGNOSTICS +Sometimes you may get linkage errors, saying that +YourClass::className() is undefined or that YourClass lacks a vtbl. +Those errors happen most often when you forget to compile the +moc-generated C++ code or include that object file in the link +command. +.PP +The +.B moc +will warn you about a number of dangerous or illegal constructs. +.SH BUGS + +The +.B moc +does not expand #include or #define, it simply skips any preprocessor +directives it encounters. This is regrettable, but is normally not a +problem in practice. + +The +.B moc +does not handle all of C++. The main problem is that class templates +cannot have signals or slots. This is an important bug. Here is an +example: +.PP +.in +4 +.nf +class SomeTemplate<int> : public QFrame { + Q_OBJECT + .... +signals: + void bugInMocDetected( int ); +}; +.fi +.in -4 +.PP +Less importantly, the following constructs are illegal. All of them +have have alternatives which we think are usually better, so removing +these limitations is not a high priority for us. +.SS "Multiple inheritance requires QObject to be first." +If you are using multiple inheritance, +.B moc +assumes that the +.B first +inherited class is a subclass of QObject. Also, be sure that +.B only +the first inherited class is a QObject. +.PP +.in +4 +.nf +class SomeClass : public QObject, public OtherClass { + ... +}; +.fi +.in -4 +.PP +This bug is almost impossible to fix; since the +.B moc +does not expand +#include or #define, it cannot find out which one of the base classes is a +QObject. +.SS "Function pointers cannot be arguments to signals or slots." +In most cases where you would consider that, we think inheritance is a +better alternative. Here is an example of illegal syntax: +.PP +.in +4 +.nf +class SomeClass : public QObject { + Q_OBJECT + ... +public slots: + // illegal + void apply( void (*apply)(List *, void *), void * ); +}; +.fi +.in -4 +.PP +You can work around this restriction like this: +.PP +.in +4 +.nf +typedef void (*ApplyFunctionType)( List *, void * ); + +class SomeClass : public QObject { + Q_OBJECT + ... +public slots: + void apply( ApplyFunctionType, char * ); +}; +.fi +.in -4 +.PP +It may sometimes be even better to replace the function pointer with +inheritance and virtual functions, signals or slots. +.SS "Friend declarations cannot be placed in signals or slots sections" +Sometimes it will work, but in general, friend declarations cannot be +placed in +.B signals +or +.B slots +sections. Put them in the good old +.BR private ", " protected +or +.B public +sections instead. Here is an example of the illegal syntax: +.PP +.in +4 +.nf +class SomeClass : public QObject { + Q_OBJECT + ... +signals: + friend class ClassTemplate<char>; // illegal +}; +.fi +.in -4 +.SS "Signals and slots cannot be upgraded" +The C++ feature of upgrading an inherited member function to +.B public +status is not extended to cover signals and slots. Here is an illegal +example: +.PP +.in +4 +.nf +class Whatever : public QButtonGroup { + ... +public slots: + QButtonGroup::buttonPressed; // illegal + ... +}; +.fi +.in -4 +.PP +The QButtonGroup::buttonPressed() slot is protected. +.PP +C++ quiz: What happens if you try to upgrade a protected member +function which is overloaded? +.IP +- All the functions are upgraded. +.IP +- That is not legal C++. +.\" Good idea, but look in the SEE ALSO section... +.SS "Type macros cannot be used for signal and slot arguments" + +Since the +.B moc +does not expand #define, type macros that take an argument +will not work in signals and slots. Here is an illegal example: +.PP +.in +4 +.nf +#ifdef ultrix +#define SIGNEDNESS(a) unsigned a +#else +#define SIGNEDNESS(a) a +#endif +class Whatever : public QObject { + ... +signals: + void someSignal( SIGNEDNESS(int) ); // illegal +}; +.PP +A #define without arguments works. +.fi +.in -4 +.SS "Nested classes cannot be in the signals or slots sections nor have signals or slots" +Here's an example: +.PP +.in +4 +.nf +class A { + Q_OBJECT +public: + class B { + public slots: // illegal + void b(); + ... + }; +signals: + class B { // illegal + void b(); + ... + }: +}; +.fi +.in -4 +.PP +.SS "Constructors cannot be used in signals or slots sections" +It is a mystery to us why anyone would put a constructor on either the +.B signals +or +.B slots +sections. You can't, anyway (except that it happens to work in some +cases). Put them in +.BR private ", " protected +or +.B public +sections, where they belong. Here is an example of the illegal syntax: +.PP +.in +4 +.nf +class SomeClass : public QObject { + Q_OBJECT +public slots: + SomeClass( QObject *parent, const char *name ) + : QObject( parent, name ) {} // illegal + ... +}; +.fi +.in -4 +.SS "Properties need to be declared before the public section that contains the respective get and set functions" +.PP +Declaring the first property within or after the public section that +contains the type definition and the respective get and set functions +does not work as expected. The +.B moc +will complain that it can neither +find the functions nor resolve the type. Here is an example of the +illegal syntax: +.PP +.in +4 +.nf +class SomeClass : public QObject { + Q_OBJECT +public: + ... + // illegal + Q_PROPERTY( Priority priority READ priority WRITE setPriority ) + Q_ENUMS( Priority ) + enum Priority { High, Low, VeryHigh, VeryLow }; + void setPriority( Priority ); + Priority priority() const; + ... +}; +.fi +.in -4 +.PP +Work around this limitation by declaring all properties at the +beginning of the class declaration, right after Q_OBJECT: +.PP +.in +4 +.nf +class SomeClass : public QObject { + Q_OBJECT + Q_PROPERTY( Priority priority READ priority WRITE setPriority ) + Q_ENUMS( Priority ) +public: + ... + enum Priority { High, Low, VeryHigh, VeryLow }; + void setPriority( Priority ); + Priority priority() const; + ... +}; +.fi +.in -4 +.PP +.SH "SEE ALSO" +.BR http://www.trolltech.com ", " +.BR "C++ ARM, section r.11.3" " (for the answer to the quiz), and" +.BR http://doc.trolltech.com " (for complete Qt documentation)." diff --git a/config.profiles/harmattan/manpages/qmake.1 b/config.profiles/harmattan/manpages/qmake.1 new file mode 100644 index 0000000..62ab78a --- /dev/null +++ b/config.profiles/harmattan/manpages/qmake.1 @@ -0,0 +1,106 @@ +.TH QMAKE 1 "2005-07-23" +.SH NAME +qmake \- cross-platform makefile generator for Qt + +.SH SYNOPSIS +.B qmake +.I "[mode] [options] [files]" +.br +.SH "DESCRIPTION" +.B qmake +has two modes, one mode for generating project files based on some +heuristics, and the other for generating makefiles. Normally you +shouldn't need to specify a mode, as makefile generation is the default +mode for qmake, but you may use this to test qmake on an existing +project. + +.SH MODE +.TP +.B "\-project" +Put qmake into project file generation mode In this mode qmake +interprets files as files to be built, defaults to *.c; *.ui; *.y; *.l; +*.ts; *.qrc; *.h; *.hpp; *.hh; *.hxx; *.H; *.cpp; *.cc; *.cxx; *.C +.TP +.B "\-makefile" +Put qmake into makefile generation mode (default) In this mode qmake +interprets files as project files to be processed, if skipped qmake will +try to find a project file in your current working directory + +.SH WARNINGS OPTIONS +.TP +.BI "\-Wnone" +Turn off all warnings +.TP +.BI "\-Wall" +Turn on all warnings +.TP +.BI "\-Wparser" +Turn on parser warnings +.TP +.BI "\-Wlogic" +Turn on logic warnings + +.SH OPTIONS +.TP +.BI "\-o" file +Write output to file +.TP +.BI "\-unix" +Run in unix mode +.TP +.BI "\-win32" +Run in win32 mode +.TP +.BI "\-macx" +Run in Mac OS X mode +.TP +.BI "\-d" +Increase debug level +.TP +.BI "\-t" templ +Overrides TEMPLATE as templ +.TP +.BI "\-tp" prefix +Overrides TEMPLATE so that prefix is prefixed +.TP +into the value +.BI "\-help" +This help +.TP +.BI "\-v" +Version information +.TP +.BI "\-after" +All variable assignments after this will be parsed after [files] +.TP +.BI "\-norecursive" +Don't do a recursive search +.TP +.BI "\-recursive" +Do a recursive search +.TP +.BI "\-cache file" +Use file as cache [makefile mode only] +.TP +.BI "\-spec spec" +Use spec as QMAKESPEC [makefile mode only] +.TP +.BI "\-nocache" +Don't use a cache file [makefile mode only] +.TP +.BI "\-nodepend" +Don't generate dependencies [makefile mode only] +.TP +.BI "\-nomoc" +Don't generate moc targets [makefile mode only] +.TP +.BI "\-nopwd" +Don't look for files in pwd [project mode only] + +.SH SEE ALSO +.PP +.BR /usr/share/qt4/doc/html/qmake-manual.html, +.SH AUTHOR +This manual page was written by Brian Nelson <pyro@debian.org> based on +the output of +.B "qmake -help". diff --git a/config.profiles/harmattan/manpages/qtconfig.1 b/config.profiles/harmattan/manpages/qtconfig.1 new file mode 100644 index 0000000..08989fb --- /dev/null +++ b/config.profiles/harmattan/manpages/qtconfig.1 @@ -0,0 +1,34 @@ +.TH "qtconfig" "1" "3.0.3" "Troll Tech AS, Norway." "" +.SH "NAME" +.LP +qtconfig \- Configuration tool for Qt +.SH "DESCRIPTION" +.LP +QConfig allows for GUI based configuration of Qt and + other Qt based sources. + +.SH "ENVIRONMENT VARIABLES" +.LP +.TP +\fBQTDIR\fP +Specifies the base Qt dir +.SH "AUTHORS" +.LP +TrollTech <http://www.trolltech.com/> +.TH "qtconfig" "1" "3.0.3" "Troll Tech AS, Norway." "" +.SH "NAME" +.LP +qtconfig \- Configuration tool for Qt +.SH "DESCRIPTION" +.LP +QConfig allows for GUI based configuration of Qt and + other Qt based sources. + +.SH "ENVIRONMENT VARIABLES" +.LP +.TP +\fBQTDIR\fP +Specifies the base Qt dir +.SH "AUTHORS" +.LP +TrollTech <http://www.trolltech.com/> diff --git a/config.profiles/harmattan/manpages/uic.1 b/config.profiles/harmattan/manpages/uic.1 new file mode 100644 index 0000000..79d03b8 --- /dev/null +++ b/config.profiles/harmattan/manpages/uic.1 @@ -0,0 +1,136 @@ +.TH uic 1 "2 Aug 2001" "Trolltech AS" \" -*- nroff -*- +.\" +.\" Copyright 2000 Trolltech AS. All rights reserved. +.\" +.\" This file is part of Qt and may be distributed and used according to +.\" the terms and conditions described in the LICENSE file. +.\" +.SH NAME +uic \- Qt user interface compiler +.SH SYNOPSIS +.B uic +[options] file +.SH DESCRIPTION +This page documents the +.B User Interface Compiler +for the Qt GUI toolkit. The +.B uic +reads a user interface definition (.ui) file in XML as generated by +.I Qt Designer +and creates corresponding C++ header or source files. It also +generates an image file that embeds raw image data in C++ source code. +.PP +.PP +Generate declaration: +.br +.I "\fB uic [options] \fI<file>" +.br +.PP +Generate implementation: +.br +.I "\fB uic [options] -impl \fI<headerfile> <file>" +.br + \fI<headerfile>\fP: name of the declaration file +.br +.PP +Generate image collection: +.br +.I "\fB uic [options] -embed \fI<project> <image1> <image2> <image3>\fP ..." +.br + \fI<project>\fP: project name + \fI<image[1..n]>\fP: image files +.br +.\" .PP +.\" Generate binary UI file: +.\" .br +.\" .I "\fB uic [options] -binary \fI<file>" +.\" .br +.PP +.PP +For convenience, +.B uic +can also generate declaration or implementation stubs for subclasses. +.PP +Generate subclass declaration: +.br +.I "\fB uic [options] -subdecl \fI<subclassname> <baseclassheaderfile> <file>" +.br + \fI<subclassname>\fP: name of the subclass to generate +.br + \fI<baseclassheaderfile>\fP: declaration file of the baseclass +.PP +Generate subclass implementation: +.br +.I "\fB uic [options] -subimpl \fI<subclassname> <subclassheaderfile> <file>" +.br + \fI<subclassname>\fP: name of the subclass to generate +.br + \fI<subclassheaderfile>\fP: declaration file of the subclass + +.SH GENERAL OPTIONS +.TP +.I "-o file" +Write output to +.I file +rather than to stdout. +.TP +.I "-nofwd" +Omit forward declarations of custom classes in the generated +header file. This is necessary if typedef classes are used. +.TP +.I "-tr func" +Use +.I func() +instead of tr() for internationalization. +.TP +.I "-version" +Display the version of +.B uic +and exit. + +.SH USAGE +.B uic +is almost always invoked by +.BR make (1), +rather than by hand. +.PP +Here are useful makefile rules if you only use GNU make: +.PP +.in +4 +%.h: %.ui +.br + uic $< -o $@ +.br +%.cpp: %.ui +.br + uic -impl $*.h $< -o $@ +.in -4 +.PP +If you want to write portably, you can use individual rules of the +following form: +.PP +.in +4 +NAME.h: NAME.ui +.br + uic $< -o $@ +.br +NAME.cpp: NAME.ui +.br + uic -impl $*.h $< -o $@ +.in -4 +.PP +You must also remember to add +.I NAME.cpp +to your SOURCES (substitute your favorite name) variable and +.I NAME.o +to your OBJECTS variable. +.PP +(While we prefer to name our C++ source files .cpp, the +.B uic +doesn't care, so you can use .C, .cc, .CC, .cxx or even .c++ if +you prefer.) +.PP +.SH "SEE ALSO" +.BR http://www.trolltech.com/ " " +.SH AUTHOR +Trolltech AS <info@trolltech.com> diff --git a/config.profiles/harmattan/mkspecs/linux-g++-cross/qmake.conf b/config.profiles/harmattan/mkspecs/linux-g++-cross/qmake.conf new file mode 100644 index 0000000..245da1e --- /dev/null +++ b/config.profiles/harmattan/mkspecs/linux-g++-cross/qmake.conf @@ -0,0 +1,54 @@ +# +# qmake configuration for linux-g++-cross +# + +MAKEFILE_GENERATOR = UNIX +TEMPLATE = app +CONFIG += qt warn_on release incremental link_prl +QT += core gui +QMAKE_INCREMENTAL_STYLE = sublib + +include(../common/g++.conf) +include(../common/linux.conf) + +QMAKE_CC = arm-none-linux-gnueabi-gcc +QMAKE_CFLAGS += -march=armv7a -mcpu=cortex-a8 -mfpu=vfp -mfloat-abi=softfp -fno-omit-frame-pointer -fno-optimize-sibling-calls +QMAKE_CFLAGS_RELEASE = -O3 +QMAKE_CFLAGS_DEBUG = -O0 + +QMAKE_CXX = arm-none-linux-gnueabi-g++ +QMAKE_CXXFLAGS += $$QMAKE_CFLAGS +QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE +QMAKE_CXXFLAGS_DEBUG = $$QMAKE_CFLAGS_DEBUG + +QMAKE_LINK = arm-none-linux-gnueabi-g++ +QMAKE_LINK_SHLIB = arm-none-linux-gnueabi-g++ +QMAKE_LINK_C = arm-none-linux-gnueabi-gcc +QMAKE_LINK_C_SHLIB = arm-none-linux-gnueabi-gcc +QMAKE_LFLAGS += -Wl,-O1 -Wl,--hash-style=gnu + +QMAKE_AR = arm-none-linux-gnueabi-ar cqs +QMAKE_OBJCOPY = arm-none-linux-gnueabi-objcopy +QMAKE_STRIP = arm-none-linux-gnueabi-strip + +#QMAKE_INCDIR = +#QMAKE_LIBDIR = +QMAKE_INCDIR_X11 = +QMAKE_LIBDIR_X11 = +#QMAKE_INCDIR_QT = $$[QT_INSTALL_HEADERS] +#QMAKE_LIBDIR_QT = $$[QT_INSTALL_LIBS] +QMAKE_INCDIR_OPENGL = +QMAKE_LIBDIR_OPENGL = +#QMAKE_INCDIR_EGL = +#QMAKE_LIBDIR_EGL = +#QMAKE_INCDIR_OPENVG = +#QMAKE_LIBDIR_OPENVG = + +QMAKE_LIBS_X11 = -lXext -lX11 -lm -lz -lXau -lxcb -lXdmcp -lexpat + +QMAKE_LIBS_OPENGL = -lEGL -lGLESv2 -lIMGegl -lsrv_um +QMAKE_LIBS_OPENGL_QT = -lEGL -lGLESv2 -lIMGegl -lsrv_um + +QT_CFLAGS_GSTREAMER += -pthread -Igstreamer-0.10 -Iglib-2.0 -Iglib-2.0/include + +load(qt_config) diff --git a/config.profiles/harmattan/mkspecs/linux-g++-cross/qplatformdefs.h b/config.profiles/harmattan/mkspecs/linux-g++-cross/qplatformdefs.h new file mode 100644 index 0000000..857eaf3 --- /dev/null +++ b/config.profiles/harmattan/mkspecs/linux-g++-cross/qplatformdefs.h @@ -0,0 +1,42 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the qmake spec of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "../linux-g++/qplatformdefs.h" diff --git a/config.profiles/harmattan/not-installed b/config.profiles/harmattan/not-installed new file mode 100644 index 0000000..d19a756 --- /dev/null +++ b/config.profiles/harmattan/not-installed @@ -0,0 +1,18 @@ +usr/share/qt4/translations/qvfb_pl.qm +usr/share/qt4/translations/qvfb_zh_TW.qm +usr/share/qt4/translations/qvfb_zh_CN.qm +usr/lib/libQtSvg.la +usr/lib/libQtXml.la +usr/lib/libQtSql.la +usr/lib/libQtOpenGL.la +usr/lib/libQtNetwork.la +usr/lib/libQtGui.la +usr/lib/libQt3Support.la +usr/lib/libQtTest.la +usr/lib/libQtCLucene.la +usr/lib/libQtScript.la +usr/lib/libQtXmlPatterns.la +usr/lib/libQtHelp.la +usr/lib/libQtCore.la +usr/lib/libQtDBus.la + diff --git a/config.profiles/harmattan/patches/default_widget_size.diff b/config.profiles/harmattan/patches/default_widget_size.diff new file mode 100644 index 0000000..1f72881 --- /dev/null +++ b/config.profiles/harmattan/patches/default_widget_size.diff @@ -0,0 +1,13 @@ +Index: qt-maemo-qtp/src/gui/kernel/qwidget.cpp +=================================================================== +--- qt-maemo-qtp.orig/src/gui/kernel/qwidget.cpp ++++ qt-maemo-qtp/src/gui/kernel/qwidget.cpp +@@ -1326,7 +1326,7 @@ + data.crect = parentWidget ? QRect(0,0,100,30) : QRect(0,0,360,640); + } + #else +- data.crect = parentWidget ? QRect(0,0,100,30) : QRect(0,0,640,480); ++ data.crect = parentWidget ? QRect(0,0,100,30) : QRect(0,0,854,480); + #endif + + focus_next = focus_prev = q; diff --git a/config.profiles/harmattan/patches/glshadercache.diff b/config.profiles/harmattan/patches/glshadercache.diff new file mode 100644 index 0000000..2c6ad9a --- /dev/null +++ b/config.profiles/harmattan/patches/glshadercache.diff @@ -0,0 +1,1003 @@ +Index: qt-maemo-qtp/src/opengl/gl2paintengineex/qglengineshadermanager.cpp +=================================================================== +--- qt-maemo-qtp.orig/src/opengl/gl2paintengineex/qglengineshadermanager.cpp ++++ qt-maemo-qtp/src/opengl/gl2paintengineex/qglengineshadermanager.cpp +@@ -42,12 +42,12 @@ + #include "qglengineshadermanager_p.h" + #include "qglengineshadersource_p.h" + #include "qpaintengineex_opengl2_p.h" ++#include "qglshadercache_p.h" + + #if defined(QT_DEBUG) + #include <QMetaEnum> + #endif + +- + QT_BEGIN_NAMESPACE + + static void qt_shared_shaders_free(void *data) +@@ -165,62 +165,89 @@ + + QGLShader* fragShader; + QGLShader* vertexShader; +- QByteArray source; ++ QByteArray vertexSource; ++ QByteArray fragSource; + + // Compile up the simple shader: +- source.clear(); +- source.append(qShaderSnippets[MainVertexShader]); +- source.append(qShaderSnippets[PositionOnlyVertexShader]); +- vertexShader = new QGLShader(QGLShader::Vertex, context, this); +- if (!vertexShader->compileSourceCode(source)) +- qWarning("Vertex shader for simpleShaderProg (MainVertexShader & PositionOnlyVertexShader) failed to compile"); +- +- source.clear(); +- source.append(qShaderSnippets[MainFragmentShader]); +- source.append(qShaderSnippets[ShockingPinkSrcFragmentShader]); +- fragShader = new QGLShader(QGLShader::Fragment, context, this); +- if (!fragShader->compileSourceCode(source)) +- qWarning("Fragment shader for simpleShaderProg (MainFragmentShader & ShockingPinkSrcFragmentShader) failed to compile"); ++ vertexSource.append(qShaderSnippets[MainVertexShader]); ++ vertexSource.append(qShaderSnippets[PositionOnlyVertexShader]); ++ ++ fragSource.append(qShaderSnippets[MainFragmentShader]); ++ fragSource.append(qShaderSnippets[ShockingPinkSrcFragmentShader]); + + simpleShaderProg = new QGLShaderProgram(context, this); +- simpleShaderProg->addShader(vertexShader); +- simpleShaderProg->addShader(fragShader); +- simpleShaderProg->bindAttributeLocation("vertexCoordsArray", QT_VERTEX_COORDS_ATTR); +- simpleShaderProg->bindAttributeLocation("pmvMatrix1", QT_PMV_MATRIX_1_ATTR); +- simpleShaderProg->bindAttributeLocation("pmvMatrix2", QT_PMV_MATRIX_2_ATTR); +- simpleShaderProg->bindAttributeLocation("pmvMatrix3", QT_PMV_MATRIX_3_ATTR); ++ ++ CachedShader simpleShaderCache(fragSource, vertexSource); ++ ++ bool inCache = simpleShaderCache.load(simpleShaderProg, context); ++ ++ if (!inCache) { ++ vertexShader = new QGLShader(QGLShader::Vertex, context, this); ++ if (!vertexShader->compileSourceCode(vertexSource)) ++ qWarning("Vertex shader for simpleShaderProg (MainVertexShader & PositionOnlyVertexShader) failed to compile"); ++ ++ fragShader = new QGLShader(QGLShader::Fragment, context, this); ++ if (!fragShader->compileSourceCode(fragSource)) ++ qWarning("Fragment shader for simpleShaderProg (MainFragmentShader & ShockingPinkSrcFragmentShader) failed to compile"); ++ ++ simpleShaderProg->addShader(vertexShader); ++ simpleShaderProg->addShader(fragShader); ++ ++ simpleShaderProg->bindAttributeLocation("vertexCoordsArray", QT_VERTEX_COORDS_ATTR); ++ simpleShaderProg->bindAttributeLocation("pmvMatrix1", QT_PMV_MATRIX_1_ATTR); ++ simpleShaderProg->bindAttributeLocation("pmvMatrix2", QT_PMV_MATRIX_2_ATTR); ++ simpleShaderProg->bindAttributeLocation("pmvMatrix3", QT_PMV_MATRIX_3_ATTR); ++ } ++ + simpleShaderProg->link(); +- if (!simpleShaderProg->isLinked()) { ++ ++ if (simpleShaderProg->isLinked()) { ++ if (!inCache) ++ simpleShaderCache.store(simpleShaderProg, context); ++ } else { + qCritical() << "Errors linking simple shader:" + << simpleShaderProg->log(); + } + + // Compile the blit shader: +- source.clear(); +- source.append(qShaderSnippets[MainWithTexCoordsVertexShader]); +- source.append(qShaderSnippets[UntransformedPositionVertexShader]); +- vertexShader = new QGLShader(QGLShader::Vertex, context, this); +- if (!vertexShader->compileSourceCode(source)) +- qWarning("Vertex shader for blitShaderProg (MainWithTexCoordsVertexShader & UntransformedPositionVertexShader) failed to compile"); +- +- source.clear(); +- source.append(qShaderSnippets[MainFragmentShader]); +- source.append(qShaderSnippets[ImageSrcFragmentShader]); +- fragShader = new QGLShader(QGLShader::Fragment, context, this); +- if (!fragShader->compileSourceCode(source)) +- qWarning("Fragment shader for blitShaderProg (MainFragmentShader & ImageSrcFragmentShader) failed to compile"); ++ vertexSource.clear(); ++ vertexSource.append(qShaderSnippets[MainWithTexCoordsVertexShader]); ++ vertexSource.append(qShaderSnippets[UntransformedPositionVertexShader]); ++ ++ fragSource.clear(); ++ fragSource.append(qShaderSnippets[MainFragmentShader]); ++ fragSource.append(qShaderSnippets[ImageSrcFragmentShader]); + + blitShaderProg = new QGLShaderProgram(context, this); +- blitShaderProg->addShader(vertexShader); +- blitShaderProg->addShader(fragShader); +- blitShaderProg->bindAttributeLocation("textureCoordArray", QT_TEXTURE_COORDS_ATTR); +- blitShaderProg->bindAttributeLocation("vertexCoordsArray", QT_VERTEX_COORDS_ATTR); ++ ++ CachedShader blitShaderCache(fragSource, vertexSource); ++ ++ inCache = blitShaderCache.load(blitShaderProg, context); ++ ++ if (!inCache) { ++ vertexShader = new QGLShader(QGLShader::Vertex, context, this); ++ if (!vertexShader->compileSourceCode(vertexSource)) ++ qWarning("Vertex shader for blitShaderProg (MainWithTexCoordsVertexShader & UntransformedPositionVertexShader) failed to compile"); ++ ++ fragShader = new QGLShader(QGLShader::Fragment, context, this); ++ if (!fragShader->compileSourceCode(fragSource)) ++ qWarning("Fragment shader for blitShaderProg (MainFragmentShader & ImageSrcFragmentShader) failed to compile"); ++ ++ blitShaderProg->addShader(vertexShader); ++ blitShaderProg->addShader(fragShader); ++ ++ blitShaderProg->bindAttributeLocation("textureCoordArray", QT_TEXTURE_COORDS_ATTR); ++ blitShaderProg->bindAttributeLocation("vertexCoordsArray", QT_VERTEX_COORDS_ATTR); ++ } ++ + blitShaderProg->link(); +- if (!blitShaderProg->isLinked()) { ++ if (blitShaderProg->isLinked()) { ++ if (!inCache) ++ blitShaderCache.store(blitShaderProg, context); ++ } else { + qCritical() << "Errors linking blit shader:" +- << simpleShaderProg->log(); ++ << blitShaderProg->log(); + } +- + } + + QGLEngineSharedShaders::~QGLEngineSharedShaders() +@@ -262,99 +289,108 @@ + } + } + +- QGLShader *vertexShader = 0; +- QGLShader *fragShader = 0; +- QGLEngineShaderProg *newProg = 0; +- bool success = false; ++ QScopedPointer<QGLEngineShaderProg> newProg; + + do { +- QByteArray source; ++ QByteArray fragSource; + // Insert the custom stage before the srcPixel shader to work around an ATI driver bug + // where you cannot forward declare a function that takes a sampler as argument. + if (prog.srcPixelFragShader == CustomImageSrcFragmentShader) +- source.append(prog.customStageSource); +- source.append(qShaderSnippets[prog.mainFragShader]); +- source.append(qShaderSnippets[prog.srcPixelFragShader]); ++ fragSource.append(prog.customStageSource); ++ fragSource.append(qShaderSnippets[prog.mainFragShader]); ++ fragSource.append(qShaderSnippets[prog.srcPixelFragShader]); + if (prog.compositionFragShader) +- source.append(qShaderSnippets[prog.compositionFragShader]); ++ fragSource.append(qShaderSnippets[prog.compositionFragShader]); + if (prog.maskFragShader) +- source.append(qShaderSnippets[prog.maskFragShader]); +- fragShader = new QGLShader(QGLShader::Fragment, ctxGuard.context(), this); +- QByteArray description; ++ fragSource.append(qShaderSnippets[prog.maskFragShader]); ++ ++ QByteArray vertexSource; ++ vertexSource.append(qShaderSnippets[prog.mainVertexShader]); ++ vertexSource.append(qShaderSnippets[prog.positionVertexShader]); ++ ++ QScopedPointer<QGLShaderProgram> shaderProgram(new QGLShaderProgram(ctxGuard.context(), this)); ++ ++ CachedShader shaderCache(fragSource, vertexSource); ++ bool inCache = shaderCache.load(shaderProgram.data(), ctxGuard.context()); ++ ++ if (!inCache) { ++ ++ QScopedPointer<QGLShader> fragShader(new QGLShader(QGLShader::Fragment, ctxGuard.context(), this)); ++ QByteArray description; + #if defined(QT_DEBUG) +- // Name the shader for easier debugging +- description.append("Fragment shader: main="); +- description.append(snippetNameStr(prog.mainFragShader)); +- description.append(", srcPixel="); +- description.append(snippetNameStr(prog.srcPixelFragShader)); +- if (prog.compositionFragShader) { +- description.append(", composition="); +- description.append(snippetNameStr(prog.compositionFragShader)); +- } +- if (prog.maskFragShader) { +- description.append(", mask="); +- description.append(snippetNameStr(prog.maskFragShader)); +- } +- fragShader->setObjectName(QString::fromLatin1(description)); ++ // Name the shader for easier debugging ++ description.append("Fragment shader: main="); ++ description.append(snippetNameStr(prog.mainFragShader)); ++ description.append(", srcPixel="); ++ description.append(snippetNameStr(prog.srcPixelFragShader)); ++ if (prog.compositionFragShader) { ++ description.append(", composition="); ++ description.append(snippetNameStr(prog.compositionFragShader)); ++ } ++ if (prog.maskFragShader) { ++ description.append(", mask="); ++ description.append(snippetNameStr(prog.maskFragShader)); ++ } ++ fragShader->setObjectName(QString::fromLatin1(description)); + #endif +- if (!fragShader->compileSourceCode(source)) { +- qWarning() << "Warning:" << description << "failed to compile!"; +- break; +- } ++ if (!fragShader->compileSourceCode(fragSource)) { ++ qWarning() << "Warning:" << description << "failed to compile!"; ++ break; ++ } + +- source.clear(); +- source.append(qShaderSnippets[prog.mainVertexShader]); +- source.append(qShaderSnippets[prog.positionVertexShader]); +- vertexShader = new QGLShader(QGLShader::Vertex, ctxGuard.context(), this); ++ QScopedPointer<QGLShader> vertexShader(new QGLShader(QGLShader::Vertex, ctxGuard.context(), this)); + #if defined(QT_DEBUG) +- // Name the shader for easier debugging +- description.clear(); +- description.append("Vertex shader: main="); +- description.append(snippetNameStr(prog.mainVertexShader)); +- description.append(", position="); +- description.append(snippetNameStr(prog.positionVertexShader)); +- vertexShader->setObjectName(QString::fromLatin1(description)); ++ // Name the shader for easier debugging ++ description.clear(); ++ description.append("Vertex shader: main="); ++ description.append(snippetNameStr(prog.mainVertexShader)); ++ description.append(", position="); ++ description.append(snippetNameStr(prog.positionVertexShader)); ++ vertexShader->setObjectName(QString::fromLatin1(description)); + #endif +- if (!vertexShader->compileSourceCode(source)) { +- qWarning() << "Warning:" << description << "failed to compile!"; +- break; +- } ++ if (!vertexShader->compileSourceCode(vertexSource)) { ++ qWarning() << "Warning:" << description << "failed to compile!"; ++ break; ++ } + +- newProg = new QGLEngineShaderProg(prog); ++ shaderProgram->addShader(vertexShader.take()); ++ shaderProgram->addShader(fragShader.take()); + +- // If the shader program's not found in the cache, create it now. +- newProg->program = new QGLShaderProgram(ctxGuard.context(), this); +- newProg->program->addShader(vertexShader); +- newProg->program->addShader(fragShader); +- +- // We have to bind the vertex attribute names before the program is linked: +- newProg->program->bindAttributeLocation("vertexCoordsArray", QT_VERTEX_COORDS_ATTR); +- if (newProg->useTextureCoords) +- newProg->program->bindAttributeLocation("textureCoordArray", QT_TEXTURE_COORDS_ATTR); +- if (newProg->useOpacityAttribute) +- newProg->program->bindAttributeLocation("opacityArray", QT_OPACITY_ATTR); +- if (newProg->usePmvMatrixAttribute) { +- newProg->program->bindAttributeLocation("pmvMatrix1", QT_PMV_MATRIX_1_ATTR); +- newProg->program->bindAttributeLocation("pmvMatrix2", QT_PMV_MATRIX_2_ATTR); +- newProg->program->bindAttributeLocation("pmvMatrix3", QT_PMV_MATRIX_3_ATTR); ++ // We have to bind the vertex attribute names before the program is linked: ++ shaderProgram->bindAttributeLocation("vertexCoordsArray", QT_VERTEX_COORDS_ATTR); ++ if (prog.useTextureCoords) ++ shaderProgram->bindAttributeLocation("textureCoordArray", QT_TEXTURE_COORDS_ATTR); ++ if (prog.useOpacityAttribute) ++ shaderProgram->bindAttributeLocation("opacityArray", QT_OPACITY_ATTR); ++ if (prog.usePmvMatrixAttribute) { ++ shaderProgram->bindAttributeLocation("pmvMatrix1", QT_PMV_MATRIX_1_ATTR); ++ shaderProgram->bindAttributeLocation("pmvMatrix2", QT_PMV_MATRIX_2_ATTR); ++ shaderProgram->bindAttributeLocation("pmvMatrix3", QT_PMV_MATRIX_3_ATTR); ++ } + } + ++ newProg.reset(new QGLEngineShaderProg(prog)); ++ newProg->program = shaderProgram.take(); ++ + newProg->program->link(); +- if (!newProg->program->isLinked()) { ++ if (newProg->program->isLinked()) { ++ if (!inCache) ++ shaderCache.store(newProg->program, ctxGuard.context()); ++ } else { + QLatin1String none("none"); + QLatin1String br("\n"); + QString error; +- error = QLatin1String("Shader program failed to link,") ++ error = QLatin1String("Shader program failed to link,"); + #if defined(QT_DEBUG) +- + br +- + QLatin1String(" Shaders Used:") + br +- + QLatin1String(" ") + vertexShader->objectName() + QLatin1String(": ") + br +- + QLatin1String(vertexShader->sourceCode()) + br +- + QLatin1String(" ") + fragShader->objectName() + QLatin1String(": ") + br +- + QLatin1String(fragShader->sourceCode()) + br ++ error += QLatin1String("\n Shaders Used:\n"); ++ for (int i = 0; i < newProg->program->shaders().count(); ++i) { ++ QGLShader *shader = newProg->program->shaders().at(i); ++ error += QLatin1String(" ") + shader->objectName() + QLatin1String(": \n") ++ + QLatin1String(shader->sourceCode()) + br; ++ } + #endif +- + QLatin1String(" Error Log:\n") +- + QLatin1String(" ") + newProg->program->log(); ++ error += QLatin1String(" Error Log:\n") ++ + QLatin1String(" ") + newProg->program->log(); + qWarning() << error; + break; + } +@@ -376,26 +412,10 @@ + } + } + +- cachedPrograms.insert(0, newProg); +- +- success = true; ++ cachedPrograms.insert(0, newProg.data()); + } while (false); + +- // Clean up everything if we weren't successful +- if (!success) { +- if (newProg) { +- delete newProg; // Also deletes the QGLShaderProgram which in turn deletes the QGLShaders +- newProg = 0; +- } +- else { +- if (vertexShader) +- delete vertexShader; +- if (fragShader) +- delete fragShader; +- } +- } +- +- return newProg; ++ return newProg.take(); + } + + void QGLEngineSharedShaders::cleanupCustomStage(QGLCustomShaderStage* stage) +Index: qt-maemo-qtp/src/opengl/gl2paintengineex/qglshadercache_meego_p.h +=================================================================== +--- /dev/null ++++ qt-maemo-qtp/src/opengl/gl2paintengineex/qglshadercache_meego_p.h +@@ -0,0 +1,457 @@ ++/**************************************************************************** ++** ++** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ++** All rights reserved. ++** Contact: Nokia Corporation (qt-info@nokia.com) ++** ++** This file is part of the QtOpenGL module of the Qt Toolkit. ++** ++** $QT_BEGIN_LICENSE:LGPL$ ++** No Commercial Usage ++** This file contains pre-release code and may not be distributed. ++** You may use this file in accordance with the terms and conditions ++** contained in the Technology Preview License Agreement accompanying ++** this package. ++** ++** 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, Nokia gives you certain additional ++** rights. These rights are described in the Nokia Qt LGPL Exception ++** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ++** ++** If you have questions regarding the use of this file, please contact ++** Nokia at qt-info@nokia.com. ++** ++** ++** ++** ++** ++** ++** ++** ++** $QT_END_LICENSE$ ++** ++****************************************************************************/ ++ ++// ++// W A R N I N G ++// ------------- ++// ++// This file is not part of the Qt API. It exists purely as an ++// implementation detail. This header file may change from version to ++// version without notice, or even be removed. ++// ++// We mean it. ++// ++ ++#ifndef QGLSHADERCACHE_MEEGO_P_H ++#define QGLSHADERCACHE_MEEGO_P_H ++ ++#include <QtCore/qglobal.h> ++ ++#if defined(QT_MEEGO_EXPERIMENTAL_SHADERCACHE) && defined(QT_OPENGL_ES_2) ++ ++#include <QtCore/qcryptographichash.h> ++#include <QtCore/qsharedmemory.h> ++#include <QtCore/qsystemsemaphore.h> ++ ++#ifndef QT_BOOTSTRAPPED ++# include <GLES2/gl2ext.h> ++#endif ++#if defined(QT_DEBUG) || defined(QT_MEEGO_EXPERIMENTAL_SHADERCACHE_TRACE) ++# include <syslog.h> ++#endif ++ ++QT_BEGIN_HEADER ++ ++/* ++ This cache stores internal Qt shader programs in shared memory. ++ ++ This header file is ugly on purpose and can only be included once. It is only to be used ++ for the internal shader cache, not as a generic cache for anyone's shaders. ++ ++ The cache stores either ShaderCacheMaxEntries shader programs or ShaderCacheDataSize kilobytes ++ of shader programs, whatever limit is reached first. ++ ++ The layout of the cache is as outlined in the CachedShaders struct. After some ++ integers, an array of headers is reserved, then comes the space for the actual binaries. ++ ++ Shader Programs are identified by the md5sum of their frag and vertex shader source code. ++ ++ Shader Programs are never removed. The cache never shrinks or re-shuffles. This is done ++ on purpose to ensure minimum amount of locking, no alignment problems and very few write ++ operations. ++ ++ Note: Locking the shader cache could be expensive, because the entire system might hang. ++ That's why the cache is immutable to minimize the time we need to keep it locked. ++ ++ Why is it Meego specific? ++ ++ First, the size is chosen so that it fits to generic meego usage. Second, on Meego, there's ++ always at least one Qt application active (the launcher), so the cache will never be destroyed. ++ Only when the last Qt app exits, the cache dies, which should only be when someone kills the ++ X11 server. And last but not least it was only tested with Meego's SGX driver. ++ ++ There's a small tool in src/opengl/util/meego that dumps the contents of the cache. ++ */ ++ ++// anonymous namespace, prevent exporting of the private symbols ++namespace ++{ ++ ++struct CachedShaderHeader ++{ ++ /* the index in the data[] member of CachedShaders */ ++ int index; ++ /* the size of the binary shader */ ++ GLsizei size; ++ /* the format of the binary shader */ ++ GLenum format; ++ /* the md5sum of the frag+vertex shaders */ ++ char md5Sum[16]; ++}; ++ ++enum ++{ ++ /* The maximum amount of shader programs the cache can hold */ ++ ShaderCacheMaxEntries = 20 ++}; ++ ++typedef CachedShaderHeader CachedShaderHeaders[ShaderCacheMaxEntries]; ++ ++enum ++{ ++ // ShaderCacheDataSize is 20k minus the other data members of CachedShaders ++ ShaderCacheDataSize = 1024 * ShaderCacheMaxEntries - sizeof(CachedShaderHeaders) - 2 * sizeof(int) ++}; ++ ++struct CachedShaders ++{ ++ /* How much space is still available in the cache */ ++ inline int availableSize() const { return ShaderCacheDataSize - dataSize; } ++ ++ /* The current amount of cached shaders */ ++ int shaderCount; ++ ++ /* The current amount (in bytes) of cached data */ ++ int dataSize; ++ ++ /* The headers describing the shaders */ ++ CachedShaderHeaders headers; ++ ++ /* The actual binary data of the shader programs */ ++ char data[ShaderCacheDataSize]; ++}; ++ ++//#define QT_DEBUG_SHADER_CACHE ++#ifdef QT_DEBUG_SHADER_CACHE ++static QDebug shaderCacheDebug() ++{ ++ return QDebug(QtDebugMsg); ++} ++#else ++static inline QNoDebug shaderCacheDebug() { return QNoDebug(); } ++#endif ++ ++class ShaderCacheSharedMemory ++{ ++public: ++ ShaderCacheSharedMemory() ++ : shm(QLatin1String("qt_gles2_shadercache_" QT_VERSION_STR)) ++ { ++ // we need a system semaphore here, since cache creation and initialization must be atomic ++ QSystemSemaphore attachSemaphore(QLatin1String("qt_gles2_shadercache_mutex_" QT_VERSION_STR), 1); ++ ++ if (!attachSemaphore.acquire()) { ++ shaderCacheDebug() << "Unable to require shader cache semaphore:" << attachSemaphore.errorString(); ++ return; ++ } ++ ++ if (shm.attach()) { ++ // success! ++ shaderCacheDebug() << "Attached to shader cache"; ++ } else { ++ ++ // no cache exists - create and initialize it ++ if (shm.create(sizeof(CachedShaders))) { ++ shaderCacheDebug() << "Created new shader cache"; ++ initializeCache(); ++ } else { ++ shaderCacheDebug() << "Unable to create shader cache:" << shm.errorString(); ++ } ++ } ++ ++ attachSemaphore.release(); ++ } ++ ++ inline bool isAttached() const { return shm.isAttached(); } ++ ++ inline bool lock() { return shm.lock(); } ++ inline bool unlock() { return shm.unlock(); } ++ inline void *data() { return shm.data(); } ++ inline QString errorString() { return shm.errorString(); } ++ ++ ~ShaderCacheSharedMemory() ++ { ++ if (!shm.detach()) ++ shaderCacheDebug() << "Unable to detach shader cache" << shm.errorString(); ++ } ++ ++private: ++ void initializeCache() ++ { ++ // no need to lock the shared memory since we're already protected by the ++ // attach system semaphore. ++ ++ void *data = shm.data(); ++ Q_ASSERT(data); ++ ++ memset(data, 0, sizeof(CachedShaders)); ++ } ++ ++ QSharedMemory shm; ++}; ++ ++class ShaderCacheLocker ++{ ++public: ++ inline ShaderCacheLocker(ShaderCacheSharedMemory *cache) ++ : shm(cache->lock() ? cache : (ShaderCacheSharedMemory *)0) ++ { ++ if (!shm) ++ shaderCacheDebug() << "Unable to lock shader cache" << cache->errorString(); ++ } ++ ++ inline bool isLocked() const { return shm; } ++ ++ inline ~ShaderCacheLocker() ++ { ++ if (!shm) ++ return; ++ if (!shm->unlock()) ++ shaderCacheDebug() << "Unable to unlock shader cache" << shm->errorString(); ++ } ++ ++private: ++ ShaderCacheSharedMemory *shm; ++}; ++ ++#ifdef QT_BOOTSTRAPPED ++} // end namespace ++#else ++ ++static void traceCacheOverflow(const char *message) ++{ ++#if defined(QT_DEBUG) || defined (QT_MEEGO_EXPERIMENTAL_SHADERCACHE_TRACE) ++ openlog(qPrintable(QCoreApplication::applicationName()), LOG_PID | LOG_ODELAY, LOG_USER); ++ syslog(LOG_DEBUG, message); ++ closelog(); ++#endif ++ shaderCacheDebug() << message; ++} ++ ++Q_GLOBAL_STATIC(ShaderCacheSharedMemory, shaderCacheSharedMemory) ++ ++/* ++ Finds the index of the shader program identified by md5Sum in the cache. ++ Note: Does NOT lock the cache for reading, the cache must already be locked! ++ ++ Returns -1 when no shader was found. ++ */ ++static int qt_cache_index_unlocked(const QByteArray &md5Sum, CachedShaders *cache) ++{ ++ for (int i = 0; i < cache->shaderCount; ++i) { ++ if (qstrncmp(md5Sum.constData(), cache->headers[i].md5Sum, 16) == 0) { ++ return i; ++ } ++ } ++ return -1; ++} ++ ++/* Returns the index of the shader identified by md5Sum */ ++static int qt_cache_index(const QByteArray &md5Sum) ++{ ++ ShaderCacheSharedMemory *shm = shaderCacheSharedMemory(); ++ if (!shm || !shm->isAttached()) ++ return false; ++ ++ Q_ASSERT(md5Sum.length() == 16); ++ ++ ShaderCacheLocker locker(shm); ++ if (!locker.isLocked()) ++ return false; ++ ++ void *data = shm->data(); ++ Q_ASSERT(data); ++ ++ CachedShaders *cache = reinterpret_cast<CachedShaders *>(data); ++ ++ return qt_cache_index_unlocked(md5Sum, cache); ++} ++ ++/* Loads the cached shader at index \a shaderIndex into \a program ++ * Note: Since the cache is immutable, this operation doesn't lock the shared memory. ++ */ ++static bool qt_cached_shader(QGLShaderProgram *program, const QGLContext *ctx, int shaderIndex) ++{ ++ Q_ASSERT(shaderIndex >= 0 && shaderIndex <= ShaderCacheMaxEntries); ++ Q_ASSERT(program); ++ ++ ShaderCacheSharedMemory *shm = shaderCacheSharedMemory(); ++ if (!shm || !shm->isAttached()) ++ return false; ++ ++ void *data = shm->data(); ++ Q_ASSERT(data); ++ ++ CachedShaders *cache = reinterpret_cast<CachedShaders *>(data); ++ ++ shaderCacheDebug() << "fetching cached shader at index" << shaderIndex ++ << "dataIndex" << cache->headers[shaderIndex].index ++ << "size" << cache->headers[shaderIndex].size ++ << "format" << cache->headers[shaderIndex].format; ++ ++ // call program->programId first, since that resolves the glProgramBinaryOES symbol ++ GLuint programId = program->programId(); ++ glProgramBinaryOES(programId, cache->headers[shaderIndex].format, ++ cache->data + cache->headers[shaderIndex].index, ++ cache->headers[shaderIndex].size); ++ ++ return true; ++} ++ ++/* Stores the shader program in the cache. Returns false if there's an error with the cache, or ++ if the cache is too small to hold the shader. */ ++static bool qt_cache_shader(const QGLShaderProgram *shader, const QGLContext *ctx, const QByteArray &md5Sum) ++{ ++ ShaderCacheSharedMemory *shm = shaderCacheSharedMemory(); ++ if (!shm || !shm->isAttached()) ++ return false; ++ ++ void *data = shm->data(); ++ Q_ASSERT(data); ++ ++ CachedShaders *cache = reinterpret_cast<CachedShaders *>(data); ++ ++ ShaderCacheLocker locker(shm); ++ if (!locker.isLocked()) ++ return false; ++ ++ int cacheIdx = cache->shaderCount; ++ if (cacheIdx >= ShaderCacheMaxEntries) { ++ traceCacheOverflow("Qt OpenGL shader cache index overflow!"); ++ return false; ++ } ++ ++ // now that we have the lock on the shared memory, make sure no one ++ // inserted the shader already while we were unlocked ++ if (qt_cache_index_unlocked(md5Sum, cache) != -1) ++ return true; // already cached ++ ++ shaderCacheDebug() << "Caching shader at index" << cacheIdx; ++ ++ GLint binaryLength = 0; ++ glGetProgramiv(shader->programId(), GL_PROGRAM_BINARY_LENGTH_OES, &binaryLength); ++ ++ if (!binaryLength) { ++ shaderCacheDebug() << "Unable to determine binary shader size!"; ++ return false; ++ } ++ ++ if (binaryLength > cache->availableSize()) { ++ traceCacheOverflow("Qt OpenGL shader cache data overflow!"); ++ return false; ++ } ++ ++ GLsizei size = 0; ++ GLenum format = 0; ++ glGetProgramBinaryOES(shader->programId(), binaryLength, &size, &format, ++ cache->data + cache->dataSize); ++ ++ if (!size) { ++ shaderCacheDebug() << "Unable to get binary shader!"; ++ return false; ++ } ++ ++ cache->headers[cacheIdx].index = cache->dataSize; ++ cache->dataSize += binaryLength; ++ ++cache->shaderCount; ++ cache->headers[cacheIdx].size = binaryLength; ++ cache->headers[cacheIdx].format = format; ++ ++ memcpy(cache->headers[cacheIdx].md5Sum, md5Sum.constData(), 16); ++ ++ shaderCacheDebug() << "cached shader size" << size ++ << "format" << format ++ << "binarySize" << binaryLength ++ << "cache index" << cacheIdx ++ << "data index" << cache->headers[cacheIdx].index; ++ ++ return true; ++} ++ ++} // namespace ++ ++QT_BEGIN_NAMESPACE ++ ++QT_MODULE(OpenGL) ++ ++class CachedShader ++{ ++public: ++ CachedShader(const QByteArray &fragSource, const QByteArray &vertexSource) ++ : cacheIdx(-1) ++ { ++ QCryptographicHash md5Hash(QCryptographicHash::Md5); ++ ++ md5Hash.addData(fragSource); ++ md5Hash.addData(vertexSource); ++ ++ md5Sum = md5Hash.result(); ++ } ++ ++ bool isCached() ++ { ++ return cacheIndex() != -1; ++ } ++ ++ int cacheIndex() ++ { ++ if (cacheIdx != -1) ++ return cacheIdx; ++ cacheIdx = qt_cache_index(md5Sum); ++ return cacheIdx; ++ } ++ ++ bool load(QGLShaderProgram *program, const QGLContext *ctx) ++ { ++ if (cacheIndex() == -1) ++ return false; ++ return qt_cached_shader(program, ctx, cacheIdx); ++ } ++ ++ bool store(QGLShaderProgram *program, const QGLContext *ctx) ++ { ++ return qt_cache_shader(program, ctx, md5Sum); ++ } ++ ++private: ++ QByteArray md5Sum; ++ int cacheIdx; ++}; ++ ++ ++QT_END_NAMESPACE ++ ++#endif ++ ++QT_END_HEADER ++ ++#endif ++#endif +Index: qt-maemo-qtp/src/opengl/gl2paintengineex/qglshadercache_p.h +=================================================================== +--- /dev/null ++++ qt-maemo-qtp/src/opengl/gl2paintengineex/qglshadercache_p.h +@@ -0,0 +1,98 @@ ++/**************************************************************************** ++** ++** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ++** All rights reserved. ++** Contact: Nokia Corporation (qt-info@nokia.com) ++** ++** This file is part of the QtOpenGL module of the Qt Toolkit. ++** ++** $QT_BEGIN_LICENSE:LGPL$ ++** No Commercial Usage ++** This file contains pre-release code and may not be distributed. ++** You may use this file in accordance with the terms and conditions ++** contained in the Technology Preview License Agreement accompanying ++** this package. ++** ++** 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, Nokia gives you certain additional ++** rights. These rights are described in the Nokia Qt LGPL Exception ++** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ++** ++** If you have questions regarding the use of this file, please contact ++** Nokia at qt-info@nokia.com. ++** ++** ++** ++** ++** ++** ++** ++** ++** $QT_END_LICENSE$ ++** ++****************************************************************************/ ++ ++// ++// W A R N I N G ++// ------------- ++// ++// This file is not part of the Qt API. It exists purely as an ++// implementation detail. This header file may change from version to ++// version without notice, or even be removed. ++// ++// We mean it. ++// ++ ++#ifndef QGLSHADERCACHE_P_H ++#define QGLSHADERCACHE_P_H ++ ++#include <QtCore/qglobal.h> ++ ++#if defined(QT_MEEGO_EXPERIMENTAL_SHADERCACHE) && defined(QT_OPENGL_ES_2) ++# include "qglshadercache_meego_p.h" ++#else ++ ++QT_BEGIN_HEADER ++ ++QT_BEGIN_NAMESPACE ++ ++QT_MODULE(OpenGL) ++ ++class QGLShaderProgram; ++class QGLContext; ++ ++class CachedShader ++{ ++public: ++ inline CachedShader(const QByteArray &, const QByteArray &) ++ {} ++ ++ inline bool isCached() ++ { ++ return false; ++ } ++ ++ inline bool load(QGLShaderProgram *, const QGLContext *) ++ { ++ return false; ++ } ++ ++ inline bool store(QGLShaderProgram *, const QGLContext *) ++ { ++ return false; ++ } ++}; ++ ++QT_END_NAMESPACE ++ ++QT_END_HEADER ++ ++#endif ++#endif +Index: qt-maemo-qtp/src/opengl/opengl.pro +=================================================================== +--- qt-maemo-qtp.orig/src/opengl/opengl.pro ++++ qt-maemo-qtp/src/opengl/opengl.pro +@@ -58,7 +58,9 @@ + gl2paintengineex/qglcustomshaderstage_p.h \ + gl2paintengineex/qtriangulatingstroker_p.h \ + gl2paintengineex/qtriangulator_p.h \ +- gl2paintengineex/qtextureglyphcache_gl_p.h ++ gl2paintengineex/qtextureglyphcache_gl_p.h \ ++ gl2paintengineex/qglshadercache_p.h \ ++ gl2paintengineex/qglshadercache_meego_p.h + + SOURCES += qglshaderprogram.cpp \ + qglpixmapfilter.cpp \ +Index: qt-maemo-qtp/src/opengl/util/meego/main.cpp +=================================================================== +--- /dev/null ++++ qt-maemo-qtp/src/opengl/util/meego/main.cpp +@@ -0,0 +1,48 @@ ++#include <QtCore/qdebug.h> ++ ++#define QT_DEBUG_SHADER_CACHE ++#define QT_MEEGO_EXPERIMENTAL_SHADERCACHE ++#define QT_OPENGL_ES_2 ++#define QT_BOOTSTRAPPED ++ ++typedef int GLsizei; ++typedef unsigned int GLenum; ++ ++#include "../../gl2paintengineex/qglshadercache_meego_p.h" ++ ++#include <stdlib.h> ++#include <stdio.h> ++ ++int main() ++{ ++ ShaderCacheSharedMemory shm; ++ ++ if (!shm.isAttached()) { ++ fprintf(stderr, "Unable to attach to shared memory\n"); ++ return EXIT_FAILURE; ++ } ++ ++ ShaderCacheLocker locker(&shm); ++ if (!locker.isLocked()) { ++ fprintf(stderr, "Unable to lock shared memory\n"); ++ return EXIT_FAILURE; ++ } ++ ++ void *data = shm.data(); ++ Q_ASSERT(data); ++ ++ CachedShaders *cache = reinterpret_cast<CachedShaders *>(data); ++ ++ for (int i = 0; i < cache->shaderCount; ++i) { ++ printf("Shader %d: %d bytes\n", i, cache->headers[i].size); ++ } ++ ++ printf("\nSummary:\n\n" ++ " Amount of cached shaders: %d\n" ++ " Bytes used: %d\n" ++ " Bytes available: %d\n", ++ cache->shaderCount, cache->dataSize, cache->availableSize()); ++ ++ return EXIT_SUCCESS; ++} ++ +Index: qt-maemo-qtp/src/opengl/util/meego/shader-cache-introspector.pro +=================================================================== +--- /dev/null ++++ qt-maemo-qtp/src/opengl/util/meego/shader-cache-introspector.pro +@@ -0,0 +1,7 @@ ++TEMPLATE = app ++ ++SOURCES += main.cpp ++ ++TARGET = shader-cache-introspector ++ ++QT = core diff --git a/config.profiles/harmattan/patches/icu.diff b/config.profiles/harmattan/patches/icu.diff new file mode 100644 index 0000000..16a17fd --- /dev/null +++ b/config.profiles/harmattan/patches/icu.diff @@ -0,0 +1,732 @@ +diff --git a/configure b/configure +index 3a748e2..77232dc 100755 +--- a/configure ++++ b/configure +@@ -779,6 +779,7 @@ CFG_PULSEAUDIO=auto + CFG_COREWLAN=auto + CFG_ICD=auto + CFG_NOPROCESS=no ++CFG_ICU=no + + # initalize variables used for installation + QT_INSTALL_PREFIX= +@@ -940,7 +941,7 @@ while [ "$#" -gt 0 ]; do + VAL=no + ;; + #Qt style yes options +- -incremental|-qvfb|-profile|-shared|-static|-sm|-xinerama|-xshape|-xsync|-xinput|-xinput2|-egl|-reduce-exports|-pch|-separate-debug-info|-stl|-freetype|-xcursor|-xfixes|-xrandr|-xrender|-mitshm|-fontconfig|-xkb|-nis|-qdbus|-dbus|-dbus-linked|-glib|-gstreamer|-gtkstyle|-cups|-iconv|-largefile|-h|-help|-v|-verbose|-debug|-release|-fast|-accessibility|-confirm-license|-gnumake|-framework|-qt3support|-debug-and-release|-exceptions|-cocoa|-carbon|-universal|-prefix-install|-silent|-armfpa|-optimized-qmake|-dwarf2|-reduce-relocations|-sse|-openssl|-openssl-linked|-ptmalloc|-xmlpatterns|-phonon|-phonon-backend|-multimedia|-audio-backend|-svg|-declarative|-javascript-jit|-script|-scripttools|-rpath|-force-pkg-config|-s60|-usedeffiles) ++ -incremental|-qvfb|-profile|-shared|-static|-sm|-xinerama|-xshape|-xsync|-xinput|-xinput2|-egl|-reduce-exports|-pch|-separate-debug-info|-stl|-freetype|-xcursor|-xfixes|-xrandr|-xrender|-mitshm|-fontconfig|-xkb|-nis|-qdbus|-dbus|-dbus-linked|-glib|-gstreamer|-gtkstyle|-cups|-iconv|-largefile|-h|-help|-v|-verbose|-debug|-release|-fast|-accessibility|-confirm-license|-gnumake|-framework|-qt3support|-debug-and-release|-exceptions|-cocoa|-carbon|-universal|-prefix-install|-silent|-armfpa|-optimized-qmake|-dwarf2|-reduce-relocations|-sse|-openssl|-openssl-linked|-ptmalloc|-xmlpatterns|-phonon|-phonon-backend|-multimedia|-audio-backend|-svg|-declarative|-javascript-jit|-script|-scripttools|-rpath|-force-pkg-config|-s60|-usedeffiles|-icu) + VAR=`echo $1 | sed "s,^-\(.*\),\1,"` + VAL=yes + ;; +@@ -2242,6 +2243,13 @@ while [ "$#" -gt 0 ]; do + QT_CFLAGS_FPU=$VAL + fi + ;; ++ icu) ++ if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then ++ CFG_ICU="$VAL" ++ else ++ UNKNOWN_OPT=yes ++ fi ++ ;; + *) + UNKNOWN_OPT=yes + ;; +@@ -7040,6 +7048,10 @@ if [ "$CFG_ICD" = "yes" ]; then + QT_CONFIG="$QT_CONFIG icd" + fi + ++if [ "$CFG_ICU" = "yes" ]; then ++ QT_CONFIG="$QT_CONFIG icu" ++fi ++ + # + # Some Qt modules are too advanced in C++ for some old compilers + # Detect here the platforms where they are known to work. +diff --git a/src/corelib/tools/qchar.cpp b/src/corelib/tools/qchar.cpp +index 7cdc256..11a85d5 100644 +--- a/src/corelib/tools/qchar.cpp ++++ b/src/corelib/tools/qchar.cpp +@@ -57,6 +57,12 @@ + + QT_BEGIN_NAMESPACE + ++#ifdef QT_USE_ICU ++// from qlocale_icu.cpp ++extern uint qt_u_toUpper(uint c); ++extern uint qt_u_toLower(uint c); ++#endif ++ + #ifndef QT_NO_CODEC_FOR_C_STRINGS + # ifdef QT_NO_TEXTCODEC + # define QT_NO_CODEC_FOR_C_STRINGS +@@ -1076,6 +1082,12 @@ QChar::UnicodeVersion QChar::unicodeVersion(ushort ucs2) + */ + QChar QChar::toLower() const + { ++#ifdef QT_USE_ICU ++ uint res = qt_u_toLower(ucs); ++ if (res) ++ return QChar(res); ++ // else fall through ++#endif + const QUnicodeTables::Properties *p = qGetProp(ucs); + if (!p->lowerCaseSpecial) + return ucs + p->lowerCaseDiff; +@@ -1090,6 +1102,12 @@ QChar QChar::toLower() const + */ + uint QChar::toLower(uint ucs4) + { ++#ifdef QT_USE_ICU ++ uint res = qt_u_toLower(ucs4); ++ if (res) ++ return res; ++ // else fall through ++#endif + if (ucs4 > UNICODE_LAST_CODEPOINT) + return ucs4; + const QUnicodeTables::Properties *p = qGetProp(ucs4); +@@ -1106,6 +1124,12 @@ uint QChar::toLower(uint ucs4) + */ + ushort QChar::toLower(ushort ucs2) + { ++#ifdef QT_USE_ICU ++ uint res = qt_u_toLower(ucs2); ++ if (res) ++ return res & 0xffff; ++ // else fall through ++#endif + const QUnicodeTables::Properties *p = qGetProp(ucs2); + if (!p->lowerCaseSpecial) + return ucs2 + p->lowerCaseDiff; +@@ -1118,6 +1142,12 @@ ushort QChar::toLower(ushort ucs2) + */ + QChar QChar::toUpper() const + { ++#ifdef QT_USE_ICU ++ uint res = qt_u_toUpper(ucs); ++ if (res) ++ return QChar(res); ++ // else fall through ++#endif + const QUnicodeTables::Properties *p = qGetProp(ucs); + if (!p->upperCaseSpecial) + return ucs + p->upperCaseDiff; +@@ -1132,6 +1162,12 @@ QChar QChar::toUpper() const + */ + uint QChar::toUpper(uint ucs4) + { ++#ifdef QT_USE_ICU ++ uint res = qt_u_toUpper(ucs4); ++ if (res) ++ return res; ++ // else fall through ++#endif + if (ucs4 > UNICODE_LAST_CODEPOINT) + return ucs4; + const QUnicodeTables::Properties *p = qGetProp(ucs4); +@@ -1148,6 +1184,12 @@ uint QChar::toUpper(uint ucs4) + */ + ushort QChar::toUpper(ushort ucs2) + { ++#ifdef QT_USE_ICU ++ uint res = qt_u_toUpper(ucs2); ++ if (res) ++ return res & 0xffff; ++ // else fall through ++#endif + const QUnicodeTables::Properties *p = qGetProp(ucs2); + if (!p->upperCaseSpecial) + return ucs2 + p->upperCaseDiff; +diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp +index 6515edb..5470048 100644 +--- a/src/corelib/tools/qlocale.cpp ++++ b/src/corelib/tools/qlocale.cpp +@@ -134,6 +134,10 @@ void qt_symbianUpdateSystemPrivate(); + void qt_symbianInitSystemLocale(); + #endif + ++#ifdef QT_USE_ICU ++extern bool qt_initIcu(const QString &localeName); ++#endif ++ + /****************************************************************************** + ** Helpers for accessing Qt locale database + */ +@@ -2346,6 +2350,10 @@ void QLocale::setDefault(const QLocale &locale) + { + default_lp = locale.d(); + default_number_options = locale.numberOptions(); ++ ++#ifdef QT_USE_ICU ++ qt_initIcu(locale.name()); ++#endif + } + + /*! +diff --git a/src/corelib/tools/qlocale_icu.cpp b/src/corelib/tools/qlocale_icu.cpp +new file mode 100644 +index 0000000..7fe3801 +--- /dev/null ++++ b/src/corelib/tools/qlocale_icu.cpp +@@ -0,0 +1,247 @@ ++/**************************************************************************** ++** ++** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ++** All rights reserved. ++** Contact: Nokia Corporation (qt-info@nokia.com) ++** ++** This file is part of the QtCore module of the Qt Toolkit. ++** ++** $QT_BEGIN_LICENSE:LGPL$ ++** No Commercial Usage ++** This file contains pre-release code and may not be distributed. ++** You may use this file in accordance with the terms and conditions ++** contained in the Technology Preview License Agreement accompanying ++** this package. ++** ++** 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, Nokia gives you certain additional ++** rights. These rights are described in the Nokia Qt LGPL Exception ++** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ++** ++** If you have questions regarding the use of this file, please contact ++** Nokia at qt-info@nokia.com. ++** ++** ++** ++** ++** ++** ++** ++** ++** $QT_END_LICENSE$ ++** ++****************************************************************************/ ++ ++#include "qglobal.h" ++#include "qlibrary.h" ++#include "qdebug.h" ++ ++#include "unicode/uversion.h" ++#include "unicode/ucol.h" ++ ++QT_BEGIN_NAMESPACE ++ ++typedef UCollator *(*Ptr_ucol_open)(const char *loc, UErrorCode *status); ++typedef void (*Ptr_ucol_close)(UCollator *coll); ++typedef UCollationResult (*Ptr_ucol_strcoll)(const UCollator *coll, const UChar *source, int32_t sourceLength, const UChar *target, int32_t targetLength); ++typedef int32_t (*Ptr_u_strToCase)(UChar *dest, int32_t destCapacity, const UChar *src, int32_t srcLength, const char *locale, UErrorCode *pErrorCode); ++ ++static Ptr_ucol_open ptr_ucol_open = 0; ++static Ptr_ucol_strcoll ptr_ucol_strcoll = 0; ++static Ptr_ucol_close ptr_ucol_close = 0; ++static Ptr_u_strToCase ptr_u_strToUpper = 0; ++static Ptr_u_strToCase ptr_u_strToLower = 0; ++ ++enum LibLoadStatus ++{ ++ ErrorLoading = -1, ++ NotLoaded = 0, ++ Loaded = 1 ++}; ++ ++static LibLoadStatus status = NotLoaded; ++ ++static UCollator *icuCollator = 0; ++ ++#define STRINGIFY2(x) #x ++#define STRINGIFY(x) STRINGIFY2(x) ++ ++bool qt_initIcu(const QString &localeString) ++{ ++ if (status == ErrorLoading) ++ return false; ++ ++ if (status == NotLoaded) { ++ ++ // resolve libicui18n ++ QLibrary lib(QLatin1String("icui18n"), QLatin1String(U_ICU_VERSION_SHORT)); ++ if (!lib.load()) { ++ qWarning() << "Unable to load library icui18n" << lib.errorString(); ++ status = ErrorLoading; ++ return false; ++ } ++ ++ ptr_ucol_open = (Ptr_ucol_open)lib.resolve("ucol_open"); ++ ptr_ucol_close = (Ptr_ucol_close)lib.resolve("ucol_close"); ++ ptr_ucol_strcoll = (Ptr_ucol_strcoll)lib.resolve("ucol_strcoll"); ++ ++ if (!ptr_ucol_open || !ptr_ucol_close || !ptr_ucol_strcoll) { ++ // try again with decorated symbol names ++ ptr_ucol_open = (Ptr_ucol_open)lib.resolve("ucol_open" STRINGIFY(U_ICU_VERSION_SUFFIX)); ++ ptr_ucol_close = (Ptr_ucol_close)lib.resolve("ucol_close" STRINGIFY(U_ICU_VERSION_SUFFIX)); ++ ptr_ucol_strcoll = (Ptr_ucol_strcoll)lib.resolve("ucol_strcoll" STRINGIFY(U_ICU_VERSION_SUFFIX)); ++ } ++ ++ if (!ptr_ucol_open || !ptr_ucol_close || !ptr_ucol_strcoll) { ++ ptr_ucol_open = 0; ++ ptr_ucol_close = 0; ++ ptr_ucol_strcoll = 0; ++ ++ qWarning("Unable to find symbols in icui18n"); ++ status = ErrorLoading; ++ return false; ++ } ++ ++ // resolve libicuuc ++ QLibrary ucLib(QLatin1String("icuuc"), QLatin1String(U_ICU_VERSION_SHORT)); ++ if (!ucLib.load()) { ++ qWarning() << "Unable to load library icuuc" << ucLib.errorString(); ++ status = ErrorLoading; ++ return false; ++ } ++ ++ ptr_u_strToUpper = (Ptr_u_strToCase)ucLib.resolve("u_strToUpper"); ++ ptr_u_strToLower = (Ptr_u_strToCase)ucLib.resolve("u_strToLower"); ++ ++ if (!ptr_u_strToUpper || !ptr_u_strToLower) { ++ ptr_u_strToUpper = (Ptr_u_strToCase)ucLib.resolve("u_strToUpper" STRINGIFY(U_ICU_VERSION_SUFFIX)); ++ ptr_u_strToLower = (Ptr_u_strToCase)ucLib.resolve("u_strToLower" STRINGIFY(U_ICU_VERSION_SUFFIX)); ++ } ++ ++ if (!ptr_u_strToUpper || !ptr_u_strToLower) { ++ ptr_u_strToUpper = 0; ++ ptr_u_strToLower = 0; ++ ++ qWarning("Unable to find symbols in icuuc"); ++ status = ErrorLoading; ++ return false; ++ } ++ ++ // success :) ++ status = Loaded; ++ } ++ ++ if (icuCollator) { ++ ptr_ucol_close(icuCollator); ++ icuCollator = 0; ++ } ++ ++ UErrorCode icuStatus = U_ZERO_ERROR; ++ icuCollator = ptr_ucol_open(localeString.toLatin1().constData(), &icuStatus); ++ ++ if (!icuCollator) { ++ qWarning("Unable to open locale %s in ICU, error code %d", qPrintable(localeString), icuStatus); ++ return false; ++ } ++ ++ return true; ++} ++ ++bool qt_ucol_strcoll(const QChar *source, int sourceLength, const QChar *target, int targetLength, int *result) ++{ ++ Q_ASSERT(result); ++ Q_ASSERT(source); ++ Q_ASSERT(target); ++ ++ if (!icuCollator) ++ return false; ++ ++ *result = ptr_ucol_strcoll(icuCollator, reinterpret_cast<const UChar *>(source), int32_t(sourceLength), ++ reinterpret_cast<const UChar *>(target), int32_t(targetLength)); ++ ++ return true; ++} ++ ++// caseFunc can either be u_strToUpper or u_strToLower ++static bool qt_u_strToCase(const QString &str, QString *out, const QLocale &locale, Ptr_u_strToCase caseFunc) ++{ ++ Q_ASSERT(out); ++ ++ if (!icuCollator) ++ return false; ++ ++ QString result(str.size(), Qt::Uninitialized); ++ ++ UErrorCode status = U_ZERO_ERROR; ++ ++ int32_t size = caseFunc(reinterpret_cast<UChar *>(result.data()), result.size(), ++ reinterpret_cast<const UChar *>(str.constData()), str.size(), ++ locale.name().toLatin1().constData(), &status); ++ ++ if (U_FAILURE(status)) ++ return false; ++ ++ if (size < result.size()) { ++ result.resize(size); ++ } else if (size > result.size()) { ++ qDebug() << "RESULT SIZE MISMATCH"; ++ // the resulting string is larger than our source string ++ result.resize(size); ++ ++ status = U_ZERO_ERROR; ++ size = caseFunc(reinterpret_cast<UChar *>(result.data()), result.size(), ++ reinterpret_cast<const UChar *>(str.constData()), str.size(), ++ locale.name().toLatin1().constData(), &status); ++ ++ if (U_FAILURE(status)) ++ return false; ++ ++ // if the sizes don't match now, we give up. ++ if (size != result.size()) ++ return false; ++ } ++ ++ *out = result; ++ return true; ++} ++ ++bool qt_u_strToUpper(const QString &str, QString *out, const QLocale &locale) ++{ ++ return qt_u_strToCase(str, out, locale, ptr_u_strToUpper); ++} ++ ++bool qt_u_strToLower(const QString &str, QString *out, const QLocale &locale) ++{ ++ return qt_u_strToCase(str, out, locale, ptr_u_strToLower); ++} ++ ++uint qt_u_toUpper(uint c) ++{ ++ if (c > 0xffff) ++ return 0; ++ ++ QString out; ++ if (qt_u_strToUpper(QChar(c), &out, QLocale()) && !out.isEmpty()) ++ return out.at(0).unicode(); ++ return 0; ++} ++ ++uint qt_u_toLower(uint c) ++{ ++ if (c > 0xffff) ++ return 0; ++ ++ QString out; ++ if (qt_u_strToLower(QChar(c), &out, QLocale()) && !out.isEmpty()) ++ return out.at(0).unicode(); ++ return 0; ++} ++ ++QT_END_NAMESPACE +diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp +index d641d74..0f5cee1 100644 +--- a/src/corelib/tools/qstring.cpp ++++ b/src/corelib/tools/qstring.cpp +@@ -112,6 +112,13 @@ int qFindString(const QChar *haystack, int haystackLen, int from, + int qFindStringBoyerMoore(const QChar *haystack, int haystackLen, int from, + const QChar *needle, int needleLen, Qt::CaseSensitivity cs); + ++#ifdef QT_USE_ICU ++// qlocale_icu.cpp ++extern bool qt_ucol_strcoll(const QChar *source, int sourceLength, const QChar *target, int targetLength, int *result); ++extern bool qt_u_strToUpper(const QString &str, QString *out, const QLocale &locale); ++extern bool qt_u_strToLower(const QString &str, QString *out, const QLocale &locale); ++#endif ++ + + // Unicode case-insensitive comparison + static int ucstricmp(const ushort *a, const ushort *ae, const ushort *b, const ushort *be) +@@ -4808,6 +4815,14 @@ int QString::localeAwareCompare_helper(const QChar *data1, int length1, + TPtrC p2 = TPtrC16(reinterpret_cast<const TUint16 *>(data2), length2); + return p1.CompareC(p2); + #elif defined(Q_OS_UNIX) ++# if defined(QT_USE_ICU) ++ int res; ++ if (qt_ucol_strcoll(data1, length1, data2, length2, &res)) { ++ if (res == 0) ++ res = ucstrcmp(data1, length1, data2, length2); ++ return res; ++ } // else fall through ++# endif + // declared in <string.h> + int delta = strcoll(toLocal8Bit_helper(data1, length1), toLocal8Bit_helper(data2, length2)); + if (delta == 0) +@@ -4943,6 +4958,15 @@ QString QString::toLower() const + if (!d->size) + return *this; + ++#ifdef QT_USE_ICU ++ { ++ QString result; ++ if (qt_u_strToLower(*this, &result, QLocale())) ++ return result; ++ // else fall through and use Qt's toUpper ++ } ++#endif ++ + const ushort *e = d->data + d->size; + + // this avoids one out of bounds check in the loop +@@ -5034,6 +5058,15 @@ QString QString::toUpper() const + if (!d->size) + return *this; + ++#ifdef QT_USE_ICU ++ { ++ QString result; ++ if (qt_u_strToUpper(*this, &result, QLocale())) ++ return result; ++ // else fall through and use Qt's toUpper ++ } ++#endif ++ + const ushort *e = d->data + d->size; + + // this avoids one out of bounds check in the loop +diff --git a/src/corelib/tools/tools.pri b/src/corelib/tools/tools.pri +index d81ab04..46c39f3 100644 +--- a/src/corelib/tools/tools.pri ++++ b/src/corelib/tools/tools.pri +@@ -92,6 +92,11 @@ else:SOURCES += tools/qelapsedtimer_generic.cpp + contains(QT_CONFIG, zlib):include($$PWD/../../3rdparty/zlib.pri) + else:include($$PWD/../../3rdparty/zlib_dependency.pri) + ++contains(QT_CONFIG,icu) { ++ SOURCES += tools/qlocale_icu.cpp ++ DEFINES += QT_USE_ICU ++} ++ + DEFINES += HB_EXPORT=Q_CORE_EXPORT + INCLUDEPATH += ../3rdparty/harfbuzz/src + HEADERS += ../3rdparty/harfbuzz/src/harfbuzz.h +diff --git a/tests/auto/qchar/qchar.pro b/tests/auto/qchar/qchar.pro +index 3813e4e..d991365 100644 +--- a/tests/auto/qchar/qchar.pro ++++ b/tests/auto/qchar/qchar.pro +@@ -13,3 +13,5 @@ symbian: { + } else { + DEFINES += SRCDIR=\\\"$$PWD/\\\" + } ++ ++contains(QT_CONFIG,icu):DEFINES += QT_USE_ICU +diff --git a/tests/auto/qchar/tst_qchar.cpp b/tests/auto/qchar/tst_qchar.cpp +index 45dd7eb..514a836 100644 +--- a/tests/auto/qchar/tst_qchar.cpp ++++ b/tests/auto/qchar/tst_qchar.cpp +@@ -103,7 +103,8 @@ tst_QChar::~tst_QChar() + { } + + void tst_QChar::initTestCase() +-{ } ++{ ++} + + void tst_QChar::cleanupTestCase() + { } +@@ -114,6 +115,7 @@ void tst_QChar::init() + int argc = 0; + app = new QCoreApplication(argc, NULL); + #endif ++ QLocale::setDefault(QLocale::C); + } + + void tst_QChar::cleanup() +@@ -143,9 +145,36 @@ void tst_QChar::toUpper() + QVERIFY(QChar::toUpper((uint)0x1c8) == 0x1c7); + QVERIFY(QChar::toUpper((uint)0x1c9) == 0x1c7); + +- QVERIFY(QChar::toUpper((uint)0x10400) == 0x10400); +- QVERIFY(QChar::toUpper((uint)0x10428) == 0x10400); ++ QCOMPARE(QChar::toUpper((uint)0x10400), 0x10400u); ++ QCOMPARE(QChar::toUpper((uint)0x10428), 0x10400u); ++ ++#ifdef QT_USE_ICU ++ QCOMPARE(QChar('i').toUpper(), QChar('I')); ++ QCOMPARE(QChar::toUpper(ushort('i')), ushort('I')); ++ QCOMPARE(QChar::toUpper(uint('i')), uint('I')); ++ ++ QLocale::setDefault(QLocale(QLocale::Turkish, QLocale::Turkey)); ++ ++ // in Turkish locale, upper-caseing a 'i' will result in a capital I plus dot (0x0130) ++ QCOMPARE(QChar('i').toUpper(), QChar(0x0130u)); ++ QCOMPARE(QChar::toUpper(ushort('i')), ushort(0x0130u)); ++ QCOMPARE(QChar::toUpper(uint('i')), 0x0130u); ++ ++ // upper-casing a lower-case i without dot (0x0131) will result in 'I' ++ QCOMPARE(QChar(0x0131u).toUpper(), QChar('I')); ++ QCOMPARE(QChar::toUpper(ushort(0x0131u)), ushort('I')); ++ QCOMPARE(QChar::toUpper(uint(0x0131u)), uint('I')); ++ ++ // upper-casing an upper-case 0x0130 should do nothing ++ QCOMPARE(QChar(0x0130u).toUpper(), QChar(0x0130u)); ++ QCOMPARE(QChar::toUpper(ushort(0x0130u)), ushort(0x0130u)); ++ QCOMPARE(QChar::toUpper(uint(0x0130u)), uint(0x0130u)); + ++ // upper-casing an upper-case I should do nothing ++ QCOMPARE(QChar('I').toUpper(), QChar('I')); ++ QCOMPARE(QChar::toUpper(ushort('I')), ushort('I')); ++ QCOMPARE(QChar::toUpper(uint('I')), uint('I')); ++#endif + } + + void tst_QChar::toLower() +@@ -170,6 +199,34 @@ void tst_QChar::toLower() + + QVERIFY(QChar::toLower((uint)0x10400) == 0x10428); + QVERIFY(QChar::toLower((uint)0x10428) == 0x10428); ++ ++#ifdef QT_USE_ICU ++ QCOMPARE(QChar('I').toLower(), QChar('i')); ++ QCOMPARE(QChar::toLower(ushort('I')), ushort('i')); ++ QCOMPARE(QChar::toLower(uint('I')), uint('i')); ++ ++ QLocale::setDefault(QLocale(QLocale::Turkish, QLocale::Turkey)); ++ ++ // in turkish locale, lower-casing an 'I' will result with a lower-case i without dot (0x0131) ++ QCOMPARE(QChar('I').toLower(), QChar(0x0131u)); ++ QCOMPARE(QChar::toLower(ushort('I')), ushort(0x0131u)); ++ QCOMPARE(QChar::toLower(uint('I')), uint(0x0131u)); ++ ++ // lower-casing a captial I with dot (0x0130) will result in 'i' ++ QCOMPARE(QChar(0x0130u).toLower(), QChar('i')); ++ QCOMPARE(QChar::toLower(ushort(0x0130u)), ushort('i')); ++ QCOMPARE(QChar::toLower(uint(0x0130u)), uint('i')); ++ ++ // lower-casing a lower-case i should do nothing ++ QCOMPARE(QChar('i').toLower(), QChar('i')); ++ QCOMPARE(QChar::toLower(ushort('i')), ushort('i')); ++ QCOMPARE(QChar::toLower(uint('i')), uint('i')); ++ ++ // lower-casing a lower-case i without dot (0x0131) should do nothing ++ QCOMPARE(QChar(0x0131u).toLower(), QChar(0x0131u)); ++ QCOMPARE(QChar::toLower(ushort(0x0131u)), ushort(0x0131u)); ++ QCOMPARE(QChar::toLower(uint(0x0131u)), uint(0x0131u)); ++#endif + } + + void tst_QChar::toTitle() +diff --git a/tests/auto/qstring/qstring.pro b/tests/auto/qstring/qstring.pro +index ed758c6..92dd755 100644 +--- a/tests/auto/qstring/qstring.pro ++++ b/tests/auto/qstring/qstring.pro +@@ -6,3 +6,5 @@ symbian:LIBS += -llibm + QT = core + + DEFINES += QT_NO_CAST_TO_ASCII ++ ++contains(QT_CONFIG,icu):DEFINES += QT_USE_ICU +diff --git a/tests/auto/qstring/tst_qstring.cpp b/tests/auto/qstring/tst_qstring.cpp +index ecae3d8..6baf9fc 100644 +--- a/tests/auto/qstring/tst_qstring.cpp ++++ b/tests/auto/qstring/tst_qstring.cpp +@@ -210,6 +210,8 @@ private slots: + void task262677remove(); + void QTBUG10404_compareRef(); + void QTBUG9281_arg_locale(); ++ ++ void toUpperLower_icu(); + }; + + typedef QList<int> IntList; +@@ -1544,6 +1546,11 @@ void tst_QString::toUpper() + QCOMPARE( lower.toUpper(), upper); + + ++#ifdef QT_USE_ICU ++ // test doesn't work with ICU support, since QChar is unaware of any locale ++ QEXPECT_FAIL("", "test doesn't work with ICU support, since QChar is unaware of any locale", Continue); ++ QVERIFY(false); ++#else + for (int i = 0; i < 65536; ++i) { + QString str(1, QChar(i)); + QString upper = str.toUpper(); +@@ -1551,6 +1558,7 @@ void tst_QString::toUpper() + if (upper.length() == 1) + QVERIFY(upper == QString(1, QChar(i).toUpper())); + } ++#endif + } + + void tst_QString::toLower() +@@ -1582,6 +1590,11 @@ void tst_QString::toLower() + upper += QChar(QChar::lowSurrogate(0x10400)); + QCOMPARE( upper.toLower(), lower); + ++#ifdef QT_USE_ICU ++ // test doesn't work with ICU support, since QChar is unaware of any locale ++ QEXPECT_FAIL("", "test doesn't work with ICU support, since QChar is unaware of any locale", Continue); ++ QVERIFY(false); ++#else + for (int i = 0; i < 65536; ++i) { + QString str(1, QChar(i)); + QString lower = str.toLower(); +@@ -1589,6 +1602,7 @@ void tst_QString::toLower() + if (lower.length() == 1) + QVERIFY(str.toLower() == QString(1, QChar(i).toLower())); + } ++#endif + } + + void tst_QString::trimmed() +@@ -4200,6 +4214,8 @@ void tst_QString::localeAwareCompare() + + #elif defined (Q_WS_MAC) + QSKIP("Setting the locale is not supported on OS X (you can set the C locale, but that won't affect CFStringCompare which is used to compare strings)", SkipAll); ++#elif defined(QT_USE_ICU) ++ QLocale::setDefault(QLocale(locale)); + #else + if (!locale.isEmpty()) { + const char *newLocale = setlocale(LC_ALL, locale.toLatin1()); +@@ -4211,6 +4227,11 @@ void tst_QString::localeAwareCompare() + } + #endif + ++#ifdef QT_USE_ICU ++ // ### for c1, ICU disagrees with libc on how to compare ++ QEXPECT_FAIL("c1", "ICU disagrees with test", Abort); ++#endif ++ + int testres = QString::localeAwareCompare(s1, s2); + if (result < 0) { + QVERIFY(testres < 0); +@@ -4912,6 +4933,40 @@ void tst_QString::QTBUG9281_arg_locale() + QLocale::setDefault(QLocale::C); + } + ++void tst_QString::toUpperLower_icu() ++{ ++#ifndef QT_USE_ICU ++ QSKIP("Qt was built without ICU support", QTest::SkipAll); ++#endif ++ ++ QString s = QString::fromLatin1("i"); ++ ++ QCOMPARE(s.toUpper(), QString::fromLatin1("I")); ++ QCOMPARE(s.toLower(), QString::fromLatin1("i")); ++ ++ QLocale::setDefault(QLocale(QLocale::Turkish, QLocale::Turkey)); ++ ++ // turkish locale has a capital I with a dot (U+0130, utf8 c4b0) ++ ++ QCOMPARE(s.toUpper(), QString::fromUtf8("\xc4\xb0")); ++ QCOMPARE(QString::fromUtf8("\xc4\xb0").toLower(), s); ++ ++ // nothing should happen here ++ QCOMPARE(s.toLower(), s); ++ QCOMPARE(QString::fromLatin1("I").toUpper(), QString::fromLatin1("I")); ++ ++ // U+0131, utf8 c4b1 is the lower-case i without a dot ++ QString sup = QString::fromUtf8("\xc4\xb1"); ++ ++ QCOMPARE(sup.toUpper(), QString::fromLatin1("I")); ++ QCOMPARE(QString::fromLatin1("I").toLower(), sup); ++ ++ // nothing should happen here ++ QCOMPARE(sup.toLower(), sup); ++ QCOMPARE(QString::fromLatin1("i").toLower(), QString::fromLatin1("i")); ++ ++ // the cleanup function will restore the default locale ++} + + + QTEST_APPLESS_MAIN(tst_QString) diff --git a/config.profiles/harmattan/patches/no_read_pro_from_quilt_dir.diff b/config.profiles/harmattan/patches/no_read_pro_from_quilt_dir.diff new file mode 100644 index 0000000..f5ddb67 --- /dev/null +++ b/config.profiles/harmattan/patches/no_read_pro_from_quilt_dir.diff @@ -0,0 +1,13 @@ +Index: qt-maemo-qtp/configure +=================================================================== +--- qt-maemo-qtp.orig/configure ++++ qt-maemo-qtp/configure +@@ -8465,7 +8465,7 @@ + # .projects.3 -> the rest + rm -f .projects .projects.1 .projects.2 .projects.3 + +-QMAKE_PROJECTS=`find "$relpath/." -name '*.pro' -print | sed 's-/\./-/-'` ++QMAKE_PROJECTS=`find "$relpath/." -name '*.pro' -a ! -path '*/.pc/*' -print | sed 's-/\./-/-'` + if [ -z "$AWK" ]; then + for p in `echo $QMAKE_PROJECTS`; do + echo "$p" >> .projects diff --git a/config.profiles/harmattan/patches/pinch_gesture_sent_twice.diff b/config.profiles/harmattan/patches/pinch_gesture_sent_twice.diff new file mode 100644 index 0000000..61dfbf9 --- /dev/null +++ b/config.profiles/harmattan/patches/pinch_gesture_sent_twice.diff @@ -0,0 +1,56 @@ +Index: qt-maemo-qtp/src/gui/kernel/qstandardgestures.cpp +=================================================================== +--- qt-maemo-qtp.orig/src/gui/kernel/qstandardgestures.cpp ++++ qt-maemo-qtp/src/gui/kernel/qstandardgestures.cpp +@@ -66,6 +66,9 @@ + #else + static_cast<QWidget *>(target)->setAttribute(Qt::WA_AcceptTouchEvents); + #endif ++ } else if (target) { ++ return 0; // this assumes the target is a QGraphicsObject, so we return ++ // NULL to indicate that the recognizer doesn't support graphicsobject + } + return new QPanGesture; + } +@@ -157,7 +160,11 @@ + { + if (target && target->isWidgetType()) { + static_cast<QWidget *>(target)->setAttribute(Qt::WA_AcceptTouchEvents); ++ } else if (target) { ++ return 0; // this assumes the target is a QGraphicsObject, so we return ++ // NULL to indicate that the recognizer doesn't support graphicsobject + } ++ + return new QPinchGesture; + } + +@@ -286,6 +293,9 @@ + { + if (target && target->isWidgetType()) { + static_cast<QWidget *>(target)->setAttribute(Qt::WA_AcceptTouchEvents); ++ } else if (target) { ++ return 0; // this assumes the target is a QGraphicsObject, so we return ++ // NULL to indicate that the recognizer doesn't support graphicsobject + } + return new QSwipeGesture; + } +@@ -424,6 +434,9 @@ + { + if (target && target->isWidgetType()) { + static_cast<QWidget *>(target)->setAttribute(Qt::WA_AcceptTouchEvents); ++ } else if (target) { ++ return 0; // this assumes the target is a QGraphicsObject, so we return ++ // NULL to indicate that the recognizer doesn't support graphicsobject + } + return new QTapGesture; + } +@@ -495,6 +508,9 @@ + { + if (target && target->isWidgetType()) { + static_cast<QWidget *>(target)->setAttribute(Qt::WA_AcceptTouchEvents); ++ } else if (target) { ++ return 0; // this assumes the target is a QGraphicsObject, so we return ++ // NULL to indicate that the recognizer doesn't support graphicsobject + } + return new QTapAndHoldGesture; + } diff --git a/config.profiles/harmattan/patches/qgltexturecache.diff b/config.profiles/harmattan/patches/qgltexturecache.diff new file mode 100644 index 0000000..0fa8ad2 --- /dev/null +++ b/config.profiles/harmattan/patches/qgltexturecache.diff @@ -0,0 +1,23 @@ +Index: qt-maemo-qtp/src/opengl/qgl.cpp +=================================================================== +--- qt-maemo-qtp.orig/src/opengl/qgl.cpp ++++ qt-maemo-qtp/src/opengl/qgl.cpp +@@ -1831,18 +1831,6 @@ + void QGLTextureCache::insert(QGLContext* ctx, qint64 key, QGLTexture* texture, int cost) + { + QWriteLocker locker(&m_lock); +- if (m_cache.totalCost() + cost > m_cache.maxCost()) { +- // the cache is full - make an attempt to remove something +- const QList<QGLTextureCacheKey> keys = m_cache.keys(); +- int i = 0; +- while (i < m_cache.count() +- && (m_cache.totalCost() + cost > m_cache.maxCost())) { +- QGLTexture *tex = m_cache.object(keys.at(i)); +- if (tex->context == ctx) +- m_cache.remove(keys.at(i)); +- ++i; +- } +- } + const QGLTextureCacheKey cacheKey = {key, QGLContextPrivate::contextGroup(ctx)}; + m_cache.insert(cacheKey, texture, cost); + } diff --git a/config.profiles/harmattan/patches/qwidget_x11.diff b/config.profiles/harmattan/patches/qwidget_x11.diff new file mode 100644 index 0000000..8bcb011 --- /dev/null +++ b/config.profiles/harmattan/patches/qwidget_x11.diff @@ -0,0 +1,39 @@ +commit 4ecc45086102807901a3bd2b9e02a169ca212716 +Author: Harald Fernengel <harald.fernengel@nokia.com> +Date: Thu Dec 9 10:51:01 2010 +0100 + + Fix a rare race condition when showing windows + + When setting a window to translucent shortly before showing it with the + OpenGL graphics system, the hijacking would call XDestroyWindow without + resetting the internal state. This might lead to the window waiting for + a map notify message forever. + + The patch now properly resets the internal state when destroying the old + window, so it'll get mapped correctly when show() is called. + + Reviewed-by: Denis Dzyubenko + +Index: qt-maemo-qtp/src/gui/kernel/qwidget_x11.cpp +=================================================================== +--- qt-maemo-qtp.orig/src/gui/kernel/qwidget_x11.cpp ++++ qt-maemo-qtp/src/gui/kernel/qwidget_x11.cpp +@@ -961,8 +961,17 @@ + inputContext->setFocusWidget(q); + } + +- if (destroyw) ++ if (destroyw) { + qt_XDestroyWindow(q, dpy, destroyw); ++ if (QTLWExtra *topData = maybeTopData()) { ++#ifndef QT_NO_XSYNC ++ if (topData->syncUpdateCounter) ++ XSyncDestroyCounter(dpy, topData->syncUpdateCounter); ++#endif ++ // we destroyed our old window - reset the top-level state ++ createTLSysExtra(); ++ } ++ } + + // newly created windows are positioned at the window system's + // (0,0) position. If the parent uses wrect mapping to expand the diff --git a/config.profiles/harmattan/patches/qwidget_x11_mapping.diff b/config.profiles/harmattan/patches/qwidget_x11_mapping.diff new file mode 100644 index 0000000..4866cfb --- /dev/null +++ b/config.profiles/harmattan/patches/qwidget_x11_mapping.diff @@ -0,0 +1,17 @@ +Index: qt-maemo-qtp/src/gui/kernel/qwidget_x11.cpp +=================================================================== +--- qt-maemo-qtp.orig/src/gui/kernel/qwidget_x11.cpp ++++ qt-maemo-qtp/src/gui/kernel/qwidget_x11.cpp +@@ -1353,6 +1353,12 @@ + //cannot trust that !isWindow() implies parentWidget() before create + return (q->isWindow() || !q->parentWidget()) ? p : q->parentWidget()->d_func()->mapToGlobal(p); + } ++ ++ // we're not embedded - use the client rect to compute the global position ++ if (!q->window()->d_func()->topData()->embedded) ++ return mapFromWS(QPoint(pos.x() - q->data->crect.left(), pos.y() - q->data->crect.top())); ++ ++ // otherwise, go through the (slow-ish) X11 round-trip + int x, y; + Window child; + QPoint p = mapToWS(pos); diff --git a/config.profiles/harmattan/patches/runtime-window-geometry-revert.diff b/config.profiles/harmattan/patches/runtime-window-geometry-revert.diff new file mode 100644 index 0000000..af55a60 --- /dev/null +++ b/config.profiles/harmattan/patches/runtime-window-geometry-revert.diff @@ -0,0 +1,12 @@ +Index: qt-maemo-qtp/src/gui/painting/qgraphicssystem_runtime.cpp +=================================================================== +--- qt-maemo-qtp.orig/src/gui/painting/qgraphicssystem_runtime.cpp ++++ qt-maemo-qtp/src/gui/painting/qgraphicssystem_runtime.cpp +@@ -285,7 +285,6 @@ + + void QRuntimeWindowSurface::setGeometry(const QRect &rect) + { +- QWindowSurface::setGeometry(rect); + m_windowSurface->setGeometry(rect); + } + diff --git a/config.profiles/harmattan/patches/series b/config.profiles/harmattan/patches/series new file mode 100644 index 0000000..f2ee5f9 --- /dev/null +++ b/config.profiles/harmattan/patches/series @@ -0,0 +1,14 @@ +tst_qscrollbar.diff +signon_authenticator4.diff +pinch_gesture_sent_twice.diff +no_read_pro_from_quilt_dir.diff +tst_qvariant.diff +icu.diff +qgltexturecache.diff +qwidget_x11.diff +qwidget_x11_mapping.diff +glshadercache.diff +temppath.diff +tst_qprogressbar.diff +default_widget_size.diff +runtime-window-geometry-revert.diff diff --git a/config.profiles/harmattan/patches/signon_authenticator4.diff b/config.profiles/harmattan/patches/signon_authenticator4.diff new file mode 100644 index 0000000..63e8d51 --- /dev/null +++ b/config.profiles/harmattan/patches/signon_authenticator4.diff @@ -0,0 +1,230 @@ +Index: qt-maemo-qtp/src/3rdparty/signon/signon.pri +=================================================================== +--- /dev/null ++++ qt-maemo-qtp/src/3rdparty/signon/signon.pri +@@ -0,0 +1,2 @@ ++# signon dependency ++CONFIG += qdbus +Index: qt-maemo-qtp/src/network/access/access.pri +=================================================================== +--- qt-maemo-qtp.orig/src/network/access/access.pri ++++ qt-maemo-qtp/src/network/access/access.pri +@@ -61,3 +61,4 @@ + access/qnetworkdiskcache.cpp + + include($$PWD/../../3rdparty/zlib_dependency.pri) ++include($$PWD/../../3rdparty/signon/signon.pri) +Index: qt-maemo-qtp/src/network/kernel/qauthenticator.cpp +=================================================================== +--- qt-maemo-qtp.orig/src/network/kernel/qauthenticator.cpp ++++ qt-maemo-qtp/src/network/kernel/qauthenticator.cpp +@@ -129,6 +129,9 @@ + \sa QSslSocket + */ + ++#ifndef QT_NO_SIGNON ++#include <QtDBus/QtDBus> ++#endif //QT_NO_SIGNON + + /*! + Constructs an empty authentication object +@@ -421,17 +424,40 @@ + { + QByteArray response; + const char *methodString = 0; ++#ifndef QT_NO_SIGNON ++ bool valid = false; ++ qint32 id = 0; ++#endif //QT_NO_SIGNON ++ + switch(method) { + case QAuthenticatorPrivate::None: + methodString = ""; + phase = Done; + break; + case QAuthenticatorPrivate::Plain: ++#ifndef QT_NO_SIGNON ++ id = this->options.value(QLatin1String("identity")).toInt(&valid); ++ if (valid) { ++ //get response from sso ++ QVariantMap signon = signonResponse(id, QLatin1String("password"),QVariantMap()); ++ response = '\0' + signon.value(QLatin1String("UserName")).toString().toUtf8() ++ + '\0' + signon.value(QLatin1String("Secret")).toString().toUtf8(); ++ } else ++#endif //QT_NO_SIGNON + response = '\0' + user.toUtf8() + '\0' + password.toUtf8(); + phase = Done; + break; + case QAuthenticatorPrivate::Basic: + methodString = "Basic "; ++#ifndef QT_NO_SIGNON ++ id = this->options.value(QLatin1String("identity")).toInt(&valid); ++ if (valid) { ++ //get response from sso ++ QVariantMap signon = signonResponse(id, QLatin1String("password"),QVariantMap()); ++ response = signon.value(QLatin1String("UserName")).toString().toLatin1() ++ + ':' + signon.value(QLatin1String("Secret")).toString().toLatin1(); ++ } else ++#endif //QT_NO_SIGNON + response = user.toLatin1() + ':' + password.toLatin1(); + response = response.toBase64(); + phase = Done; +@@ -613,6 +639,90 @@ + return hash.result().toHex(); + } + ++#ifndef QT_NO_SIGNON ++ ++static QVariantMap signonResponse(const quint32 id, const QString &method, QVariantMap args) ++{ ++ //check dbus connection ++ QDBusConnection connection = QDBusConnection::sessionBus(); ++ if (!QDBusConnection::sessionBus().isConnected()) { ++ qCritical() << "DBus connection failed"; ++ return QVariantMap(); ++ } ++ ++ QDBusMessage msg = ++ QDBusMessage::createMethodCall(QLatin1String("com.nokia.SingleSignOn"), ++ QLatin1String("/com/nokia/SingleSignOn") , ++ QLatin1String("com.nokia.SingleSignOn.AuthService"), ++ QLatin1String("getAuthSessionObjectPath")); ++ msg << id << method; ++ QDBusReply<QString> pathReply = connection.call(msg); ++ ++ QString sessionPath; ++ if (pathReply.isValid()) { ++ sessionPath = pathReply.value(); ++ } else { ++ qDebug() << pathReply.error(); ++ return QVariantMap(); ++ } ++ ++ //authenticate using auth session ++ msg = QDBusMessage::createMethodCall(QLatin1String("com.nokia.SingleSignOn"), ++ sessionPath, QString(), ++ QLatin1String("process")); ++ msg << args << method; ++ QDBusReply<QVariantMap> reply = connection.call(msg); ++ ++ if (reply.isValid()) { ++ QVariantMap map = reply.value(); ++ return map; ++ } else { ++ qDebug() << reply.error(); ++ return QVariantMap(); ++ } ++ return QVariantMap(); ++} ++ ++static QByteArray signonDigestMd5( ++ const quint32 id, ++ const QByteArray &alg, ++ QString &user, ++ const QByteArray &realm, ++ const QByteArray &nonce, /* nonce from server */ ++ QByteArray &nonceCount, /* 8 hex digits */ ++ QByteArray &cNonce, /* client nonce */ ++ const QByteArray &qop, /* qop-value: "", "auth", "auth-int" */ ++ const QByteArray &method, /* method from the request */ ++ const QByteArray &digestUri, /* requested URL */ ++ const QByteArray &hEntity /* H(entity body) if qop="auth-int" */ ++ ) ++{ ++ QByteArray digest = QByteArray(); ++ nonceCount = "00000001"; ++ ++ QVariantMap args; ++ args.insert(QLatin1String("Algorithm"), alg); ++ args.insert(QLatin1String("Realm"), QLatin1String(realm)); ++ args.insert(QLatin1String("nonce"), nonce); ++ args.insert(QLatin1String("nonceCount"), nonceCount); ++ args.insert(QLatin1String("cNonce"), cNonce); ++ args.insert(QLatin1String("qop"), qop); ++ args.insert(QLatin1String("method"), method); ++ args.insert(QLatin1String("digestUri"), digestUri); ++ args.insert(QLatin1String("Entity"), hEntity); ++ ++ QVariantMap response = signonResponse(id, QLatin1String("digest"), args); ++ ++ if (response.isEmpty()) ++ return digest; ++ digest = response.value(QLatin1String("Digest")).toByteArray(); ++ user = response.value(QLatin1String("UserName")).toString(); ++ cNonce = response.value(QLatin1String("cNonce")).toByteArray(); ++ ++ return digest; ++} ++#endif //QT_NO_SIGNON ++ + QByteArray QAuthenticatorPrivate::digestMd5Response(const QByteArray &challenge, const QByteArray &method, const QByteArray &path) + { + QHash<QByteArray,QByteArray> options = parseDigestAuthenticationChallenge(challenge); +@@ -625,9 +735,23 @@ + QByteArray nonce = options.value("nonce"); + QByteArray opaque = options.value("opaque"); + QByteArray qop = options.value("qop"); ++ QByteArray response; + + // qDebug() << "calculating digest: method=" << method << "path=" << path; +- QByteArray response = digestMd5ResponseHelper(options.value("algorithm"), user.toLatin1(), ++ ++#ifndef QT_NO_SIGNON ++ bool valid = false; ++ qint32 id = this->options.value(QLatin1String("identity")).toInt(&valid); ++ if (valid) { ++ //get response from sso ++ response = signonDigestMd5(id, options.value("algorithm"), user, ++ realm.toLatin1(), ++ nonce, nonceCountString, ++ cnonce, qop, method, ++ path, QByteArray()); ++ } else ++#endif //QT_NO_SIGNON ++ response = digestMd5ResponseHelper(options.value("algorithm"), user.toLatin1(), + realm.toLatin1(), password.toLatin1(), + nonce, nonceCountString, + cnonce, qop, method, +Index: qt-maemo-qtp/src/network/kernel/qauthenticator_p.h +=================================================================== +--- qt-maemo-qtp.orig/src/network/kernel/qauthenticator_p.h ++++ qt-maemo-qtp/src/network/kernel/qauthenticator_p.h +@@ -109,6 +109,23 @@ + + }; + ++#ifndef QT_NO_SIGNON ++ static QVariantMap signonResponse(const quint32 id, const QString &method, QVariantMap args); ++ static QByteArray signonDigestMd5( ++ const quint32 id, ++ const QByteArray &alg, ++ QString &user, ++ const QByteArray &realm, ++ const QByteArray &nonce, /* nonce from server */ ++ QByteArray &nonceCount, /* 8 hex digits */ ++ QByteArray &cNonce, /* client nonce */ ++ const QByteArray &qop, /* qop-value: "", "auth", "auth-int" */ ++ const QByteArray &method, /* method from the request */ ++ const QByteArray &digestUri, /* requested URL */ ++ const QByteArray &hEntity /* H(entity body) if qop="auth-int" */ ++ ); ++#endif //QT_NO_SIGNON ++ + + QT_END_NAMESPACE + +Index: qt-maemo-qtp/src/src.pro +=================================================================== +--- qt-maemo-qtp.orig/src/src.pro ++++ qt-maemo-qtp/src/src.pro +@@ -4,8 +4,9 @@ + unset(SRC_SUBDIRS) + win32:SRC_SUBDIRS += src_winmain + symbian:SRC_SUBDIRS += src_s60main +-SRC_SUBDIRS += src_corelib src_xml src_network src_sql src_testlib ++SRC_SUBDIRS += src_corelib src_xml + !symbian:contains(QT_CONFIG, dbus):SRC_SUBDIRS += src_dbus ++SRC_SUBDIRS += src_network src_sql src_testlib + !contains(QT_CONFIG, no-gui): SRC_SUBDIRS += src_gui + !wince*:!symbian:!vxworks:contains(QT_CONFIG, qt3support): SRC_SUBDIRS += src_qt3support + diff --git a/config.profiles/harmattan/patches/temppath.diff b/config.profiles/harmattan/patches/temppath.diff new file mode 100644 index 0000000..065c2d0 --- /dev/null +++ b/config.profiles/harmattan/patches/temppath.diff @@ -0,0 +1,28 @@ +Index: qt-maemo-qtp/mkspecs/linux-g++-maemo/qplatformdefs.h +=================================================================== +--- qt-maemo-qtp.orig/mkspecs/linux-g++-maemo/qplatformdefs.h ++++ qt-maemo-qtp/mkspecs/linux-g++-maemo/qplatformdefs.h +@@ -43,3 +43,8 @@ + + #define QT_GUI_DOUBLE_CLICK_RADIUS 20 + #define QT_GUI_DRAG_DISTANCE 16 ++ ++// TMPDIR sometimes points to /tmp and sometimes to /var/tmp ++// To guarantee native platform key generation for QSharedMemory and friends, ++// we must hard code the temp path to /var/tmp here. ++#define QT_UNIX_TEMP_PATH_OVERRIDE "/var/tmp" +Index: qt-maemo-qtp/src/corelib/io/qfsfileengine_unix.cpp +=================================================================== +--- qt-maemo-qtp.orig/src/corelib/io/qfsfileengine_unix.cpp ++++ qt-maemo-qtp/src/corelib/io/qfsfileengine_unix.cpp +@@ -643,7 +643,9 @@ + + QString QFSFileEngine::tempPath() + { +-#if defined(Q_OS_SYMBIAN) ++#if defined(QT_UNIX_TEMP_PATH_OVERRIDE) ++ QString temp = QLatin1String(QT_UNIX_TEMP_PATH_OVERRIDE); ++#elif defined(Q_OS_SYMBIAN) + TFileName symbianPath = PathInfo::PhoneMemoryRootPath(); + QString temp = QDir::fromNativeSeparators(qt_TDesC2QString(symbianPath)); + temp += QLatin1String( "temp/"); diff --git a/config.profiles/harmattan/patches/tst_qprogressbar.diff b/config.profiles/harmattan/patches/tst_qprogressbar.diff new file mode 100644 index 0000000..d252fe3 --- /dev/null +++ b/config.profiles/harmattan/patches/tst_qprogressbar.diff @@ -0,0 +1,19 @@ +Index: qt-maemo-qtp/tests/auto/qprogressbar/tst_qprogressbar.cpp +=================================================================== +--- qt-maemo-qtp.orig/tests/auto/qprogressbar/tst_qprogressbar.cpp ++++ qt-maemo-qtp/tests/auto/qprogressbar/tst_qprogressbar.cpp +@@ -179,10 +179,14 @@ + bar.repainted = false; + bar.setFormat("%v of %m (%p%)"); + qApp->processEvents(); ++ ++#if 0 // Removed + #ifndef Q_WS_MAC + // The Mac scroll bar is animated, which means we get paint events all the time. + QVERIFY(!bar.repainted); + #endif ++#endif ++ + QCOMPARE(bar.text(), QString("1 of 10 (10%)")); + bar.setRange(5, 5); + bar.setValue(5); diff --git a/config.profiles/harmattan/patches/tst_qscrollbar.diff b/config.profiles/harmattan/patches/tst_qscrollbar.diff new file mode 100644 index 0000000..3c777a9 --- /dev/null +++ b/config.profiles/harmattan/patches/tst_qscrollbar.diff @@ -0,0 +1,12 @@ +Index: qt-maemo-qtp/tests/auto/qscrollbar/tst_qscrollbar.cpp +=================================================================== +--- qt-maemo-qtp.orig/tests/auto/qscrollbar/tst_qscrollbar.cpp ++++ qt-maemo-qtp/tests/auto/qscrollbar/tst_qscrollbar.cpp +@@ -104,6 +104,7 @@ + + void tst_QScrollBar::task_209492() + { ++ QSKIP("Unstable test on Harmattan", SkipSingle); + class MyScrollArea : public QScrollArea + { + public: diff --git a/config.profiles/harmattan/patches/tst_qvariant.diff b/config.profiles/harmattan/patches/tst_qvariant.diff new file mode 100644 index 0000000..bcded52 --- /dev/null +++ b/config.profiles/harmattan/patches/tst_qvariant.diff @@ -0,0 +1,21 @@ +Index: qt-maemo-qtp/tests/auto/qvariant/tst_qvariant.cpp +=================================================================== +--- qt-maemo-qtp.orig/tests/auto/qvariant/tst_qvariant.cpp ++++ qt-maemo-qtp/tests/auto/qvariant/tst_qvariant.cpp +@@ -3122,6 +3122,7 @@ + + void tst_QVariant::numericalConvert() + { ++ int low_int = 3; + QVariant vfloat(float(5.3)); + QVariant vdouble(double(5.3)); + QVariant vreal(qreal(5.3)); +@@ -3137,7 +3138,7 @@ + + for(int i = 0; i < vect.size(); i++) { + double num = 5.3; +- if (i >= 3 && i <= 7) ++ if (i >= low_int && i <= 7) + num = 5; + QVariant *v = vect.at(i); + QCOMPARE(v->toFloat() , float(num)); diff --git a/config.profiles/harmattan/qt4-acceptance-tests.lintian b/config.profiles/harmattan/qt4-acceptance-tests.lintian new file mode 100644 index 0000000..c44aad8 --- /dev/null +++ b/config.profiles/harmattan/qt4-acceptance-tests.lintian @@ -0,0 +1,6 @@ +qt4-acceptance-tests: unknown-control-file digsigsums +qt4-acceptance-tests: file-in-unusual-dir usr/tests/qt4/tst_qdbusconnection +qt4-acceptance-tests: file-in-unusual-dir usr/tests/qt4/tst_qhash +qt4-acceptance-tests: file-in-unusual-dir usr/tests/qt4/tst_qlist +qt4-acceptance-tests: file-in-unusual-dir usr/tests/qt4/tst_qmap +qt4-acceptance-tests: non-standard-dir-in-usr usr/tests/ diff --git a/config.profiles/harmattan/qt4-declarative-qmlviewer.install b/config.profiles/harmattan/qt4-declarative-qmlviewer.install new file mode 100644 index 0000000..2822108 --- /dev/null +++ b/config.profiles/harmattan/qt4-declarative-qmlviewer.install @@ -0,0 +1,3 @@ +usr/bin/qmlviewer +usr/share/applications/QMLViewer.desktop +usr/share/icons/hicolor/64x64/apps/QMLViewer.png diff --git a/config.profiles/harmattan/qt4-declarative-qmlviewer.lintian b/config.profiles/harmattan/qt4-declarative-qmlviewer.lintian new file mode 100644 index 0000000..4acdec6 --- /dev/null +++ b/config.profiles/harmattan/qt4-declarative-qmlviewer.lintian @@ -0,0 +1 @@ +qt4-declarative-qmlviewer: unknown-control-file digsigsums diff --git a/config.profiles/harmattan/qt4-doc-html.doc-base b/config.profiles/harmattan/qt4-doc-html.doc-base new file mode 100644 index 0000000..58063c6 --- /dev/null +++ b/config.profiles/harmattan/qt4-doc-html.doc-base @@ -0,0 +1,11 @@ +Document: qt4-doc-html +Title: Qt4 Reference Documentation +Author: Trolltech AS +Abstract: Qt is a cross-platform C++ application framework. Qt's + primary feature is its rich set of widgets that provide standard GUI + functionality. +Section: Apps/programming + +Format: HTML +Index: /usr/share/doc/qt4-doc-html/html/index.html +Files: /usr/share/doc/qt4-doc-html/html/*.html diff --git a/config.profiles/harmattan/qt4-doc-html.install b/config.profiles/harmattan/qt4-doc-html.install new file mode 100644 index 0000000..8467be4 --- /dev/null +++ b/config.profiles/harmattan/qt4-doc-html.install @@ -0,0 +1,2 @@ +usr/share/qt4/doc/html + diff --git a/config.profiles/harmattan/qt4-doc-html.links b/config.profiles/harmattan/qt4-doc-html.links new file mode 100644 index 0000000..d1fed65 --- /dev/null +++ b/config.profiles/harmattan/qt4-doc-html.links @@ -0,0 +1,2 @@ +usr/share/qt4/doc/html usr/share/doc/qt4-doc-html/html + diff --git a/config.profiles/harmattan/qt4-doc.install b/config.profiles/harmattan/qt4-doc.install new file mode 100644 index 0000000..1037a6c --- /dev/null +++ b/config.profiles/harmattan/qt4-doc.install @@ -0,0 +1,3 @@ +usr/share/qt4/doc/qch/* +usr/share/qt4/doc/src/* + diff --git a/config.profiles/harmattan/qt4-linguist-tools.install b/config.profiles/harmattan/qt4-linguist-tools.install new file mode 100644 index 0000000..73c0bb1 --- /dev/null +++ b/config.profiles/harmattan/qt4-linguist-tools.install @@ -0,0 +1,4 @@ +usr/bin/native-lrelease +usr/bin/host-lrelease +usr/bin/lupdate +usr/bin/lconvert diff --git a/config.profiles/harmattan/qt4-linguist-tools.lintian b/config.profiles/harmattan/qt4-linguist-tools.lintian new file mode 100644 index 0000000..0f8ed2b --- /dev/null +++ b/config.profiles/harmattan/qt4-linguist-tools.lintian @@ -0,0 +1,4 @@ +qt4-linguist-tools: unknown-control-file digsigsums +qt4-linguist-tools: binary-from-other-architecture ./usr/bin/host-lrelease +qt4-linguist-tools: binary-or-shlib-defines-rpath ./usr/bin/host-lrelease /scratchbox/host_shared/lib +qt4-linguist-tools: binary-or-shlib-defines-rpath ./usr/bin/host-lrelease /host_usr/lib diff --git a/config.profiles/harmattan/qt4-linguist-tools.postinst b/config.profiles/harmattan/qt4-linguist-tools.postinst new file mode 100644 index 0000000..2453b95 --- /dev/null +++ b/config.profiles/harmattan/qt4-linguist-tools.postinst @@ -0,0 +1,16 @@ +#!/bin/sh + +set -e + +PREFIX=native +if [ -f /targets/links/scratchbox.config ]; then + PREFIX=host +fi + +BINARIES="lrelease" + +for bin in $BINARIES; do + ln -sf "/usr/bin/${PREFIX}-${bin}" "/usr/bin/${bin}" +done + +#DEBHELPER# diff --git a/config.profiles/harmattan/qt4-linguist-tools.prerm b/config.profiles/harmattan/qt4-linguist-tools.prerm new file mode 100644 index 0000000..04b51bd --- /dev/null +++ b/config.profiles/harmattan/qt4-linguist-tools.prerm @@ -0,0 +1,16 @@ +#!/bin/sh + +set -e + +BINARIES="lrelease" + +case "$1" in + upgrade) ;; + remove|failed-upgrade|deconfigure) + for bin in $BINARIES; do + rm -f "/usr/bin/${bin}" + done + ;; +esac + +#DEBHELPER# diff --git a/config.profiles/harmattan/qt4-maemo-auto-tests.lintian b/config.profiles/harmattan/qt4-maemo-auto-tests.lintian new file mode 100644 index 0000000..3745c80 --- /dev/null +++ b/config.profiles/harmattan/qt4-maemo-auto-tests.lintian @@ -0,0 +1,41 @@ +qt4-maemo-auto-tests: unknown-control-file digsigsums +qt4-maemo-auto-tests: file-in-unusual-dir usr/tests/qt4/tst_qdbusabstractadaptor +qt4-maemo-auto-tests: file-in-unusual-dir usr/tests/qt4/tst_qdbusabstractinterface +qt4-maemo-auto-tests: file-in-unusual-dir usr/tests/qt4/tst_qdbuscontext +qt4-maemo-auto-tests: file-in-unusual-dir usr/tests/qt4/tst_qdbusinterface +qt4-maemo-auto-tests: file-in-unusual-dir usr/tests/qt4/tst_qdbuslocalcalls +qt4-maemo-auto-tests: file-in-unusual-dir usr/tests/qt4/tst_qdbusmetaobject +qt4-maemo-auto-tests: file-in-unusual-dir usr/tests/qt4/tst_qdbusmetatype +qt4-maemo-auto-tests: file-in-unusual-dir usr/tests/qt4/tst_qdbuspendingcall +qt4-maemo-auto-tests: file-in-unusual-dir usr/tests/qt4/tst_qdbuspendingreply +qt4-maemo-auto-tests: file-in-unusual-dir usr/tests/qt4/tst_qdbusreply +qt4-maemo-auto-tests: file-in-unusual-dir usr/tests/qt4/tst_qdbusservicewatcher +qt4-maemo-auto-tests: file-in-unusual-dir usr/tests/qt4/tst_qdbusthreading +qt4-maemo-auto-tests: file-in-unusual-dir usr/tests/qt4/tst_qdbusxmlparser +qt4-maemo-auto-tests: file-in-unusual-dir usr/tests/qt4/tst_qdebug +qt4-maemo-auto-tests: file-in-unusual-dir usr/tests/qt4/tst_qmutexlocker +qt4-maemo-auto-tests: file-in-unusual-dir usr/tests/qt4/tst_qnetworkaddressentry +qt4-maemo-auto-tests: file-in-unusual-dir usr/tests/qt4/tst_qnetworkcookie +qt4-maemo-auto-tests: file-in-unusual-dir usr/tests/qt4/tst_qnetworkcookiejar +qt4-maemo-auto-tests: file-in-unusual-dir usr/tests/qt4/tst_qnetworkproxy +qt4-maemo-auto-tests: file-in-unusual-dir usr/tests/qt4/tst_qnetworkrequest +qt4-maemo-auto-tests: file-in-unusual-dir usr/tests/qt4/tst_qobjectrace +qt4-maemo-auto-tests: file-in-unusual-dir usr/tests/qt4/tst_qpainterpathstroker +qt4-maemo-auto-tests: file-in-unusual-dir usr/tests/qt4/tst_qpen +qt4-maemo-auto-tests: file-in-unusual-dir usr/tests/qt4/tst_qpoint +qt4-maemo-auto-tests: file-in-unusual-dir usr/tests/qt4/tst_qpolygon +qt4-maemo-auto-tests: file-in-unusual-dir usr/tests/qt4/tst_qquaternion +qt4-maemo-auto-tests: file-in-unusual-dir usr/tests/qt4/tst_qqueue +qt4-maemo-auto-tests: file-in-unusual-dir usr/tests/qt4/tst_qrand +qt4-maemo-auto-tests: file-in-unusual-dir usr/tests/qt4/tst_qreadlocker +qt4-maemo-auto-tests: file-in-unusual-dir usr/tests/qt4/tst_qreadwritelock +qt4-maemo-auto-tests: file-in-unusual-dir usr/tests/qt4/tst_qrect +qt4-maemo-auto-tests: file-in-unusual-dir usr/tests/qt4/tst_qringbuffer +qt4-maemo-auto-tests: file-in-unusual-dir usr/tests/qt4/tst_qscopedpointer +qt4-maemo-auto-tests: file-in-unusual-dir usr/tests/qt4/tst_qscriptclass +qt4-maemo-auto-tests: file-in-unusual-dir usr/tests/qt4/tst_qscriptcontextinfo +qt4-maemo-auto-tests: file-in-unusual-dir usr/tests/qt4/tst_qscriptstring +qt4-maemo-auto-tests: file-in-unusual-dir usr/tests/qt4/tst_qscriptvalueiterator +qt4-maemo-auto-tests: file-in-unusual-dir usr/tests/qt4/tst_qsequentialanimationgroup +qt4-maemo-auto-tests: file-in-unusual-dir usr/tests/qt4/tst_qset +qt4-maemo-auto-tests: non-standard-dir-in-usr usr/tests/ diff --git a/config.profiles/harmattan/readdir-hppa-test.c b/config.profiles/harmattan/readdir-hppa-test.c new file mode 100644 index 0000000..eb893ba --- /dev/null +++ b/config.profiles/harmattan/readdir-hppa-test.c @@ -0,0 +1,25 @@ +#include <sys/types.h> +#include <dirent.h> +#include <errno.h> +#include <stdio.h> + +main() { + int return_code; + DIR *dir; + struct dirent entry; + struct dirent *result; + + if ((dir = opendir(".")) == NULL) + perror("opendir() error"); + else { + // puts("contents of .:"); + for (return_code = readdir_r(dir, &entry, &result); + result != NULL && return_code == 0; + return_code = readdir_r(dir, &entry, &result)) + printf("%s\n", entry.d_name); + if (return_code != 0) + perror("readdir_r() error"); + closedir(dir); + } +} + diff --git a/config.profiles/harmattan/rules b/config.profiles/harmattan/rules new file mode 100755 index 0000000..3042551 --- /dev/null +++ b/config.profiles/harmattan/rules @@ -0,0 +1,404 @@ +#!/usr/bin/make -f + +export QTDIR := $(shell pwd) +export PATH := $(QTDIR)/bin:$(PATH) +# workaround to use lrelease. +export LD_LIBRARY_PATH := $(QTDIR)/lib:$(LD_LIBRARY_PATH) +export QT_PLUGIN_PATH := $(QTDIR)/plugins +export DH_VERBOSE=1 + +# Only present in official source package +#QTVERSION := $(shell ls changes-* | cut -f2 -d '-') +CURRENTVERSION := $(shell head -1 debian/changelog | sed 's/[^(]*(\([^)]*\)).*/\1/') + +include /usr/share/cdbs/1/rules/debhelper.mk +include /usr/share/cdbs/1/class/makefile.mk +include /usr/share/cdbs/1/rules/patchsys-quilt.mk +include /usr/share/cdbs/1/rules/utils.mk + +# Find out how many parallel threads to run +TMP_BUILD_OPTS = $(subst $(comma),$(space),$(DEB_BUILD_OPTIONS)) +ifneq (,$(filter parallel=%,$(TMP_BUILD_OPTS))) + NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(TMP_BUILD_OPTS))) + PARALLEL_MAKEFLAGS += -j$(NUMJOBS) +endif +BUILD_NOOPT := no +ifneq (,$(filter noopt,$(TMP_BUILD_OPTS))) + BUILD_NOOPT := yes +endif +BUILD_DOCS := yes +ifneq (,$(filter nodoc,$(TMP_BUILD_OPTS))) + BUILD_DOCS := no +endif +ifneq (,$(filter nodocs,$(TMP_BUILD_OPTS))) + BUILD_DOCS := no +endif +TRY_TARGET_BUILD := no +ifneq (,$(filter native-tools,$(TMP_BUILD_OPTS))) + TRY_TARGET_BUILD := yes +endif + +DEB_MAKE_INVOKE := $(MAKE) $(PARALLEL_MAKEFLAGS) +DEB_MAKE_BUILD_TARGET := sub-src +DEB_MAKE_INSTALL_TARGET := INSTALL_ROOT=$(DEB_DESTDIR) install +DEB_DH_INSTALL_SOURCEDIR := debian/tmp + +# Ensure the *.debug files aren't included in any package other than libqt4-dbg +DEB_DH_INSTALL_ARGS := --exclude=.debug + +DEB_MAKE_CLEAN_TARGET := confclean distclean + +# Shlibs of the current upstream version +DEB_DH_MAKESHLIBS_ARGS_ALL := -V + +DEB_DH_SHLIBDEPS_ARGS_ALL := --exclude=.debug -Xusr/bin/host- + +# Only present in official source package +#DEB_INSTALL_CHANGELOGS_ALL := changes-$(QTVERSION) + +QT_MAEMO_TESTDIR := debian/tests +export QMAKEFEATURES=$(CURDIR)/debian/tests +export QMAKE_INVOKE=$(CURDIR)/bin/qmake +export QMAKE_BUILD_ROOT=$(CURDIR) + +#Test packages that will run using -style option +QT_AUTOTESTS_GUI_STYLE := "libqt4-gui-tests" + +# Select OpenGL backend driver +# Enable multituch support +ifeq ($(DEB_HOST_ARCH),arm) + CONFIG_ARCH_OPT = armv6 +else + ifeq ($(DEB_HOST_ARCH),armel) + CONFIG_ARCH_OPT = armv6 + else + CONFIG_ARCH_OPT = i386 + endif + +endif + +EXTRA_CONFIGURE_OPTS += -DQT_QLOCALE_USES_FCVT -DQT_EXPERIMENTAL_CLIENT_DECORATIONS -DQT_MEEGO_EXPERIMENTAL_SHADERCACHE -DQT_MEEGO_EXPERIMENTAL_SHADERCACHE_TRACE + +# Check if running inside scratchbox, and that host-gcc works +IN_SBOX = $(shell if [ -f /targets/links/scratchbox.config ]; then echo yes; else echo no; fi) +HOST_GCC_WORKS = $(shell if host-gcc --version > /dev/null; then echo yes; else echo no; fi) +TARGET_BUILD = no +ifeq ($(TRY_TARGET_BUILD),yes) + ifeq ($(IN_SBOX),yes) + ifeq ($(HOST_GCC_WORKS),yes) + TARGET_BUILD = yes + endif + endif +# Except don't use host-gcc if building for i386 + ifeq ($(DEB_HOST_ARCH),i386) + TARGET_BUILD = no + endif +endif + +TARGET_PLATFORM = linux-g++-maemo +HOST_PLATFORM = unsupported/linux-host-g++ +PLATFORM_FLAG = -platform $(TARGET_PLATFORM) +FORCE_PKG_CONFIG_FLAG = +HOST_EXLUDES = +ifeq ($(TARGET_BUILD),yes) + PLATFORM_FLAG = -platform $(HOST_PLATFORM) \ + -xplatform $(TARGET_PLATFORM) + FORCE_PKG_CONFIG_FLAG = -force-pkg-config + HOST_EXCLUDES := usr/bin/host- usr/bin/qmake +endif + +DEB_STRIP_EXCLUDE := $(HOST_EXCLUDES) + +# Determine target architecture +ifeq ($(DEB_HOST_ARCH_OS),linux) + ifeq ($(CONFIG_ARCH_OPT),armv6) + GL_BACKEND=es2 + EXTRA_CONFIGURE_OPTS += -graphicssystem runtime \ + -runtimegraphicssystem meego + CONFIG_BUILD_OPT = -release + else + GL_BACKEND=desktop + CONFIG_BUILD_OPT = -debug + endif +else + TARGET_PLATFORM = glibc-g++ +endif + +#If noopt is selected, force -debug and some compilation flags +ifeq ($(BUILD_NOOPT),yes) + CONFIG_BUILD_OPT = -debug + CFLAGS = -g + CXXFLAGS = -g + export CFLAGS + export CXXFLAGS +endif + +MAKE_DOCS := -make docs +DOCS_EXCLUDE := +ifeq ($(BUILD_DOCS),no) + MAKE_DOCS := -nomake docs +endif + +common-build-arch:: debian/stamp-makefile-build-tools + +debian/stamp-makefile-build-tools: debian/stamp-makefile-build + $(DEB_MAKE_INVOKE) sub-tools + touch $@ + +common-configure-arch:: config.status + +config.status: + # Create mkspecs/glibc-g++ from mkspecs/linux-g++, needed by GNU/kFreeBSD + # we cannot use directly linux-g++ due to src/corelib/io/io.pri + rm -rf mkspecs/glibc-g++ + cp -a mkspecs/linux-g++ mkspecs/glibc-g++ + ./configure -opensource \ + -confirm-license \ + $(CONFIG_BUILD_OPT) \ + -prefix "/usr" \ + -bindir "/usr/bin" \ + -libdir "/usr/lib" \ + -docdir "/usr/share/qt4/doc" \ + -headerdir "/usr/include/qt4" \ + -datadir "/usr/share/qt4" \ + -plugindir "/usr/lib/qt4/plugins" \ + -importdir "/usr/lib/qt4/imports" \ + -translationdir "/usr/share/qt4/translations" \ + -sysconfdir "/etc/xdg" \ + $(PLATFORM_FLAG) \ + $(FORCE_PKG_CONFIG_FLAG) \ + -arch $(CONFIG_ARCH_OPT) \ + -fast \ + -no-optimized-qmake \ + -reduce-relocations \ + -no-separate-debug-info \ + -no-rpath \ + -system-zlib \ + -system-libtiff \ + -system-libpng \ + -system-libjpeg \ + -no-nas-sound \ + -qt-gif \ + -no-qt3support \ + -no-libmng \ + -opengl $(GL_BACKEND) \ + -accessibility \ + -make tools \ + $(MAKE_DOCS) \ + -nomake examples \ + -nomake demos \ + -little-endian \ + -no-cups \ + -no-gtkstyle \ + -exceptions \ + -no-xinerama \ + -no-xcursor \ + -dbus-linked \ + -glib \ + -no-pch \ + -gstreamer \ + -svg \ + -no-webkit \ + -no-sql-ibase \ + -xmlpatterns \ + -system-sqlite \ + -plugin-sql-sqlite \ + -openssl \ + -phonon \ + -xinput2 \ + -icu \ + $(EXTRA_CONFIGURE_OPTS) + +BINARY_NAMES := qmake moc lrelease rcc uic +HOST_BINARIES := $(addprefix $(CURDIR)/bin/, $(addprefix host-, $(BINARY_NAMES))) + +# host-prefixed binaries are to be copied anyway regardless of the platform +common-build-arch:: $(HOST_BINARIES) debian/stamp-makefile-build-target-binaries + +$(HOST_BINARIES): + cp "$(subst host-,,$@)" "$@" + if [ -n "$(HOST_EXCLUDES)" ]; then host-strip --strip-all "$@"; fi + +debian/stamp-makefile-build-target-binaries: $(HOST_BINARIES) +# Build target-platform tools when cross-compiling + # First make sure qdoc3 is built + if [ "x$(BUILD_DOCS)" = "xyes" ]; then $(DEB_MAKE_INVOKE) -C tools/qdoc3; fi + # Keep qmake as is while building the rest, build into native-qmake + (cd qmake && $(DEB_MAKE_INVOKE) clean && $(QMAKE_INVOKE) -spec "$(CURDIR)/mkspecs/$(TARGET_PLATFORM)" && $(DEB_MAKE_INVOKE) "TARGET=$(QTDIR)/bin/native-qmake") + # bootstrap needs to be first + for dir in src/tools/bootstrap src/tools/moc tools/linguist/lrelease src/tools/rcc src/tools/uic; do \ + (cd "$$dir" && $(DEB_MAKE_INVOKE) clean && $(QMAKE_INVOKE) -spec "$(CURDIR)/mkspecs/$(TARGET_PLATFORM)" && $(DEB_MAKE_INVOKE)) \ + done + #Use the host binaries for the rest of the Qt build + for binary in moc rcc uic lrelease; do \ + mv "$(CURDIR)/bin/$$binary" "$(CURDIR)/bin/native-$$binary" ; \ + cp "$(CURDIR)/bin/host-$$binary" "$(CURDIR)/bin/$$binary"; \ + done + touch $@ + +#Build the auto tests +TEST_PACKAGES := $(filter %-tests, $(DEB_PACKAGES)) +common-build-arch:: $(addprefix debian/stamp-makefile-build-autotest-,$(TEST_PACKAGES)) + +BUILD_TEST_PACKAGE_NAME = $(subst debian/stamp-makefile-build-autotest-,,$@) +BUILD_TEST_DIR = build_tests/$(BUILD_TEST_PACKAGE_NAME) +$(addprefix debian/stamp-makefile-build-autotest-,$(TEST_PACKAGES)) : + rm -f tests/auto/$(BUILD_TEST_PACKAGE_NAME).pro + cp debian/tests/$(BUILD_TEST_PACKAGE_NAME).pro tests/auto + mkdir -p $(BUILD_TEST_DIR) + cd $(BUILD_TEST_DIR) && $(QMAKE_INVOKE) -recursive $(CURDIR)/tests/auto/$(BUILD_TEST_PACKAGE_NAME).pro CONFIG+=maemo_tests + $(DEB_MAKE_INVOKE) -C $(BUILD_TEST_DIR) + touch $@ + + +clean:: +# Extra stuff missed by confclean/distclean + + # Misc. files + rm -f \ + config.status \ + config.tests/.qmake.cache \ + .qmake.cache \ + examples/dbus/*/Makefile.* \ + mkspecs/qconfig.pri \ + src/corelib/global/qconfig.* \ + src/tools/uic/qclass_lib_map.h \ + lib/*.so.* \ + lib/*.la \ + tests/auto/libqt4-gui-tests.pri \ + tests/auto/maemo-auto.pro \ + tests/auto/qt4-acceptance-tests.pri \ + tests/auto/qt4-maemo-auto-tests.pri \ + ; + + # Misc. directories + rm -rf \ + examples/tools/plugandpaint/plugins/ \ + examples/tools/styleplugin/styles/ \ + mkspecs/glibc-g++/ \ + plugins/ \ + include/ \ + doc-build/ \ + doc/html/ \ + doc/qch/ \ + ; + + # hppa test directory + rm -rf debian/hppa-tmp + + # Leftover dirs + find -depth -type d \( -false \ + -o -name debug-shared \ + -o -name debug-static \ + -o -name \*.gch \ + -o -name .moc\* \ + -o -name .obj\* \ + -o -name .pch \ + -o -name pkgconfig \ + -o -name .rcc \ + -o -name release-shared \ + -o -name release-static \ + -o -name .uic \ + \) -print0 | xargs -0 rm -rf + + # Leftover files and all symlinks except those in .git + find \( -false \ + -o \( -name \*.a -a ! -path \*/tests/auto/qdir/types/\*.a \) \ + -o -name Makefile.Debug \ + -o -name Makefile.Release \ + -o -name \*.o \ + -o -name \*.prl \ + -o \( -name \*.so -a ! -path \*/tests/auto/qlibrary/library_path/invalid.so \) \ + -o -name \*.so.debug \ + -o -type l \ + \! -path ./.git/\* \ + \) -print0 | xargs -0 rm -rf + + # Delete all Makefiles, excluding some from src/3rdparty + find $(CURDIR) -name Makefile \ + ! -path $(CURDIR)/src/3rdparty/Makefile \ + ! -path $(CURDIR)/src/3rdparty/freetype/\* \ + ! -path $(CURDIR)/src/3rdparty/zlib/\* \ + ! -path $(CURDIR)/src/3rdparty/ptmalloc/Makefile \ + ! -path $(CURDIR)/util/gencmap/Makefile \ + -print0 | xargs -0 rm -rf + + # Any remaining executables + find $(CURDIR) -type f -perm +111 -exec file -i '{}' \; \ + | grep -e application/x-executable \ + | cut -d ':' -f 1 | xargs rm -f + + # Generated on build + rm -f debian/shlibs.local + rm -f debian/stamp-makefile-build-tools + rm -f debian/stamp-makefile-build-docs + rm -f debian/stamp-makefile-build-target-binaries + rm -f $(addprefix debian/stamp-makefile-build-autotest-,$(TEST_PACKAGES)) + rm -f $(addprefix debian/,$(addsuffix .install, $(TEST_PACKAGES))) + rm -f $(addprefix tests/auto/,$(addsuffix .pro, $(TEST_PACKAGES))) + rm -rf build_tests/ + + +common-install-arch:: + mkdir -p $(DEB_DESTDIR)/usr/share/qt4/translations/ + cp $(CURDIR)/translations/*.ts $(DEB_DESTDIR)/usr/share/qt4/translations/. + find $(DEB_DESTDIR)/usr/share/qt4/translations/ -type f -name "*.ts" | xargs $(CURDIR)/bin/lrelease + rm -rf $(DEB_DESTDIR)/usr/share/qt4/translations/*.ts +# Fix wrong path in pkgconfig files + find $(DEB_DESTDIR)/usr/lib/pkgconfig -type f -name '*.pc' \ + -exec perl -pi -e "s, -L$(CURDIR)/?\S+,,g" {} \; +# Fix wrong path in prl files + find $(DEB_DESTDIR)/usr/lib -type f -name '*.prl' \ + -exec perl -pi -e "s, -L$(CURDIR)/\S+,,g" {} \; + find $(DEB_DESTDIR)/usr/lib -type f -name '*.prl' \ + -exec sed -i -e "/^QMAKE_PRL_BUILD_DIR/d;s/\(QMAKE_PRL_LIBS =\).*/\1/" {} \; + + +install/qt4-declarative-qmlviewer:: + install -p -D "debian/QMLViewer.desktop" "$(DEB_DESTDIR)/usr/share/applications/QMLViewer.desktop" + install -p -D "debian/QMLViewer.png" "$(DEB_DESTDIR)/usr/share/icons/hicolor/64x64/apps/QMLViewer.png" + + +$(patsubst %,install/%,$(TEST_PACKAGES)) :: install/%: + rm -f debian/$(cdbs_curpkg).install + $(DEB_MAKE_INVOKE) -C build_tests/$(cdbs_curpkg) $(DEB_MAKE_INSTALL_TARGET) + $(DEB_MAKE_INVOKE) -C build_tests/$(cdbs_curpkg) QTM_TEST_INSTALL_FILE=$(CURDIR)/debian/$(cdbs_curpkg).install installtests + if [ -z "$(findstring $(cdbs_curpkg),$(QT_AUTOTESTS_GUI_STYLE))" ]; then \ + $(QT_MAEMO_TESTDIR)/create_tests_xml -t $(QT_MAEMO_TESTDIR) \ + -i $(DEB_DESTDIR) -p $(CURDIR)/debian/$(cdbs_curpkg).install ;\ + else \ + $(QT_MAEMO_TESTDIR)/create_tests_xml -t $(QT_MAEMO_TESTDIR) -c "-style plastique" \ + -i $(DEB_DESTDIR) -p $(CURDIR)/debian/$(cdbs_curpkg).install ;\ + fi + +common-install-arch:: + find "$(CURDIR)/bin" -name "host-*" -exec install -p -D {} "$(DEB_DESTDIR)/usr/bin" \; + find "$(CURDIR)/bin" -name "native-*" -exec install -p -D {} "$(DEB_DESTDIR)/usr/bin" \; + + +install/libqt4-doc:: + mkdir -p "$(DEB_DESTDIR)/usr/share/qt4/doc/html/" + if [ "x$(BUILD_DOCS)" = "xno" ]; then touch "$(DEB_DESTDIR)/usr/share/qt4/doc/html/BUILT_WITH_NODOCS"; fi + +common-build-indep:: debian/stamp-makefile-build-docs + +debian/stamp-makefile-build-docs: + if [ "x$(BUILD_DOCS)" = "xyes" ]; then $(DEB_MAKE_INVOKE) docs; fi + touch $@ + +binary-predeb/libqt4-dev:: + sed -i -e 's/#PLATFORM_ARG#/$(TARGET_PLATFORM)/g' debian/$(cdbs_curpkg)/DEBIAN/postinst + +# Automatically install lintian overrides, stolen from debian-qt-kde.mk +$(patsubst %,binary-install/%,$(DEB_PACKAGES)) :: binary-install/%: + if test -e debian/$(cdbs_curpkg).lintian; then \ + install -p -D -m644 debian/$(cdbs_curpkg).lintian \ + debian/$(cdbs_curpkg)/usr/share/lintian/overrides/$(cdbs_curpkg); \ + fi + +# Generate shlibs local files +$(patsubst %,binary-fixup/%,$(DEB_ALL_PACKAGES)) :: binary-fixup/%: binary-strip/% + if test -e debian/$(cdbs_curpkg)/DEBIAN/shlibs ; then \ + sed 's/>=[^)]*/= $(CURRENTVERSION)/' debian/$(cdbs_curpkg)/DEBIAN/shlibs >> debian/shlibs.local ;\ + fi + diff --git a/config.profiles/harmattan/source.lintian-overrides b/config.profiles/harmattan/source.lintian-overrides new file mode 100644 index 0000000..1835a30 --- /dev/null +++ b/config.profiles/harmattan/source.lintian-overrides @@ -0,0 +1,5 @@ +qt4-x11 source: changelog-should-mention-nmu +qt4-x11 source: native-package-with-dash-version +qt4-x11 source: source-nmu-has-incorrect-version-number +qt4-x11 source: virtual-package-depends-without-real-package-depends build-depends: libgl-dev +qt4-x11 source: virtual-package-depends-without-real-package-depends build-depends: libgl1 diff --git a/config.profiles/harmattan/source/format b/config.profiles/harmattan/source/format new file mode 100644 index 0000000..89ae9db --- /dev/null +++ b/config.profiles/harmattan/source/format @@ -0,0 +1 @@ +3.0 (native) diff --git a/config.profiles/harmattan/tests/create_tests_xml b/config.profiles/harmattan/tests/create_tests_xml new file mode 100755 index 0000000..d6122bc --- /dev/null +++ b/config.profiles/harmattan/tests/create_tests_xml @@ -0,0 +1,174 @@ +#!/bin/sh + +############################################################################# +## +## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +## All rights reserved. +## Contact: Nokia Corporation (qt-info@nokia.com) +## +## This file is the build configuration utility of the Qt Toolkit. +## +## $QT_BEGIN_LICENSE:LGPL$ +## No Commercial Usage +## This file contains pre-release code and may not be distributed. +## You may use this file in accordance with the terms and conditions +## contained in the Technology Preview License Agreement accompanying +## this package. +## +## 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, Nokia gives you certain additional +## rights. These rights are described in the Nokia Qt LGPL Exception +## version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +## +## If you have questions regarding the use of this file, please contact +## Nokia at qt-info@nokia.com. +## +## +## +## +## +## +## +## +## $QT_END_LICENSE$ +## +############################################################################# + + +set -e +#set -u + +xmlInstallDir="usr/share" + +testSuiteHeader="testsuite_header.txt" +testSuiteFooter="testsuite_footer.txt" +testSetTemplate="testset.txt" + + +#------------------------------------------------------------------------------- +#Parameters: $1 the project file where the tests are defined +#------------------------------------------------------------------------------- +create_test_xml() +{ + + mkdir -p "$installDir/$xmlInstallDir/$packageName" + xmlFile="$installDir/$xmlInstallDir/$packageName/tests.xml" + + + begin_test_suite $xmlFile + + for testApp in $(< "$installFile"); do + if file -i "$installDir/$testApp"|grep -e "application/x-executable" ; then + add_test_set "$testApp" "$xmlFile" + fi + done + + end_test_suite $xmlFile + + echo "$xmlInstallDir/$packageName/tests.xml" >> "$installFile" + +} + +#------------------------------------------------------------------------------- +#Parameters: $1 the xml output file' +#------------------------------------------------------------------------------- +begin_test_suite() +{ + optstr="/<suite/s;name=\"[^\"]*\";name=\"$packageName\";g" + template="$templateDir/$testSuiteHeader" + runsed $optstr $template > "$1" +} + +#Parameters: $1 the xml output file +end_test_suite() +{ + cat "$templateDir/$testSuiteFooter" >> "$1" +} + +#------------------------------------------------------------------------------- +#Parameters: $1 the name of the test application +#Parameters: $2 the xml output file +#------------------------------------------------------------------------------- +add_test_set() +{ + templateSetFile="$templateDir/$testSetTemplate" + testSuiteName=$(basename $1) + add_set_name "$testSuiteName" "$templateSetFile" |add_description "$testSuiteName" |add_case_name "$testSuiteName" |add_step "$1" >> "$2" +} + +add_set_name() +{ + optstr="/<set/s;name=\"[^\"]*\";name=\"${packageName}_$1\";g" + runsed "$optstr" "$2" +} + +add_case_name() +{ + optstr="/<case/s;name=\"[^\"]*\";name=\"$1\";g" + runsed "$optstr" "$2" +} + +add_description() +{ + optstr="s;<description>.*</description>;<description>${packageName}:$1</description>;g" + runsed "$optstr" "$2" +} + +add_step() +{ + if [ -n "$testCliOptions" ]; then + optstr="s;<step>.*</step>;<step>$1 $testCliOptions</step>;g" + else + optstr="s;<step>.*</step>;<step>$1</step>;g" + fi + runsed "$optstr" "$2" +} + +runsed() +{ + sedopt=$(echo $1) + cmd='sed -e "$sedopt" $2' + eval $cmd +} + + +#======= main ========= + +programName="$0" +usage="Usage: `basename $programName` -t <template_dir> -d <debian_dir> \ +-i <dir_where_tests_will_be_installed> <project_files>" + +if [ $# -le 0 ]; then + echo "$usage" 1>&2 + exit 1 +fi + +while [ $# -gt 0 ]; do + case "$1" in + -t) templateDir=$(cd "$2"; pwd) + shift + ;; + -i) installDir=$(cd "$2"; pwd) + shift + ;; + -p) installFile="$2" + packageName=$(basename "$installFile" ".install") + shift + ;; + -c) testCliOptions="$2" + shift + ;; + *) projFileList="$projFileList $1";; + esac + shift +done + + +create_test_xml diff --git a/config.profiles/harmattan/tests/libqt4-gui-tests.pro b/config.profiles/harmattan/tests/libqt4-gui-tests.pro new file mode 100644 index 0000000..d00f139 --- /dev/null +++ b/config.profiles/harmattan/tests/libqt4-gui-tests.pro @@ -0,0 +1,64 @@ +#Staging tests for gui +TEMPLATE = subdirs + +SUBDIRS += modeltest \ + qabstractbutton \ + qabstractitemmodel \ + qabstractprintdialog \ + qabstractproxymodel \ + qabstractslider \ + qabstractspinbox \ + qabstracttextdocumentlayout \ + qabstractvideobuffer \ + qabstractvideosurface \ + qaction \ + qfileiconprovider \ + qfocusframe \ + qfont \ + qfontmetrics \ + qformlayout \ + qgraphicslayout \ + qnetworkcachemetadata \ + qpaintengine \ + qpalette \ + qparallelanimationgroup \ + qpauseanimation \ + qpicture \ + qplaintextedit \ + qpointer \ + qprinterinfo \ + qprogressbar \ + qprogressdialog \ + qpropertyanimation \ + qradiobutton \ + qregexpvalidator \ + qscriptenginedebugger \ + qscrollarea \ + qscrollbar \ + qsharedpointer_and_qwidget \ + qsignalmapper \ + qslider \ + qsortfilterproxymodel \ + qspinbox \ + qstackedlayout \ + qstackedwidget \ + qstandarditem \ + qstandarditemmodel \ + qstatemachine \ + qstringlistmodel \ + qstyleoption \ + qsyntaxhighlighter \ + qtextblock \ + qtextcursor \ + qtextformat \ + qtextlist \ + qtextobject \ + qtextscriptengine \ + qtexttable \ + qtoolbox \ + qtoolbutton \ + qtreewidgetitemiterator \ + qundogroup \ + qundostack \ + qvideosurfaceformat \ + qwidgetaction diff --git a/config.profiles/harmattan/tests/maemo_tests.prf b/config.profiles/harmattan/tests/maemo_tests.prf new file mode 100644 index 0000000..1b87781 --- /dev/null +++ b/config.profiles/harmattan/tests/maemo_tests.prf @@ -0,0 +1,57 @@ +############################################################################# +## +## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +## All rights reserved. +## Contact: Nokia Corporation (qt-info@nokia.com) +## +## This file is the build configuration utility of the Qt Toolkit. +## +## $QT_BEGIN_LICENSE:LGPL$ +## No Commercial Usage +## This file contains pre-release code and may not be distributed. +## You may use this file in accordance with the terms and conditions +## contained in the Technology Preview License Agreement accompanying +## this package. +## +## 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, Nokia gives you certain additional +## rights. These rights are described in the Nokia Qt LGPL Exception +## version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +## +## If you have questions regarding the use of this file, please contact +## Nokia at qt-info@nokia.com. +## +## +## +## +## +## +## +## +## $QT_END_LICENSE$ +## +############################################################################# + +load(qttest_p4) + +installtests.CONFIG = recursive +!contains(TEMPLATE, subdirs): for(install_set, INSTALLS) { + contains(install_set, target) { + installtests.commands += echo $${target.path}/$${TARGET} >> \$(QTM_TEST_INSTALL_FILE) ; + } else { + install_set_path=$$member($${install_set}.path) + installtests.commands += echo $${install_set_path} >> \$(QTM_TEST_INSTALL_FILE) ; + } +} + +QMAKE_EXTRA_TARGETS += installtests + +DEFINES -= $$find(DEFINES, SRCDIR.*) +DEFINES += SRCDIR=\\\"$${target.path}\\\" diff --git a/config.profiles/harmattan/tests/qt4-acceptance-tests.pro b/config.profiles/harmattan/tests/qt4-acceptance-tests.pro new file mode 100644 index 0000000..4549f7a --- /dev/null +++ b/config.profiles/harmattan/tests/qt4-acceptance-tests.pro @@ -0,0 +1,6 @@ +#Acceptance tests +TEMPLATE = subdirs +SUBDIRS += qdbusconnection \ + qhash \ + qlist \ + qmap diff --git a/config.profiles/harmattan/tests/qt4-maemo-auto-tests.pro b/config.profiles/harmattan/tests/qt4-maemo-auto-tests.pro new file mode 100644 index 0000000..bd218f5 --- /dev/null +++ b/config.profiles/harmattan/tests/qt4-maemo-auto-tests.pro @@ -0,0 +1,44 @@ +#Staging tests that require no data or style ibfo +TEMPLATE = subdirs +SUBDIRS += qdbusabstractadaptor \ + qdbusabstractinterface \ + qdbuscontext \ + qdbusinterface \ + qdbuslocalcalls \ + qdbusmetaobject \ + qdbusmetatype \ + qdbuspendingcall \ + qdbuspendingreply \ + qdbusreply \ + qdbusservicewatcher \ + qdbusthreading \ + qdbusxmlparser \ + qdebug \ + qeventloop \ + qmutexlocker \ + qnetworkaddressentry \ + qnetworkproxy \ + qnetworkrequest \ + qnetworkcookie \ + qnetworkcookiejar \ + qobjectrace \ + qpainterpathstroker \ + qpen \ + qpoint \ + qpolygon \ + qquaternion \ + qqueue \ + qrand \ + qreadlocker \ + qreadwritelock \ + qrect \ + qringbuffer \ + qscopedpointer \ + qscriptclass \ + qscriptcontextinfo \ + qscriptstring \ + qscriptvalueiterator \ + qsequentialanimationgroup \ + qset \ + qwaitcondition + diff --git a/config.profiles/harmattan/tests/tests.xml b/config.profiles/harmattan/tests/tests.xml new file mode 100644 index 0000000..e276bfa --- /dev/null +++ b/config.profiles/harmattan/tests/tests.xml @@ -0,0 +1,320 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<testdefinition version="1.0"> + <suite domain="Application framework" level="Component" name="qt4-acceptance-tests" type="Functional"> + <description /> + <set feature="qt" level="Component" name="acceptance_tst_qhash" type="Functional"> + <description>qt4-acceptance-tests:tst_qhash</description> + <case level="Component" name="tst_qhash-insert1" type="Functional"> + <description>qt4-acceptance-tests:tst_qhash:insert1</description> + <step>/usr/tests/qt4/tst_qhash insert1</step> + </case> + <case level="Component" name="tst_qhash-erase" type="Functional"> + <description>qt4-acceptance-tests:tst_qhash:erase</description> + <step>/usr/tests/qt4/tst_qhash erase</step> + </case> + <case level="Component" name="tst_qhash-key" type="Functional"> + <description>qt4-acceptance-tests:tst_qhash:key</description> + <step>/usr/tests/qt4/tst_qhash key</step> + </case> + <case level="Component" name="tst_qhash-count" type="Functional"> + <description>qt4-acceptance-tests:tst_qhash:count</description> + <step>/usr/tests/qt4/tst_qhash count</step> + </case> + <case level="Component" name="tst_qhash-clear" type="Functional"> + <description>qt4-acceptance-tests:tst_qhash:clear</description> + <step>/usr/tests/qt4/tst_qhash clear</step> + </case> + <case level="Component" name="tst_qhash-empty" type="Functional"> + <description>qt4-acceptance-tests:tst_qhash:empty</description> + <step>/usr/tests/qt4/tst_qhash empty</step> + </case> + <case level="Component" name="tst_qhash-find" type="Functional"> + <description>qt4-acceptance-tests:tst_qhash:find</description> + <step>/usr/tests/qt4/tst_qhash find</step> + </case> + <case level="Component" name="tst_qhash-constFind" type="Functional"> + <description>qt4-acceptance-tests:tst_qhash:constFind</description> + <step>/usr/tests/qt4/tst_qhash constFind</step> + </case> + <case level="Component" name="tst_qhash-contains" type="Functional"> + <description>qt4-acceptance-tests:tst_qhash:contains</description> + <step>/usr/tests/qt4/tst_qhash contains</step> + </case> + <case level="Component" name="tst_qhash-take" type="Functional"> + <description>qt4-acceptance-tests:tst_qhash:take</description> + <step>/usr/tests/qt4/tst_qhash take</step> + </case> + <case level="Component" name="tst_qhash-operator_eq" type="Functional"> + <description>qt4-acceptance-tests:tst_qhash:operator_eq</description> + <step>/usr/tests/qt4/tst_qhash operator_eq</step> + </case> + <case level="Component" name="tst_qhash-rehash_isnt_quadratic" type="Functional"> + <description>qt4-acceptance-tests:tst_qhash:rehash_isnt_quadratic</description> + <step>/usr/tests/qt4/tst_qhash rehash_isnt_quadratic</step> + </case> + <case level="Component" name="tst_qhash-dont_need_default_constructor" type="Functional"> + <description>qt4-acceptance-tests:tst_qhash:dont_need_default_constructor</description> + <step>/usr/tests/qt4/tst_qhash dont_need_default_constructor</step> + </case> + <case level="Component" name="tst_qhash-qhash" type="Functional"> + <description>qt4-acceptance-tests:tst_qhash:qhash</description> + <step>/usr/tests/qt4/tst_qhash qhash</step> + </case> + <case level="Component" name="tst_qhash-qmultihash_specific" type="Functional"> + <description>qt4-acceptance-tests:tst_qhash:qmultihash_specific</description> + <step>/usr/tests/qt4/tst_qhash qmultihash_specific</step> + </case> + <case level="Component" name="tst_qhash-compare" type="Functional"> + <description>qt4-acceptance-tests:tst_qhash:compare</description> + <step>/usr/tests/qt4/tst_qhash compare</step> + </case> + <case level="Component" name="tst_qhash-compare2" type="Functional"> + <description>qt4-acceptance-tests:tst_qhash:compare2</description> + <step>/usr/tests/qt4/tst_qhash compare2</step> + </case> + <case level="Component" name="tst_qhash-iterators" type="Functional"> + <description>qt4-acceptance-tests:tst_qhash:iterators</description> + <step>/usr/tests/qt4/tst_qhash iterators</step> + </case> + <case level="Component" name="tst_qhash-keys_values_uniqueKeys" type="Functional"> + <description>qt4-acceptance-tests:tst_qhash:keys_values_uniqueKeys</description> + <step>/usr/tests/qt4/tst_qhash keys_values_uniqueKeys</step> + </case> + <case level="Component" name="tst_qhash-noNeedlessRehashes" type="Functional"> + <description>qt4-acceptance-tests:tst_qhash:noNeedlessRehashes</description> + <step>/usr/tests/qt4/tst_qhash noNeedlessRehashes</step> + </case> + <environments> + <scratchbox>true</scratchbox> + <hardware>true</hardware> + </environments> + </set> + <set feature="qt" level="Component" name="acceptance_tst_qdbusconnection" type="Functional"> + <description>qt4-acceptance-tests:tst_qdbusconnection</description> + <case level="Component" name="tst_qdbusconnection-noConnection" type="Functional"> + <description>qt4-acceptance-tests:tst_qdbusconnection:noConnection</description> + <step>/usr/tests/qt4/tst_qdbusconnection noConnection</step> + </case> + <case level="Component" name="tst_qdbusconnection-connectToBus" type="Functional"> + <description>qt4-acceptance-tests:tst_qdbusconnection:connectToBus</description> + <step>/usr/tests/qt4/tst_qdbusconnection connectToBus</step> + </case> + <case level="Component" name="tst_qdbusconnection-connect" type="Functional"> + <description>qt4-acceptance-tests:tst_qdbusconnection:connect</description> + <step>/usr/tests/qt4/tst_qdbusconnection connect</step> + </case> + <case level="Component" name="tst_qdbusconnection-send" type="Functional"> + <description>qt4-acceptance-tests:tst_qdbusconnection:send</description> + <step>/usr/tests/qt4/tst_qdbusconnection send</step> + </case> + <case level="Component" name="tst_qdbusconnection-sendAsync" type="Functional"> + <description>qt4-acceptance-tests:tst_qdbusconnection:sendAsync</description> + <step>/usr/tests/qt4/tst_qdbusconnection sendAsync</step> + </case> + <case level="Component" name="tst_qdbusconnection-sendSignal" type="Functional"> + <description>qt4-acceptance-tests:tst_qdbusconnection:sendSignal</description> + <step>/usr/tests/qt4/tst_qdbusconnection sendSignal</step> + </case> + <case level="Component" name="tst_qdbusconnection-registerObject" type="Functional"> + <description>qt4-acceptance-tests:tst_qdbusconnection:registerObject</description> + <step>/usr/tests/qt4/tst_qdbusconnection registerObject</step> + </case> + <case level="Component" name="tst_qdbusconnection-registerObject2" type="Functional"> + <description>qt4-acceptance-tests:tst_qdbusconnection:registerObject2</description> + <step>/usr/tests/qt4/tst_qdbusconnection registerObject2</step> + </case> + <case level="Component" name="tst_qdbusconnection-registerQObjectChildren" type="Functional"> + <description>qt4-acceptance-tests:tst_qdbusconnection:registerQObjectChildren</description> + <step>/usr/tests/qt4/tst_qdbusconnection registerQObjectChildren</step> + </case> + <case level="Component" name="tst_qdbusconnection-callSelf" type="Functional"> + <description>qt4-acceptance-tests:tst_qdbusconnection:callSelf</description> + <step>/usr/tests/qt4/tst_qdbusconnection callSelf</step> + </case> + <case level="Component" name="tst_qdbusconnection-callSelfByAnotherName" type="Functional"> + <description>qt4-acceptance-tests:tst_qdbusconnection:callSelfByAnotherName</description> + <step>/usr/tests/qt4/tst_qdbusconnection callSelfByAnotherName</step> + </case> + <case level="Component" name="tst_qdbusconnection-multipleInterfacesInQObject" type="Functional"> + <description>qt4-acceptance-tests:tst_qdbusconnection:multipleInterfacesInQObject</description> + <step>/usr/tests/qt4/tst_qdbusconnection multipleInterfacesInQObject</step> + </case> + <case level="Component" name="tst_qdbusconnection-slotsWithLessParameters" type="Functional"> + <description>qt4-acceptance-tests:tst_qdbusconnection:slotsWithLessParameters</description> + <step>/usr/tests/qt4/tst_qdbusconnection slotsWithLessParameters</step> + </case> + <environments> + <scratchbox>true</scratchbox> + <hardware>true</hardware> + </environments> + </set> + <set feature="qt" level="Component" name="acceptance_tst_qaction" type="Functional"> + <description>qt4-acceptance-tests:tst_qaction</description> + <case level="Component" name="tst_qaction-getSetCheck" type="Functional"> + <description>qt4-acceptance-tests:tst_qaction:getSetCheck</description> + <step>/usr/tests/qt4/tst_qaction getSetCheck</step> + </case> + <case level="Component" name="tst_qaction-setText" type="Functional"> + <description>qt4-acceptance-tests:tst_qaction:setText</description> + <step>/usr/tests/qt4/tst_qaction setText</step> + </case> + <case level="Component" name="tst_qaction-setIconText" type="Functional"> + <description>qt4-acceptance-tests:tst_qaction:setIconText</description> + <step>/usr/tests/qt4/tst_qaction setIconText</step> + </case> + <case level="Component" name="tst_qaction-actionEvent" type="Functional"> + <description>qt4-acceptance-tests:tst_qaction:actionEvent</description> + <step>/usr/tests/qt4/tst_qaction actionEvent</step> + </case> + <case level="Component" name="tst_qaction-setStandardKeys" type="Functional"> + <description>qt4-acceptance-tests:tst_qaction:setStandardKeys</description> + <step>/usr/tests/qt4/tst_qaction setStandardKeys</step> + </case> + <case level="Component" name="tst_qaction-alternateShortcuts" type="Functional"> + <description>qt4-acceptance-tests:tst_qaction:alternateShortcuts</description> + <step>/usr/tests/qt4/tst_qaction alternateShortcuts</step> + </case> + <case level="Component" name="tst_qaction-enabledVisibleInteraction" type="Functional"> + <description>qt4-acceptance-tests:tst_qaction:enabledVisibleInteraction</description> + <step>/usr/tests/qt4/tst_qaction enabledVisibleInteraction</step> + </case> + <case level="Component" name="tst_qaction-task200823_tooltip" type="Functional"> + <description>qt4-acceptance-tests:tst_qaction:task200823_tooltip</description> + <step>/usr/tests/qt4/tst_qaction task200823_tooltip</step> + </case> + <case level="Component" name="tst_qaction-task229128TriggeredSignalWithoutActiongroup" type="Functional"> + <description>qt4-acceptance-tests:tst_qaction:task229128TriggeredSignalWithoutActiongroup</description> + <step>/usr/tests/qt4/tst_qaction task229128TriggeredSignalWithoutActiongroup</step> + </case> + <case level="Component" name="tst_qaction-task229128TriggeredSignalWhenInActiongroup" type="Functional"> + <description>qt4-acceptance-tests:tst_qaction:task229128TriggeredSignalWhenInActiongroup</description> + <step>/usr/tests/qt4/tst_qaction task229128TriggeredSignalWhenInActiongroup</step> + </case> + <environments> + <scratchbox>true</scratchbox> + <hardware>true</hardware> + </environments> + </set> + <set feature="qt" level="Component" name="acceptance_tst_qlist" type="Functional"> + <description>qt4-acceptance-tests:tst_qlist</description> + <case level="Component" name="tst_qlist-length" type="Functional"> + <description>qt4-acceptance-tests:tst_qlist:length</description> + <step>/usr/tests/qt4/tst_qlist length</step> + </case> + <case level="Component" name="tst_qlist-lengthSignature" type="Functional"> + <description>qt4-acceptance-tests:tst_qlist:lengthSignature</description> + <step>/usr/tests/qt4/tst_qlist lengthSignature</step> + </case> + <case level="Component" name="tst_qlist-append" type="Functional"> + <description>qt4-acceptance-tests:tst_qlist:append</description> + <step>/usr/tests/qt4/tst_qlist append</step> + </case> + <environments> + <scratchbox>true</scratchbox> + <hardware>true</hardware> + </environments> + </set> + <set feature="qt" level="Component" name="acceptance_tst_qgraphicslayout" type="Functional"> + <description>qt4-acceptance-tests:tst_qgraphicslayout</description> + <case level="Component" name="tst_qgraphicslayout-sizeHints" type="Functional"> + <description>qt4-acceptance-tests:tst_qgraphicslayout:sizeHints</description> + <step>/usr/tests/qt4/tst_qgraphicslayout sizeHints</step> + </case> + <case level="Component" name="tst_qgraphicslayout-compressLayoutRequest" type="Functional"> + <description>qt4-acceptance-tests:tst_qgraphicslayout:compressLayoutRequest</description> + <step>/usr/tests/qt4/tst_qgraphicslayout compressLayoutRequest</step> + </case> + <case level="Component" name="tst_qgraphicslayout-automaticReparenting" type="Functional"> + <description>qt4-acceptance-tests:tst_qgraphicslayout:automaticReparenting</description> + <step>/usr/tests/qt4/tst_qgraphicslayout automaticReparenting</step> + </case> + <case level="Component" name="tst_qgraphicslayout-verifyActivate" type="Functional"> + <description>qt4-acceptance-tests:tst_qgraphicslayout:verifyActivate</description> + <step>/usr/tests/qt4/tst_qgraphicslayout verifyActivate</step> + </case> + <case level="Component" name="tst_qgraphicslayout-constructors" type="Functional"> + <description>qt4-acceptance-tests:tst_qgraphicslayout:constructors</description> + <step>/usr/tests/qt4/tst_qgraphicslayout constructors</step> + </case> + <case level="Component" name="tst_qgraphicslayout-alternativeLayoutItems" type="Functional"> + <description>qt4-acceptance-tests:tst_qgraphicslayout:alternativeLayoutItems</description> + <step>/usr/tests/qt4/tst_qgraphicslayout alternativeLayoutItems</step> + </case> + <case level="Component" name="tst_qgraphicslayout-ownership" type="Functional"> + <description>qt4-acceptance-tests:tst_qgraphicslayout:ownership</description> + <step>/usr/tests/qt4/tst_qgraphicslayout ownership</step> + </case> + <environments> + <scratchbox>true</scratchbox> + <hardware>true</hardware> + </environments> + </set> + <set feature="qt" level="Component" name="acceptance_tst_qmap" type="Functional"> + <description>qt4-acceptance-tests:tst_qmap</description> + <case level="Component" name="tst_qmap-count" type="Functional"> + <description>qt4-acceptance-tests:tst_qmap:count</description> + <step>/usr/tests/qt4/tst_qmap count</step> + </case> + <case level="Component" name="tst_qmap-clear" type="Functional"> + <description>qt4-acceptance-tests:tst_qmap:clear</description> + <step>/usr/tests/qt4/tst_qmap clear</step> + </case> + <case level="Component" name="tst_qmap-beginEnd" type="Functional"> + <description>qt4-acceptance-tests:tst_qmap:beginEnd</description> + <step>/usr/tests/qt4/tst_qmap beginEnd</step> + </case> + <case level="Component" name="tst_qmap-key" type="Functional"> + <description>qt4-acceptance-tests:tst_qmap:key</description> + <step>/usr/tests/qt4/tst_qmap key</step> + </case> + <case level="Component" name="tst_qmap-operator_eq" type="Functional"> + <description>qt4-acceptance-tests:tst_qmap:operator_eq</description> + <step>/usr/tests/qt4/tst_qmap operator_eq</step> + </case> + <case level="Component" name="tst_qmap-empty" type="Functional"> + <description>qt4-acceptance-tests:tst_qmap:empty</description> + <step>/usr/tests/qt4/tst_qmap empty</step> + </case> + <case level="Component" name="tst_qmap-contains" type="Functional"> + <description>qt4-acceptance-tests:tst_qmap:contains</description> + <step>/usr/tests/qt4/tst_qmap contains</step> + </case> + <case level="Component" name="tst_qmap-find" type="Functional"> + <description>qt4-acceptance-tests:tst_qmap:find</description> + <step>/usr/tests/qt4/tst_qmap find</step> + </case> + <case level="Component" name="tst_qmap-constFind" type="Functional"> + <description>qt4-acceptance-tests:tst_qmap:constFind</description> + <step>/usr/tests/qt4/tst_qmap constFind</step> + </case> + <case level="Component" name="tst_qmap-lowerUpperBound" type="Functional"> + <description>qt4-acceptance-tests:tst_qmap:lowerUpperBound</description> + <step>/usr/tests/qt4/tst_qmap lowerUpperBound</step> + </case> + <case level="Component" name="tst_qmap-mergeCompare" type="Functional"> + <description>qt4-acceptance-tests:tst_qmap:mergeCompare</description> + <step>/usr/tests/qt4/tst_qmap mergeCompare</step> + </case> + <case level="Component" name="tst_qmap-take" type="Functional"> + <description>qt4-acceptance-tests:tst_qmap:take</description> + <step>/usr/tests/qt4/tst_qmap take</step> + </case> + <case level="Component" name="tst_qmap-iterators" type="Functional"> + <description>qt4-acceptance-tests:tst_qmap:iterators</description> + <step>/usr/tests/qt4/tst_qmap iterators</step> + </case> + <case level="Component" name="tst_qmap-keys_values_uniqueKeys" type="Functional"> + <description>qt4-acceptance-tests:tst_qmap:keys_values_uniqueKeys</description> + <step>/usr/tests/qt4/tst_qmap keys_values_uniqueKeys</step> + </case> + <case level="Component" name="tst_qmap-qmultimap_specific" type="Functional"> + <description>qt4-acceptance-tests:tst_qmap:qmultimap_specific</description> + <step>/usr/tests/qt4/tst_qmap qmultimap_specific</step> + </case> + <environments> + <scratchbox>true</scratchbox> + <hardware>true</hardware> + </environments> + </set> + </suite> +</testdefinition> diff --git a/config.profiles/harmattan/tests/testset.txt b/config.profiles/harmattan/tests/testset.txt new file mode 100644 index 0000000..62de93d --- /dev/null +++ b/config.profiles/harmattan/tests/testset.txt @@ -0,0 +1,11 @@ + <set feature="qt" level="Component" name="##Package-name_test_name##" type="Functional"> + <description>##Package-name:test_name##</description> + <case level="Component" name="##tst_foo##" type="Functional"> + <description>##Package-name:test_name##</description> + <step>##/usr/tests/qtm/tst_foo##</step> + </case> + <environments> + <scratchbox>true</scratchbox> + <hardware>true</hardware> + </environments> + </set> diff --git a/config.profiles/harmattan/tests/testsuite_footer.txt b/config.profiles/harmattan/tests/testsuite_footer.txt new file mode 100644 index 0000000..8c71c93 --- /dev/null +++ b/config.profiles/harmattan/tests/testsuite_footer.txt @@ -0,0 +1,2 @@ + </suite> +</testdefinition> diff --git a/config.profiles/harmattan/tests/testsuite_header.txt b/config.profiles/harmattan/tests/testsuite_header.txt new file mode 100644 index 0000000..4c57f76 --- /dev/null +++ b/config.profiles/harmattan/tests/testsuite_header.txt @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<testdefinition version="1.0"> + <suite domain="Application framework" level="Component" name="##Add your name here##" type="Functional"> + <description /> -- cgit v0.12 From bbc6358d5259951e3f1ede41301d303bc10948ba Mon Sep 17 00:00:00 2001 From: Martin Petersson <martin.petersson@nokia.com> Date: Thu, 10 Mar 2011 11:58:24 +0100 Subject: Windows: Activate the context menu on tray icons when shown. Task-number: QTBUG-14807 Reviewed-by: Markus Goetz --- src/gui/util/qsystemtrayicon_win.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/util/qsystemtrayicon_win.cpp b/src/gui/util/qsystemtrayicon_win.cpp index 2b7935b..5a0e179 100644 --- a/src/gui/util/qsystemtrayicon_win.cpp +++ b/src/gui/util/qsystemtrayicon_win.cpp @@ -305,6 +305,7 @@ bool QSystemTrayIconSys::winEvent( MSG *m, long *result ) case WM_CONTEXTMENU: if (q->contextMenu()) { q->contextMenu()->popup(gpos); + q->contextMenu()->activateWindow(); } emit q->activated(QSystemTrayIcon::Context); break; -- cgit v0.12 From 1e2410b5e486344d86cf02888a978fcda94fe02a Mon Sep 17 00:00:00 2001 From: con <qtc-committer@nokia.com> Date: Wed, 16 Feb 2011 10:24:12 +0100 Subject: Objective-c prf may not override OBJECTIVE_CFLAGS settings. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Morten Johan Sørvig --- mkspecs/common/gcc-base-macx.conf | 15 +++++++++++---- mkspecs/features/mac/objective_c.prf | 9 --------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/mkspecs/common/gcc-base-macx.conf b/mkspecs/common/gcc-base-macx.conf index 5c9a8a1..2894f86 100644 --- a/mkspecs/common/gcc-base-macx.conf +++ b/mkspecs/common/gcc-base-macx.conf @@ -24,10 +24,16 @@ QMAKE_CXXFLAGS_PPC += $$QMAKE_CFLAGS_PPC QMAKE_CXXFLAGS_PPC_64 += $$QMAKE_CFLAGS_PPC_64 QMAKE_CXXFLAGS_DWARF2 += $$QMAKE_CFLAGS_DWARF2 -QMAKE_OBJECTIVE_CFLAGS_X86 += $$QMAKE_CFLAGS_X86 -QMAKE_OBJECTIVE_CFLAGS_X86_64 += $$QMAKE_CFLAGS_X86_64 -QMAKE_OBJECTIVE_CFLAGS_PPC += $$QMAKE_CFLAGS_PPC -QMAKE_OBJECTIVE_CFLAGS_PPC_64 += $$QMAKE_CFLAGS_PPC_64 +QMAKE_OBJECTIVE_CFLAGS = $$QMAKE_CFLAGS +QMAKE_OBJECTIVE_CFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON +QMAKE_OBJECTIVE_CFLAGS_WARN_OFF = $$QMAKE_CFLAGS_WARN_OFF +QMAKE_OBJECTIVE_CFLAGS_DEBUG = $$QMAKE_CFLAGS_DEBUG +QMAKE_OBJECTIVE_CFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE +QMAKE_OBJECTIVE_CFLAGS_HIDESYMS = $$QMAKE_CXXFLAGS_HIDESYMS +QMAKE_OBJECTIVE_CFLAGS_X86 = $$QMAKE_CFLAGS_X86 +QMAKE_OBJECTIVE_CFLAGS_X86_64 = $$QMAKE_CFLAGS_X86_64 +QMAKE_OBJECTIVE_CFLAGS_PPC = $$QMAKE_CFLAGS_PPC +QMAKE_OBJECTIVE_CFLAGS_PPC_64 = $$QMAKE_CFLAGS_PPC_64 QMAKE_LFLAGS_X86 += $$QMAKE_CFLAGS_X86 QMAKE_LFLAGS_X86_64 += $$QMAKE_CFLAGS_X86_64 @@ -41,3 +47,4 @@ QMAKE_LFLAGS_INCREMENTAL += -undefined suppress -flat_namespace QMAKE_LFLAGS_SONAME += -install_name$${LITERAL_WHITESPACE} QMAKE_LFLAGS_VERSION += -current_version$${LITERAL_WHITESPACE} QMAKE_LFLAGS_COMPAT_VERSION += -compatibility_version$${LITERAL_WHITESPACE} + diff --git a/mkspecs/features/mac/objective_c.prf b/mkspecs/features/mac/objective_c.prf index ca693ba..0f25f41 100644 --- a/mkspecs/features/mac/objective_c.prf +++ b/mkspecs/features/mac/objective_c.prf @@ -9,15 +9,6 @@ for(source, SOURCES) { isEmpty(QMAKE_OBJECTIVE_CC):QMAKE_OBJECTIVE_CC = $$QMAKE_CC -QMAKE_OBJECTIVE_CFLAGS = $$QMAKE_CFLAGS -QMAKE_OBJECTIVE_CFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON -QMAKE_OBJECTIVE_CFLAGS_WARN_OFF = $$QMAKE_CFLAGS_WARN_OFF -QMAKE_OBJECTIVE_CFLAGS_DEBUG = $$QMAKE_CFLAGS_DEBUG -QMAKE_OBJECTIVE_CFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE -QMAKE_OBJECTIVE_CFLAGS_X86 = $$QMAKE_CFLAGS_X86 -QMAKE_OBJECTIVE_CFLAGS_PPC = $$QMAKE_CFLAGS_PPC -QMAKE_OBJECTIVE_CFLAGS_HIDESYMS = $$QMAKE_CXXFLAGS_HIDESYMS - OBJECTIVE_C_OBJECTS_DIR = $$OBJECTS_DIR isEmpty(OBJECTIVE_C_OBJECTS_DIR):OBJECTIVE_C_OBJECTS_DIR = . isEmpty(QMAKE_EXT_OBJECTIVE_C):QMAKE_EXT_OBJECTIVE_C = .mm .m -- cgit v0.12 From bf1eb9a98bedae2c1b261ed4d7d92d4a1dbe28e3 Mon Sep 17 00:00:00 2001 From: con <qtc-committer@nokia.com> Date: Fri, 4 Mar 2011 14:11:53 +0100 Subject: Build JavaScriptCore also under unusual platform combination. Reviewed-by: Jedrzej Nowacki Reviewed-by: Simon Hausmann --- src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h index 5abe9a1..cb4a963 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h +++ b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h @@ -635,6 +635,9 @@ #define ENABLE_REPAINT_THROTTLING 1 #define HAVE_READLINE 1 #define WTF_PLATFORM_CF 1 +#endif + +#if OS(IPHONE_OS) && !PLATFORM(QT) #define WTF_USE_PTHREADS 1 #define HAVE_PTHREAD_RWLOCK 1 #endif -- cgit v0.12 From c84d09e1c5dd8fc3e989a07372abba8ed589ec67 Mon Sep 17 00:00:00 2001 From: con <qtc-committer@nokia.com> Date: Mon, 7 Mar 2011 15:24:42 +0100 Subject: Build QProcess on platforms that don't have _NSGetEnviron MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Jørgen Lind --- src/corelib/io/qprocess.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp index a44c1e1..e11cef9 100644 --- a/src/corelib/io/qprocess.cpp +++ b/src/corelib/io/qprocess.cpp @@ -2232,10 +2232,10 @@ bool QProcess::startDetached(const QString &program) } QT_BEGIN_INCLUDE_NAMESPACE -#ifdef Q_OS_MAC +#if defined(Q_OS_MAC) && !defined(QT_NO_CORESERVICES) # include <crt_externs.h> # define environ (*_NSGetEnviron()) -#elif defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN) +#elif defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN) || (defined(Q_OS_MAC) && defined(QT_NO_CORESERVICES)) static char *qt_empty_environ[] = { 0 }; #define environ qt_empty_environ #elif !defined(Q_OS_WIN) -- cgit v0.12 From 3e2db2ed3c8f12534871cc1fb014210b471d55cf Mon Sep 17 00:00:00 2001 From: Martin Petersson <martin.petersson@nokia.com> Date: Thu, 10 Mar 2011 13:30:37 +0100 Subject: tst_qnetworkreply: fix MiniHttpServer crash Reviewed-by: Markus Goetz --- tests/auto/qnetworkreply/tst_qnetworkreply.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp index 93e3051..a7e6f9f 100644 --- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp @@ -498,7 +498,6 @@ public slots: if (doClose && client->bytesToWrite() == 0) { client->disconnectFromHost(); disconnect(client, 0, this, 0); - client = 0; } } }; -- cgit v0.12 From 096eed1745d78ae8377f0231871100fd5ba6a78e Mon Sep 17 00:00:00 2001 From: Martin Petersson <martin.petersson@nokia.com> Date: Thu, 10 Mar 2011 13:31:36 +0100 Subject: QNAM HTTP: Pair channels with requests at a later state. Connect a new channel only when there is no one currently available. Only pair the request with the channel once we know if it got connected or not. This leads to faster sending on requests as we reuse already connected channels that became free in the meanwhile. Task-number: QTBUG-17084 Reviewed-by: Markus Goetz Reviewed-by: Peter Hartmann --- src/network/access/qhttpnetworkconnection.cpp | 37 ++++++++++++---------- src/network/access/qhttpnetworkconnection_p.h | 2 +- .../access/qhttpnetworkconnectionchannel.cpp | 33 +++++++++++++++---- 3 files changed, 48 insertions(+), 24 deletions(-) diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp index 35c3a67..29ae5b0 100644 --- a/src/network/access/qhttpnetworkconnection.cpp +++ b/src/network/access/qhttpnetworkconnection.cpp @@ -487,7 +487,7 @@ void QHttpNetworkConnectionPrivate::requeueRequest(const HttpMessagePair &pair) QMetaObject::invokeMethod(q, "_q_startNextRequest", Qt::QueuedConnection); } -void QHttpNetworkConnectionPrivate::dequeueAndSendRequest(QAbstractSocket *socket) +bool QHttpNetworkConnectionPrivate::dequeueRequest(QAbstractSocket *socket) { Q_ASSERT(socket); @@ -500,8 +500,7 @@ void QHttpNetworkConnectionPrivate::dequeueAndSendRequest(QAbstractSocket *socke prepareRequest(messagePair); channels[i].request = messagePair.first; channels[i].reply = messagePair.second; - channels[i].sendRequest(); - return; + return true; } if (!lowPriorityQueue.isEmpty()) { @@ -511,9 +510,9 @@ void QHttpNetworkConnectionPrivate::dequeueAndSendRequest(QAbstractSocket *socke prepareRequest(messagePair); channels[i].request = messagePair.first; channels[i].reply = messagePair.second; - channels[i].sendRequest(); - return; + return true; } + return false; } // this is called from _q_startNextRequest and when a request has been sent down a socket from the channel @@ -784,17 +783,8 @@ void QHttpNetworkConnectionPrivate::_q_startNextRequest() // try to get a free AND connected socket for (int i = 0; i < channelCount; ++i) { if (!channels[i].reply && !channels[i].isSocketBusy() && channels[i].socket->state() == QAbstractSocket::ConnectedState) { - dequeueAndSendRequest(channels[i].socket); - } - } - - // return fast if there is nothing to do - if (highPriorityQueue.isEmpty() && lowPriorityQueue.isEmpty()) - return; - // try to get a free unconnected socket - for (int i = 0; i < channelCount; ++i) { - if (!channels[i].reply && !channels[i].isSocketBusy()) { - dequeueAndSendRequest(channels[i].socket); + if (dequeueRequest(channels[i].socket)) + channels[i].sendRequest(); } } @@ -811,6 +801,21 @@ void QHttpNetworkConnectionPrivate::_q_startNextRequest() for (int i = 0; i < channelCount; i++) if (channels[i].socket->state() == QAbstractSocket::ConnectedState) fillPipeline(channels[i].socket); + + // If there is not already any connected channels we need to connect a new one. + // We do not pair the channel with the request until we know if it is + // connected or not. This is to reuse connected channels before we connect new once. + int queuedRequest = highPriorityQueue.count() + lowPriorityQueue.count(); + for (int i = 0; i < channelCount; ++i) { + if (channels[i].socket->state() == QAbstractSocket::ConnectingState) + queuedRequest--; + if ( queuedRequest <=0 ) + break; + if (!channels[i].reply && !channels[i].isSocketBusy() && (channels[i].socket->state() == QAbstractSocket::UnconnectedState)) { + channels[i].ensureConnection(); + queuedRequest--; + } + } } diff --git a/src/network/access/qhttpnetworkconnection_p.h b/src/network/access/qhttpnetworkconnection_p.h index d4748c1..874ea22 100644 --- a/src/network/access/qhttpnetworkconnection_p.h +++ b/src/network/access/qhttpnetworkconnection_p.h @@ -161,7 +161,7 @@ public: QHttpNetworkReply *queueRequest(const QHttpNetworkRequest &request); void requeueRequest(const HttpMessagePair &pair); // e.g. after pipeline broke - void dequeueAndSendRequest(QAbstractSocket *socket); + bool dequeueRequest(QAbstractSocket *socket); void prepareRequest(HttpMessagePair &request); void fillPipeline(QAbstractSocket *socket); diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp index 60094b0..23dd518 100644 --- a/src/network/access/qhttpnetworkconnectionchannel.cpp +++ b/src/network/access/qhttpnetworkconnectionchannel.cpp @@ -502,6 +502,7 @@ void QHttpNetworkConnectionChannel::_q_receiveReply() // called when unexpectedly reading a -1 or when data is expected but socket is closed void QHttpNetworkConnectionChannel::handleUnexpectedEOF() { + Q_ASSERT(reply); if (reconnectAttempts <= 0) { // too many errors reading/receiving/parsing the status, close the socket and emit error requeueCurrentlyPipelinedRequests(); @@ -524,7 +525,8 @@ bool QHttpNetworkConnectionChannel::ensureConnection() // resend this request after we receive the disconnected signal if (socketState == QAbstractSocket::ClosingState) { - resendCurrent = true; + if (reply) + resendCurrent = true; return false; } @@ -646,6 +648,7 @@ bool QHttpNetworkConnectionChannel::expand(bool dataComplete) void QHttpNetworkConnectionChannel::allDone() { + Q_ASSERT(reply); #ifndef QT_NO_COMPRESS // expand the whole data. if (reply->d_func()->expectContent() && reply->d_func()->autoDecompress && !reply->d_func()->streamEnd) { @@ -741,6 +744,7 @@ void QHttpNetworkConnectionChannel::allDone() void QHttpNetworkConnectionChannel::detectPipeliningSupport() { + Q_ASSERT(reply); // detect HTTP Pipelining support QByteArray serverHeaderField; if ( @@ -824,6 +828,7 @@ void QHttpNetworkConnectionChannel::handleStatus() bool QHttpNetworkConnectionChannel::resetUploadData() { + Q_ASSERT(reply); QNonContiguousByteDevice* uploadByteDevice = request.uploadByteDevice(); if (!uploadByteDevice) return true; @@ -881,7 +886,8 @@ void QHttpNetworkConnectionChannel::closeAndResendCurrentRequest() { requeueCurrentlyPipelinedRequests(); close(); - resendCurrent = true; + if (reply) + resendCurrent = true; if (qobject_cast<QHttpNetworkConnection*>(connection)) QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection); } @@ -983,10 +989,10 @@ void QHttpNetworkConnectionChannel::_q_connected() //channels[i].reconnectAttempts = 2; if (!pendingEncrypt) { state = QHttpNetworkConnectionChannel::IdleState; + if (!reply) + connection->d_func()->dequeueRequest(socket); if (reply) sendRequest(); - else - close(); } } @@ -1040,6 +1046,9 @@ void QHttpNetworkConnectionChannel::_q_error(QAbstractSocket::SocketError socket QPointer<QHttpNetworkConnection> that = connection; QString errorString = connection->d_func()->errorDetail(errorCode, socket, socket->errorString()); + // Need to dequeu the request so that we can emit the error. + if (!reply) + connection->d_func()->dequeueRequest(socket); if (reply) { reply->d_func()->errorString = errorString; emit reply->finishedWithError(errorCode, errorString); @@ -1054,7 +1063,11 @@ void QHttpNetworkConnectionChannel::_q_error(QAbstractSocket::SocketError socket #ifndef QT_NO_NETWORKPROXY void QHttpNetworkConnectionChannel::_q_proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator* auth) { - connection->d_func()->emitProxyAuthenticationRequired(this, proxy, auth); + // Need to dequeue the request before we can emit the error. + if (!reply) + connection->d_func()->dequeueRequest(socket); + if (reply) + connection->d_func()->emitProxyAuthenticationRequired(this, proxy, auth); } #endif @@ -1070,7 +1083,10 @@ void QHttpNetworkConnectionChannel::_q_encrypted() return; // ### error state = QHttpNetworkConnectionChannel::IdleState; pendingEncrypt = false; - sendRequest(); + if (!reply) + connection->d_func()->dequeueRequest(socket); + if (reply) + sendRequest(); } void QHttpNetworkConnectionChannel::_q_sslErrors(const QList<QSslError> &errors) @@ -1081,7 +1097,10 @@ void QHttpNetworkConnectionChannel::_q_sslErrors(const QList<QSslError> &errors) // Also pause the connection because socket notifiers may fire while an user // dialog is displaying connection->d_func()->pauseConnection(); - emit reply->sslErrors(errors); + if (pendingEncrypt && !reply) + connection->d_func()->dequeueRequest(socket); + if (reply) + emit reply->sslErrors(errors); connection->d_func()->resumeConnection(); } -- cgit v0.12 From 4500aa5227f75c3f10f82e5e5b452eb6bee386ae Mon Sep 17 00:00:00 2001 From: Martin Petersson <martin.petersson@nokia.com> Date: Thu, 10 Mar 2011 14:15:09 +0100 Subject: Fix corner of scroll area so it is stylable on Mac. Task-number: QTBUG-13055 Reviewed-by: Olivier Goffart --- src/gui/styles/qmacstyle_mac.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/gui/styles/qmacstyle_mac.mm index ac05789..f2ad782 100644 --- a/src/gui/styles/qmacstyle_mac.mm +++ b/src/gui/styles/qmacstyle_mac.mm @@ -3084,7 +3084,7 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai } break; case PE_PanelScrollAreaCorner: { - const QBrush brush(qApp->palette().brush(QPalette::Base)); + const QBrush brush(opt->palette().brush(QPalette::Base)); p->fillRect(opt->rect, brush); p->setPen(QPen(QColor(217, 217, 217))); p->drawLine(opt->rect.topLeft(), opt->rect.topRight()); -- cgit v0.12 From e250660cced1f0bcb16494c23277f9205833ec03 Mon Sep 17 00:00:00 2001 From: con <qtc-committer@nokia.com> Date: Mon, 18 Oct 2010 09:49:18 +0200 Subject: Add proof-of-concept UIKit based lighthouse platform. See the README in the uikit platform plugin for details. --- mkspecs/qws/macx-iphonedevice-g++/Info.plist.lib | 18 + mkspecs/qws/macx-iphonedevice-g++/qmake.conf | 44 ++ mkspecs/qws/macx-iphonedevice-g++/qplatformdefs.h | 97 +++++ .../qws/macx-iphonesimulator-g++/Info.plist.lib | 18 + mkspecs/qws/macx-iphonesimulator-g++/qmake.conf | 45 ++ .../qws/macx-iphonesimulator-g++/qplatformdefs.h | 97 +++++ src/plugins/platforms/uikit/README | 45 ++ .../platforms/uikit/examples/qmltest/main.mm | 33 ++ .../platforms/uikit/examples/qmltest/qml/main.qml | 112 +++++ .../moc_qmlapplicationviewer.cpp | 69 ++++ .../qmlapplicationviewer/qmlapplicationviewer.cpp | 155 +++++++ .../qmlapplicationviewer/qmlapplicationviewer.h | 39 ++ .../uikit/examples/qmltest/qmltest-Info.plist | 28 ++ .../qmltest/qmltest.xcodeproj/project.pbxproj | 455 +++++++++++++++++++++ .../uikit/examples/qmltest/qmltest_Prefix.pch | 8 + src/plugins/platforms/uikit/main.mm | 74 ++++ src/plugins/platforms/uikit/quikiteventloop.h | 68 +++ src/plugins/platforms/uikit/quikiteventloop.mm | 158 +++++++ src/plugins/platforms/uikit/quikitintegration.h | 72 ++++ src/plugins/platforms/uikit/quikitintegration.mm | 104 +++++ src/plugins/platforms/uikit/quikitscreen.h | 75 ++++ src/plugins/platforms/uikit/quikitscreen.mm | 81 ++++ src/plugins/platforms/uikit/quikitwindow.h | 70 ++++ src/plugins/platforms/uikit/quikitwindow.mm | 88 ++++ src/plugins/platforms/uikit/quikitwindowsurface.h | 83 ++++ src/plugins/platforms/uikit/quikitwindowsurface.mm | 242 +++++++++++ src/plugins/platforms/uikit/uikit.pro | 23 ++ 27 files changed, 2401 insertions(+) create mode 100644 mkspecs/qws/macx-iphonedevice-g++/Info.plist.lib create mode 100644 mkspecs/qws/macx-iphonedevice-g++/qmake.conf create mode 100644 mkspecs/qws/macx-iphonedevice-g++/qplatformdefs.h create mode 100644 mkspecs/qws/macx-iphonesimulator-g++/Info.plist.lib create mode 100644 mkspecs/qws/macx-iphonesimulator-g++/qmake.conf create mode 100644 mkspecs/qws/macx-iphonesimulator-g++/qplatformdefs.h create mode 100644 src/plugins/platforms/uikit/README create mode 100644 src/plugins/platforms/uikit/examples/qmltest/main.mm create mode 100644 src/plugins/platforms/uikit/examples/qmltest/qml/main.qml create mode 100644 src/plugins/platforms/uikit/examples/qmltest/qmlapplicationviewer/moc_qmlapplicationviewer.cpp create mode 100644 src/plugins/platforms/uikit/examples/qmltest/qmlapplicationviewer/qmlapplicationviewer.cpp create mode 100644 src/plugins/platforms/uikit/examples/qmltest/qmlapplicationviewer/qmlapplicationviewer.h create mode 100644 src/plugins/platforms/uikit/examples/qmltest/qmltest-Info.plist create mode 100755 src/plugins/platforms/uikit/examples/qmltest/qmltest.xcodeproj/project.pbxproj create mode 100644 src/plugins/platforms/uikit/examples/qmltest/qmltest_Prefix.pch create mode 100644 src/plugins/platforms/uikit/main.mm create mode 100644 src/plugins/platforms/uikit/quikiteventloop.h create mode 100644 src/plugins/platforms/uikit/quikiteventloop.mm create mode 100644 src/plugins/platforms/uikit/quikitintegration.h create mode 100644 src/plugins/platforms/uikit/quikitintegration.mm create mode 100644 src/plugins/platforms/uikit/quikitscreen.h create mode 100644 src/plugins/platforms/uikit/quikitscreen.mm create mode 100644 src/plugins/platforms/uikit/quikitwindow.h create mode 100644 src/plugins/platforms/uikit/quikitwindow.mm create mode 100644 src/plugins/platforms/uikit/quikitwindowsurface.h create mode 100644 src/plugins/platforms/uikit/quikitwindowsurface.mm create mode 100644 src/plugins/platforms/uikit/uikit.pro diff --git a/mkspecs/qws/macx-iphonedevice-g++/Info.plist.lib b/mkspecs/qws/macx-iphonedevice-g++/Info.plist.lib new file mode 100644 index 0000000..97609ed --- /dev/null +++ b/mkspecs/qws/macx-iphonedevice-g++/Info.plist.lib @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd"> +<plist version="0.9"> +<dict> + <key>CFBundlePackageType</key> + <string>FMWK</string> + <key>CFBundleShortVersionString</key> + <string>@SHORT_VERSION@</string> + <key>CFBundleGetInfoString</key> + <string>Created by Qt/QMake</string> + <key>CFBundleSignature</key> + <string>@TYPEINFO@</string> + <key>CFBundleExecutable</key> + <string>@LIBRARY@</string> + <key>NOTE</key> + <string>Please, do NOT change this file -- It was generated by Qt/QMake.</string> +</dict> +</plist> diff --git a/mkspecs/qws/macx-iphonedevice-g++/qmake.conf b/mkspecs/qws/macx-iphonedevice-g++/qmake.conf new file mode 100644 index 0000000..2cef3df --- /dev/null +++ b/mkspecs/qws/macx-iphonedevice-g++/qmake.conf @@ -0,0 +1,44 @@ +# +# qmake configuration for iphone-device-g++ +# +include(../../common/mac.conf) +include(../../common/g++-macx.conf) + +MAKEFILE_GENERATOR = UNIX +TEMPLATE = app +CONFIG += qt warn_on release app_bundle incremental global_init_link_order lib_version_first plugin_no_soname link_prl +QT += core gui +QMAKE_INCREMENTAL_STYLE = sublib + +# Do not compile a few things +DEFINES += QT_NO_AUDIO_BACKEND QT_NO_NETWORKPROXY QT_NO_FILESYSTEMWATCHER + +# You may need to change this to point to the iOS SDK you want to use. +QMAKE_IOS_DEV_PATH = /Developer/Platforms/iPhoneOS.platform/Developer +QMAKE_IOS_SDK = $$QMAKE_IOS_DEV_PATH/SDKs/iPhoneOS4.2.sdk +DEFINES += __IPHONE_OS_VERSION_MIN_REQUIRED=40200 + +#clear +QMAKE_MACOSX_DEPLOYMENT_TARGET = + +# TARGET_PLATFORM = ios +QMAKE_CC = /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.2 +QMAKE_CXX = /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/g++-4.2 +QMAKE_LINK = $$QMAKE_CXX +QMAKE_LINK_SHLIB = $$QMAKE_CXX + +QMAKE_CFLAGS += -arch armv7 -marm -isysroot $$QMAKE_IOS_SDK -fmessage-length=0 -fexceptions -miphoneos-version-min=4.2 -gdwarf-2 +QMAKE_CXXFLAGS += $$QMAKE_CFLAGS +QMAKE_OBJECTIVE_CFLAGS += -arch armv7 -marm -isysroot $$QMAKE_IOS_SDK -fmessage-length=0 -fexceptions -miphoneos-version-min=4.2 -gdwarf-2 -fobjc-abi-version=2 -fobjc-legacy-dispatch +QMAKE_LFLAGS += -arch armv7 -marm -miphoneos-version-min=4.2 -Wl,-syslibroot,$$QMAKE_IOS_SDK + +QMAKE_INCDIR_OPENGL = +QMAKE_LIBS_OPENGL = +QMAKE_LIBS_OPENGL_QT = + +#QMAKE_RESOURCE = +QMAKE_FIX_RPATH = $$QMAKE_IOS_DEV_PATH/usr/bin/install_name_tool -id +QMAKE_AR = $$QMAKE_IOS_DEV_PATH/usr/bin/ar cq +QMAKE_RANLIB = $$QMAKE_IOS_DEV_PATH/usr/bin/ranlib -s + +load(qt_config) diff --git a/mkspecs/qws/macx-iphonedevice-g++/qplatformdefs.h b/mkspecs/qws/macx-iphonedevice-g++/qplatformdefs.h new file mode 100644 index 0000000..425fda3 --- /dev/null +++ b/mkspecs/qws/macx-iphonedevice-g++/qplatformdefs.h @@ -0,0 +1,97 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the qmake spec of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPLATFORMDEFS_H +#define QPLATFORMDEFS_H + +// Get Qt defines/settings + +#include "qglobal.h" + +// Set any POSIX/XOPEN defines at the top of this file to turn on specific APIs + +#include <unistd.h> + + +// We are hot - unistd.h should have turned on the specific APIs we requested + + +#include <pthread.h> +#include <dirent.h> +#include <fcntl.h> +#include <grp.h> +#include <pwd.h> +#include <signal.h> +#define QT_NO_LIBRARY_UNLOAD + +#include <sys/types.h> +#include <sys/ioctl.h> +#include <sys/ipc.h> +#include <sys/time.h> +#include <sys/shm.h> +#include <sys/socket.h> +#include <sys/stat.h> +#include <sys/wait.h> +#include <netinet/in.h> +#ifndef QT_NO_IPV6IFNAME +#include <net/if.h> +#endif + +#include "../../common/posix/qplatformdefs.h" + +#undef QT_OPEN_LARGEFILE +#undef QT_SOCKLEN_T +#undef QT_SIGNAL_IGNORE + +#define QT_OPEN_LARGEFILE 0 + +#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4) +#define QT_SOCKLEN_T socklen_t +#else +#define QT_SOCKLEN_T int +#endif + +#define QT_SIGNAL_IGNORE (void (*)(int))1 + +#define QT_SNPRINTF ::snprintf +#define QT_VSNPRINTF ::vsnprintf + +#endif // QPLATFORMDEFS_H diff --git a/mkspecs/qws/macx-iphonesimulator-g++/Info.plist.lib b/mkspecs/qws/macx-iphonesimulator-g++/Info.plist.lib new file mode 100644 index 0000000..97609ed --- /dev/null +++ b/mkspecs/qws/macx-iphonesimulator-g++/Info.plist.lib @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd"> +<plist version="0.9"> +<dict> + <key>CFBundlePackageType</key> + <string>FMWK</string> + <key>CFBundleShortVersionString</key> + <string>@SHORT_VERSION@</string> + <key>CFBundleGetInfoString</key> + <string>Created by Qt/QMake</string> + <key>CFBundleSignature</key> + <string>@TYPEINFO@</string> + <key>CFBundleExecutable</key> + <string>@LIBRARY@</string> + <key>NOTE</key> + <string>Please, do NOT change this file -- It was generated by Qt/QMake.</string> +</dict> +</plist> diff --git a/mkspecs/qws/macx-iphonesimulator-g++/qmake.conf b/mkspecs/qws/macx-iphonesimulator-g++/qmake.conf new file mode 100644 index 0000000..9a06857 --- /dev/null +++ b/mkspecs/qws/macx-iphonesimulator-g++/qmake.conf @@ -0,0 +1,45 @@ +# +# qmake configuration for macx-g++ +# +include(../../common/mac.conf) +include(../../common/g++-macx.conf) + +MAKEFILE_GENERATOR = UNIX +TEMPLATE = app +CONFIG += qt warn_on release app_bundle incremental global_init_link_order lib_version_first plugin_no_soname link_prl +QT += core gui +QMAKE_INCREMENTAL_STYLE = sublib + +# Do not compile a few things +DEFINES += QT_NO_AUDIO_BACKEND QT_NO_NETWORKPROXY QT_NO_FILESYSTEMWATCHER + +# You may need to change this to point to the iOS SDK you want to use. +QMAKE_IOS_DEV_PATH = /Developer/Platforms/iPhoneSimulator.platform/Developer +QMAKE_IOS_SDK = $$QMAKE_IOS_DEV_PATH/SDKs/iPhoneSimulator4.2.sdk +DEFINES += __IPHONE_OS_VERSION_MIN_REQUIRED=40200 +#clear +QMAKE_MACOSX_DEPLOYMENT_TARGET = + +# TARGET_PLATFORM = ios +QMAKE_CC = /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 +QMAKE_CXX = /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/g++-4.2 +QMAKE_LINK = $$QMAKE_CXX +QMAKE_LINK_SHLIB = $$QMAKE_CXX + +QMAKE_CFLAGS += -arch i386 -isysroot $$QMAKE_IOS_SDK +QMAKE_CXXFLAGS += $$QMAKE_CFLAGS +QMAKE_OBJECTIVE_CFLAGS += -arch i386 -isysroot $$QMAKE_IOS_SDK -fobjc-abi-version=2 -fobjc-legacy-dispatch +QMAKE_LFLAGS += -arch i386 -Wl,-syslibroot,$$QMAKE_IOS_SDK + +QMAKE_INCDIR_OPENGL = +QMAKE_LIBS_OPENGL = +QMAKE_LIBS_OPENGL_QT = + +#QMAKE_RESOURCE = +QMAKE_FIX_RPATH = $$QMAKE_IOS_DEV_PATH/usr/bin/install_name_tool -id +QMAKE_AR = $$QMAKE_IOS_DEV_PATH/usr/bin/ar cq +QMAKE_RANLIB = $$QMAKE_IOS_DEV_PATH/usr/bin/ranlib -s + +load(qt_config) + +QMAKE_OBJECTIVE_CFLAGS_X86 += -arch i386 -isysroot $$QMAKE_IOS_SDK -fobjc-abi-version=2 -fobjc-legacy-dispatch diff --git a/mkspecs/qws/macx-iphonesimulator-g++/qplatformdefs.h b/mkspecs/qws/macx-iphonesimulator-g++/qplatformdefs.h new file mode 100644 index 0000000..425fda3 --- /dev/null +++ b/mkspecs/qws/macx-iphonesimulator-g++/qplatformdefs.h @@ -0,0 +1,97 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the qmake spec of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPLATFORMDEFS_H +#define QPLATFORMDEFS_H + +// Get Qt defines/settings + +#include "qglobal.h" + +// Set any POSIX/XOPEN defines at the top of this file to turn on specific APIs + +#include <unistd.h> + + +// We are hot - unistd.h should have turned on the specific APIs we requested + + +#include <pthread.h> +#include <dirent.h> +#include <fcntl.h> +#include <grp.h> +#include <pwd.h> +#include <signal.h> +#define QT_NO_LIBRARY_UNLOAD + +#include <sys/types.h> +#include <sys/ioctl.h> +#include <sys/ipc.h> +#include <sys/time.h> +#include <sys/shm.h> +#include <sys/socket.h> +#include <sys/stat.h> +#include <sys/wait.h> +#include <netinet/in.h> +#ifndef QT_NO_IPV6IFNAME +#include <net/if.h> +#endif + +#include "../../common/posix/qplatformdefs.h" + +#undef QT_OPEN_LARGEFILE +#undef QT_SOCKLEN_T +#undef QT_SIGNAL_IGNORE + +#define QT_OPEN_LARGEFILE 0 + +#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4) +#define QT_SOCKLEN_T socklen_t +#else +#define QT_SOCKLEN_T int +#endif + +#define QT_SIGNAL_IGNORE (void (*)(int))1 + +#define QT_SNPRINTF ::snprintf +#define QT_VSNPRINTF ::vsnprintf + +#endif // QPLATFORMDEFS_H diff --git a/src/plugins/platforms/uikit/README b/src/plugins/platforms/uikit/README new file mode 100644 index 0000000..19ec83f --- /dev/null +++ b/src/plugins/platforms/uikit/README @@ -0,0 +1,45 @@ +This is a proof-of-concept implemenation of a UIKit based +QPA plugin. Note that this is completely unsupported, and it is probable +that many parts of QtCore and other Qt Modules don't work properly. + +1) Build Qt + +The example Xcode project in the examples subdirectory requires that you do shadow +builds of Qt in qt-lighthouse-ios-simulator and qt-lighthouse-ios-device directories +parallel to the sources. To build for simulator make sure that both the Simulator +configuration *and* the simulator specific target are active. To build for device +make sure that both the Device configuration *and* the device specific target are +active. + +The setup is configured to use the iOS 4.2 SDKs, you might want to edit the mkspecs +to fit your need. + +After configuring and building Qt you need to also build src/plugins/platforms/uikit. + +Simulator: +---------- +configure -qpa -xplatform qws/macx-iphonesimulator-g++ -arch i386 -developer-build -no-accessibility -no-qt3support -no-xmlpatterns -no-multimedia -no-phonon -no-phonon-backend -no-svg -no-webkit -no-scripttools -no-openssl -no-sql-mysql -no-sql-odbc -no-cups -no-iconv -no-dbus -no-opengl -static -nomake tools -nomake demos -nomake docs -nomake examples -nomake translations + +Device: +------- +configure -qpa -xplatform qws/macx-iphonedevice-g++ -arch armv7 -developer-build -no-accessibility -no-qt3support -no-xmlpatterns -no-multimedia -no-phonon -no-phonon-backend -no-svg -no-webkit -no-scripttools -no-openssl -no-sql-mysql -no-sql-odbc -no-cups -no-iconv -no-dbus -no-opengl -static -nomake tools -nomake demos -nomake docs -nomake examples -nomake translations + +2) XCode setup: +- there are examples in the examples subdirectory of the platform plugin +- to create something fresh do something like: + - Xcode: Create a "View-based Appplication" + - remove the nibs and view controller and app controller files + - remove the reference to "Main nib file" from plist file + - create a main.mm like in the examples + - add the qmlapplicationviewer sources to your project (including the moc_*.h) + (best to link, not copy), the code for this is from the Qt Creator + mobile Qt Quick application template + - Add the Qt .a libraries, uikit platform plugin and libz (v1.2.3) to Frameworks + - add "$(SRCROOT)/../../../../qt-lighthouse-ios-device/include" (or -simulator) + to the include search paths. + - add "$(SRCROOT)/../qmltest" to the include search path if you didn't copy but + linked to the qmlapplicationviewer + - for device set the architecture to armv7 only + +3) Done: Build and Run. + diff --git a/src/plugins/platforms/uikit/examples/qmltest/main.mm b/src/plugins/platforms/uikit/examples/qmltest/main.mm new file mode 100644 index 0000000..d90be56 --- /dev/null +++ b/src/plugins/platforms/uikit/examples/qmltest/main.mm @@ -0,0 +1,33 @@ +// +// main.m +// qmltest +// +// Created by Eike Troll on 18.02.11. +// Copyright 2011 __MyCompanyName__. All rights reserved. +// + +#import <UIKit/UIKit.h> + +#include "qmlapplicationviewer/qmlapplicationviewer.h" + +#include <QtGui/QApplication> +#include <QtCore/QtPlugin> + +Q_IMPORT_PLUGIN(UIKit) + +int main(int argc, char *argv[]) { + + NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; + + setenv("QT_QPA_PLATFORM","uikit",1); + + QApplication app(argc, argv); + QmlApplicationViewer viewer; + viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto); + NSString *resourcePath = [[NSBundle mainBundle] resourcePath]; + viewer.setMainQmlFile(QString::fromUtf8([[resourcePath stringByAppendingPathComponent:@"qml/main.qml"] UTF8String])); + viewer.showMaximized(); + int retVal = app.exec(); + [pool release]; + return retVal; +} diff --git a/src/plugins/platforms/uikit/examples/qmltest/qml/main.qml b/src/plugins/platforms/uikit/examples/qmltest/qml/main.qml new file mode 100644 index 0000000..889a6d0 --- /dev/null +++ b/src/plugins/platforms/uikit/examples/qmltest/qml/main.qml @@ -0,0 +1,112 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id: box + width: 350; height: 250 + + Rectangle { + id: redSquare + width: 80; height: 80 + anchors.top: parent.top; anchors.left: parent.left; anchors.margins: 10 + color: "red" + + Text { text: "Click"; font.pixelSize: 16; anchors.centerIn: parent } + + MouseArea { + anchors.fill: parent + hoverEnabled: true + acceptedButtons: Qt.LeftButton | Qt.RightButton + + onEntered: info.text = 'Entered' + onExited: info.text = 'Exited (pressed=' + pressed + ')' + + onPressed: { + info.text = 'Pressed (button=' + (mouse.button == Qt.RightButton ? 'right' : 'left') + + ' shift=' + (mouse.modifiers & Qt.ShiftModifier ? 'true' : 'false') + ')' + var posInBox = redSquare.mapToItem(box, mouse.x, mouse.y) + posInfo.text = + mouse.x + ',' + mouse.y + ' in square' + + ' (' + posInBox.x + ',' + posInBox.y + ' in window)' + } + + onReleased: { + info.text = 'Released (isClick=' + mouse.isClick + ' wasHeld=' + mouse.wasHeld + ')' + posInfo.text = '' + } + + onPressAndHold: info.text = 'Press and hold' + onClicked: info.text = 'Clicked (wasHeld=' + mouse.wasHeld + ')' + onDoubleClicked: info.text = 'Double clicked' + } + } + + Rectangle { + id: blueSquare + width: 80; height: 80 + x: box.width - width - 10; y: 10 // making this item draggable, so don't use anchors + color: "blue" + + Text { text: "Drag"; font.pixelSize: 16; color: "white"; anchors.centerIn: parent } + + MouseArea { + anchors.fill: parent + drag.target: blueSquare + drag.axis: Drag.XandYAxis + drag.minimumX: 0 + drag.maximumX: box.width - parent.width + drag.minimumY: 0 + drag.maximumY: box.height - parent.width + } + } + + Text { + id: info + anchors.bottom: posInfo.top; anchors.horizontalCenter: parent.horizontalCenter; anchors.margins: 30 + + onTextChanged: console.log(text) + } + + Text { + id: posInfo + anchors.bottom: parent.bottom; anchors.horizontalCenter: parent.horizontalCenter; anchors.margins: 30 + } +} diff --git a/src/plugins/platforms/uikit/examples/qmltest/qmlapplicationviewer/moc_qmlapplicationviewer.cpp b/src/plugins/platforms/uikit/examples/qmltest/qmlapplicationviewer/moc_qmlapplicationviewer.cpp new file mode 100644 index 0000000..7733ce2 --- /dev/null +++ b/src/plugins/platforms/uikit/examples/qmltest/qmlapplicationviewer/moc_qmlapplicationviewer.cpp @@ -0,0 +1,69 @@ +/**************************************************************************** +** Meta object code from reading C++ file 'qmlapplicationviewer.h' +** +** Created: Fri Feb 18 17:53:42 2011 +** by: The Qt Meta Object Compiler version 62 (Qt 4.7.2) +** +** WARNING! All changes made in this file will be lost! +*****************************************************************************/ + +#include "qmlapplicationviewer.h" +#if !defined(Q_MOC_OUTPUT_REVISION) +#error "The header file 'qmlapplicationviewer.h' doesn't include <QObject>." +#elif Q_MOC_OUTPUT_REVISION != 62 +#error "This file was generated using the moc from 4.7.2. It" +#error "cannot be used with the include files from this version of Qt." +#error "(The moc has changed too much.)" +#endif + +QT_BEGIN_MOC_NAMESPACE +static const uint qt_meta_data_QmlApplicationViewer[] = { + + // content: + 5, // revision + 0, // classname + 0, 0, // classinfo + 0, 0, // methods + 0, 0, // properties + 0, 0, // enums/sets + 0, 0, // constructors + 0, // flags + 0, // signalCount + + 0 // eod +}; + +static const char qt_meta_stringdata_QmlApplicationViewer[] = { + "QmlApplicationViewer\0" +}; + +const QMetaObject QmlApplicationViewer::staticMetaObject = { + { &QDeclarativeView::staticMetaObject, qt_meta_stringdata_QmlApplicationViewer, + qt_meta_data_QmlApplicationViewer, 0 } +}; + +#ifdef Q_NO_DATA_RELOCATION +const QMetaObject &QmlApplicationViewer::getStaticMetaObject() { return staticMetaObject; } +#endif //Q_NO_DATA_RELOCATION + +const QMetaObject *QmlApplicationViewer::metaObject() const +{ + return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject; +} + +void *QmlApplicationViewer::qt_metacast(const char *_clname) +{ + if (!_clname) return 0; + if (!strcmp(_clname, qt_meta_stringdata_QmlApplicationViewer)) + return static_cast<void*>(const_cast< QmlApplicationViewer*>(this)); + return QDeclarativeView::qt_metacast(_clname); +} + +int QmlApplicationViewer::qt_metacall(QMetaObject::Call _c, int _id, void **_a) +{ + _id = QDeclarativeView::qt_metacall(_c, _id, _a); + if (_id < 0) + return _id; + return _id; +} +QT_END_MOC_NAMESPACE diff --git a/src/plugins/platforms/uikit/examples/qmltest/qmlapplicationviewer/qmlapplicationviewer.cpp b/src/plugins/platforms/uikit/examples/qmltest/qmlapplicationviewer/qmlapplicationviewer.cpp new file mode 100644 index 0000000..7844e46 --- /dev/null +++ b/src/plugins/platforms/uikit/examples/qmltest/qmlapplicationviewer/qmlapplicationviewer.cpp @@ -0,0 +1,155 @@ +// checksum 0x17fa version 0x3000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#include "qmlapplicationviewer.h" + +#include <QtCore/QCoreApplication> +#include <QtCore/QDir> +#include <QtCore/QFileInfo> +#include <QtDeclarative/QDeclarativeComponent> +#include <QtDeclarative/QDeclarativeEngine> +#include <QtDeclarative/QDeclarativeContext> + +#if defined(QMLJSDEBUGGER) +#include <qt_private/qdeclarativedebughelper_p.h> +#endif + +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) +#include <jsdebuggeragent.h> +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) +#include <qdeclarativeviewobserver.h> +#endif + +#if defined(QMLJSDEBUGGER) + +// Enable debugging before any QDeclarativeEngine is created +struct QmlJsDebuggingEnabler +{ + QmlJsDebuggingEnabler() + { + QDeclarativeDebugHelper::enableDebugging(); + } +}; + +// Execute code in constructor before first QDeclarativeEngine is instantiated +static QmlJsDebuggingEnabler enableDebuggingHelper; + +#endif // QMLJSDEBUGGER + +class QmlApplicationViewerPrivate +{ + QString mainQmlFile; + friend class QmlApplicationViewer; + static QString adjustPath(const QString &path); +}; + +QString QmlApplicationViewerPrivate::adjustPath(const QString &path) +{ +#ifdef Q_OS_UNIX +#ifdef Q_OS_MAC + if (!QDir::isAbsolutePath(path)) + return QCoreApplication::applicationDirPath() + + QLatin1String("/../Resources/") + path; +#else + const QString pathInShareDir = QCoreApplication::applicationDirPath() + + QLatin1String("/../share/") + + QFileInfo(QCoreApplication::applicationFilePath()).fileName() + + QLatin1Char('/') + path; + if (QFileInfo(pathInShareDir).exists()) + return pathInShareDir; +#endif +#endif + return path; +} + +QmlApplicationViewer::QmlApplicationViewer(QWidget *parent) : + QDeclarativeView(parent), + m_d(new QmlApplicationViewerPrivate) +{ + connect(engine(), SIGNAL(quit()), SLOT(close())); + setResizeMode(QDeclarativeView::SizeRootObjectToView); +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) + new QmlJSDebugger::JSDebuggerAgent(engine()); +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) + new QmlJSDebugger::QDeclarativeViewObserver(this, parent); +#endif +} + +QmlApplicationViewer::~QmlApplicationViewer() +{ + delete m_d; +} + +void QmlApplicationViewer::setMainQmlFile(const QString &file) +{ + m_d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file); + setSource(QUrl::fromLocalFile(m_d->mainQmlFile)); +} + +void QmlApplicationViewer::addImportPath(const QString &path) +{ + engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path)); +} + +void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) +{ +//#if defined(Q_OS_SYMBIAN) +// // If the version of Qt on the device is < 4.7.2, that attribute won't work +// if (orientation != ScreenOrientationAuto) { +// const QStringList v = QString::fromAscii(qVersion()).split(QLatin1Char('.')); +// if (v.count() == 3 && (v.at(0).toInt() << 16 | v.at(1).toInt() << 8 | v.at(2).toInt()) < 0x040702) { +// qWarning("Screen orientation locking only supported with Qt 4.7.2 and above"); +// return; +// } +// } +//#endif // Q_OS_SYMBIAN +// +// Qt::WidgetAttribute attribute; +// switch (orientation) { +//#if QT_VERSION < 0x040702 +// // Qt < 4.7.2 does not yet have the Qt::WA_*Orientation attributes +// case ScreenOrientationLockPortrait: +// attribute = static_cast<Qt::WidgetAttribute>(128); +// break; +// case ScreenOrientationLockLandscape: +// attribute = static_cast<Qt::WidgetAttribute>(129); +// break; +// default: +// case ScreenOrientationAuto: +// attribute = static_cast<Qt::WidgetAttribute>(130); +// break; +//#else // QT_VERSION < 0x040702 +// case ScreenOrientationLockPortrait: +// attribute = Qt::WA_LockPortraitOrientation; +// break; +// case ScreenOrientationLockLandscape: +// attribute = Qt::WA_LockLandscapeOrientation; +// break; +// default: +// case ScreenOrientationAuto: +// attribute = Qt::WA_AutoOrientation; +// break; +//#endif // QT_VERSION < 0x040702 +// }; +// setAttribute(attribute, true); +} + +void QmlApplicationViewer::showExpanded() +{ +#ifdef Q_OS_SYMBIAN + showFullScreen(); +#elif defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) + showMaximized(); +#else + show(); +#endif +} diff --git a/src/plugins/platforms/uikit/examples/qmltest/qmlapplicationviewer/qmlapplicationviewer.h b/src/plugins/platforms/uikit/examples/qmltest/qmlapplicationviewer/qmlapplicationviewer.h new file mode 100644 index 0000000..0e4de04 --- /dev/null +++ b/src/plugins/platforms/uikit/examples/qmltest/qmlapplicationviewer/qmlapplicationviewer.h @@ -0,0 +1,39 @@ +// checksum 0x5a59 version 0x3000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#ifndef QMLAPPLICATIONVIEWER_H +#define QMLAPPLICATIONVIEWER_H + +#include <QtDeclarative/QDeclarativeView> + +class QmlApplicationViewer : public QDeclarativeView +{ + Q_OBJECT + +public: + enum ScreenOrientation { + ScreenOrientationLockPortrait, + ScreenOrientationLockLandscape, + ScreenOrientationAuto + }; + + explicit QmlApplicationViewer(QWidget *parent = 0); + virtual ~QmlApplicationViewer(); + + void setMainQmlFile(const QString &file); + void addImportPath(const QString &path); + void setOrientation(ScreenOrientation orientation); + void showExpanded(); + +private: + class QmlApplicationViewerPrivate *m_d; +}; + +#endif // QMLAPPLICATIONVIEWER_H diff --git a/src/plugins/platforms/uikit/examples/qmltest/qmltest-Info.plist b/src/plugins/platforms/uikit/examples/qmltest/qmltest-Info.plist new file mode 100644 index 0000000..1566585 --- /dev/null +++ b/src/plugins/platforms/uikit/examples/qmltest/qmltest-Info.plist @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>CFBundleDevelopmentRegion</key> + <string>English</string> + <key>CFBundleDisplayName</key> + <string>${PRODUCT_NAME}</string> + <key>CFBundleExecutable</key> + <string>${EXECUTABLE_NAME}</string> + <key>CFBundleIconFile</key> + <string></string> + <key>CFBundleIdentifier</key> + <string>com.yourcompany.${PRODUCT_NAME:rfc1034identifier}</string> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundleName</key> + <string>${PRODUCT_NAME}</string> + <key>CFBundlePackageType</key> + <string>APPL</string> + <key>CFBundleSignature</key> + <string>????</string> + <key>CFBundleVersion</key> + <string>1.0</string> + <key>LSRequiresIPhoneOS</key> + <true/> +</dict> +</plist> diff --git a/src/plugins/platforms/uikit/examples/qmltest/qmltest.xcodeproj/project.pbxproj b/src/plugins/platforms/uikit/examples/qmltest/qmltest.xcodeproj/project.pbxproj new file mode 100755 index 0000000..e105b73 --- /dev/null +++ b/src/plugins/platforms/uikit/examples/qmltest/qmltest.xcodeproj/project.pbxproj @@ -0,0 +1,455 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 45; + objects = { + +/* Begin PBXBuildFile section */ + 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; }; + 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; }; + 288765A50DF7441C002DB57D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765A40DF7441C002DB57D /* CoreGraphics.framework */; }; + D3CAA7C813264AAD008BB877 /* main.mm in Sources */ = {isa = PBXBuildFile; fileRef = D3CAA7C713264AAD008BB877 /* main.mm */; }; + D3CAA7E613264EA6008BB877 /* moc_qmlapplicationviewer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D3CAA7E313264EA6008BB877 /* moc_qmlapplicationviewer.cpp */; }; + D3CAA7E713264EA6008BB877 /* qmlapplicationviewer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D3CAA7E413264EA6008BB877 /* qmlapplicationviewer.cpp */; }; + D3CAA7EC13264F52008BB877 /* main.mm in Sources */ = {isa = PBXBuildFile; fileRef = D3CAA7C713264AAD008BB877 /* main.mm */; }; + D3CAA7ED13264F52008BB877 /* moc_qmlapplicationviewer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D3CAA7E313264EA6008BB877 /* moc_qmlapplicationviewer.cpp */; }; + D3CAA7EE13264F52008BB877 /* qmlapplicationviewer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D3CAA7E413264EA6008BB877 /* qmlapplicationviewer.cpp */; }; + D3CAA7F013264F52008BB877 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; }; + D3CAA7F113264F52008BB877 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; }; + D3CAA7F213264F52008BB877 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765A40DF7441C002DB57D /* CoreGraphics.framework */; }; + D3CAA7FA13264F8A008BB877 /* libz.1.2.3.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = D3CAA7F913264F8A008BB877 /* libz.1.2.3.dylib */; }; + D3CAA80613264FD5008BB877 /* libQtCore_debug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3CAA7FB13264FB9008BB877 /* libQtCore_debug.a */; }; + D3CAA80713264FD5008BB877 /* libQtDeclarative_debug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3CAA7FC13264FB9008BB877 /* libQtDeclarative_debug.a */; }; + D3CAA80813264FD6008BB877 /* libQtGui_debug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3CAA7FD13264FB9008BB877 /* libQtGui_debug.a */; }; + D3CAA80913264FD6008BB877 /* libQtScript_debug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3CAA7FE13264FB9008BB877 /* libQtScript_debug.a */; }; + D3CAA80A13264FD7008BB877 /* libQtSql_debug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3CAA7FF13264FB9008BB877 /* libQtSql_debug.a */; }; + D3CAA81113264FF0008BB877 /* libz.1.2.3.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = D3CAA7F913264F8A008BB877 /* libz.1.2.3.dylib */; }; + D3CAA81313265005008BB877 /* libquikit_debug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3CAA81213265005008BB877 /* libquikit_debug.a */; }; + D3CAA81B13265056008BB877 /* libQtCore_debug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3CAA81613265056008BB877 /* libQtCore_debug.a */; }; + D3CAA81C13265056008BB877 /* libQtDeclarative_debug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3CAA81713265056008BB877 /* libQtDeclarative_debug.a */; }; + D3CAA81D13265056008BB877 /* libQtGui_debug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3CAA81813265056008BB877 /* libQtGui_debug.a */; }; + D3CAA81E13265056008BB877 /* libQtScript_debug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3CAA81913265056008BB877 /* libQtScript_debug.a */; }; + D3CAA81F13265056008BB877 /* libQtSql_debug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3CAA81A13265056008BB877 /* libQtSql_debug.a */; }; + D3CAA8211326507D008BB877 /* libquikit_debug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3CAA8201326507D008BB877 /* libquikit_debug.a */; }; + D3CAA8261326520A008BB877 /* libQtNetwork_debug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3CAA8251326520A008BB877 /* libQtNetwork_debug.a */; }; + D3CAA82813265220008BB877 /* libQtNetwork_debug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3CAA82713265220008BB877 /* libQtNetwork_debug.a */; }; + D3CAA88A132652E5008BB877 /* fonts in Resources */ = {isa = PBXBuildFile; fileRef = D3CAA836132652E5008BB877 /* fonts */; }; + D3CAA88B132652E5008BB877 /* fonts in Resources */ = {isa = PBXBuildFile; fileRef = D3CAA836132652E5008BB877 /* fonts */; }; + D3CAA89113265310008BB877 /* qml in Resources */ = {isa = PBXBuildFile; fileRef = D3CAA88E13265310008BB877 /* qml */; }; + D3CAA89213265310008BB877 /* qml in Resources */ = {isa = PBXBuildFile; fileRef = D3CAA88E13265310008BB877 /* qml */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 1D30AB110D05D00D00671497 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + 1D6058910D05DD3D006BFB54 /* qmltest.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = qmltest.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; + 288765A40DF7441C002DB57D /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; + 32CA4F630368D1EE00C91783 /* qmltest_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = qmltest_Prefix.pch; sourceTree = "<group>"; }; + 8D1107310486CEB800E47090 /* qmltest-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "qmltest-Info.plist"; plistStructureDefinitionIdentifier = "com.apple.xcode.plist.structure-definition.iphone.info-plist"; sourceTree = "<group>"; }; + D3CAA7C713264AAD008BB877 /* main.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = main.mm; sourceTree = "<group>"; }; + D3CAA7E313264EA6008BB877 /* moc_qmlapplicationviewer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = moc_qmlapplicationviewer.cpp; path = qmlapplicationviewer/moc_qmlapplicationviewer.cpp; sourceTree = "<group>"; }; + D3CAA7E413264EA6008BB877 /* qmlapplicationviewer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = qmlapplicationviewer.cpp; path = qmlapplicationviewer/qmlapplicationviewer.cpp; sourceTree = "<group>"; }; + D3CAA7E513264EA6008BB877 /* qmlapplicationviewer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = qmlapplicationviewer.h; path = qmlapplicationviewer/qmlapplicationviewer.h; sourceTree = "<group>"; }; + D3CAA7F613264F52008BB877 /* qmltest.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = qmltest.app; sourceTree = BUILT_PRODUCTS_DIR; }; + D3CAA7F913264F8A008BB877 /* libz.1.2.3.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.1.2.3.dylib; path = usr/lib/libz.1.2.3.dylib; sourceTree = SDKROOT; }; + D3CAA7FB13264FB9008BB877 /* libQtCore_debug.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtCore_debug.a; path = "../../../../../../../qt-lighthouse-ios-device/lib/libQtCore_debug.a"; sourceTree = SOURCE_ROOT; }; + D3CAA7FC13264FB9008BB877 /* libQtDeclarative_debug.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtDeclarative_debug.a; path = "../../../../../../../qt-lighthouse-ios-device/lib/libQtDeclarative_debug.a"; sourceTree = SOURCE_ROOT; }; + D3CAA7FD13264FB9008BB877 /* libQtGui_debug.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtGui_debug.a; path = "../../../../../../../qt-lighthouse-ios-device/lib/libQtGui_debug.a"; sourceTree = SOURCE_ROOT; }; + D3CAA7FE13264FB9008BB877 /* libQtScript_debug.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtScript_debug.a; path = "../../../../../../../qt-lighthouse-ios-device/lib/libQtScript_debug.a"; sourceTree = SOURCE_ROOT; }; + D3CAA7FF13264FB9008BB877 /* libQtSql_debug.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtSql_debug.a; path = "../../../../../../../qt-lighthouse-ios-device/lib/libQtSql_debug.a"; sourceTree = SOURCE_ROOT; }; + D3CAA81213265005008BB877 /* libquikit_debug.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libquikit_debug.a; path = "../../../../../../../qt-lighthouse-ios-device/plugins/platforms/libquikit_debug.a"; sourceTree = SOURCE_ROOT; }; + D3CAA81613265056008BB877 /* libQtCore_debug.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtCore_debug.a; path = "../../../../../../../qt-lighthouse-ios-simulator/lib/libQtCore_debug.a"; sourceTree = SOURCE_ROOT; }; + D3CAA81713265056008BB877 /* libQtDeclarative_debug.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtDeclarative_debug.a; path = "../../../../../../../qt-lighthouse-ios-simulator/lib/libQtDeclarative_debug.a"; sourceTree = SOURCE_ROOT; }; + D3CAA81813265056008BB877 /* libQtGui_debug.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtGui_debug.a; path = "../../../../../../../qt-lighthouse-ios-simulator/lib/libQtGui_debug.a"; sourceTree = SOURCE_ROOT; }; + D3CAA81913265056008BB877 /* libQtScript_debug.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtScript_debug.a; path = "../../../../../../../qt-lighthouse-ios-simulator/lib/libQtScript_debug.a"; sourceTree = SOURCE_ROOT; }; + D3CAA81A13265056008BB877 /* libQtSql_debug.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtSql_debug.a; path = "../../../../../../../qt-lighthouse-ios-simulator/lib/libQtSql_debug.a"; sourceTree = SOURCE_ROOT; }; + D3CAA8201326507D008BB877 /* libquikit_debug.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libquikit_debug.a; path = "../../../../../../../qt-lighthouse-ios-simulator/plugins/platforms/libquikit_debug.a"; sourceTree = SOURCE_ROOT; }; + D3CAA8251326520A008BB877 /* libQtNetwork_debug.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtNetwork_debug.a; path = "../../../../../../../qt-lighthouse-ios-device/lib/libQtNetwork_debug.a"; sourceTree = SOURCE_ROOT; }; + D3CAA82713265220008BB877 /* libQtNetwork_debug.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtNetwork_debug.a; path = "../../../../../../../qt-lighthouse-ios-simulator/lib/libQtNetwork_debug.a"; sourceTree = SOURCE_ROOT; }; + D3CAA836132652E5008BB877 /* fonts */ = {isa = PBXFileReference; lastKnownFileType = folder; name = fonts; path = ../../../../../../lib/fonts; sourceTree = SOURCE_ROOT; }; + D3CAA88E13265310008BB877 /* qml */ = {isa = PBXFileReference; lastKnownFileType = folder; path = qml; sourceTree = SOURCE_ROOT; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 1D60588F0D05DD3D006BFB54 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */, + 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */, + 288765A50DF7441C002DB57D /* CoreGraphics.framework in Frameworks */, + D3CAA7FA13264F8A008BB877 /* libz.1.2.3.dylib in Frameworks */, + D3CAA81B13265056008BB877 /* libQtCore_debug.a in Frameworks */, + D3CAA81C13265056008BB877 /* libQtDeclarative_debug.a in Frameworks */, + D3CAA81D13265056008BB877 /* libQtGui_debug.a in Frameworks */, + D3CAA81E13265056008BB877 /* libQtScript_debug.a in Frameworks */, + D3CAA81F13265056008BB877 /* libQtSql_debug.a in Frameworks */, + D3CAA8211326507D008BB877 /* libquikit_debug.a in Frameworks */, + D3CAA82813265220008BB877 /* libQtNetwork_debug.a in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D3CAA7EF13264F52008BB877 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + D3CAA7F013264F52008BB877 /* Foundation.framework in Frameworks */, + D3CAA7F113264F52008BB877 /* UIKit.framework in Frameworks */, + D3CAA7F213264F52008BB877 /* CoreGraphics.framework in Frameworks */, + D3CAA80613264FD5008BB877 /* libQtCore_debug.a in Frameworks */, + D3CAA80713264FD5008BB877 /* libQtDeclarative_debug.a in Frameworks */, + D3CAA80813264FD6008BB877 /* libQtGui_debug.a in Frameworks */, + D3CAA80913264FD6008BB877 /* libQtScript_debug.a in Frameworks */, + D3CAA80A13264FD7008BB877 /* libQtSql_debug.a in Frameworks */, + D3CAA81113264FF0008BB877 /* libz.1.2.3.dylib in Frameworks */, + D3CAA81313265005008BB877 /* libquikit_debug.a in Frameworks */, + D3CAA8261326520A008BB877 /* libQtNetwork_debug.a in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 19C28FACFE9D520D11CA2CBB /* Products */ = { + isa = PBXGroup; + children = ( + 1D6058910D05DD3D006BFB54 /* qmltest.app */, + D3CAA7F613264F52008BB877 /* qmltest.app */, + ); + name = Products; + sourceTree = "<group>"; + }; + 29B97314FDCFA39411CA2CEA /* CustomTemplate */ = { + isa = PBXGroup; + children = ( + 29B97315FDCFA39411CA2CEA /* Other Sources */, + 29B97317FDCFA39411CA2CEA /* Resources */, + D3CAA7E213264E8C008BB877 /* QMLApplicationViewer */, + 29B97323FDCFA39411CA2CEA /* Frameworks */, + 19C28FACFE9D520D11CA2CBB /* Products */, + ); + name = CustomTemplate; + sourceTree = "<group>"; + }; + 29B97315FDCFA39411CA2CEA /* Other Sources */ = { + isa = PBXGroup; + children = ( + 32CA4F630368D1EE00C91783 /* qmltest_Prefix.pch */, + D3CAA7C713264AAD008BB877 /* main.mm */, + ); + name = "Other Sources"; + sourceTree = "<group>"; + }; + 29B97317FDCFA39411CA2CEA /* Resources */ = { + isa = PBXGroup; + children = ( + D3CAA88E13265310008BB877 /* qml */, + D3CAA836132652E5008BB877 /* fonts */, + 8D1107310486CEB800E47090 /* qmltest-Info.plist */, + ); + name = Resources; + sourceTree = "<group>"; + }; + 29B97323FDCFA39411CA2CEA /* Frameworks */ = { + isa = PBXGroup; + children = ( + D3CAA81513265035008BB877 /* Simulator */, + D3CAA8141326500A008BB877 /* Device */, + 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */, + 1D30AB110D05D00D00671497 /* Foundation.framework */, + 288765A40DF7441C002DB57D /* CoreGraphics.framework */, + D3CAA7F913264F8A008BB877 /* libz.1.2.3.dylib */, + ); + name = Frameworks; + sourceTree = "<group>"; + }; + D3CAA7E213264E8C008BB877 /* QMLApplicationViewer */ = { + isa = PBXGroup; + children = ( + D3CAA7E313264EA6008BB877 /* moc_qmlapplicationviewer.cpp */, + D3CAA7E413264EA6008BB877 /* qmlapplicationviewer.cpp */, + D3CAA7E513264EA6008BB877 /* qmlapplicationviewer.h */, + ); + name = QMLApplicationViewer; + sourceTree = "<group>"; + }; + D3CAA8141326500A008BB877 /* Device */ = { + isa = PBXGroup; + children = ( + D3CAA81213265005008BB877 /* libquikit_debug.a */, + D3CAA7FB13264FB9008BB877 /* libQtCore_debug.a */, + D3CAA7FC13264FB9008BB877 /* libQtDeclarative_debug.a */, + D3CAA7FD13264FB9008BB877 /* libQtGui_debug.a */, + D3CAA8251326520A008BB877 /* libQtNetwork_debug.a */, + D3CAA7FE13264FB9008BB877 /* libQtScript_debug.a */, + D3CAA7FF13264FB9008BB877 /* libQtSql_debug.a */, + ); + name = Device; + sourceTree = "<group>"; + }; + D3CAA81513265035008BB877 /* Simulator */ = { + isa = PBXGroup; + children = ( + D3CAA8201326507D008BB877 /* libquikit_debug.a */, + D3CAA81613265056008BB877 /* libQtCore_debug.a */, + D3CAA81713265056008BB877 /* libQtDeclarative_debug.a */, + D3CAA81813265056008BB877 /* libQtGui_debug.a */, + D3CAA82713265220008BB877 /* libQtNetwork_debug.a */, + D3CAA81913265056008BB877 /* libQtScript_debug.a */, + D3CAA81A13265056008BB877 /* libQtSql_debug.a */, + ); + name = Simulator; + sourceTree = "<group>"; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 1D6058900D05DD3D006BFB54 /* qmltest simulator */ = { + isa = PBXNativeTarget; + buildConfigurationList = 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "qmltest simulator" */; + buildPhases = ( + 1D60588D0D05DD3D006BFB54 /* Resources */, + 1D60588E0D05DD3D006BFB54 /* Sources */, + 1D60588F0D05DD3D006BFB54 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "qmltest simulator"; + productName = qmltest; + productReference = 1D6058910D05DD3D006BFB54 /* qmltest.app */; + productType = "com.apple.product-type.application"; + }; + D3CAA7E813264F52008BB877 /* qmltest device */ = { + isa = PBXNativeTarget; + buildConfigurationList = D3CAA7F313264F52008BB877 /* Build configuration list for PBXNativeTarget "qmltest device" */; + buildPhases = ( + D3CAA7E913264F52008BB877 /* Resources */, + D3CAA7EB13264F52008BB877 /* Sources */, + D3CAA7EF13264F52008BB877 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "qmltest device"; + productName = qmltest; + productReference = D3CAA7F613264F52008BB877 /* qmltest.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 29B97313FDCFA39411CA2CEA /* Project object */ = { + isa = PBXProject; + buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "qmltest" */; + compatibilityVersion = "Xcode 3.1"; + developmentRegion = English; + hasScannedForEncodings = 1; + knownRegions = ( + English, + Japanese, + French, + German, + ); + mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 1D6058900D05DD3D006BFB54 /* qmltest simulator */, + D3CAA7E813264F52008BB877 /* qmltest device */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 1D60588D0D05DD3D006BFB54 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D3CAA88A132652E5008BB877 /* fonts in Resources */, + D3CAA89113265310008BB877 /* qml in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D3CAA7E913264F52008BB877 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D3CAA88B132652E5008BB877 /* fonts in Resources */, + D3CAA89213265310008BB877 /* qml in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 1D60588E0D05DD3D006BFB54 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D3CAA7C813264AAD008BB877 /* main.mm in Sources */, + D3CAA7E613264EA6008BB877 /* moc_qmlapplicationviewer.cpp in Sources */, + D3CAA7E713264EA6008BB877 /* qmlapplicationviewer.cpp in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D3CAA7EB13264F52008BB877 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D3CAA7EC13264F52008BB877 /* main.mm in Sources */, + D3CAA7ED13264F52008BB877 /* moc_qmlapplicationviewer.cpp in Sources */, + D3CAA7EE13264F52008BB877 /* qmlapplicationviewer.cpp in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 1D6058940D05DD3E006BFB54 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_UNIVERSAL_IPHONE_OS)"; + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = qmltest_Prefix.pch; + HEADER_SEARCH_PATHS = "\"$(SRCROOT)/../../../../../../../qt-lighthouse-ios-simulator/include\"/**"; + INFOPLIST_FILE = "qmltest-Info.plist"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "\"$(SRCROOT)/../../../../../../../qt-lighthouse-ios-simulator/lib\"", + "\"$(SRCROOT)/../../../../../../../qt-lighthouse-ios-simulator/plugins/platforms\"", + ); + PRODUCT_NAME = qmltest; + }; + name = Debug; + }; + 1D6058950D05DD3E006BFB54 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_UNIVERSAL_IPHONE_OS)"; + COPY_PHASE_STRIP = YES; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = qmltest_Prefix.pch; + HEADER_SEARCH_PATHS = "\"$(SRCROOT)/../../../../../../../qt-lighthouse-ios-simulator/include\"/**"; + INFOPLIST_FILE = "qmltest-Info.plist"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "\"$(SRCROOT)/../../../../../../../qt-lighthouse-ios-simulator/lib\"", + "\"$(SRCROOT)/../../../../../../../qt-lighthouse-ios-simulator/plugins/platforms\"", + ); + PRODUCT_NAME = qmltest; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + C01FCF4F08A954540054247B /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + PREBINDING = NO; + SDKROOT = iphoneos; + }; + name = Debug; + }; + C01FCF5008A954540054247B /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; + PREBINDING = NO; + SDKROOT = iphoneos; + }; + name = Release; + }; + D3CAA7F413264F52008BB877 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_UNIVERSAL_IPHONE_OS)"; + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = qmltest_Prefix.pch; + HEADER_SEARCH_PATHS = "\"$(SRCROOT)/../../../../../../../qt-lighthouse-ios-device/include\"/**"; + INFOPLIST_FILE = "qmltest-Info.plist"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "\"$(SRCROOT)/../../../../../../../qt-lighthouse-ios-device/lib\"", + "\"$(SRCROOT)/../../../../../../../qt-lighthouse-ios-device/plugins/platforms\"", + ); + PRODUCT_NAME = qmltest; + }; + name = Debug; + }; + D3CAA7F513264F52008BB877 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_UNIVERSAL_IPHONE_OS)"; + COPY_PHASE_STRIP = YES; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = qmltest_Prefix.pch; + HEADER_SEARCH_PATHS = "\"$(SRCROOT)/../../../../../../../qt-lighthouse-ios-device/include\"/**"; + INFOPLIST_FILE = "qmltest-Info.plist"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "\"$(SRCROOT)/../../../../../../../qt-lighthouse-ios-device/lib\"", + "\"$(SRCROOT)/../../../../../../../qt-lighthouse-ios-device/plugins/platforms\"", + ); + PRODUCT_NAME = qmltest; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "qmltest simulator" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1D6058940D05DD3E006BFB54 /* Debug */, + 1D6058950D05DD3E006BFB54 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + C01FCF4E08A954540054247B /* Build configuration list for PBXProject "qmltest" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + C01FCF4F08A954540054247B /* Debug */, + C01FCF5008A954540054247B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + D3CAA7F313264F52008BB877 /* Build configuration list for PBXNativeTarget "qmltest device" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + D3CAA7F413264F52008BB877 /* Debug */, + D3CAA7F513264F52008BB877 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 29B97313FDCFA39411CA2CEA /* Project object */; +} diff --git a/src/plugins/platforms/uikit/examples/qmltest/qmltest_Prefix.pch b/src/plugins/platforms/uikit/examples/qmltest/qmltest_Prefix.pch new file mode 100644 index 0000000..c06715c --- /dev/null +++ b/src/plugins/platforms/uikit/examples/qmltest/qmltest_Prefix.pch @@ -0,0 +1,8 @@ +// +// Prefix header for all source files of the 'qmltest' target in the 'qmltest' project +// + +#ifdef __OBJC__ + #import <Foundation/Foundation.h> + #import <UIKit/UIKit.h> +#endif diff --git a/src/plugins/platforms/uikit/main.mm b/src/plugins/platforms/uikit/main.mm new file mode 100644 index 0000000..05e0d02 --- /dev/null +++ b/src/plugins/platforms/uikit/main.mm @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <UIKit/UIKit.h> + +#include <QtGui/QPlatformIntegrationPlugin> +#include "quikitintegration.h" + +QT_BEGIN_NAMESPACE + +class QUIKitIntegrationPlugin : public QPlatformIntegrationPlugin +{ +public: + QStringList keys() const; + QPlatformIntegration *create(const QString&, const QStringList&); +}; + +QStringList QUIKitIntegrationPlugin::keys() const +{ + QStringList list; + list << "UIKit"; + return list; +} + +QPlatformIntegration * QUIKitIntegrationPlugin::create(const QString& system, const QStringList& paramList) +{ + Q_UNUSED(paramList); + if (system.toLower() == "uikit") + return new QUIKitIntegration; + + return 0; +} + +Q_EXPORT_PLUGIN2(UIKit, QUIKitIntegrationPlugin) + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/uikit/quikiteventloop.h b/src/plugins/platforms/uikit/quikiteventloop.h new file mode 100644 index 0000000..5c18999 --- /dev/null +++ b/src/plugins/platforms/uikit/quikiteventloop.h @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QUIKITEVENTLOOP_H +#define QUIKITEVENTLOOP_H + +#include <QtGui/QPlatformEventLoopIntegration> + +@class EventLoopHelper; +@class NSTimer; + +QT_BEGIN_NAMESPACE + +class QUIKitEventLoop : public QPlatformEventLoopIntegration +{ +public: + QUIKitEventLoop(); + ~QUIKitEventLoop(); + + void startEventLoop(); + void quitEventLoop(); + void qtNeedsToProcessEvents(); + + EventLoopHelper *mHelper; + NSTimer *mTimer; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/platforms/uikit/quikiteventloop.mm b/src/plugins/platforms/uikit/quikiteventloop.mm new file mode 100644 index 0000000..4469ae9 --- /dev/null +++ b/src/plugins/platforms/uikit/quikiteventloop.mm @@ -0,0 +1,158 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "quikiteventloop.h" +#include "quikitwindow.h" +#include "quikitwindowsurface.h" + +#include <UIKit/UIKit.h> + +#include <QtGui/QApplication> +#include <QtGui/QWidget> +#include <QtDebug> + +@interface QUIKitAppDelegate : NSObject <UIApplicationDelegate> { +} +@end + +@interface EventLoopHelper : NSObject { + QUIKitEventLoop *mIntegration; +} + +- (id)initWithEventLoopIntegration:(QUIKitEventLoop *)integration; + +- (void)processEvents; +- (void)processEventsAndSchedule; + +@end + +@implementation QUIKitAppDelegate + +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions +{ + foreach (QWidget *widget, qApp->topLevelWidgets()) { + QRect geom = widget->geometry(); + CGRect bar = [UIApplication sharedApplication].statusBarFrame; + if (geom.y() <= bar.size.height) { + geom.setY(bar.size.height); + widget->setGeometry(geom); + } + QUIKitWindow *platformWindow = static_cast<QUIKitWindow *>(widget->platformWindow()); + platformWindow->ensureNativeWindow(); + QUIKitWindowSurface *surface = static_cast<QUIKitWindowSurface*>(widget->windowSurface()); + UIView *view = surface->nativeView(); + [platformWindow->nativeWindow() addSubview:view]; + [platformWindow->nativeWindow() makeKeyAndVisible]; + } + return YES; +} + +- (void)applicationWillTerminate:(UIApplication *)application +{ + // TODO this isn't called for some reason + qDebug() << "quit"; + qApp->quit(); +} + +@end + +@implementation EventLoopHelper + +- (id)initWithEventLoopIntegration:(QUIKitEventLoop *)integration +{ + if (self = [self init]) { + mIntegration = integration; + } + return self; +} + +- (void)processEvents +{ + QPlatformEventLoopIntegration::processEvents(); +} + +- (void)processEventsAndSchedule +{ + QPlatformEventLoopIntegration::processEvents(); + qint64 nextTime = mIntegration->nextTimerEvent(); + NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; + NSDate *nextDate = [[NSDate date] dateByAddingTimeInterval:((double)nextTime/1000)]; + [mIntegration->mTimer setFireDate:nextDate]; + [pool release]; +} + +@end + +QT_BEGIN_NAMESPACE + +QUIKitEventLoop::QUIKitEventLoop() +{ + NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; + mHelper = [[EventLoopHelper alloc] initWithEventLoopIntegration:this]; + mTimer = [[NSTimer timerWithTimeInterval:0.030 target:mHelper selector:@selector(processEventsAndSchedule) userInfo:nil repeats:YES] retain]; + [pool release]; +} + +QUIKitEventLoop::~QUIKitEventLoop() +{ + [mTimer release]; + [mHelper release]; +} + +void QUIKitEventLoop::startEventLoop() +{ + NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; + [[NSRunLoop currentRunLoop] addTimer:[mTimer autorelease] forMode:NSDefaultRunLoopMode]; + UIApplicationMain(qApp->argc(), qApp->argv(), nil, @"QUIKitAppDelegate"); + [pool release]; +} + +void QUIKitEventLoop::quitEventLoop() +{ + +} + +void QUIKitEventLoop::qtNeedsToProcessEvents() +{ + [mHelper performSelectorOnMainThread:@selector(processEvents) withObject:nil waitUntilDone:NO]; +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/uikit/quikitintegration.h b/src/plugins/platforms/uikit/quikitintegration.h new file mode 100644 index 0000000..e448881 --- /dev/null +++ b/src/plugins/platforms/uikit/quikitintegration.h @@ -0,0 +1,72 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPLATFORMINTEGRATION_UIKIT_H +#define QPLATFORMINTEGRATION_UIKIT_H + +#include <QtGui/QPlatformIntegration> + +QT_BEGIN_NAMESPACE + +class QUIKitIntegration : public QPlatformIntegration +{ +public: + QUIKitIntegration(); + ~QUIKitIntegration(); + + QPixmapData *createPixmapData(QPixmapData::PixelType type) const; + QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId = 0) const; + QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const; + + QList<QPlatformScreen *> screens() const; + + QPlatformFontDatabase *fontDatabase() const; + + QPlatformEventLoopIntegration *createEventLoopIntegration() const; + +private: + QList<QPlatformScreen *> mScreens; +}; + +QT_END_NAMESPACE + +#endif + diff --git a/src/plugins/platforms/uikit/quikitintegration.mm b/src/plugins/platforms/uikit/quikitintegration.mm new file mode 100644 index 0000000..f1fc402 --- /dev/null +++ b/src/plugins/platforms/uikit/quikitintegration.mm @@ -0,0 +1,104 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "quikitintegration.h" +#include "quikitwindow.h" +#include "quikitwindowsurface.h" +#include "quikitscreen.h" +#include "quikiteventloop.h" + +#include <QtGui/QApplication> + +#include <private/qpixmap_raster_p.h> + +#include <UIKit/UIKit.h> + +#include <QtDebug> + +QT_BEGIN_NAMESPACE + +QUIKitIntegration::QUIKitIntegration() +{ + mScreens << new QUIKitScreen(0); +} + +QUIKitIntegration::~QUIKitIntegration() +{ +} + +QPixmapData *QUIKitIntegration::createPixmapData(QPixmapData::PixelType type) const +{ + return new QRasterPixmapData(type); +} + +QPlatformWindow *QUIKitIntegration::createPlatformWindow(QWidget *widget, WId winId) const +{ + Q_UNUSED(winId); + return new QUIKitWindow(widget); +} + +QList<QPlatformScreen *> QUIKitIntegration::screens() const +{ + return mScreens; +} + +QWindowSurface *QUIKitIntegration::createWindowSurface(QWidget *widget, WId winId) const +{ + Q_UNUSED(winId); + return new QUIKitWindowSurface(widget); +} + +QPlatformEventLoopIntegration *QUIKitIntegration::createEventLoopIntegration() const +{ + return new QUIKitEventLoop(); +} + +QPlatformFontDatabase * QUIKitIntegration::fontDatabase() const +{ + static bool initialized = false; + if (!initialized) { + initialized = true; + setenv("QT_QPA_FONTDIR",[[[[NSBundle mainBundle] bundlePath] stringByAppendingPathComponent:@"fonts"] UTF8String],1); + } + return QPlatformIntegration::fontDatabase(); +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/uikit/quikitscreen.h b/src/plugins/platforms/uikit/quikitscreen.h new file mode 100644 index 0000000..0253795 --- /dev/null +++ b/src/plugins/platforms/uikit/quikitscreen.h @@ -0,0 +1,75 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QUIKITSCREEN_H +#define QUIKITSCREEN_H + +#include <UIKit/UIKit.h> + +#include <QtGui/QPlatformScreen> + +QT_BEGIN_NAMESPACE + +class QUIKitScreen : public QPlatformScreen +{ +public: + QUIKitScreen(int screenIndex); + ~QUIKitScreen(); + + QRect geometry() const { return m_geometry; } + int depth() const { return m_depth; } + QImage::Format format() const { return m_format; } + QSize physicalSize() const { return m_physicalSize; } + + UIScreen *uiScreen() const; + +private: + QRect m_geometry; + int m_depth; + QImage::Format m_format; + QSize m_physicalSize; + int m_index; +}; + +QT_END_NAMESPACE + + +#endif diff --git a/src/plugins/platforms/uikit/quikitscreen.mm b/src/plugins/platforms/uikit/quikitscreen.mm new file mode 100644 index 0000000..718ba54 --- /dev/null +++ b/src/plugins/platforms/uikit/quikitscreen.mm @@ -0,0 +1,81 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "quikitscreen.h" + +#include <QtDebug> + +QT_BEGIN_NAMESPACE + +QUIKitScreen::QUIKitScreen(int screenIndex) + : QPlatformScreen(), + m_index(screenIndex) +{ + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + UIScreen *screen = [[UIScreen screens] objectAtIndex:screenIndex]; + UIScreenMode *mode = [screen currentMode]; + CGSize size = [mode size]; + m_geometry = QRect(0, 0, size.width, size.height); + CGRect bounds = [screen bounds]; // in 'points', 1p == 1/160in + +// qreal xDpi = size.width * 160. / bounds.size.width; +// qreal yDpi = size.height * 160. / bounds.size.height; +// qDebug() << xDpi << yDpi; + + m_format = QImage::Format_ARGB32; + + m_depth = 24; + + const qreal inch = 25.4; + m_physicalSize = QSize(qRound(bounds.size.width * inch / 160.), qRound(bounds.size.height * inch / 160.)); + [pool release]; +} + +QUIKitScreen::~QUIKitScreen() +{ +} + +UIScreen *QUIKitScreen::uiScreen() const +{ + return [[UIScreen screens] objectAtIndex:m_index]; +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/uikit/quikitwindow.h b/src/plugins/platforms/uikit/quikitwindow.h new file mode 100644 index 0000000..8e8c51b --- /dev/null +++ b/src/plugins/platforms/uikit/quikitwindow.h @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QUIKITWINDOW_H +#define QUIKITWINDOW_H + +#include <QPlatformWindow> +#include <UIKit/UIKit.h> + +QT_BEGIN_NAMESPACE + +class QUIKitScreen; + +class QUIKitWindow : public QPlatformWindow +{ +public: + explicit QUIKitWindow(QWidget *tlw); + ~QUIKitWindow(); + + UIWindow *nativeWindow() const { return mWindow; } + void setGeometry(const QRect &rect); + + UIWindow *ensureNativeWindow(); + +private: + QUIKitScreen *mScreen; + UIWindow *mWindow; +}; + +QT_END_NAMESPACE + +#endif // QUIKITWINDOW_H diff --git a/src/plugins/platforms/uikit/quikitwindow.mm b/src/plugins/platforms/uikit/quikitwindow.mm new file mode 100644 index 0000000..4ac7447 --- /dev/null +++ b/src/plugins/platforms/uikit/quikitwindow.mm @@ -0,0 +1,88 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "quikitwindow.h" + +#include "quikitscreen.h" + +#include <QtDebug> + +QT_BEGIN_NAMESPACE + +QUIKitWindow::QUIKitWindow(QWidget *tlw) : + QPlatformWindow(tlw), + mWindow(nil) +{ + mScreen = static_cast<QUIKitScreen *>(QPlatformScreen::platformScreenForWidget(tlw)); + CGRect screenBounds = [mScreen->uiScreen() bounds]; + QRect geom(screenBounds.origin.x, screenBounds.origin.y, screenBounds.size.width, screenBounds.size.height); + setGeometry(geom); + // TODO ensure the native window if the application is already running +} + +QUIKitWindow::~QUIKitWindow() +{ + [mWindow release]; +} + +void QUIKitWindow::setGeometry(const QRect &rect) +{ + if (mWindow) { + mWindow.frame = CGRectMake(rect.x(), rect.y(), rect.width(), rect.height()); + [mWindow setNeedsDisplay]; + } + QPlatformWindow::setGeometry(rect); +} + +UIWindow *QUIKitWindow::ensureNativeWindow() +{ + if (!mWindow) { + CGRect screenBounds = [mScreen->uiScreen() bounds]; + QRect geom = geometry(); + CGRect frame = CGRectMake(geom.x(), geom.y(), geom.width(), geom.height()); + mWindow = [[UIWindow alloc] initWithFrame:frame]; + mWindow.screen = mScreen->uiScreen(); + mWindow.frame = frame; // for some reason setting the screen resets frame.origin + [mWindow setNeedsDisplay]; + } +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/uikit/quikitwindowsurface.h b/src/plugins/platforms/uikit/quikitwindowsurface.h new file mode 100644 index 0000000..2c22d7f --- /dev/null +++ b/src/plugins/platforms/uikit/quikitwindowsurface.h @@ -0,0 +1,83 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QUIKITWINDOWSURFACE_H +#define QUIKITWINDOWSURFACE_H + +#include <QtGui/QPlatformIntegration> +#include <QtGui/QImage> +#include <QtGui/QWindowSystemInterface> + +#include <UIKit/UIKit.h> + +@interface QImageView : UIView +{ + CGImageRef m_cgImage; + QWidget *m_widget; +} + +- (void)setImage:(QImage *)image; +- (void)setWidget:(QWidget *)widget; + +//- (QList<struct QWindowSystemInterface::TouchPoint>)touchPointsForTouches:(NSSet *)touches; +- (void)sendMouseEventForTouches:(NSSet *)touches withEvent:(UIEvent *)event fakeButtons:(Qt::MouseButtons)buttons; +@end + +QT_BEGIN_NAMESPACE + +class QUIKitWindowSurface : public QWindowSurface +{ +public: + QUIKitWindowSurface(QWidget *window); + + QPaintDevice *paintDevice(); + void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); + void resize (const QSize &size); + + QImageView *nativeView() const { return mView; } +private: + QImage *mImage; + QImageView *mView; +}; + +QT_END_NAMESPACE + +#endif // QUIKITWINDOWSURFACE_H diff --git a/src/plugins/platforms/uikit/quikitwindowsurface.mm b/src/plugins/platforms/uikit/quikitwindowsurface.mm new file mode 100644 index 0000000..f21bb77 --- /dev/null +++ b/src/plugins/platforms/uikit/quikitwindowsurface.mm @@ -0,0 +1,242 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "quikitwindowsurface.h" +#include "quikitwindow.h" + +#include <QtDebug> + +@implementation QImageView + +- (void)dealloc +{ + CGImageRelease(m_cgImage); + [super dealloc]; +} + +- (void)setImage:(QImage *)image +{ + CGImageRelease(m_cgImage); + + const uchar *imageData = image->bits(); + int bitDepth = image->depth(); + int colorBufferSize = 8; + int bytesPrLine = image->bytesPerLine(); + int width = image->width(); + int height = image->height(); + + CGColorSpaceRef cgColourSpaceRef = CGColorSpaceCreateDeviceRGB(); + + CGDataProviderRef cgDataProviderRef = CGDataProviderCreateWithData( + NULL, + imageData, + image->byteCount(), + NULL); + + m_cgImage = CGImageCreate(width, + height, + colorBufferSize, + bitDepth, + bytesPrLine, + cgColourSpaceRef, + kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Little, + cgDataProviderRef, + NULL, + false, + kCGRenderingIntentDefault); + + CGDataProviderRelease(cgDataProviderRef); + CGColorSpaceRelease(cgColourSpaceRef); +} + +- (void)setWidget:(QWidget *)widget +{ + m_widget = widget; +} + +- (void)drawRect:(CGRect)rect +{ + + if (!m_cgImage) + return; + + CGContextRef cgContext = UIGraphicsGetCurrentContext(); + CGContextSaveGState( cgContext ); + + int dy = rect.origin.y + CGRectGetMaxY(rect); + CGContextTranslateCTM(cgContext, 0, dy); + CGContextScaleCTM(cgContext, 1, -1); + CGImageRef subImage = CGImageCreateWithImageInRect(m_cgImage, rect); + CGContextDrawImage(cgContext,rect,subImage); + CGImageRelease(subImage); + + CGContextRestoreGState(cgContext); +} + +//- (QList<struct QWindowSystemInterface::TouchPoint>)touchPointsForTouches:(NSSet *)touches +//{ +// NSEnumerator *enumerator = [touches objectEnumerator]; +// id touch; +// int count = 0; +// QList<struct QWindowSystemInterface::TouchPoint> result; +// while ((touch = [enumerator nextObject])) { +// CGPoint locationInView = [touch locationInView:self]; +// CGRect bounds = [self bounds]; +// struct QWindowSystemInterface::TouchPoint p; +// p.id = count; +// p.isPrimary = true; +// p.normalPosition = QPointF(locationInView.x / bounds.size.width, +// locationInView.y / bounds.size.height); +// p.area = QRectF(locationInView.x, locationInView.y, 1, 1); +// p.pressure = 1.; +// switch ([touch phase]) { +// case UITouchPhaseBegan: +// p.state = Qt::TouchPointPressed; +// break; +// case UITouchPhaseMoved: +// p.state = Qt::TouchPointMoved; +// break; +// case UITouchPhaseStationary: +// p.state = Qt::TouchPointStationary; +// break; +// case UITouchPhaseEnded: +// case UITouchPhaseCancelled: +// p.state = Qt::TouchPointReleased; +// break; +// } +// result << p; +// qDebug() << p.id << ":" << p.normalPosition << p.area << p.state; +// ++count; +// } +// qDebug() << result.size(); +// return result; +//} + +- (void)sendMouseEventForTouches:(NSSet *)touches withEvent:(UIEvent *)event fakeButtons:(Qt::MouseButtons)buttons +{ + UITouch *touch = [touches anyObject]; + CGPoint locationInView = [touch locationInView:self]; + QPoint p(locationInView.x, locationInView.y); + // TODO handle global touch point? for status bar? + QWindowSystemInterface::handleMouseEvent(m_widget, (ulong)(event.timestamp*1000), + p, p, buttons); +} + +- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event +{ + //QWindowSystemInterface::handleTouchEvent(m_widget, (ulong)(event.timestamp*1000), + // QEvent::TouchBegin, QTouchEvent::TouchScreen, + // [self touchPointsForTouches:touches]); + [self sendMouseEventForTouches:touches withEvent:event fakeButtons:Qt::LeftButton]; +} + +- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event +{ + //QWindowSystemInterface::handleTouchEvent(m_widget, (ulong)(event.timestamp*1000), + // QEvent::TouchUpdate, QTouchEvent::TouchScreen, + // [self touchPointsForTouches:touches]); + [self sendMouseEventForTouches:touches withEvent:event fakeButtons:Qt::LeftButton]; +} + +- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event +{ + //QWindowSystemInterface::handleTouchEvent(m_widget, (ulong)(event.timestamp*1000), + // QEvent::TouchEnd, QTouchEvent::TouchScreen, + // [self touchPointsForTouches:touches]); + [self sendMouseEventForTouches:touches withEvent:event fakeButtons:Qt::NoButton]; +} + +- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event +{ + //QWindowSystemInterface::handleTouchEvent(m_widget, (ulong)(event.timestamp*1000), + // QEvent::TouchEnd, QTouchEvent::TouchScreen, + // [self touchPointsForTouches:touches]); + [self sendMouseEventForTouches:touches withEvent:event fakeButtons:Qt::NoButton]; +} + +@end + +QT_BEGIN_NAMESPACE + +QUIKitWindowSurface::QUIKitWindowSurface(QWidget *window) + : QWindowSurface(window) +{ + QUIKitWindow *platformWindow = static_cast<QUIKitWindow *>(window->platformWindow()); + Q_ASSERT(platformWindow); + const QRect geo = window->geometry(); + mView = [[QImageView alloc] initWithFrame:CGRectMake(geo.x(),geo.y(),geo.width(),geo.height())]; + [mView setMultipleTouchEnabled:YES]; + [mView setWidget:window]; + mImage = new QImage(window->size(),QImage::Format_ARGB32_Premultiplied); + [mView setImage:mImage]; + if (platformWindow->nativeWindow()) { + [platformWindow->nativeWindow() addSubview:mView]; + [mView setNeedsDisplay]; + } +} + +QPaintDevice *QUIKitWindowSurface::paintDevice() +{ + return mImage; +} + +void QUIKitWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) +{ + Q_UNUSED(widget); + Q_UNUSED(offset); + + QRect geo = region.boundingRect(); + [mView setNeedsDisplayInRect:CGRectMake(geo.x(),geo.y(),geo.width(),geo.height())]; +} + +void QUIKitWindowSurface::resize (const QSize &size) +{ + QWindowSurface::resize(size); + + delete mImage; + mImage = new QImage(size,QImage::Format_ARGB32_Premultiplied); + [mView setImage:mImage]; + const QRect geo = geometry(); + [mView setFrame:CGRectMake(geo.x(), geo.y(), size.width(), size.height())]; + [mView setNeedsDisplay]; +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/uikit/uikit.pro b/src/plugins/platforms/uikit/uikit.pro new file mode 100644 index 0000000..b73c334 --- /dev/null +++ b/src/plugins/platforms/uikit/uikit.pro @@ -0,0 +1,23 @@ +TARGET = quikit +include(../../qpluginbase.pri) +QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforms + +OBJECTIVE_SOURCES = main.mm \ + quikitintegration.mm \ + quikitwindow.mm \ + quikitscreen.mm \ + quikiteventloop.mm \ + quikitwindowsurface.mm + +OBJECTIVE_HEADERS = quikitintegration.h \ + quikitwindow.h \ + quikitscreen.h \ + quikiteventloop.h \ + quikitwindowsurface.h + +#add libz for freetype. +LIBS += -lz + +#include(../fontdatabases/basicunix/basicunix.pri) +target.path += $$[QT_INSTALL_PLUGINS]/platforms +INSTALLS += target -- cgit v0.12 From db1ccf9d57f19cf01efb020b6d1967ef6084a8e3 Mon Sep 17 00:00:00 2001 From: Martin Petersson <martin.petersson@nokia.com> Date: Thu, 10 Mar 2011 15:07:15 +0100 Subject: Mac: Center the Window title on Cocoa. Task-number: QTBUG-13593 Reviewed-by: Richard Moe Gustavsen --- src/gui/kernel/qwidget_mac.mm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index 9a5a5f1..14a90ef 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -3239,6 +3239,8 @@ void QWidgetPrivate::setWindowIcon_sys(bool forceReset) ReleaseIconRef(previousIcon); #else QMacCocoaAutoReleasePool pool; + if (icon.isNull()) + return; NSButton *iconButton = [qt_mac_window_for(q) standardWindowButton:NSWindowDocumentIconButton]; if (iconButton == nil) { QCFString string(q->windowTitle()); -- cgit v0.12 From dc96e9a935d8a48bae173b4febfb3bf32b34788d Mon Sep 17 00:00:00 2001 From: con <qtc-committer@nokia.com> Date: Thu, 10 Mar 2011 17:53:45 +0100 Subject: Fix http in combination with QT_NO_NETWORKPROXY. --- src/corelib/global/qfeatures.h | 2 +- src/corelib/global/qfeatures.txt | 2 +- src/network/access/qhttpnetworkconnectionchannel.cpp | 7 ++++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/corelib/global/qfeatures.h b/src/corelib/global/qfeatures.h index b26563a..d1a73a6 100644 --- a/src/corelib/global/qfeatures.h +++ b/src/corelib/global/qfeatures.h @@ -579,7 +579,7 @@ #endif // Hyper Text Transfer Protocol -#if !defined(QT_NO_HTTP) && (defined(QT_NO_HOSTINFO) || defined(QT_NO_NETWORKPROXY)) +#if !defined(QT_NO_HTTP) && defined(QT_NO_HOSTINFO) #define QT_NO_HTTP #endif diff --git a/src/corelib/global/qfeatures.txt b/src/corelib/global/qfeatures.txt index f07fbd5..4d938a9 100644 --- a/src/corelib/global/qfeatures.txt +++ b/src/corelib/global/qfeatures.txt @@ -1050,7 +1050,7 @@ SeeAlso: ??? Feature: HTTP Description: Supports HTTP file access. Section: Networking -Requires: HOSTINFO NETWORKPROXY +Requires: HOSTINFO Name: Hyper Text Transfer Protocol SeeAlso: ??? diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp index 079f608..228bc58 100644 --- a/src/network/access/qhttpnetworkconnectionchannel.cpp +++ b/src/network/access/qhttpnetworkconnectionchannel.cpp @@ -91,8 +91,10 @@ void QHttpNetworkConnectionChannel::init() #else socket = new QTcpSocket; #endif +#ifndef QT_NO_NETWORKPROXY // Set by QNAM anyway, but let's be safe here socket->setProxy(QNetworkProxy::NoProxy); +#endif QObject::connect(socket, SIGNAL(bytesWritten(qint64)), this, SLOT(_q_bytesWritten(qint64)), @@ -581,13 +583,15 @@ bool QHttpNetworkConnectionChannel::ensureConnection() #endif } else { // In case of no proxy we can use the Unbuffered QTcpSocket +#ifndef QT_NO_NETWORKPROXY if (connection->d_func()->networkProxy.type() == QNetworkProxy::NoProxy && connection->cacheProxy().type() == QNetworkProxy::NoProxy && connection->transparentProxy().type() == QNetworkProxy::NoProxy) { +#endif socket->connectToHost(connectHost, connectPort, QIODevice::ReadWrite | QIODevice::Unbuffered); // For an Unbuffered QTcpSocket, the read buffer size has a special meaning. socket->setReadBufferSize(1*1024); - +#ifndef QT_NO_NETWORKPROXY } else { socket->connectToHost(connectHost, connectPort); @@ -596,6 +600,7 @@ bool QHttpNetworkConnectionChannel::ensureConnection() // here and there. socket->setReadBufferSize(64*1024); } +#endif } return false; } -- cgit v0.12 From b2fb53bcfcac393c31a1dd4f2ef5e6111cb9f51c Mon Sep 17 00:00:00 2001 From: con <qtc-committer@nokia.com> Date: Thu, 10 Mar 2011 20:45:04 +0100 Subject: XmlPatterns actually compiles and runs. --- src/plugins/platforms/uikit/README | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/uikit/README b/src/plugins/platforms/uikit/README index 19ec83f..7477cb0 100644 --- a/src/plugins/platforms/uikit/README +++ b/src/plugins/platforms/uikit/README @@ -18,11 +18,11 @@ After configuring and building Qt you need to also build src/plugins/platforms/u Simulator: ---------- -configure -qpa -xplatform qws/macx-iphonesimulator-g++ -arch i386 -developer-build -no-accessibility -no-qt3support -no-xmlpatterns -no-multimedia -no-phonon -no-phonon-backend -no-svg -no-webkit -no-scripttools -no-openssl -no-sql-mysql -no-sql-odbc -no-cups -no-iconv -no-dbus -no-opengl -static -nomake tools -nomake demos -nomake docs -nomake examples -nomake translations +configure -qpa -xplatform qws/macx-iphonesimulator-g++ -arch i386 -developer-build -no-accessibility -no-qt3support -no-multimedia -no-phonon -no-phonon-backend -no-svg -no-webkit -no-scripttools -no-openssl -no-sql-mysql -no-sql-odbc -no-cups -no-iconv -no-dbus -no-opengl -static -nomake tools -nomake demos -nomake docs -nomake examples -nomake translations Device: ------- -configure -qpa -xplatform qws/macx-iphonedevice-g++ -arch armv7 -developer-build -no-accessibility -no-qt3support -no-xmlpatterns -no-multimedia -no-phonon -no-phonon-backend -no-svg -no-webkit -no-scripttools -no-openssl -no-sql-mysql -no-sql-odbc -no-cups -no-iconv -no-dbus -no-opengl -static -nomake tools -nomake demos -nomake docs -nomake examples -nomake translations +configure -qpa -xplatform qws/macx-iphonedevice-g++ -arch armv7 -developer-build -no-accessibility -no-qt3support -no-multimedia -no-phonon -no-phonon-backend -no-svg -no-webkit -no-scripttools -no-openssl -no-sql-mysql -no-sql-odbc -no-cups -no-iconv -no-dbus -no-opengl -static -nomake tools -nomake demos -nomake docs -nomake examples -nomake translations 2) XCode setup: - there are examples in the examples subdirectory of the platform plugin -- cgit v0.12 From 48ebe36a8b5d101c5dcad26d88d6fc0504fc9319 Mon Sep 17 00:00:00 2001 From: con <qtc-committer@nokia.com> Date: Fri, 11 Mar 2011 11:31:58 +0100 Subject: Do release build for devices and remove some warnings. --- mkspecs/qws/macx-iphonedevice-g++/qmake.conf | 5 +- mkspecs/qws/macx-iphonesimulator-g++/qmake.conf | 1 + src/plugins/platforms/uikit/README | 2 +- .../qmltest/qmltest.xcodeproj/project.pbxproj | 64 ++++++++++++---------- src/plugins/platforms/uikit/quikiteventloop.mm | 6 +- src/plugins/platforms/uikit/quikitwindow.mm | 1 + 6 files changed, 46 insertions(+), 33 deletions(-) diff --git a/mkspecs/qws/macx-iphonedevice-g++/qmake.conf b/mkspecs/qws/macx-iphonedevice-g++/qmake.conf index 2cef3df..36b9496 100644 --- a/mkspecs/qws/macx-iphonedevice-g++/qmake.conf +++ b/mkspecs/qws/macx-iphonedevice-g++/qmake.conf @@ -2,6 +2,7 @@ # qmake configuration for iphone-device-g++ # include(../../common/mac.conf) +include(../../common/gcc-base-macx.conf) include(../../common/g++-macx.conf) MAKEFILE_GENERATOR = UNIX @@ -27,9 +28,9 @@ QMAKE_CXX = /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/g++- QMAKE_LINK = $$QMAKE_CXX QMAKE_LINK_SHLIB = $$QMAKE_CXX -QMAKE_CFLAGS += -arch armv7 -marm -isysroot $$QMAKE_IOS_SDK -fmessage-length=0 -fexceptions -miphoneos-version-min=4.2 -gdwarf-2 +QMAKE_CFLAGS += -arch armv7 -marm -isysroot $$QMAKE_IOS_SDK -fmessage-length=0 -fexceptions -miphoneos-version-min=4.2 QMAKE_CXXFLAGS += $$QMAKE_CFLAGS -QMAKE_OBJECTIVE_CFLAGS += -arch armv7 -marm -isysroot $$QMAKE_IOS_SDK -fmessage-length=0 -fexceptions -miphoneos-version-min=4.2 -gdwarf-2 -fobjc-abi-version=2 -fobjc-legacy-dispatch +QMAKE_OBJECTIVE_CFLAGS += -arch armv7 -marm -isysroot $$QMAKE_IOS_SDK -fmessage-length=0 -fexceptions -miphoneos-version-min=4.2 -fobjc-abi-version=2 -fobjc-legacy-dispatch QMAKE_LFLAGS += -arch armv7 -marm -miphoneos-version-min=4.2 -Wl,-syslibroot,$$QMAKE_IOS_SDK QMAKE_INCDIR_OPENGL = diff --git a/mkspecs/qws/macx-iphonesimulator-g++/qmake.conf b/mkspecs/qws/macx-iphonesimulator-g++/qmake.conf index 9a06857..dccab70 100644 --- a/mkspecs/qws/macx-iphonesimulator-g++/qmake.conf +++ b/mkspecs/qws/macx-iphonesimulator-g++/qmake.conf @@ -2,6 +2,7 @@ # qmake configuration for macx-g++ # include(../../common/mac.conf) +include(../../common/gcc-base-macx.conf) include(../../common/g++-macx.conf) MAKEFILE_GENERATOR = UNIX diff --git a/src/plugins/platforms/uikit/README b/src/plugins/platforms/uikit/README index 7477cb0..b2984fc 100644 --- a/src/plugins/platforms/uikit/README +++ b/src/plugins/platforms/uikit/README @@ -22,7 +22,7 @@ configure -qpa -xplatform qws/macx-iphonesimulator-g++ -arch i386 -developer-bui Device: ------- -configure -qpa -xplatform qws/macx-iphonedevice-g++ -arch armv7 -developer-build -no-accessibility -no-qt3support -no-multimedia -no-phonon -no-phonon-backend -no-svg -no-webkit -no-scripttools -no-openssl -no-sql-mysql -no-sql-odbc -no-cups -no-iconv -no-dbus -no-opengl -static -nomake tools -nomake demos -nomake docs -nomake examples -nomake translations +configure -qpa -xplatform qws/macx-iphonedevice-g++ -arch armv7 -developer-build -release -no-accessibility -no-qt3support -no-multimedia -no-phonon -no-phonon-backend -no-svg -no-webkit -no-scripttools -no-openssl -no-sql-mysql -no-sql-odbc -no-cups -no-iconv -no-dbus -no-opengl -static -nomake tools -nomake demos -nomake docs -nomake examples -nomake translations 2) XCode setup: - there are examples in the examples subdirectory of the platform plugin diff --git a/src/plugins/platforms/uikit/examples/qmltest/qmltest.xcodeproj/project.pbxproj b/src/plugins/platforms/uikit/examples/qmltest/qmltest.xcodeproj/project.pbxproj index e105b73..fc4f1df 100755 --- a/src/plugins/platforms/uikit/examples/qmltest/qmltest.xcodeproj/project.pbxproj +++ b/src/plugins/platforms/uikit/examples/qmltest/qmltest.xcodeproj/project.pbxproj @@ -20,25 +20,27 @@ D3CAA7F113264F52008BB877 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; }; D3CAA7F213264F52008BB877 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765A40DF7441C002DB57D /* CoreGraphics.framework */; }; D3CAA7FA13264F8A008BB877 /* libz.1.2.3.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = D3CAA7F913264F8A008BB877 /* libz.1.2.3.dylib */; }; - D3CAA80613264FD5008BB877 /* libQtCore_debug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3CAA7FB13264FB9008BB877 /* libQtCore_debug.a */; }; - D3CAA80713264FD5008BB877 /* libQtDeclarative_debug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3CAA7FC13264FB9008BB877 /* libQtDeclarative_debug.a */; }; - D3CAA80813264FD6008BB877 /* libQtGui_debug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3CAA7FD13264FB9008BB877 /* libQtGui_debug.a */; }; - D3CAA80913264FD6008BB877 /* libQtScript_debug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3CAA7FE13264FB9008BB877 /* libQtScript_debug.a */; }; - D3CAA80A13264FD7008BB877 /* libQtSql_debug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3CAA7FF13264FB9008BB877 /* libQtSql_debug.a */; }; D3CAA81113264FF0008BB877 /* libz.1.2.3.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = D3CAA7F913264F8A008BB877 /* libz.1.2.3.dylib */; }; - D3CAA81313265005008BB877 /* libquikit_debug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3CAA81213265005008BB877 /* libquikit_debug.a */; }; D3CAA81B13265056008BB877 /* libQtCore_debug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3CAA81613265056008BB877 /* libQtCore_debug.a */; }; D3CAA81C13265056008BB877 /* libQtDeclarative_debug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3CAA81713265056008BB877 /* libQtDeclarative_debug.a */; }; D3CAA81D13265056008BB877 /* libQtGui_debug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3CAA81813265056008BB877 /* libQtGui_debug.a */; }; D3CAA81E13265056008BB877 /* libQtScript_debug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3CAA81913265056008BB877 /* libQtScript_debug.a */; }; D3CAA81F13265056008BB877 /* libQtSql_debug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3CAA81A13265056008BB877 /* libQtSql_debug.a */; }; D3CAA8211326507D008BB877 /* libquikit_debug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3CAA8201326507D008BB877 /* libquikit_debug.a */; }; - D3CAA8261326520A008BB877 /* libQtNetwork_debug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3CAA8251326520A008BB877 /* libQtNetwork_debug.a */; }; D3CAA82813265220008BB877 /* libQtNetwork_debug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3CAA82713265220008BB877 /* libQtNetwork_debug.a */; }; D3CAA88A132652E5008BB877 /* fonts in Resources */ = {isa = PBXBuildFile; fileRef = D3CAA836132652E5008BB877 /* fonts */; }; D3CAA88B132652E5008BB877 /* fonts in Resources */ = {isa = PBXBuildFile; fileRef = D3CAA836132652E5008BB877 /* fonts */; }; D3CAA89113265310008BB877 /* qml in Resources */ = {isa = PBXBuildFile; fileRef = D3CAA88E13265310008BB877 /* qml */; }; D3CAA89213265310008BB877 /* qml in Resources */ = {isa = PBXBuildFile; fileRef = D3CAA88E13265310008BB877 /* qml */; }; + D3D817B2132A2CFD00CDE422 /* libQtCore.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3D817AA132A2CFD00CDE422 /* libQtCore.a */; }; + D3D817B3132A2CFD00CDE422 /* libQtDeclarative.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3D817AB132A2CFD00CDE422 /* libQtDeclarative.a */; }; + D3D817B4132A2CFD00CDE422 /* libQtGui.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3D817AC132A2CFD00CDE422 /* libQtGui.a */; }; + D3D817B5132A2CFD00CDE422 /* libQtNetwork.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3D817AD132A2CFD00CDE422 /* libQtNetwork.a */; }; + D3D817B6132A2CFD00CDE422 /* libQtScript.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3D817AE132A2CFD00CDE422 /* libQtScript.a */; }; + D3D817B7132A2CFD00CDE422 /* libQtSql.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3D817AF132A2CFD00CDE422 /* libQtSql.a */; }; + D3D817B8132A2CFD00CDE422 /* libQtXml.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3D817B0132A2CFD00CDE422 /* libQtXml.a */; }; + D3D817B9132A2CFD00CDE422 /* libQtXmlPatterns.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3D817B1132A2CFD00CDE422 /* libQtXmlPatterns.a */; }; + D3D817BB132A2D0E00CDE422 /* libquikit.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3D817BA132A2D0E00CDE422 /* libquikit.a */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -54,22 +56,24 @@ D3CAA7E513264EA6008BB877 /* qmlapplicationviewer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = qmlapplicationviewer.h; path = qmlapplicationviewer/qmlapplicationviewer.h; sourceTree = "<group>"; }; D3CAA7F613264F52008BB877 /* qmltest.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = qmltest.app; sourceTree = BUILT_PRODUCTS_DIR; }; D3CAA7F913264F8A008BB877 /* libz.1.2.3.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.1.2.3.dylib; path = usr/lib/libz.1.2.3.dylib; sourceTree = SDKROOT; }; - D3CAA7FB13264FB9008BB877 /* libQtCore_debug.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtCore_debug.a; path = "../../../../../../../qt-lighthouse-ios-device/lib/libQtCore_debug.a"; sourceTree = SOURCE_ROOT; }; - D3CAA7FC13264FB9008BB877 /* libQtDeclarative_debug.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtDeclarative_debug.a; path = "../../../../../../../qt-lighthouse-ios-device/lib/libQtDeclarative_debug.a"; sourceTree = SOURCE_ROOT; }; - D3CAA7FD13264FB9008BB877 /* libQtGui_debug.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtGui_debug.a; path = "../../../../../../../qt-lighthouse-ios-device/lib/libQtGui_debug.a"; sourceTree = SOURCE_ROOT; }; - D3CAA7FE13264FB9008BB877 /* libQtScript_debug.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtScript_debug.a; path = "../../../../../../../qt-lighthouse-ios-device/lib/libQtScript_debug.a"; sourceTree = SOURCE_ROOT; }; - D3CAA7FF13264FB9008BB877 /* libQtSql_debug.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtSql_debug.a; path = "../../../../../../../qt-lighthouse-ios-device/lib/libQtSql_debug.a"; sourceTree = SOURCE_ROOT; }; - D3CAA81213265005008BB877 /* libquikit_debug.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libquikit_debug.a; path = "../../../../../../../qt-lighthouse-ios-device/plugins/platforms/libquikit_debug.a"; sourceTree = SOURCE_ROOT; }; D3CAA81613265056008BB877 /* libQtCore_debug.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtCore_debug.a; path = "../../../../../../../qt-lighthouse-ios-simulator/lib/libQtCore_debug.a"; sourceTree = SOURCE_ROOT; }; D3CAA81713265056008BB877 /* libQtDeclarative_debug.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtDeclarative_debug.a; path = "../../../../../../../qt-lighthouse-ios-simulator/lib/libQtDeclarative_debug.a"; sourceTree = SOURCE_ROOT; }; D3CAA81813265056008BB877 /* libQtGui_debug.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtGui_debug.a; path = "../../../../../../../qt-lighthouse-ios-simulator/lib/libQtGui_debug.a"; sourceTree = SOURCE_ROOT; }; D3CAA81913265056008BB877 /* libQtScript_debug.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtScript_debug.a; path = "../../../../../../../qt-lighthouse-ios-simulator/lib/libQtScript_debug.a"; sourceTree = SOURCE_ROOT; }; D3CAA81A13265056008BB877 /* libQtSql_debug.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtSql_debug.a; path = "../../../../../../../qt-lighthouse-ios-simulator/lib/libQtSql_debug.a"; sourceTree = SOURCE_ROOT; }; D3CAA8201326507D008BB877 /* libquikit_debug.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libquikit_debug.a; path = "../../../../../../../qt-lighthouse-ios-simulator/plugins/platforms/libquikit_debug.a"; sourceTree = SOURCE_ROOT; }; - D3CAA8251326520A008BB877 /* libQtNetwork_debug.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtNetwork_debug.a; path = "../../../../../../../qt-lighthouse-ios-device/lib/libQtNetwork_debug.a"; sourceTree = SOURCE_ROOT; }; D3CAA82713265220008BB877 /* libQtNetwork_debug.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtNetwork_debug.a; path = "../../../../../../../qt-lighthouse-ios-simulator/lib/libQtNetwork_debug.a"; sourceTree = SOURCE_ROOT; }; D3CAA836132652E5008BB877 /* fonts */ = {isa = PBXFileReference; lastKnownFileType = folder; name = fonts; path = ../../../../../../lib/fonts; sourceTree = SOURCE_ROOT; }; D3CAA88E13265310008BB877 /* qml */ = {isa = PBXFileReference; lastKnownFileType = folder; path = qml; sourceTree = SOURCE_ROOT; }; + D3D817AA132A2CFD00CDE422 /* libQtCore.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtCore.a; path = "../../../../../../../qt-lighthouse-ios-device/lib/libQtCore.a"; sourceTree = SOURCE_ROOT; }; + D3D817AB132A2CFD00CDE422 /* libQtDeclarative.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtDeclarative.a; path = "../../../../../../../qt-lighthouse-ios-device/lib/libQtDeclarative.a"; sourceTree = SOURCE_ROOT; }; + D3D817AC132A2CFD00CDE422 /* libQtGui.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtGui.a; path = "../../../../../../../qt-lighthouse-ios-device/lib/libQtGui.a"; sourceTree = SOURCE_ROOT; }; + D3D817AD132A2CFD00CDE422 /* libQtNetwork.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtNetwork.a; path = "../../../../../../../qt-lighthouse-ios-device/lib/libQtNetwork.a"; sourceTree = SOURCE_ROOT; }; + D3D817AE132A2CFD00CDE422 /* libQtScript.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtScript.a; path = "../../../../../../../qt-lighthouse-ios-device/lib/libQtScript.a"; sourceTree = SOURCE_ROOT; }; + D3D817AF132A2CFD00CDE422 /* libQtSql.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtSql.a; path = "../../../../../../../qt-lighthouse-ios-device/lib/libQtSql.a"; sourceTree = SOURCE_ROOT; }; + D3D817B0132A2CFD00CDE422 /* libQtXml.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtXml.a; path = "../../../../../../../qt-lighthouse-ios-device/lib/libQtXml.a"; sourceTree = SOURCE_ROOT; }; + D3D817B1132A2CFD00CDE422 /* libQtXmlPatterns.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtXmlPatterns.a; path = "../../../../../../../qt-lighthouse-ios-device/lib/libQtXmlPatterns.a"; sourceTree = SOURCE_ROOT; }; + D3D817BA132A2D0E00CDE422 /* libquikit.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libquikit.a; path = "../../../../../../../qt-lighthouse-ios-device/plugins/platforms/libquikit.a"; sourceTree = SOURCE_ROOT; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -98,14 +102,16 @@ D3CAA7F013264F52008BB877 /* Foundation.framework in Frameworks */, D3CAA7F113264F52008BB877 /* UIKit.framework in Frameworks */, D3CAA7F213264F52008BB877 /* CoreGraphics.framework in Frameworks */, - D3CAA80613264FD5008BB877 /* libQtCore_debug.a in Frameworks */, - D3CAA80713264FD5008BB877 /* libQtDeclarative_debug.a in Frameworks */, - D3CAA80813264FD6008BB877 /* libQtGui_debug.a in Frameworks */, - D3CAA80913264FD6008BB877 /* libQtScript_debug.a in Frameworks */, - D3CAA80A13264FD7008BB877 /* libQtSql_debug.a in Frameworks */, D3CAA81113264FF0008BB877 /* libz.1.2.3.dylib in Frameworks */, - D3CAA81313265005008BB877 /* libquikit_debug.a in Frameworks */, - D3CAA8261326520A008BB877 /* libQtNetwork_debug.a in Frameworks */, + D3D817B2132A2CFD00CDE422 /* libQtCore.a in Frameworks */, + D3D817B3132A2CFD00CDE422 /* libQtDeclarative.a in Frameworks */, + D3D817B4132A2CFD00CDE422 /* libQtGui.a in Frameworks */, + D3D817B5132A2CFD00CDE422 /* libQtNetwork.a in Frameworks */, + D3D817B6132A2CFD00CDE422 /* libQtScript.a in Frameworks */, + D3D817B7132A2CFD00CDE422 /* libQtSql.a in Frameworks */, + D3D817B8132A2CFD00CDE422 /* libQtXml.a in Frameworks */, + D3D817B9132A2CFD00CDE422 /* libQtXmlPatterns.a in Frameworks */, + D3D817BB132A2D0E00CDE422 /* libquikit.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -178,13 +184,15 @@ D3CAA8141326500A008BB877 /* Device */ = { isa = PBXGroup; children = ( - D3CAA81213265005008BB877 /* libquikit_debug.a */, - D3CAA7FB13264FB9008BB877 /* libQtCore_debug.a */, - D3CAA7FC13264FB9008BB877 /* libQtDeclarative_debug.a */, - D3CAA7FD13264FB9008BB877 /* libQtGui_debug.a */, - D3CAA8251326520A008BB877 /* libQtNetwork_debug.a */, - D3CAA7FE13264FB9008BB877 /* libQtScript_debug.a */, - D3CAA7FF13264FB9008BB877 /* libQtSql_debug.a */, + D3D817BA132A2D0E00CDE422 /* libquikit.a */, + D3D817AA132A2CFD00CDE422 /* libQtCore.a */, + D3D817AB132A2CFD00CDE422 /* libQtDeclarative.a */, + D3D817AC132A2CFD00CDE422 /* libQtGui.a */, + D3D817AD132A2CFD00CDE422 /* libQtNetwork.a */, + D3D817AE132A2CFD00CDE422 /* libQtScript.a */, + D3D817AF132A2CFD00CDE422 /* libQtSql.a */, + D3D817B0132A2CFD00CDE422 /* libQtXml.a */, + D3D817B1132A2CFD00CDE422 /* libQtXmlPatterns.a */, ); name = Device; sourceTree = "<group>"; diff --git a/src/plugins/platforms/uikit/quikiteventloop.mm b/src/plugins/platforms/uikit/quikiteventloop.mm index 4469ae9..78f046e 100644 --- a/src/plugins/platforms/uikit/quikiteventloop.mm +++ b/src/plugins/platforms/uikit/quikiteventloop.mm @@ -68,9 +68,10 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { + Q_UNUSED(launchOptions) foreach (QWidget *widget, qApp->topLevelWidgets()) { QRect geom = widget->geometry(); - CGRect bar = [UIApplication sharedApplication].statusBarFrame; + CGRect bar = application.statusBarFrame; if (geom.y() <= bar.size.height) { geom.setY(bar.size.height); widget->setGeometry(geom); @@ -87,6 +88,7 @@ - (void)applicationWillTerminate:(UIApplication *)application { + Q_UNUSED(application) // TODO this isn't called for some reason qDebug() << "quit"; qApp->quit(); @@ -98,7 +100,7 @@ - (id)initWithEventLoopIntegration:(QUIKitEventLoop *)integration { - if (self = [self init]) { + if ((self = [self init])) { mIntegration = integration; } return self; diff --git a/src/plugins/platforms/uikit/quikitwindow.mm b/src/plugins/platforms/uikit/quikitwindow.mm index 4ac7447..457598b 100644 --- a/src/plugins/platforms/uikit/quikitwindow.mm +++ b/src/plugins/platforms/uikit/quikitwindow.mm @@ -83,6 +83,7 @@ UIWindow *QUIKitWindow::ensureNativeWindow() mWindow.frame = frame; // for some reason setting the screen resets frame.origin [mWindow setNeedsDisplay]; } + return mWindow; } QT_END_NAMESPACE -- cgit v0.12 From ccd2feb1ec829af15073763218c258cb4d0b0525 Mon Sep 17 00:00:00 2001 From: Rohan McGovern <rohan.mcgovern@nokia.com> Date: Mon, 14 Mar 2011 10:51:50 +1000 Subject: Harmattan: fixed license headers. --- config.profiles/harmattan/configure-pulse.sh | 41 +++++++++++++++++++++++++ config.profiles/harmattan/manpages/lrelease.1 | 44 ++++++++++++++++++++------- config.profiles/harmattan/manpages/lupdate.1 | 44 ++++++++++++++++++++------- config.profiles/harmattan/manpages/moc.1 | 40 +++++++++++++++++++++--- config.profiles/harmattan/manpages/qmake.1 | 38 +++++++++++++++++++++++ config.profiles/harmattan/manpages/qtconfig.1 | 40 +++++++++++++++++++++++- config.profiles/harmattan/manpages/uic.1 | 40 +++++++++++++++++++++--- config.profiles/harmattan/readdir-hppa-test.c | 40 ++++++++++++++++++++++++ 8 files changed, 295 insertions(+), 32 deletions(-) diff --git a/config.profiles/harmattan/configure-pulse.sh b/config.profiles/harmattan/configure-pulse.sh index c683705..bc1615b 100755 --- a/config.profiles/harmattan/configure-pulse.sh +++ b/config.profiles/harmattan/configure-pulse.sh @@ -1,4 +1,45 @@ #/bin/sh +############################################################################# +## +## Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +## All rights reserved. +## Contact: Nokia Corporation (qt-info@nokia.com) +## +## This file is the build configuration utility of the Qt Toolkit. +## +## $QT_BEGIN_LICENSE:LGPL$ +## No Commercial Usage +## This file contains pre-release code and may not be distributed. +## You may use this file in accordance with the terms and conditions +## contained in the Technology Preview License Agreement accompanying +## this package. +## +## 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, Nokia gives you certain additional +## rights. These rights are described in the Nokia Qt LGPL Exception +## version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +## +## If you have questions regarding the use of this file, please contact +## Nokia at qt-info@nokia.com. +## +## +## +## +## +## +## +## +## $QT_END_LICENSE$ +## +############################################################################# + # Fail on error set -e diff --git a/config.profiles/harmattan/manpages/lrelease.1 b/config.profiles/harmattan/manpages/lrelease.1 index 174d40c..79a10fe 100644 --- a/config.profiles/harmattan/manpages/lrelease.1 +++ b/config.profiles/harmattan/manpages/lrelease.1 @@ -1,19 +1,41 @@ -.TH lrelease 1 "18 October 2001" "Trolltech AS" \" -*- nroff -*- +.TH lrelease 1 "18 October 2001" "Nokia Corporation and/or its subsidiary(-ies)" \" -*- nroff -*- .\" -.\" Copyright 2001 Trolltech AS. All rights reserved. +.\" Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +.\" All rights reserved. +.\" Contact: Nokia Corporation (qt-info@nokia.com) .\" -.\" This file may be distributed and/or modified under the terms of the -.\" GNU General Public License version 2 as published by the Free Software -.\" Foundation and appearing in the file LICENSE.GPL included in the -.\" packaging of this file. +.\" This file is part of the QtGui module of the Qt Toolkit. .\" -.\" This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -.\" WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +.\" $QT_BEGIN_LICENSE:LGPL$ +.\" No Commercial Usage +.\" This file contains pre-release code and may not be distributed. +.\" You may use this file in accordance with the terms and conditions +.\" contained in the Technology Preview License Agreement accompanying +.\" this package. .\" -.\" See http://www.trolltech.com/gpl/ for GPL licensing information. +.\" 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. .\" -.\" Contact info@trolltech.com if any conditions of this licensing are -.\" not clear to you. +.\" In addition, as a special exception, Nokia gives you certain additional +.\" rights. These rights are described in the Nokia Qt LGPL Exception +.\" version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +.\" +.\" If you have questions regarding the use of this file, please contact +.\" Nokia at qt-info@nokia.com. +.\" +.\" +.\" +.\" +.\" +.\" +.\" +.\" +.\" $QT_END_LICENSE$ .\" .SH NAME lrelease \- generate Qt message files from Qt Linguist translation files diff --git a/config.profiles/harmattan/manpages/lupdate.1 b/config.profiles/harmattan/manpages/lupdate.1 index 722657d..c0771df 100644 --- a/config.profiles/harmattan/manpages/lupdate.1 +++ b/config.profiles/harmattan/manpages/lupdate.1 @@ -1,19 +1,41 @@ -.TH lupdate 1 "18 October 2001" "Trolltech AS" \" -*- nroff -*- +.TH lupdate 1 "18 October 2001" "Nokia Corporation and/or its subsidiary(-ies)" \" -*- nroff -*- .\" -.\" Copyright 2001 Trolltech AS. All rights reserved. +.\" Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +.\" All rights reserved. +.\" Contact: Nokia Corporation (qt-info@nokia.com) .\" -.\" This file may be distributed and/or modified under the terms of the -.\" GNU General Public License version 2 as published by the Free Software -.\" Foundation and appearing in the file LICENSE.GPL included in the -.\" packaging of this file. +.\" This file is part of the QtGui module of the Qt Toolkit. .\" -.\" This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -.\" WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +.\" $QT_BEGIN_LICENSE:LGPL$ +.\" No Commercial Usage +.\" This file contains pre-release code and may not be distributed. +.\" You may use this file in accordance with the terms and conditions +.\" contained in the Technology Preview License Agreement accompanying +.\" this package. .\" -.\" See http://www.trolltech.com/gpl/ for GPL licensing information. +.\" 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. .\" -.\" Contact info@trolltech.com if any conditions of this licensing are -.\" not clear to you. +.\" In addition, as a special exception, Nokia gives you certain additional +.\" rights. These rights are described in the Nokia Qt LGPL Exception +.\" version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +.\" +.\" If you have questions regarding the use of this file, please contact +.\" Nokia at qt-info@nokia.com. +.\" +.\" +.\" +.\" +.\" +.\" +.\" +.\" +.\" $QT_END_LICENSE$ .\" .SH NAME lupdate \- update Qt Linguist translation files diff --git a/config.profiles/harmattan/manpages/moc.1 b/config.profiles/harmattan/manpages/moc.1 index 131827a..a11e101 100644 --- a/config.profiles/harmattan/manpages/moc.1 +++ b/config.profiles/harmattan/manpages/moc.1 @@ -1,11 +1,41 @@ -.TH moc 1 "24 June 2001" "Trolltech AS" \" -*- nroff -*- +.TH moc 1 "24 June 2001" "Nokia Corporation and/or its subsidiary(-ies)" \" -*- nroff -*- .\" -.\" $Id: qt/moc.1 3.3.4 edited May 27 2003 $ +.\" Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +.\" All rights reserved. +.\" Contact: Nokia Corporation (qt-info@nokia.com) .\" -.\" Copyright 1992-2002 Trolltech AS. All rights reserved. +.\" This file is part of the QtGui module of the Qt Toolkit. .\" -.\" This file is part of Qt and may be distributed and used according to -.\" the terms and conditions described in the LICENSE file. +.\" $QT_BEGIN_LICENSE:LGPL$ +.\" No Commercial Usage +.\" This file contains pre-release code and may not be distributed. +.\" You may use this file in accordance with the terms and conditions +.\" contained in the Technology Preview License Agreement accompanying +.\" this package. +.\" +.\" 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, Nokia gives you certain additional +.\" rights. These rights are described in the Nokia Qt LGPL Exception +.\" version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +.\" +.\" If you have questions regarding the use of this file, please contact +.\" Nokia at qt-info@nokia.com. +.\" +.\" +.\" +.\" +.\" +.\" +.\" +.\" +.\" $QT_END_LICENSE$ .\" .nh .SH NAME diff --git a/config.profiles/harmattan/manpages/qmake.1 b/config.profiles/harmattan/manpages/qmake.1 index 62ab78a..b6e2c30 100644 --- a/config.profiles/harmattan/manpages/qmake.1 +++ b/config.profiles/harmattan/manpages/qmake.1 @@ -1,4 +1,42 @@ .TH QMAKE 1 "2005-07-23" +.\" +.\" Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +.\" All rights reserved. +.\" Contact: Nokia Corporation (qt-info@nokia.com) +.\" +.\" This file is part of the QtGui module of the Qt Toolkit. +.\" +.\" $QT_BEGIN_LICENSE:LGPL$ +.\" No Commercial Usage +.\" This file contains pre-release code and may not be distributed. +.\" You may use this file in accordance with the terms and conditions +.\" contained in the Technology Preview License Agreement accompanying +.\" this package. +.\" +.\" 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, Nokia gives you certain additional +.\" rights. These rights are described in the Nokia Qt LGPL Exception +.\" version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +.\" +.\" If you have questions regarding the use of this file, please contact +.\" Nokia at qt-info@nokia.com. +.\" +.\" +.\" +.\" +.\" +.\" +.\" +.\" +.\" $QT_END_LICENSE$ +.\" .SH NAME qmake \- cross-platform makefile generator for Qt diff --git a/config.profiles/harmattan/manpages/qtconfig.1 b/config.profiles/harmattan/manpages/qtconfig.1 index 08989fb..854c88f 100644 --- a/config.profiles/harmattan/manpages/qtconfig.1 +++ b/config.profiles/harmattan/manpages/qtconfig.1 @@ -1,4 +1,42 @@ -.TH "qtconfig" "1" "3.0.3" "Troll Tech AS, Norway." "" +.TH "qtconfig" "1" "3.0.3" "Nokia Corporation and/or its subsidiary(-ies)" "" +.\" +.\" Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +.\" All rights reserved. +.\" Contact: Nokia Corporation (qt-info@nokia.com) +.\" +.\" This file is part of the QtGui module of the Qt Toolkit. +.\" +.\" $QT_BEGIN_LICENSE:LGPL$ +.\" No Commercial Usage +.\" This file contains pre-release code and may not be distributed. +.\" You may use this file in accordance with the terms and conditions +.\" contained in the Technology Preview License Agreement accompanying +.\" this package. +.\" +.\" 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, Nokia gives you certain additional +.\" rights. These rights are described in the Nokia Qt LGPL Exception +.\" version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +.\" +.\" If you have questions regarding the use of this file, please contact +.\" Nokia at qt-info@nokia.com. +.\" +.\" +.\" +.\" +.\" +.\" +.\" +.\" +.\" $QT_END_LICENSE$ +.\" .SH "NAME" .LP qtconfig \- Configuration tool for Qt diff --git a/config.profiles/harmattan/manpages/uic.1 b/config.profiles/harmattan/manpages/uic.1 index 79d03b8..b781900 100644 --- a/config.profiles/harmattan/manpages/uic.1 +++ b/config.profiles/harmattan/manpages/uic.1 @@ -1,9 +1,41 @@ -.TH uic 1 "2 Aug 2001" "Trolltech AS" \" -*- nroff -*- +.TH uic 1 "2 Aug 2001" "Nokia Corporation and/or its subsidiary(-ies)" \" -*- nroff -*- .\" -.\" Copyright 2000 Trolltech AS. All rights reserved. +.\" Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +.\" All rights reserved. +.\" Contact: Nokia Corporation (qt-info@nokia.com) .\" -.\" This file is part of Qt and may be distributed and used according to -.\" the terms and conditions described in the LICENSE file. +.\" This file is part of the QtGui module of the Qt Toolkit. +.\" +.\" $QT_BEGIN_LICENSE:LGPL$ +.\" No Commercial Usage +.\" This file contains pre-release code and may not be distributed. +.\" You may use this file in accordance with the terms and conditions +.\" contained in the Technology Preview License Agreement accompanying +.\" this package. +.\" +.\" 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, Nokia gives you certain additional +.\" rights. These rights are described in the Nokia Qt LGPL Exception +.\" version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +.\" +.\" If you have questions regarding the use of this file, please contact +.\" Nokia at qt-info@nokia.com. +.\" +.\" +.\" +.\" +.\" +.\" +.\" +.\" +.\" $QT_END_LICENSE$ .\" .SH NAME uic \- Qt user interface compiler diff --git a/config.profiles/harmattan/readdir-hppa-test.c b/config.profiles/harmattan/readdir-hppa-test.c index eb893ba..1162840 100644 --- a/config.profiles/harmattan/readdir-hppa-test.c +++ b/config.profiles/harmattan/readdir-hppa-test.c @@ -1,3 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the config.tests of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ #include <sys/types.h> #include <dirent.h> #include <errno.h> -- cgit v0.12 From 99aa67f649c44dda8c0da639b4925dbb0e4c9b70 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs <laszlo.p.agocs@nokia.com> Date: Mon, 14 Mar 2011 13:53:44 +0200 Subject: Fix qgraphicstransform autotest for Symbian, where qreal is float. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-17907 Reviewed-by: Samuel Rødal --- tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp b/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp index 79f2213..9434a0b 100644 --- a/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp +++ b/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp @@ -163,10 +163,11 @@ static inline bool fuzzyCompare(qreal p1, qreal p2) { // increase delta on small machines using float instead of double if (sizeof(qreal) == sizeof(float)) - return (qAbs(p1 - p2) <= 0.00002f * qMin(qAbs(p1), qAbs(p2))); + return (qAbs(p1 - p2) <= 0.00003f * qMin(qAbs(p1), qAbs(p2))); else return (qAbs(p1 - p2) <= 0.00001f * qMin(qAbs(p1), qAbs(p2))); } + static bool fuzzyCompare(const QTransform& t1, const QTransform& t2) { return fuzzyCompare(t1.m11(), t2.m11()) && @@ -180,6 +181,15 @@ static bool fuzzyCompare(const QTransform& t1, const QTransform& t2) fuzzyCompare(t1.m33(), t2.m33()); } +static inline bool fuzzyCompare(const QMatrix4x4& m1, const QMatrix4x4& m2) +{ + bool ok = true; + for (int y = 0; y < 4; ++y) + for (int x = 0; x < 4; ++x) + ok &= fuzzyCompare(m1(y, x), m2(y, x)); + return ok; +} + void tst_QGraphicsTransform::rotation() { QGraphicsRotation rotation; @@ -267,7 +277,7 @@ void tst_QGraphicsTransform::rotation3d() // because the deg2rad value in QTransform is not accurate // enough to match what QMatrix4x4 is doing. } else { - QVERIFY(qFuzzyCompare(t, r)); + QVERIFY(fuzzyCompare(t, r)); } //now let's check that a null vector will not change the transform -- cgit v0.12 From ad5ef5c565b0399c65827d67be8ff00fa8db1a68 Mon Sep 17 00:00:00 2001 From: Sami Merila <sami.merila@nokia.com> Date: Mon, 14 Mar 2011 14:23:31 +0200 Subject: QS60Style slows down layout switch by updating widgets unnecessarily Remove refreshUi() method frmo QS60Style. It might have been necessary two years ago, when we didn't have proper polishing of QWidgets (when style changed), but it is no longer needed. It just slows down orientation switch. Task-number: QTBUG-17840 Reviewed-by: Tomi Vihria --- src/gui/styles/qs60style.cpp | 19 ------------------- src/gui/styles/qs60style_p.h | 2 -- src/gui/styles/qs60style_s60.cpp | 1 - 3 files changed, 22 deletions(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 87d990e..15cb5c6 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -630,25 +630,6 @@ QPixmap QS60StylePrivate::cachedFrame(SkinFrameElements frame, const QSize &size return result; } -void QS60StylePrivate::refreshUI() -{ - QList<QWidget *> widgets = QApplication::allWidgets(); - - for (int i = 0; i < widgets.size(); ++i) { - QWidget *widget = widgets.at(i); - if (widget == 0) - continue; - - if (widget->style()) { - widget->style()->polish(widget); - QEvent event(QEvent::StyleChange); - qApp->sendEvent(widget, &event); - } - widget->update(); - widget->updateGeometry(); - } -} - void QS60StylePrivate::setFont(QWidget *widget) const { QS60StyleEnums::FontCategories fontCategory = QS60StyleEnums::FC_Undefined; diff --git a/src/gui/styles/qs60style_p.h b/src/gui/styles/qs60style_p.h index 242c451..c64cbb1 100644 --- a/src/gui/styles/qs60style_p.h +++ b/src/gui/styles/qs60style_p.h @@ -592,8 +592,6 @@ private: static QPixmap cachedFrame(SkinFrameElements frame, const QSize &size, SkinElementFlags flags = KDefaultSkinElementFlags); - static void refreshUI(); - // set S60 font for widget void setFont(QWidget *widget) const; void setThemePalette(QWidget *widget) const; diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp index 600c631..b4785dc 100644 --- a/src/gui/styles/qs60style_s60.cpp +++ b/src/gui/styles/qs60style_s60.cpp @@ -1429,7 +1429,6 @@ void QS60StylePrivate::handleDynamicLayoutVariantSwitch() { clearCaches(QS60StylePrivate::CC_LayoutChange); setActiveLayout(); - refreshUI(); foreach (QWidget *widget, QApplication::allWidgets()) widget->ensurePolished(); } -- cgit v0.12 From d0e46f9221b614007cc4dea25e0f83d10f1c2f11 Mon Sep 17 00:00:00 2001 From: Martin Petersson <martin.petersson@nokia.com> Date: Mon, 14 Mar 2011 14:20:22 +0100 Subject: Mac Style: Compile Fix Task-number: QTBUG-13055 Reviewed-by: Markus Goetz --- src/gui/styles/qmacstyle_mac.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/gui/styles/qmacstyle_mac.mm index f2ad782..18933ff 100644 --- a/src/gui/styles/qmacstyle_mac.mm +++ b/src/gui/styles/qmacstyle_mac.mm @@ -3084,7 +3084,7 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai } break; case PE_PanelScrollAreaCorner: { - const QBrush brush(opt->palette().brush(QPalette::Base)); + const QBrush brush(opt->palette.brush(QPalette::Base)); p->fillRect(opt->rect, brush); p->setPen(QPen(QColor(217, 217, 217))); p->drawLine(opt->rect.topLeft(), opt->rect.topRight()); -- cgit v0.12 From 5f2eccbc8a392784868dd9919442642b4a9f9ef8 Mon Sep 17 00:00:00 2001 From: Martin Petersson <martin.petersson@nokia.com> Date: Mon, 14 Mar 2011 14:25:33 +0100 Subject: SSL: Fix certification loading on Mac OS X 10.5 Do not add the expired certificates on Mac OS X 10.5. Task-number: QTBUG-14520 Reviewed-by: Markus Goetz --- src/network/ssl/qsslsocket_openssl.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp index 84e14ff..0866534 100644 --- a/src/network/ssl/qsslsocket_openssl.cpp +++ b/src/network/ssl/qsslsocket_openssl.cpp @@ -312,9 +312,18 @@ init_context: q_X509_STORE_add_cert(ctx->cert_store, (X509 *)caCertificate.handle()); } } + + bool addExpiredCerts = true; +#if defined(Q_OS_MAC) && (MAC_OS_X_VERSION_MAX_ALLOWED == MAC_OS_X_VERSION_10_5) + //On Leopard SSL does not work if we add the expired certificates. + if (QSysInfo::MacintoshVersion == QSysInfo::MV_10_5) + addExpiredCerts = false; +#endif // now add the expired certs - foreach (const QSslCertificate &caCertificate, expiredCerts) { - q_X509_STORE_add_cert(ctx->cert_store, (X509 *)caCertificate.handle()); + if (addExpiredCerts) { + foreach (const QSslCertificate &caCertificate, expiredCerts) { + q_X509_STORE_add_cert(ctx->cert_store, (X509 *)caCertificate.handle()); + } } // Register a custom callback to get all verification errors. -- cgit v0.12 From c30714122c58a3dc6fd8401427da60c4afc4127b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= <samuel.rodal@nokia.com> Date: Mon, 14 Mar 2011 14:35:22 +0100 Subject: Prevented infinite recursion in QPainterPath::contains(). Limit the amount of recursions in qt_painterpath_isect_curve to prevent a crash. Task-number: QTBUG-16422 Reviewed-by: Kim --- src/gui/painting/qpainterpath.cpp | 8 ++++---- tests/auto/qpainterpath/tst_qpainterpath.cpp | 5 +++++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/gui/painting/qpainterpath.cpp b/src/gui/painting/qpainterpath.cpp index 7ecf10a..88eef99 100644 --- a/src/gui/painting/qpainterpath.cpp +++ b/src/gui/painting/qpainterpath.cpp @@ -1690,7 +1690,7 @@ static void qt_painterpath_isect_line(const QPointF &p1, } static void qt_painterpath_isect_curve(const QBezier &bezier, const QPointF &pt, - int *winding) + int *winding, int depth = 0) { qreal y = pt.y(); qreal x = pt.x(); @@ -1705,7 +1705,7 @@ static void qt_painterpath_isect_curve(const QBezier &bezier, const QPointF &pt, // hit lower limit... This is a rough threshold, but its a // tradeoff between speed and precision. const qreal lower_bound = qreal(.001); - if (bounds.width() < lower_bound && bounds.height() < lower_bound) { + if (depth == 32 || (bounds.width() < lower_bound && bounds.height() < lower_bound)) { // We make the assumption here that the curve starts to // approximate a line after while (i.e. that it doesn't // change direction drastically during its slope) @@ -1718,8 +1718,8 @@ static void qt_painterpath_isect_curve(const QBezier &bezier, const QPointF &pt, // split curve and try again... QBezier first_half, second_half; bezier.split(&first_half, &second_half); - qt_painterpath_isect_curve(first_half, pt, winding); - qt_painterpath_isect_curve(second_half, pt, winding); + qt_painterpath_isect_curve(first_half, pt, winding, depth + 1); + qt_painterpath_isect_curve(second_half, pt, winding, depth + 1); } } diff --git a/tests/auto/qpainterpath/tst_qpainterpath.cpp b/tests/auto/qpainterpath/tst_qpainterpath.cpp index 00f9b91..4ade9ad 100644 --- a/tests/auto/qpainterpath/tst_qpainterpath.cpp +++ b/tests/auto/qpainterpath/tst_qpainterpath.cpp @@ -290,6 +290,11 @@ void tst_QPainterPath::contains_QPointF_data() QTest::newRow("horizontal cubic, out left") << path << QPointF(0, 100) << false; QTest::newRow("horizontal cubic, out right") << path << QPointF(300, 100) <<false; QTest::newRow("horizontal cubic, in mid") << path << QPointF(150, 100) << true; + + path = QPainterPath(); + path.addEllipse(QRectF(-5000.0, -5000.0, 1500000.0, 1500000.0)); + QTest::newRow("huge ellipse, qreal=float crash") << path << QPointF(1100000.35, 1098000.2) << true; + } void tst_QPainterPath::contains_QPointF() -- cgit v0.12 From 369ad09515fc8dac87613930114f4b3cf6381e81 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete <paul.tvete@nokia.com> Date: Mon, 14 Mar 2011 16:55:19 +0100 Subject: Fix race condition in the non-GL case MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make sure to also flush output when waiting for an ack from the compositor, in case we haven't sent the frame request yet. Reviewed-by: Jørgen --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 11 ++++++++--- src/plugins/platforms/wayland/qwaylanddisplay.h | 4 +++- src/plugins/platforms/wayland/qwaylandshmsurface.cpp | 2 +- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index d0a0725..27f4334 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -141,7 +141,12 @@ void QWaylandDisplay::displayHandleGlobal(struct wl_display *display, } } -void QWaylandDisplay::eventDispatcher(void) +void QWaylandDisplay::iterate() +{ + wl_display_iterate(mDisplay, WL_DISPLAY_READABLE | WL_DISPLAY_WRITABLE); +} + +void QWaylandDisplay::readEvents(void) { wl_display_iterate(mDisplay, WL_DISPLAY_READABLE); } @@ -189,7 +194,7 @@ QWaylandDisplay::QWaylandDisplay(void) mNativeEglDisplay = 0; #endif - eventDispatcher(); + readEvents(); #ifdef QT_WAYLAND_GL_SUPPORT mEglDisplay = eglGetDisplay((EGLNativeDisplayType)mNativeEglDisplay); @@ -208,7 +213,7 @@ QWaylandDisplay::QWaylandDisplay(void) int fd = wl_display_get_fd(mDisplay, sourceUpdate, this); mReadNotifier = new QSocketNotifier(fd, QSocketNotifier::Read, this); connect(mReadNotifier, - SIGNAL(activated(int)), this, SLOT(eventDispatcher())); + SIGNAL(activated(int)), this, SLOT(readEvents())); mWriteNotifier = new QSocketNotifier(fd, QSocketNotifier::Write, this); connect(mWriteNotifier, diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.h b/src/plugins/platforms/wayland/qwaylanddisplay.h index ca31756..d994ffe 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay.h @@ -81,8 +81,10 @@ public: void syncCallback(wl_display_sync_func_t func, void *data); void frameCallback(wl_display_frame_func_t func, void *data); + void iterate(); + public slots: - void eventDispatcher(void); + void readEvents(void); void flushRequests(void); private: diff --git a/src/plugins/platforms/wayland/qwaylandshmsurface.cpp b/src/plugins/platforms/wayland/qwaylandshmsurface.cpp index b1cba71..6872bac 100644 --- a/src/plugins/platforms/wayland/qwaylandshmsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmsurface.cpp @@ -111,7 +111,7 @@ QPaintDevice *QWaylandShmWindowSurface::paintDevice() void QWaylandShmWindowSurface::beginPaint(const QRegion &) { while (mWaitingForFrameSync) { - mDisplay->eventDispatcher(); + mDisplay->iterate(); } } -- cgit v0.12 From cdd52ad8acff0af2ecca1cef982228c6bb489feb Mon Sep 17 00:00:00 2001 From: Markus Goetz <Markus.Goetz@nokia.com> Date: Mon, 14 Mar 2011 17:28:15 +0100 Subject: QNAM HTTP: error() in case connection is closed unexpectedly Task-number: QT-4658 Task-number: QT-3494 Reviewed-by: Peter Hartmann --- .../access/qhttpnetworkconnectionchannel.cpp | 15 +++++++++++++- tests/auto/qnetworkreply/tst_qnetworkreply.cpp | 24 +++++++++++++++------- 2 files changed, 31 insertions(+), 8 deletions(-) diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp index 82b5ce3..700b455 100644 --- a/src/network/access/qhttpnetworkconnectionchannel.cpp +++ b/src/network/access/qhttpnetworkconnectionchannel.cpp @@ -963,8 +963,20 @@ void QHttpNetworkConnectionChannel::_q_error(QAbstractSocket::SocketError socket } else { errorCode = QNetworkReply::RemoteHostClosedError; } + } else if (state == QHttpNetworkConnectionChannel::ReadingState) { + if (!reply->d_func()->expectContent()) { + // No content expected, this is a valid way to have the connection closed by the server + return; + } + if (reply->contentLength() == -1 && !reply->d_func()->isChunked()) { + // There was no content-length header and it's not chunked encoding, + // so this is a valid way to have the connection closed by the server + return; + } + // ok, we got a disconnect even though we did not expect it + errorCode = QNetworkReply::RemoteHostClosedError; } else { - return; + errorCode = QNetworkReply::RemoteHostClosedError; } break; case QAbstractSocket::SocketTimeoutError: @@ -992,6 +1004,7 @@ void QHttpNetworkConnectionChannel::_q_error(QAbstractSocket::SocketError socket if (reply) { reply->d_func()->errorString = errorString; emit reply->finishedWithError(errorCode, errorString); + reply = 0; } // send the next request QMetaObject::invokeMethod(that, "_q_startNextRequest", Qt::QueuedConnection); diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp index 8274140..39bb0fc 100644 --- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp @@ -951,6 +951,7 @@ tst_QNetworkReply::tst_QNetworkReply() qRegisterMetaType<QAuthenticator *>(); qRegisterMetaType<QNetworkProxy>(); qRegisterMetaType<QList<QSslError> >(); + qRegisterMetaType<QNetworkReply::NetworkError>(); Q_SET_DEFAULT_IAP @@ -2572,6 +2573,9 @@ void tst_QNetworkReply::ioGetFromHttpBrokenServer_data() QTest::newRow("justHalfStatus+disconnect") << QByteArray("HTTP/1.1") << true; QTest::newRow("justStatus+disconnect") << QByteArray("HTTP/1.1 200 OK\r\n") << true; QTest::newRow("justStatusAndHalfHeaders+disconnect") << QByteArray("HTTP/1.1 200 OK\r\nContent-L") << true; + + QTest::newRow("halfContent+disconnect") << QByteArray("HTTP/1.1 200 OK\r\nContent-Length: 4\r\n\r\nAB") << true; + } void tst_QNetworkReply::ioGetFromHttpBrokenServer() @@ -2583,29 +2587,35 @@ void tst_QNetworkReply::ioGetFromHttpBrokenServer() QNetworkRequest request(QUrl("http://localhost:" + QString::number(server.serverPort()))); QNetworkReplyPtr reply = manager.get(request); + QSignalSpy spy(reply, SIGNAL(error(QNetworkReply::NetworkError))); + connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop())); QTestEventLoop::instance().enterLoop(10); QVERIFY(!QTestEventLoop::instance().timeout()); QCOMPARE(reply->url(), request.url()); + QCOMPARE(spy.count(), 1); QVERIFY(reply->error() != QNetworkReply::NoError); } void tst_QNetworkReply::ioGetFromHttpStatus100_data() { QTest::addColumn<QByteArray>("dataToSend"); - QTest::newRow("normal") << QByteArray("HTTP/1.1 100 Continue\r\n\r\nHTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n"); - QTest::newRow("minimal") << QByteArray("HTTP/1.1 100 Continue\n\nHTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n"); - QTest::newRow("minimal2") << QByteArray("HTTP/1.1 100 Continue\n\nHTTP/1.0 200 OK\r\n\r\n"); - QTest::newRow("minimal3") << QByteArray("HTTP/1.1 100 Continue\n\nHTTP/1.0 200 OK\n\n"); - QTest::newRow("with_headers") << QByteArray("HTTP/1.1 100 Continue\r\nBla: x\r\n\r\nHTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n"); - QTest::newRow("with_headers2") << QByteArray("HTTP/1.1 100 Continue\nBla: x\n\nHTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n"); + QTest::addColumn<int>("statusCode"); + QTest::newRow("normal") << QByteArray("HTTP/1.1 100 Continue\r\n\r\nHTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n") << 200; + QTest::newRow("minimal") << QByteArray("HTTP/1.1 100 Continue\n\nHTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n") << 200; + QTest::newRow("minimal2") << QByteArray("HTTP/1.1 100 Continue\n\nHTTP/1.0 200 OK\r\n\r\n") << 200; + QTest::newRow("minimal3") << QByteArray("HTTP/1.1 100 Continue\n\nHTTP/1.0 200 OK\n\n") << 200; + QTest::newRow("minimal+404") << QByteArray("HTTP/1.1 100 Continue\n\nHTTP/1.0 204 No Content\r\n\r\n") << 204; + QTest::newRow("with_headers") << QByteArray("HTTP/1.1 100 Continue\r\nBla: x\r\n\r\nHTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n") << 200; + QTest::newRow("with_headers2") << QByteArray("HTTP/1.1 100 Continue\nBla: x\n\nHTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n") << 200; } void tst_QNetworkReply::ioGetFromHttpStatus100() { QFETCH(QByteArray, dataToSend); + QFETCH(int, statusCode); MiniHttpServer server(dataToSend); server.doClose = true; @@ -2618,7 +2628,7 @@ void tst_QNetworkReply::ioGetFromHttpStatus100() QCOMPARE(reply->url(), request.url()); QCOMPARE(reply->error(), QNetworkReply::NoError); - QCOMPARE(reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(), 200); + QCOMPARE(reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(), statusCode); QVERIFY(reply->rawHeader("bla").isNull()); } -- cgit v0.12 From b2c8421ff95ad62cbd67843ad5cd3edf72ecda31 Mon Sep 17 00:00:00 2001 From: Peter Hartmann <peter.hartmann@nokia.com> Date: Mon, 14 Mar 2011 14:28:34 +0100 Subject: SSL: introduce new option TlsV1SslV3 for SSL communication currently there are 3 supported protocols: SSL2, SSL3 and TLS1. SSL2 is considered insecure and should not be used anymore. This commit offers an option to use both TLS1 and SSL3, leaving SSL2 out. Part-of-the-patch-by: Darren Lissimore Reviewed-by: Markus Goetz Task-number: QTBUG-12338 --- src/network/ssl/qssl.cpp | 3 + src/network/ssl/qssl.h | 1 + src/network/ssl/qsslsocket_openssl.cpp | 7 +- tests/auto/qsslsocket/tst_qsslsocket.cpp | 150 ++++++++++++++++++++++++------- 4 files changed, 130 insertions(+), 31 deletions(-) diff --git a/src/network/ssl/qssl.cpp b/src/network/ssl/qssl.cpp index 8a450b9..241eb12 100644 --- a/src/network/ssl/qssl.cpp +++ b/src/network/ssl/qssl.cpp @@ -107,6 +107,9 @@ QT_BEGIN_NAMESPACE \value UnknownProtocol The cipher's protocol cannot be determined. \value AnyProtocol The socket understands SSLv2, SSLv3, and TLSv1. This value is used by QSslSocket only. + \value TlsV1SslV3 On the client side, this will send + a TLS 1.0 Client Hello, enabling TLSv1 and SSLv3 connections. + On the server side, this will enable both SSLv3 and TLSv1 connections. Note: most servers using SSL understand both versions (2 and 3), but it is recommended to use the latest version only for security diff --git a/src/network/ssl/qssl.h b/src/network/ssl/qssl.h index 4c035fd..e13ee78 100644 --- a/src/network/ssl/qssl.h +++ b/src/network/ssl/qssl.h @@ -77,6 +77,7 @@ namespace QSsl { SslV2, TlsV1, AnyProtocol, + TlsV1SslV3, UnknownProtocol = -1 }; } diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp index 646889c..8da3bb7 100644 --- a/src/network/ssl/qsslsocket_openssl.cpp +++ b/src/network/ssl/qsslsocket_openssl.cpp @@ -259,6 +259,7 @@ init_context: case QSsl::SslV3: ctx = q_SSL_CTX_new(client ? q_SSLv3_client_method() : q_SSLv3_server_method()); break; + case QSsl::TlsV1SslV3: // TlsV1SslV3 will be disabled below case QSsl::AnyProtocol: default: ctx = q_SSL_CTX_new(client ? q_SSLv23_client_method() : q_SSLv23_server_method()); @@ -284,7 +285,11 @@ init_context: } // Enable all bug workarounds. - q_SSL_CTX_set_options(ctx, SSL_OP_ALL); + if (configuration.protocol == QSsl::TlsV1SslV3) { + q_SSL_CTX_set_options(ctx, SSL_OP_ALL|SSL_OP_NO_SSLv2); + } else { + q_SSL_CTX_set_options(ctx, SSL_OP_ALL); + } // Initialize ciphers QByteArray cipherString; diff --git a/tests/auto/qsslsocket/tst_qsslsocket.cpp b/tests/auto/qsslsocket/tst_qsslsocket.cpp index 4beddad..b420b1d 100644 --- a/tests/auto/qsslsocket/tst_qsslsocket.cpp +++ b/tests/auto/qsslsocket/tst_qsslsocket.cpp @@ -66,6 +66,7 @@ Q_DECLARE_METATYPE(QSslSocket::SslMode) typedef QList<QSslError::SslError> SslErrorList; Q_DECLARE_METATYPE(SslErrorList) Q_DECLARE_METATYPE(QSslError) +Q_DECLARE_METATYPE(QSsl::SslProtocol) #endif #if defined Q_OS_HPUX && defined Q_CC_GNU @@ -145,10 +146,11 @@ private slots: void peerCertificateChain(); void privateKey(); void protocol(); + void protocolServerSide_data(); + void protocolServerSide(); void setCaCertificates(); void setLocalCertificate(); void setPrivateKey(); - void setProtocol(); void setSocketDescriptor(); void waitForEncrypted(); void waitForConnectedEncryptedReadyRead(); @@ -763,14 +765,12 @@ void tst_QSslSocket::protocol() this->socket = socket; QList<QSslCertificate> certs = QSslCertificate::fromPath(SRCDIR "certs/qt-test-server-cacert.pem"); -// qDebug() << "certs:" << certs.at(0).issuerInfo(QSslCertificate::CommonName); socket->setCaCertificates(certs); #ifdef QSSLSOCKET_CERTUNTRUSTED_WORKAROUND connect(socket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(untrustedWorkaroundSlot(QList<QSslError>))); #endif -// qDebug() << "socket cert:" << socket->caCertificates().at(0).issuerInfo(QSslCertificate::CommonName); QCOMPARE(socket->protocol(), QSsl::TlsV1); { // Fluke allows SSLv3. @@ -835,44 +835,36 @@ void tst_QSslSocket::protocol() QCOMPARE(socket->protocol(), QSsl::AnyProtocol); socket->abort(); } -} - -void tst_QSslSocket::setCaCertificates() -{ - if (!QSslSocket::supportsSsl()) - return; - - QSslSocket socket; - QCOMPARE(socket.caCertificates(), QSslSocket::defaultCaCertificates()); - socket.setCaCertificates(QSslCertificate::fromPath(SRCDIR "certs/qt-test-server-cacert.pem")); - QCOMPARE(socket.caCertificates().size(), 1); - socket.setCaCertificates(socket.defaultCaCertificates()); - QCOMPARE(socket.caCertificates(), QSslSocket::defaultCaCertificates()); -} - -void tst_QSslSocket::setLocalCertificate() -{ -} - -void tst_QSslSocket::setPrivateKey() -{ -} - -void tst_QSslSocket::setProtocol() -{ + { + // Fluke allows SSLV3, so it allows NoSslV2 + socket->setProtocol(QSsl::TlsV1SslV3); + QCOMPARE(socket->protocol(), QSsl::TlsV1SslV3); + socket->connectToHostEncrypted(QtNetworkSettings::serverName(), 443); + QVERIFY(socket->waitForEncrypted()); + QCOMPARE(socket->protocol(), QSsl::TlsV1SslV3); + socket->abort(); + QCOMPARE(socket->protocol(), QSsl::TlsV1SslV3); + socket->connectToHost(QtNetworkSettings::serverName(), 443); + QVERIFY2(socket->waitForConnected(), qPrintable(socket->errorString())); + socket->startClientEncryption(); + QVERIFY2(socket->waitForEncrypted(), qPrintable(socket->errorString())); + QCOMPARE(socket->protocol(), QSsl::TlsV1SslV3); + socket->abort(); + } } class SslServer : public QTcpServer { Q_OBJECT public: - SslServer() : socket(0) { } + SslServer() : socket(0), protocol(QSsl::TlsV1) { } QSslSocket *socket; - + QSsl::SslProtocol protocol; protected: void incomingConnection(int socketDescriptor) { socket = new QSslSocket(this); + socket->setProtocol(protocol); connect(socket, SIGNAL(sslErrors(const QList<QSslError> &)), this, SLOT(ignoreErrorSlot())); QFile file(SRCDIR "certs/fluke.key"); @@ -902,6 +894,104 @@ protected slots: } }; +void tst_QSslSocket::protocolServerSide_data() +{ + + QTest::addColumn<QSsl::SslProtocol>("serverProtocol"); + QTest::addColumn<QSsl::SslProtocol>("clientProtocol"); + QTest::addColumn<bool>("works"); + + QTest::newRow("ssl2-ssl2") << QSsl::SslV2 << QSsl::SslV2 << false; // no idea why it does not work, but we don't care about SSL 2 + QTest::newRow("ssl3-ssl3") << QSsl::SslV3 << QSsl::SslV3 << true; + QTest::newRow("tls1-tls1") << QSsl::TlsV1 << QSsl::TlsV1 << true; + QTest::newRow("tls1ssl3-tls1ssl3") << QSsl::TlsV1SslV3 << QSsl::TlsV1SslV3 << true; + QTest::newRow("any-any") << QSsl::AnyProtocol << QSsl::AnyProtocol << true; + + QTest::newRow("ssl2-ssl3") << QSsl::SslV2 << QSsl::SslV3 << false; + QTest::newRow("ssl2-tls1") << QSsl::SslV2 << QSsl::TlsV1 << false; + QTest::newRow("ssl2-tls1ssl3") << QSsl::SslV2 << QSsl::TlsV1SslV3 << false; + QTest::newRow("ssl2-any") << QSsl::SslV2 << QSsl::AnyProtocol << false; // no idea why it does not work, but we don't care about SSL 2 + + QTest::newRow("ssl3-ssl2") << QSsl::SslV3 << QSsl::SslV2 << false; + QTest::newRow("ssl3-tls1") << QSsl::SslV3 << QSsl::TlsV1 << false; + QTest::newRow("ssl3-tls1ssl3") << QSsl::SslV3 << QSsl::TlsV1SslV3 << true; + QTest::newRow("ssl3-any") << QSsl::SslV3 << QSsl::AnyProtocol << true; + + QTest::newRow("tls1-ssl2") << QSsl::TlsV1 << QSsl::SslV2 << false; + QTest::newRow("tls1-ssl3") << QSsl::TlsV1 << QSsl::SslV3 << false; + QTest::newRow("tls1-tls1ssl3") << QSsl::TlsV1 << QSsl::TlsV1SslV3 << true; + QTest::newRow("tls1-any") << QSsl::TlsV1 << QSsl::AnyProtocol << true; + + QTest::newRow("tls1ssl3-ssl2") << QSsl::TlsV1SslV3 << QSsl::SslV2 << false; + QTest::newRow("tls1ssl3-ssl3") << QSsl::TlsV1SslV3 << QSsl::SslV3 << true; + QTest::newRow("tls1ssl3-tls1") << QSsl::TlsV1SslV3 << QSsl::TlsV1 << true; + QTest::newRow("tls1ssl3-tls1") << QSsl::TlsV1SslV3 << QSsl::AnyProtocol << true; + + QTest::newRow("any-ssl2") << QSsl::AnyProtocol << QSsl::SslV2 << false; // no idea why it does not work, but we don't care about SSL 2 + QTest::newRow("any-ssl3") << QSsl::AnyProtocol << QSsl::SslV3 << true; + QTest::newRow("any-tls1") << QSsl::AnyProtocol << QSsl::TlsV1 << true; + QTest::newRow("any-tls1ssl3") << QSsl::AnyProtocol << QSsl::TlsV1SslV3 << true; +} + +void tst_QSslSocket::protocolServerSide() +{ + if (!QSslSocket::supportsSsl()) { + qWarning("SSL not supported, skipping test"); + return; + } + + QFETCH_GLOBAL(bool, setProxy); + if (setProxy) + return; + + QFETCH(QSsl::SslProtocol, serverProtocol); + SslServer server; + server.protocol = serverProtocol; + QVERIFY(server.listen()); + + QEventLoop loop; + QTimer::singleShot(5000, &loop, SLOT(quit())); + + QSslSocketPtr client = new QSslSocket; + socket = client; + QFETCH(QSsl::SslProtocol, clientProtocol); + socket->setProtocol(clientProtocol); + // upon SSL wrong version error, error will be triggered, not sslErrors + connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), &loop, SLOT(quit())); + connect(socket, SIGNAL(sslErrors(const QList<QSslError> &)), this, SLOT(ignoreErrorSlot())); + connect(client, SIGNAL(encrypted()), &loop, SLOT(quit())); + + client->connectToHostEncrypted(QHostAddress(QHostAddress::LocalHost).toString(), server.serverPort()); + + loop.exec(); + + QFETCH(bool, works); + QAbstractSocket::SocketState expectedState = (works) ? QAbstractSocket::ConnectedState : QAbstractSocket::UnconnectedState; + QCOMPARE(client->state(), expectedState); + QCOMPARE(client->isEncrypted(), works); +} + +void tst_QSslSocket::setCaCertificates() +{ + if (!QSslSocket::supportsSsl()) + return; + + QSslSocket socket; + QCOMPARE(socket.caCertificates(), QSslSocket::defaultCaCertificates()); + socket.setCaCertificates(QSslCertificate::fromPath(SRCDIR "certs/qt-test-server-cacert.pem")); + QCOMPARE(socket.caCertificates().size(), 1); + socket.setCaCertificates(socket.defaultCaCertificates()); + QCOMPARE(socket.caCertificates(), QSslSocket::defaultCaCertificates()); +} + +void tst_QSslSocket::setLocalCertificate() +{ +} + +void tst_QSslSocket::setPrivateKey() +{ +} + void tst_QSslSocket::setSocketDescriptor() { if (!QSslSocket::supportsSsl()) -- cgit v0.12 From f8f6e15ee3ec0b7aec8421cb5ddaab0ff871e733 Mon Sep 17 00:00:00 2001 From: Peter Hartmann <peter.hartmann@nokia.com> Date: Mon, 14 Mar 2011 14:58:53 +0100 Subject: SSL: Switch default version to TlsV1SslV3 (i.e. use TLS 1 or SSL 3) ... and introduce a new enum SecureProtocols. Switching the default version is better for compatibility (e.g. servers using this option will understand both TLS and SSL 3). Reviewed-by: Markus Goetz --- src/network/ssl/qssl.cpp | 4 +++- src/network/ssl/qssl.h | 1 + src/network/ssl/qsslconfiguration.cpp | 4 ++-- src/network/ssl/qsslconfiguration_p.h | 2 +- src/network/ssl/qsslsocket.cpp | 2 +- tests/auto/qsslsocket/tst_qsslsocket.cpp | 18 +++++++++++++++--- 6 files changed, 23 insertions(+), 8 deletions(-) diff --git a/src/network/ssl/qssl.cpp b/src/network/ssl/qssl.cpp index 241eb12..e3dc84c 100644 --- a/src/network/ssl/qssl.cpp +++ b/src/network/ssl/qssl.cpp @@ -103,13 +103,15 @@ QT_BEGIN_NAMESPACE \value SslV3 SSLv3 \value SslV2 SSLv2 - \value TlsV1 TLSv1 - the default protocol. + \value TlsV1 TLSv1 \value UnknownProtocol The cipher's protocol cannot be determined. \value AnyProtocol The socket understands SSLv2, SSLv3, and TLSv1. This value is used by QSslSocket only. \value TlsV1SslV3 On the client side, this will send a TLS 1.0 Client Hello, enabling TLSv1 and SSLv3 connections. On the server side, this will enable both SSLv3 and TLSv1 connections. + \value SecureProtocols The default option, using protocols known to be secure. + Currently set to TlsV1SslV3. Note: most servers using SSL understand both versions (2 and 3), but it is recommended to use the latest version only for security diff --git a/src/network/ssl/qssl.h b/src/network/ssl/qssl.h index e13ee78..7c47361 100644 --- a/src/network/ssl/qssl.h +++ b/src/network/ssl/qssl.h @@ -78,6 +78,7 @@ namespace QSsl { TlsV1, AnyProtocol, TlsV1SslV3, + SecureProtocols = TlsV1SslV3, UnknownProtocol = -1 }; } diff --git a/src/network/ssl/qsslconfiguration.cpp b/src/network/ssl/qsslconfiguration.cpp index b0d5c90..150f77e 100644 --- a/src/network/ssl/qsslconfiguration.cpp +++ b/src/network/ssl/qsslconfiguration.cpp @@ -213,7 +213,7 @@ bool QSslConfiguration::isNull() const */ QSsl::SslProtocol QSslConfiguration::protocol() const { - return d ? d->protocol : QSsl::TlsV1; + return d ? d->protocol : QSsl::SecureProtocols; } /*! @@ -518,7 +518,7 @@ void QSslConfiguration::setCaCertificates(const QList<QSslCertificate> &certific \list \o no local certificate and no private key - \o protocol TlsV1 + \o protocol SecureProtocols (meaning either TLS 1.0 or SSL 3 will be used) \o the system's default CA certificate list \o the cipher list equal to the list of the SSL libraries' supported SSL ciphers diff --git a/src/network/ssl/qsslconfiguration_p.h b/src/network/ssl/qsslconfiguration_p.h index 47adace..1c6815b 100644 --- a/src/network/ssl/qsslconfiguration_p.h +++ b/src/network/ssl/qsslconfiguration_p.h @@ -80,7 +80,7 @@ class QSslConfigurationPrivate: public QSharedData { public: QSslConfigurationPrivate() - : protocol(QSsl::TlsV1), + : protocol(QSsl::TlsV1SslV3), peerVerifyMode(QSslSocket::AutoVerifyPeer), peerVerifyDepth(0) { } diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp index 224ed67..98e2dc5 100644 --- a/src/network/ssl/qsslsocket.cpp +++ b/src/network/ssl/qsslsocket.cpp @@ -552,7 +552,7 @@ bool QSslSocket::isEncrypted() const } /*! - Returns the socket's SSL protocol. By default, \l QSsl::TLSv1 is used. + Returns the socket's SSL protocol. By default, \l QSsl::SecureProtocols is used. \sa setProtocol() */ diff --git a/tests/auto/qsslsocket/tst_qsslsocket.cpp b/tests/auto/qsslsocket/tst_qsslsocket.cpp index b420b1d..ef5833ef 100644 --- a/tests/auto/qsslsocket/tst_qsslsocket.cpp +++ b/tests/auto/qsslsocket/tst_qsslsocket.cpp @@ -387,7 +387,7 @@ void tst_QSslSocket::constructing() QVERIFY(!socket.waitForConnected(10)); QTest::ignoreMessage(QtWarningMsg, "QSslSocket::waitForDisconnected() is not allowed in UnconnectedState"); QVERIFY(!socket.waitForDisconnected(10)); - QCOMPARE(socket.protocol(), QSsl::TlsV1); + QCOMPARE(socket.protocol(), QSsl::SecureProtocols); QSslConfiguration savedDefault = QSslConfiguration::defaultConfiguration(); @@ -771,7 +771,7 @@ void tst_QSslSocket::protocol() this, SLOT(untrustedWorkaroundSlot(QList<QSslError>))); #endif - QCOMPARE(socket->protocol(), QSsl::TlsV1); + QCOMPARE(socket->protocol(), QSsl::SecureProtocols); { // Fluke allows SSLv3. socket->setProtocol(QSsl::SslV3); @@ -906,31 +906,43 @@ void tst_QSslSocket::protocolServerSide_data() QTest::newRow("tls1-tls1") << QSsl::TlsV1 << QSsl::TlsV1 << true; QTest::newRow("tls1ssl3-tls1ssl3") << QSsl::TlsV1SslV3 << QSsl::TlsV1SslV3 << true; QTest::newRow("any-any") << QSsl::AnyProtocol << QSsl::AnyProtocol << true; + QTest::newRow("secure-secure") << QSsl::SecureProtocols << QSsl::SecureProtocols << true; QTest::newRow("ssl2-ssl3") << QSsl::SslV2 << QSsl::SslV3 << false; QTest::newRow("ssl2-tls1") << QSsl::SslV2 << QSsl::TlsV1 << false; QTest::newRow("ssl2-tls1ssl3") << QSsl::SslV2 << QSsl::TlsV1SslV3 << false; + QTest::newRow("ssl2-secure") << QSsl::SslV2 << QSsl::SecureProtocols << false; QTest::newRow("ssl2-any") << QSsl::SslV2 << QSsl::AnyProtocol << false; // no idea why it does not work, but we don't care about SSL 2 QTest::newRow("ssl3-ssl2") << QSsl::SslV3 << QSsl::SslV2 << false; QTest::newRow("ssl3-tls1") << QSsl::SslV3 << QSsl::TlsV1 << false; QTest::newRow("ssl3-tls1ssl3") << QSsl::SslV3 << QSsl::TlsV1SslV3 << true; + QTest::newRow("ssl3-secure") << QSsl::SslV3 << QSsl::SecureProtocols << true; QTest::newRow("ssl3-any") << QSsl::SslV3 << QSsl::AnyProtocol << true; QTest::newRow("tls1-ssl2") << QSsl::TlsV1 << QSsl::SslV2 << false; QTest::newRow("tls1-ssl3") << QSsl::TlsV1 << QSsl::SslV3 << false; QTest::newRow("tls1-tls1ssl3") << QSsl::TlsV1 << QSsl::TlsV1SslV3 << true; + QTest::newRow("tls1-secure") << QSsl::TlsV1 << QSsl::SecureProtocols << true; QTest::newRow("tls1-any") << QSsl::TlsV1 << QSsl::AnyProtocol << true; QTest::newRow("tls1ssl3-ssl2") << QSsl::TlsV1SslV3 << QSsl::SslV2 << false; QTest::newRow("tls1ssl3-ssl3") << QSsl::TlsV1SslV3 << QSsl::SslV3 << true; QTest::newRow("tls1ssl3-tls1") << QSsl::TlsV1SslV3 << QSsl::TlsV1 << true; - QTest::newRow("tls1ssl3-tls1") << QSsl::TlsV1SslV3 << QSsl::AnyProtocol << true; + QTest::newRow("tls1ssl3-secure") << QSsl::TlsV1SslV3 << QSsl::SecureProtocols << true; + QTest::newRow("tls1ssl3-any") << QSsl::TlsV1SslV3 << QSsl::AnyProtocol << true; + + QTest::newRow("secure-ssl2") << QSsl::SecureProtocols << QSsl::SslV2 << false; + QTest::newRow("secure-ssl3") << QSsl::SecureProtocols << QSsl::SslV3 << true; + QTest::newRow("secure-tls1") << QSsl::SecureProtocols << QSsl::TlsV1 << true; + QTest::newRow("secure-tls1ssl3") << QSsl::SecureProtocols << QSsl::TlsV1SslV3 << true; + QTest::newRow("secure-any") << QSsl::SecureProtocols << QSsl::AnyProtocol << true; QTest::newRow("any-ssl2") << QSsl::AnyProtocol << QSsl::SslV2 << false; // no idea why it does not work, but we don't care about SSL 2 QTest::newRow("any-ssl3") << QSsl::AnyProtocol << QSsl::SslV3 << true; QTest::newRow("any-tls1") << QSsl::AnyProtocol << QSsl::TlsV1 << true; QTest::newRow("any-tls1ssl3") << QSsl::AnyProtocol << QSsl::TlsV1SslV3 << true; + QTest::newRow("any-secure") << QSsl::AnyProtocol << QSsl::SecureProtocols << true; } void tst_QSslSocket::protocolServerSide() -- cgit v0.12 From 1992cdb292d1961d6b210a3c1d2532556d2c9195 Mon Sep 17 00:00:00 2001 From: Peter Hartmann <peter.hartmann@nokia.com> Date: Mon, 14 Mar 2011 15:05:03 +0100 Subject: SSL backend: avoid setting SNI hostname for old SSL versions With this patch, we only use SNI functionality when the SSL version supports it (meaning when using TLS), otherwise the function call would trigger a warning. Reviewed-by: Markus Goetz --- src/network/ssl/qssl.h | 2 +- src/network/ssl/qsslsocket_openssl.cpp | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/network/ssl/qssl.h b/src/network/ssl/qssl.h index 7c47361..1980659 100644 --- a/src/network/ssl/qssl.h +++ b/src/network/ssl/qssl.h @@ -75,7 +75,7 @@ namespace QSsl { enum SslProtocol { SslV3, SslV2, - TlsV1, + TlsV1, // ### Qt 5: rename to TlsV1_0 or so AnyProtocol, TlsV1SslV3, SecureProtocols = TlsV1SslV3, diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp index 8da3bb7..664fce2 100644 --- a/src/network/ssl/qsslsocket_openssl.cpp +++ b/src/network/ssl/qsslsocket_openssl.cpp @@ -398,7 +398,10 @@ init_context: } #if OPENSSL_VERSION_NUMBER >= 0x0090806fL && !defined(OPENSSL_NO_TLSEXT) - if (client && q_SSLeay() >= 0x00090806fL) { + if ((configuration.protocol == QSsl::TlsV1SslV3 || + configuration.protocol == QSsl::TlsV1 || + configuration.protocol == QSsl::AnyProtocol) && + client && q_SSLeay() >= 0x00090806fL) { // Set server hostname on TLS extension. RFC4366 section 3.1 requires it in ACE format. QString tlsHostName = verificationPeerName.isEmpty() ? q->peerName() : verificationPeerName; if (tlsHostName.isEmpty()) -- cgit v0.12 From 774cb9eca9ea243436dbf61cdb7081fc270cdec9 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy <aaron.kennedy@nokia.com> Date: Tue, 15 Mar 2011 10:25:54 +1000 Subject: Remove bindings before assigning constants in VME Change-Id: I4c246cbcf8d0168cb4af028d6d04088fe20cdbba Task-number: QTBUG-17276 --- src/declarative/qml/qdeclarativevme.cpp | 63 ++++++++++++++++++++++ .../data/InlineAssignmentsOverrideBindingsType.qml | 7 +++ .../InlineAssignmentsOverrideBindingsType2.qml | 5 ++ .../data/inlineAssignmentsOverrideBindings.qml | 6 +++ .../tst_qdeclarativelanguage.cpp | 12 ++++- 5 files changed, 92 insertions(+), 1 deletion(-) create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/InlineAssignmentsOverrideBindingsType.qml create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/InlineAssignmentsOverrideBindingsType2.qml create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/inlineAssignmentsOverrideBindings.qml diff --git a/src/declarative/qml/qdeclarativevme.cpp b/src/declarative/qml/qdeclarativevme.cpp index 2d551f2..781e1b8 100644 --- a/src/declarative/qml/qdeclarativevme.cpp +++ b/src/declarative/qml/qdeclarativevme.cpp @@ -127,6 +127,22 @@ void QDeclarativeVME::runDeferred(QObject *object) run(stack, ctxt, comp, start, count, QBitField()); } +inline bool fastHasBinding(QObject *o, int index) +{ + QDeclarativeData *ddata = static_cast<QDeclarativeData *>(QObjectPrivate::get(o)->declarativeData); + + return ddata && (ddata->bindingBitsSize > index) && + (ddata->bindingBits[index / 32] & (1 << (index % 32))); +} + +static void removeBindingOnProperty(QObject *o, int index) +{ + QDeclarativeAbstractBinding *binding = QDeclarativePropertyPrivate::setBinding(o, index, -1, 0); + if (binding) binding->destroy(); +} + +#define CLEAN_PROPERTY(o, index) if (fastHasBinding(o, index)) removeBindingOnProperty(o, index) + QObject *QDeclarativeVME::run(QDeclarativeVMEStack<QObject *> &stack, QDeclarativeContextData *ctxt, QDeclarativeCompiledData *comp, @@ -336,6 +352,8 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack<QObject *> &stack, case QDeclarativeInstruction::StoreVariant: { QObject *target = stack.top(); + CLEAN_PROPERTY(target, instr.storeString.propertyIndex); + // XXX - can be more efficient QVariant v = QDeclarativeStringConverters::variantFromString(primitives.at(instr.storeString.value)); void *a[] = { &v, 0, &status, &flags }; @@ -347,6 +365,8 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack<QObject *> &stack, case QDeclarativeInstruction::StoreVariantInteger: { QObject *target = stack.top(); + CLEAN_PROPERTY(target, instr.storeString.propertyIndex); + QVariant v(instr.storeInteger.value); void *a[] = { &v, 0, &status, &flags }; QMetaObject::metacall(target, QMetaObject::WriteProperty, @@ -357,6 +377,8 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack<QObject *> &stack, case QDeclarativeInstruction::StoreVariantDouble: { QObject *target = stack.top(); + CLEAN_PROPERTY(target, instr.storeString.propertyIndex); + QVariant v(instr.storeDouble.value); void *a[] = { &v, 0, &status, &flags }; QMetaObject::metacall(target, QMetaObject::WriteProperty, @@ -367,6 +389,8 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack<QObject *> &stack, case QDeclarativeInstruction::StoreVariantBool: { QObject *target = stack.top(); + CLEAN_PROPERTY(target, instr.storeString.propertyIndex); + QVariant v(instr.storeBool.value); void *a[] = { &v, 0, &status, &flags }; QMetaObject::metacall(target, QMetaObject::WriteProperty, @@ -377,6 +401,8 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack<QObject *> &stack, case QDeclarativeInstruction::StoreString: { QObject *target = stack.top(); + CLEAN_PROPERTY(target, instr.storeString.propertyIndex); + void *a[] = { (void *)&primitives.at(instr.storeString.value), 0, &status, &flags }; QMetaObject::metacall(target, QMetaObject::WriteProperty, instr.storeString.propertyIndex, a); @@ -386,6 +412,8 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack<QObject *> &stack, case QDeclarativeInstruction::StoreUrl: { QObject *target = stack.top(); + CLEAN_PROPERTY(target, instr.storeUrl.propertyIndex); + void *a[] = { (void *)&urls.at(instr.storeUrl.value), 0, &status, &flags }; QMetaObject::metacall(target, QMetaObject::WriteProperty, instr.storeUrl.propertyIndex, a); @@ -395,6 +423,8 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack<QObject *> &stack, case QDeclarativeInstruction::StoreFloat: { QObject *target = stack.top(); + CLEAN_PROPERTY(target, instr.storeFloat.propertyIndex); + float f = instr.storeFloat.value; void *a[] = { &f, 0, &status, &flags }; QMetaObject::metacall(target, QMetaObject::WriteProperty, @@ -405,6 +435,8 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack<QObject *> &stack, case QDeclarativeInstruction::StoreDouble: { QObject *target = stack.top(); + CLEAN_PROPERTY(target, instr.storeDouble.propertyIndex); + double d = instr.storeDouble.value; void *a[] = { &d, 0, &status, &flags }; QMetaObject::metacall(target, QMetaObject::WriteProperty, @@ -415,6 +447,8 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack<QObject *> &stack, case QDeclarativeInstruction::StoreBool: { QObject *target = stack.top(); + CLEAN_PROPERTY(target, instr.storeBool.propertyIndex); + void *a[] = { (void *)&instr.storeBool.value, 0, &status, &flags }; QMetaObject::metacall(target, QMetaObject::WriteProperty, instr.storeBool.propertyIndex, a); @@ -424,6 +458,8 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack<QObject *> &stack, case QDeclarativeInstruction::StoreInteger: { QObject *target = stack.top(); + CLEAN_PROPERTY(target, instr.storeInteger.propertyIndex); + void *a[] = { (void *)&instr.storeInteger.value, 0, &status, &flags }; QMetaObject::metacall(target, QMetaObject::WriteProperty, instr.storeInteger.propertyIndex, a); @@ -433,6 +469,8 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack<QObject *> &stack, case QDeclarativeInstruction::StoreColor: { QObject *target = stack.top(); + CLEAN_PROPERTY(target, instr.storeColor.propertyIndex); + QColor c = QColor::fromRgba(instr.storeColor.value); void *a[] = { &c, 0, &status, &flags }; QMetaObject::metacall(target, QMetaObject::WriteProperty, @@ -443,6 +481,8 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack<QObject *> &stack, case QDeclarativeInstruction::StoreDate: { QObject *target = stack.top(); + CLEAN_PROPERTY(target, instr.storeDate.propertyIndex); + QDate d = QDate::fromJulianDay(instr.storeDate.value); void *a[] = { &d, 0, &status, &flags }; QMetaObject::metacall(target, QMetaObject::WriteProperty, @@ -453,6 +493,8 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack<QObject *> &stack, case QDeclarativeInstruction::StoreTime: { QObject *target = stack.top(); + CLEAN_PROPERTY(target, instr.storeTime.propertyIndex); + QTime t; t.setHMS(intData.at(instr.storeTime.valueIndex), intData.at(instr.storeTime.valueIndex+1), @@ -467,6 +509,8 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack<QObject *> &stack, case QDeclarativeInstruction::StoreDateTime: { QObject *target = stack.top(); + CLEAN_PROPERTY(target, instr.storeDateTime.propertyIndex); + QTime t; t.setHMS(intData.at(instr.storeDateTime.valueIndex+1), intData.at(instr.storeDateTime.valueIndex+2), @@ -482,6 +526,8 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack<QObject *> &stack, case QDeclarativeInstruction::StorePoint: { QObject *target = stack.top(); + CLEAN_PROPERTY(target, instr.storeRealPair.propertyIndex); + QPoint p = QPointF(floatData.at(instr.storeRealPair.valueIndex), floatData.at(instr.storeRealPair.valueIndex+1)).toPoint(); void *a[] = { &p, 0, &status, &flags }; @@ -493,6 +539,8 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack<QObject *> &stack, case QDeclarativeInstruction::StorePointF: { QObject *target = stack.top(); + CLEAN_PROPERTY(target, instr.storeRealPair.propertyIndex); + QPointF p(floatData.at(instr.storeRealPair.valueIndex), floatData.at(instr.storeRealPair.valueIndex+1)); void *a[] = { &p, 0, &status, &flags }; @@ -504,6 +552,8 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack<QObject *> &stack, case QDeclarativeInstruction::StoreSize: { QObject *target = stack.top(); + CLEAN_PROPERTY(target, instr.storeRealPair.propertyIndex); + QSize p = QSizeF(floatData.at(instr.storeRealPair.valueIndex), floatData.at(instr.storeRealPair.valueIndex+1)).toSize(); void *a[] = { &p, 0, &status, &flags }; @@ -515,6 +565,8 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack<QObject *> &stack, case QDeclarativeInstruction::StoreSizeF: { QObject *target = stack.top(); + CLEAN_PROPERTY(target, instr.storeRealPair.propertyIndex); + QSizeF s(floatData.at(instr.storeRealPair.valueIndex), floatData.at(instr.storeRealPair.valueIndex+1)); void *a[] = { &s, 0, &status, &flags }; @@ -526,6 +578,8 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack<QObject *> &stack, case QDeclarativeInstruction::StoreRect: { QObject *target = stack.top(); + CLEAN_PROPERTY(target, instr.storeRect.propertyIndex); + QRect r = QRectF(floatData.at(instr.storeRect.valueIndex), floatData.at(instr.storeRect.valueIndex+1), floatData.at(instr.storeRect.valueIndex+2), @@ -539,6 +593,8 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack<QObject *> &stack, case QDeclarativeInstruction::StoreRectF: { QObject *target = stack.top(); + CLEAN_PROPERTY(target, instr.storeRect.propertyIndex); + QRectF r(floatData.at(instr.storeRect.valueIndex), floatData.at(instr.storeRect.valueIndex+1), floatData.at(instr.storeRect.valueIndex+2), @@ -552,6 +608,8 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack<QObject *> &stack, case QDeclarativeInstruction::StoreVector3D: { QObject *target = stack.top(); + CLEAN_PROPERTY(target, instr.storeVector3D.propertyIndex); + QVector3D p(floatData.at(instr.storeVector3D.valueIndex), floatData.at(instr.storeVector3D.valueIndex+1), floatData.at(instr.storeVector3D.valueIndex+2)); @@ -565,6 +623,7 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack<QObject *> &stack, { QObject *assignObj = stack.pop(); QObject *target = stack.top(); + CLEAN_PROPERTY(target, instr.storeObject.propertyIndex); void *a[] = { (void *)&assignObj, 0, &status, &flags }; QMetaObject::metacall(target, QMetaObject::WriteProperty, @@ -576,6 +635,8 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack<QObject *> &stack, case QDeclarativeInstruction::AssignCustomType: { QObject *target = stack.top(); + CLEAN_PROPERTY(target, instr.assignCustomType.propertyIndex); + QDeclarativeCompiledData::CustomTypeData data = customTypeData.at(instr.assignCustomType.valueIndex); const QString &primitive = primitives.at(data.index); QDeclarativeMetaType::StringConverter converter = @@ -780,6 +841,7 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack<QObject *> &stack, { QObject *assign = stack.pop(); QObject *target = stack.top(); + CLEAN_PROPERTY(target, instr.storeObject.propertyIndex); QVariant v = QVariant::fromValue(assign); void *a[] = { &v, 0, &status, &flags }; @@ -792,6 +854,7 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack<QObject *> &stack, { QObject *assign = stack.pop(); QObject *target = stack.top(); + CLEAN_PROPERTY(target, instr.storeObject.propertyIndex); int coreIdx = instr.storeObject.propertyIndex; QMetaProperty prop = target->metaObject()->property(coreIdx); diff --git a/tests/auto/declarative/qdeclarativelanguage/data/InlineAssignmentsOverrideBindingsType.qml b/tests/auto/declarative/qdeclarativelanguage/data/InlineAssignmentsOverrideBindingsType.qml new file mode 100644 index 0000000..4526cf0 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/InlineAssignmentsOverrideBindingsType.qml @@ -0,0 +1,7 @@ +import QtQuick 1.0 + +QtObject { + property InlineAssignmentsOverrideBindingsType2 nested: InlineAssignmentsOverrideBindingsType2 { + value: 19 * 33 + } +} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/InlineAssignmentsOverrideBindingsType2.qml b/tests/auto/declarative/qdeclarativelanguage/data/InlineAssignmentsOverrideBindingsType2.qml new file mode 100644 index 0000000..4127ca4 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/InlineAssignmentsOverrideBindingsType2.qml @@ -0,0 +1,5 @@ +import QtQuick 1.0 + +QtObject { + property int value +} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/inlineAssignmentsOverrideBindings.qml b/tests/auto/declarative/qdeclarativelanguage/data/inlineAssignmentsOverrideBindings.qml new file mode 100644 index 0000000..8f3c5ce --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/inlineAssignmentsOverrideBindings.qml @@ -0,0 +1,6 @@ +import QtQuick 1.0 + +InlineAssignmentsOverrideBindingsType { + property int test: nested.value + nested.value: 11 +} diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp index f3f41a9..5a2591f 100644 --- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp +++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp @@ -134,6 +134,7 @@ private slots: void dontDoubleCallClassBegin(); void reservedWords_data(); void reservedWords(); + void inlineAssignmentsOverrideBindings(); void basicRemote_data(); void basicRemote(); @@ -1413,9 +1414,18 @@ void tst_qdeclarativelanguage::testType(const QString& qml, const QString& type, } } +// QTBUG-17276 +void tst_qdeclarativelanguage::inlineAssignmentsOverrideBindings() +{ + QDeclarativeComponent component(&engine, TEST_FILE("inlineAssignmentsOverrideBindings.qml")); -// Import tests (QT-558) + QObject *o = component.create(); + QVERIFY(o != 0); + QCOMPARE(o->property("test").toInt(), 11); + delete o; +} +// Import tests (QT-558) void tst_qdeclarativelanguage::importsBuiltin_data() { // QT-610 -- cgit v0.12 From ce38c6e3a9b7eb336cbd9cd1e9520a5000c8f8ac Mon Sep 17 00:00:00 2001 From: Martin Jones <martin.jones@nokia.com> Date: Tue, 15 Mar 2011 13:53:34 +1000 Subject: Regression: currentIndex was not set correctly after model cleared. Change b3080d78f2ff2d98410249e09d5d7d6e20fd155c stopped the currentIndex from being updated when a new item is added to an empty view. Change-Id: I77a0789fcf3693034a2d7aca173fec669b913b18 Task-number: QTBUG-18123 Reviewed-by: Bea Lam --- .../graphicsitems/qdeclarativegridview.cpp | 6 ++-- .../graphicsitems/qdeclarativelistview.cpp | 6 ++-- .../tst_qdeclarativegridview.cpp | 39 ++++++++++++++++++++++ .../tst_qdeclarativelistview.cpp | 7 ++++ 4 files changed, 53 insertions(+), 5 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp index 5c2f781..c0cbed0 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview.cpp +++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp @@ -2834,11 +2834,9 @@ void QDeclarativeGridView::itemsInserted(int modelIndex, int count) if (d->currentItem) { d->currentItem->index = d->currentIndex; d->currentItem->setPosition(d->colPosAt(d->currentIndex), d->rowPosAt(d->currentIndex)); - } else if (!d->currentIndex || (d->currentIndex < 0 && !d->currentIndexCleared)) { - d->updateCurrent(0); } emit currentIndexChanged(); - } else if (d->itemCount == 0 && d->currentIndex == -1) { + } else if (d->itemCount == 0 && (!d->currentIndex || (d->currentIndex < 0 && !d->currentIndexCleared))) { setCurrentIndex(0); } @@ -2906,6 +2904,8 @@ void QDeclarativeGridView::itemsRemoved(int modelIndex, int count) d->currentIndex = -1; if (d->itemCount) d->updateCurrent(qMin(modelIndex, d->itemCount-1)); + else + emit currentIndexChanged(); } // update visibleIndex diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index 2c23a1b..6ae1ddc 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -3272,10 +3272,10 @@ void QDeclarativeListView::itemsInserted(int modelIndex, int count) if (d->currentItem) { d->currentItem->index = d->currentIndex; d->currentItem->setPosition(d->currentItem->position() + diff); - } else if (!d->currentIndex || (d->currentIndex < 0 && !d->currentIndexCleared)) { - d->updateCurrent(0); } emit currentIndexChanged(); + } else if (!d->itemCount && (!d->currentIndex || (d->currentIndex < 0 && !d->currentIndexCleared))) { + d->updateCurrent(0); } // Update the indexes of the following visible items. for (; index < d->visibleItems.count(); ++index) { @@ -3356,6 +3356,8 @@ void QDeclarativeListView::itemsRemoved(int modelIndex, int count) d->currentIndex = -1; if (d->itemCount) d->updateCurrent(qMin(modelIndex, d->itemCount-1)); + else + emit currentIndexChanged(); } // update visibleIndex diff --git a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp index 5ced02b..c183934 100644 --- a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp +++ b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp @@ -69,6 +69,7 @@ private slots: void changed(); void inserted(); void removed(); + void clear(); void moved(); void changeFlow(); void currentIndex(); @@ -501,6 +502,44 @@ void tst_QDeclarativeGridView::removed() delete canvas; } +void tst_QDeclarativeGridView::clear() +{ + QDeclarativeView *canvas = createView(); + + TestModel model; + for (int i = 0; i < 30; i++) + model.addItem("Item" + QString::number(i), ""); + + QDeclarativeContext *ctxt = canvas->rootContext(); + ctxt->setContextProperty("testModel", &model); + ctxt->setContextProperty("testRightToLeft", QVariant(false)); + ctxt->setContextProperty("testTopToBottom", QVariant(false)); + + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/gridview1.qml")); + qApp->processEvents(); + + QDeclarativeGridView *gridview = findItem<QDeclarativeGridView>(canvas->rootObject(), "grid"); + QVERIFY(gridview != 0); + + QDeclarativeItem *contentItem = gridview->contentItem(); + QVERIFY(contentItem != 0); + + model.clear(); + + QVERIFY(gridview->count() == 0); + QVERIFY(gridview->currentItem() == 0); + QVERIFY(gridview->contentY() == 0); + QVERIFY(gridview->currentIndex() == -1); + + // confirm sanity when adding an item to cleared list + model.addItem("New", "1"); + QVERIFY(gridview->count() == 1); + QVERIFY(gridview->currentItem() != 0); + QVERIFY(gridview->currentIndex() == 0); + + delete canvas; +} + void tst_QDeclarativeGridView::moved() { QDeclarativeView *canvas = createView(); diff --git a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp index c87318e..2267a89 100644 --- a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp +++ b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp @@ -741,6 +741,13 @@ void tst_QDeclarativeListView::clear() QTRY_VERIFY(listview->count() == 0); QTRY_VERIFY(listview->currentItem() == 0); QTRY_VERIFY(listview->contentY() == 0); + QVERIFY(listview->currentIndex() == -1); + + // confirm sanity when adding an item to cleared list + model.addItem("New", "1"); + QTRY_VERIFY(listview->count() == 1); + QVERIFY(listview->currentItem() != 0); + QVERIFY(listview->currentIndex() == 0); delete canvas; } -- cgit v0.12 From 77342ad3e7beecb75c136ee26c0c77cd1a41b415 Mon Sep 17 00:00:00 2001 From: Martin Jones <martin.jones@nokia.com> Date: Tue, 15 Mar 2011 14:26:20 +1000 Subject: Border still drawn on Rectangle elements when border.width == 0 The _valid flag did not consider both color alpha and line width in both setters. Change-Id: Iba544d65a0a40e36f1e09091e007418c9eefa0cd Task-number: QTBUG-18102 Reviewed-by: Alan Alpert --- src/declarative/graphicsitems/qdeclarativerectangle.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativerectangle.cpp b/src/declarative/graphicsitems/qdeclarativerectangle.cpp index d962919..8f59073 100644 --- a/src/declarative/graphicsitems/qdeclarativerectangle.cpp +++ b/src/declarative/graphicsitems/qdeclarativerectangle.cpp @@ -70,7 +70,7 @@ QT_BEGIN_NAMESPACE void QDeclarativePen::setColor(const QColor &c) { _color = c; - _valid = _color.alpha() ? true : false; + _valid = (_color.alpha() && _width >= 1) ? true : false; emit penChanged(); } @@ -80,7 +80,7 @@ void QDeclarativePen::setWidth(int w) return; _width = w; - _valid = (_width < 1) ? false : true; + _valid = (_color.alpha() && _width >= 1) ? true : false; emit penChanged(); } -- cgit v0.12 From e546b6b38f95e6496fd53efba41442cde879819a Mon Sep 17 00:00:00 2001 From: Sami Merila <sami.merila@nokia.com> Date: Tue, 15 Mar 2011 08:22:13 +0200 Subject: Prevent null pointer crash when closing splitview Prevents crash when focus item is not set and splitview is closed. This is partial fix to QTBUG-17045. Task-number: QTBUG-17045 Reviewed-by: Guoqing Zhang --- src/gui/inputmethod/qcoefepinputcontext_s60.cpp | 3 ++- src/gui/widgets/qcombobox.cpp | 28 +++++++++++-------------- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp index 73aa982..9d8dd41 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp +++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp @@ -394,7 +394,8 @@ void QCoeFepInputContext::resetSplitViewWidget(bool keepInputWidget) if (!alwaysResize) { if (gv->scene()) { - disconnect(gv->scene()->focusItem()->toGraphicsObject(), SIGNAL(cursorPositionChanged()), this, SLOT(translateInputWidget())); + if (gv->scene()->focusItem()) + disconnect(gv->scene()->focusItem()->toGraphicsObject(), SIGNAL(cursorPositionChanged()), this, SLOT(translateInputWidget())); QGraphicsItem *rootItem; foreach (QGraphicsItem *item, gv->scene()->items()) { if (!item->parentItem()) { diff --git a/src/gui/widgets/qcombobox.cpp b/src/gui/widgets/qcombobox.cpp index dbbf49a..af2440a 100644 --- a/src/gui/widgets/qcombobox.cpp +++ b/src/gui/widgets/qcombobox.cpp @@ -2348,7 +2348,7 @@ void QComboBox::showPopup() initStyleOption(&opt); QRect listRect(style->subControlRect(QStyle::CC_ComboBox, &opt, QStyle::SC_ComboBoxListBoxPopup, this)); - QRect screen = d->popupGeometry(QApplication::desktop()->screenNumber(this)); + QRect screen = qt_TRect2QRect(static_cast<CEikAppUi*>(S60->appUi())->ClientRect()); QPoint below = mapToGlobal(listRect.bottomLeft()); int belowHeight = screen.bottom() - below.y(); QPoint above = mapToGlobal(listRect.topLeft()); @@ -2476,18 +2476,10 @@ void QComboBox::showPopup() listRect.setWidth(listRect.height()); //by default popup is centered on screen in landscape listRect.moveCenter(screen.center()); - if (staConTopRect.IsEmpty()) { - TRect cbaRect = TRect(); - AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EControlPane, cbaRect); - AknLayoutUtils::TAknCbaLocation cbaLocation = AknLayoutUtils::CbaLocation(); - switch (cbaLocation) { - case AknLayoutUtils::EAknCbaLocationRight: - listRect.setRight(screen.right()); - break; - case AknLayoutUtils::EAknCbaLocationLeft: - listRect.setLeft(screen.left()); - break; - } + if (staConTopRect.IsEmpty() && AknLayoutUtils::CbaLocation() != AknLayoutUtils::EAknCbaLocationBottom) { + // landscape without stacon, menu should be at the right + (opt.direction == Qt::LeftToRight) ? listRect.setRight(screen.right()) : + listRect.setLeft(screen.left()); } } #endif @@ -2706,7 +2698,7 @@ void QComboBox::changeEvent(QEvent *e) initStyleOption(&opt); if (style()->styleHint(QStyle::SH_ComboBox_Popup, &opt, this)) { - const QRect screen = d->popupGeometry(QApplication::desktop()->screenNumber(this)); + QRect screen = qt_TRect2QRect(static_cast<CEikAppUi*>(S60->appUi())->ClientRect()); QRect listRect(style()->subControlRect(QStyle::CC_ComboBox, &opt, QStyle::SC_ComboBoxListBoxPopup, this)); @@ -2721,13 +2713,13 @@ void QComboBox::changeEvent(QEvent *e) listRect.setWidth(listRect.height()); //by default popup is centered on screen in landscape listRect.moveCenter(screen.center()); - if (staConTopRect.IsEmpty()) { + if (staConTopRect.IsEmpty() && AknLayoutUtils::CbaLocation() != AknLayoutUtils::EAknCbaLocationBottom) { // landscape without stacon, menu should be at the right (opt.direction == Qt::LeftToRight) ? listRect.setRight(screen.right()) : listRect.setLeft(screen.left()); } - d->container->setGeometry(listRect); } + d->container->setGeometry(listRect); } } #endif @@ -2760,6 +2752,10 @@ void QComboBox::changeEvent(QEvent *e) void QComboBox::resizeEvent(QResizeEvent *) { Q_D(QComboBox); +#ifdef Q_WS_S60 + if (d->viewContainer() && d->viewContainer()->isVisible()) + showPopup(); +#endif d->updateLineEditGeometry(); } -- cgit v0.12 From d919343e91fd5e6771f11cb59d4730ec83ed7381 Mon Sep 17 00:00:00 2001 From: Sami Merila <sami.merila@nokia.com> Date: Tue, 15 Mar 2011 08:32:22 +0200 Subject: Remove changes from fix to QTBUG-17045 that were not related to the fix There were changes included in the fix for QTBUG-17045 that were not supposed to be part of that fix. These changes to qcombobox.cpp are now removed. Task-number: QTBUG-17045 Reviewed-by: TrustMe --- src/gui/widgets/qcombobox.cpp | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/gui/widgets/qcombobox.cpp b/src/gui/widgets/qcombobox.cpp index af2440a..dbbf49a 100644 --- a/src/gui/widgets/qcombobox.cpp +++ b/src/gui/widgets/qcombobox.cpp @@ -2348,7 +2348,7 @@ void QComboBox::showPopup() initStyleOption(&opt); QRect listRect(style->subControlRect(QStyle::CC_ComboBox, &opt, QStyle::SC_ComboBoxListBoxPopup, this)); - QRect screen = qt_TRect2QRect(static_cast<CEikAppUi*>(S60->appUi())->ClientRect()); + QRect screen = d->popupGeometry(QApplication::desktop()->screenNumber(this)); QPoint below = mapToGlobal(listRect.bottomLeft()); int belowHeight = screen.bottom() - below.y(); QPoint above = mapToGlobal(listRect.topLeft()); @@ -2476,10 +2476,18 @@ void QComboBox::showPopup() listRect.setWidth(listRect.height()); //by default popup is centered on screen in landscape listRect.moveCenter(screen.center()); - if (staConTopRect.IsEmpty() && AknLayoutUtils::CbaLocation() != AknLayoutUtils::EAknCbaLocationBottom) { - // landscape without stacon, menu should be at the right - (opt.direction == Qt::LeftToRight) ? listRect.setRight(screen.right()) : - listRect.setLeft(screen.left()); + if (staConTopRect.IsEmpty()) { + TRect cbaRect = TRect(); + AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EControlPane, cbaRect); + AknLayoutUtils::TAknCbaLocation cbaLocation = AknLayoutUtils::CbaLocation(); + switch (cbaLocation) { + case AknLayoutUtils::EAknCbaLocationRight: + listRect.setRight(screen.right()); + break; + case AknLayoutUtils::EAknCbaLocationLeft: + listRect.setLeft(screen.left()); + break; + } } } #endif @@ -2698,7 +2706,7 @@ void QComboBox::changeEvent(QEvent *e) initStyleOption(&opt); if (style()->styleHint(QStyle::SH_ComboBox_Popup, &opt, this)) { - QRect screen = qt_TRect2QRect(static_cast<CEikAppUi*>(S60->appUi())->ClientRect()); + const QRect screen = d->popupGeometry(QApplication::desktop()->screenNumber(this)); QRect listRect(style()->subControlRect(QStyle::CC_ComboBox, &opt, QStyle::SC_ComboBoxListBoxPopup, this)); @@ -2713,13 +2721,13 @@ void QComboBox::changeEvent(QEvent *e) listRect.setWidth(listRect.height()); //by default popup is centered on screen in landscape listRect.moveCenter(screen.center()); - if (staConTopRect.IsEmpty() && AknLayoutUtils::CbaLocation() != AknLayoutUtils::EAknCbaLocationBottom) { + if (staConTopRect.IsEmpty()) { // landscape without stacon, menu should be at the right (opt.direction == Qt::LeftToRight) ? listRect.setRight(screen.right()) : listRect.setLeft(screen.left()); } + d->container->setGeometry(listRect); } - d->container->setGeometry(listRect); } } #endif @@ -2752,10 +2760,6 @@ void QComboBox::changeEvent(QEvent *e) void QComboBox::resizeEvent(QResizeEvent *) { Q_D(QComboBox); -#ifdef Q_WS_S60 - if (d->viewContainer() && d->viewContainer()->isVisible()) - showPopup(); -#endif d->updateLineEditGeometry(); } -- cgit v0.12 From c600cbac60c0453815ee2721e0748a991343b5b2 Mon Sep 17 00:00:00 2001 From: Martin Petersson <martin.petersson@nokia.com> Date: Tue, 15 Mar 2011 09:40:36 +0100 Subject: QMAKE: Fix post build events for VS2010 We have changed 'Use in build' for VS2010 to now use "Excluded From Build" to have the same as in VS2008. This will enable post build event again for VS2010. Reviewed-by: Joerg Bornemann --- qmake/generators/win32/msvc_vcproj.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index 0df33d0..8455189 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp @@ -1072,22 +1072,26 @@ void VcprojGenerator::initPreBuildEventTools() void VcprojGenerator::initPostBuildEventTools() { VCConfiguration &conf = vcProject.Configuration; - if(!project->values("QMAKE_POST_LINK").isEmpty()) { + if (!project->values("QMAKE_POST_LINK").isEmpty()) { QStringList cmdline = VCToolBase::fixCommandLine(var("QMAKE_POST_LINK")); conf.postBuild.CommandLine = cmdline; conf.postBuild.Description = cmdline.join(QLatin1String("\r\n")); + conf.postBuild.ExcludedFromBuild = _False; } QString signature = !project->isEmpty("SIGNATURE_FILE") ? var("SIGNATURE_FILE") : var("DEFAULT_SIGNATURE"); bool useSignature = !signature.isEmpty() && !project->isActiveConfig("staticlib") && !project->isEmpty("CE_SDK") && !project->isEmpty("CE_ARCH"); - if(useSignature) + if (useSignature) { conf.postBuild.CommandLine.prepend( QLatin1String("signtool sign /F ") + signature + QLatin1String(" \"$(TargetPath)\"")); + conf.postBuild.ExcludedFromBuild = _False; + } - if(!project->values("MSVCPROJ_COPY_DLL").isEmpty()) { + if (!project->values("MSVCPROJ_COPY_DLL").isEmpty()) { conf.postBuild.Description += var("MSVCPROJ_COPY_DLL_DESC"); conf.postBuild.CommandLine += var("MSVCPROJ_COPY_DLL"); + conf.postBuild.ExcludedFromBuild = _False; } } @@ -1218,6 +1222,7 @@ void VcprojGenerator::initPreLinkEventTools() QStringList cmdline = VCToolBase::fixCommandLine(var("QMAKE_PRE_LINK")); conf.preLink.CommandLine = cmdline; conf.preLink.Description = cmdline.join(QLatin1String("\r\n")); + conf.preLink.ExcludedFromBuild = _False; } } -- cgit v0.12 From f7cbd336ba532e29a07d1f81f62e1b12ca53f835 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= <samuel.rodal@nokia.com> Date: Tue, 15 Mar 2011 10:36:41 +0100 Subject: Properly set the window event masks etc for screens and GL windows too. --- src/plugins/platforms/xcb/qxcbscreen.cpp | 2 +- src/plugins/platforms/xcb/qxcbwindow.cpp | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp index 519db63..f868db8 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.cpp +++ b/src/plugins/platforms/xcb/qxcbscreen.cpp @@ -66,7 +66,7 @@ QXcbScreen::QXcbScreen(QXcbConnection *connection, xcb_screen_t *screen, int num | XCB_EVENT_MASK_PROPERTY_CHANGE }; - xcb_configure_window(xcb_connection(), screen->root, mask, values); + xcb_change_window_attributes(xcb_connection(), screen->root, mask, values); } QXcbScreen::~QXcbScreen() diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 005aa0e..9478b5b 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -155,12 +155,14 @@ QXcbWindow::QXcbWindow(QWidget *tlw) 0, // border width XCB_WINDOW_CLASS_INPUT_OUTPUT, // window class m_screen->screen()->root_visual, // visual - mask, // value mask - values); // value list + 0, // value mask + 0); // value list printf("created regular window: %d\n", m_window); } + xcb_change_window_attributes(xcb_connection(), m_window, mask, values); + xcb_atom_t properties[4]; int propertyCount = 0; properties[propertyCount++] = atom(QXcbAtom::WM_DELETE_WINDOW); -- cgit v0.12 From 7480f77039bf104c0b9a0763898038ce988dc4b3 Mon Sep 17 00:00:00 2001 From: Sami Merila <sami.merila@nokia.com> Date: Tue, 15 Mar 2011 11:54:30 +0200 Subject: Regression: QS60Style: Theme background is incorrect Fix for QTBUG-16816 cause theme background to display incorrectly after a layout switch is done. Theme background is shown "tiled" instead of being whole screen size. This is because the setBackgroundTexture() call was removed to "save" QPixmap creation. Unfortunately, it really skips the background texture creation, but does not re-create a new one for the new layout, so portrait background is used again. This leads to tiling the image. Let's just return the call to the setBackgroundTexture() (this will eventually anyway be "optimized" with fix for QTBUG-14910). Task-number: QTBUG-17930 Reviewed-by: Laszlo Agocs --- src/gui/styles/qs60style_s60.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp index b4785dc..8e442bf 100644 --- a/src/gui/styles/qs60style_s60.cpp +++ b/src/gui/styles/qs60style_s60.cpp @@ -1428,6 +1428,7 @@ QS60Style::QS60Style() void QS60StylePrivate::handleDynamicLayoutVariantSwitch() { clearCaches(QS60StylePrivate::CC_LayoutChange); + setBackgroundTexture(qApp); setActiveLayout(); foreach (QWidget *widget, QApplication::allWidgets()) widget->ensurePolished(); -- cgit v0.12 From 5e47ee6a97f54f1cdac577f76cd338b40e624f32 Mon Sep 17 00:00:00 2001 From: Peter Hartmann <peter.hartmann@nokia.com> Date: Tue, 15 Mar 2011 11:20:17 +0100 Subject: SSL: give protocol enum SecureProtocols an own value ... so that an application that uses SecureProtocols can make use of updates to a Qt version without being recompiled. Reviewed-by: Markus Goetz Reviewed-by: Richard J. Moore --- src/network/ssl/qssl.cpp | 4 ++-- src/network/ssl/qssl.h | 2 +- src/network/ssl/qsslconfiguration_p.h | 2 +- src/network/ssl/qsslsocket_openssl.cpp | 6 ++++-- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/network/ssl/qssl.cpp b/src/network/ssl/qssl.cpp index e3dc84c..5594296 100644 --- a/src/network/ssl/qssl.cpp +++ b/src/network/ssl/qssl.cpp @@ -110,8 +110,8 @@ QT_BEGIN_NAMESPACE \value TlsV1SslV3 On the client side, this will send a TLS 1.0 Client Hello, enabling TLSv1 and SSLv3 connections. On the server side, this will enable both SSLv3 and TLSv1 connections. - \value SecureProtocols The default option, using protocols known to be secure. - Currently set to TlsV1SslV3. + \value SecureProtocols The default option, using protocols known to be secure; + currently behaves like TlsV1SslV3. Note: most servers using SSL understand both versions (2 and 3), but it is recommended to use the latest version only for security diff --git a/src/network/ssl/qssl.h b/src/network/ssl/qssl.h index 1980659..24dbb09 100644 --- a/src/network/ssl/qssl.h +++ b/src/network/ssl/qssl.h @@ -78,7 +78,7 @@ namespace QSsl { TlsV1, // ### Qt 5: rename to TlsV1_0 or so AnyProtocol, TlsV1SslV3, - SecureProtocols = TlsV1SslV3, + SecureProtocols, UnknownProtocol = -1 }; } diff --git a/src/network/ssl/qsslconfiguration_p.h b/src/network/ssl/qsslconfiguration_p.h index 1c6815b..a5af51a 100644 --- a/src/network/ssl/qsslconfiguration_p.h +++ b/src/network/ssl/qsslconfiguration_p.h @@ -80,7 +80,7 @@ class QSslConfigurationPrivate: public QSharedData { public: QSslConfigurationPrivate() - : protocol(QSsl::TlsV1SslV3), + : protocol(QSsl::SecureProtocols), peerVerifyMode(QSslSocket::AutoVerifyPeer), peerVerifyDepth(0) { } diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp index 664fce2..3d7612a 100644 --- a/src/network/ssl/qsslsocket_openssl.cpp +++ b/src/network/ssl/qsslsocket_openssl.cpp @@ -259,7 +259,8 @@ init_context: case QSsl::SslV3: ctx = q_SSL_CTX_new(client ? q_SSLv3_client_method() : q_SSLv3_server_method()); break; - case QSsl::TlsV1SslV3: // TlsV1SslV3 will be disabled below + case QSsl::SecureProtocols: // SslV2 will be disabled below + case QSsl::TlsV1SslV3: // SslV2 will be disabled below case QSsl::AnyProtocol: default: ctx = q_SSL_CTX_new(client ? q_SSLv23_client_method() : q_SSLv23_server_method()); @@ -285,7 +286,7 @@ init_context: } // Enable all bug workarounds. - if (configuration.protocol == QSsl::TlsV1SslV3) { + if (configuration.protocol == QSsl::TlsV1SslV3 || configuration.protocol == QSsl::SecureProtocols) { q_SSL_CTX_set_options(ctx, SSL_OP_ALL|SSL_OP_NO_SSLv2); } else { q_SSL_CTX_set_options(ctx, SSL_OP_ALL); @@ -400,6 +401,7 @@ init_context: #if OPENSSL_VERSION_NUMBER >= 0x0090806fL && !defined(OPENSSL_NO_TLSEXT) if ((configuration.protocol == QSsl::TlsV1SslV3 || configuration.protocol == QSsl::TlsV1 || + configuration.protocol == QSsl::SecureProtocols || configuration.protocol == QSsl::AnyProtocol) && client && q_SSLeay() >= 0x00090806fL) { // Set server hostname on TLS extension. RFC4366 section 3.1 requires it in ACE format. -- cgit v0.12 From 7dfa50a9b97d28813341329a55aa1a4b5a7de527 Mon Sep 17 00:00:00 2001 From: Sami Merila <sami.merila@nokia.com> Date: Tue, 15 Mar 2011 13:31:39 +0200 Subject: QS60Style: use placeholder texture when polishing widgets and palette Background texture is not created until it is actually painted. This allows skipping the whole background texture creation, if app overwrites the QPalette::Window with its own data (image or color). When widget is drawn and style notices that the widget is still using a placeholder (1*1 red QPixmap) texture, it creates the real texture and uses that for drawing. Note that accessing QPalette::Window will give the placeholder pixmap. Which is then again replaced with the real texture, if it is drawn through the qt_s60_fill_background(). Task-number: QTBUG-14910 Reviewed-by: Laszlo Agocs --- src/gui/styles/qs60style.cpp | 22 +++++++++++++++++----- src/gui/styles/qs60style_p.h | 4 ++++ src/gui/styles/qs60style_s60.cpp | 14 ++++++++++++-- 3 files changed, 33 insertions(+), 7 deletions(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 15cb5c6..c100330 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -118,6 +118,7 @@ const short *QS60StylePrivate::m_pmPointer = QS60StylePrivate::data[0]; // theme background texture QPixmap *QS60StylePrivate::m_background = 0; +QPixmap *QS60StylePrivate::m_placeHolderTexture = 0; // theme palette QPalette *QS60StylePrivate::m_themePalette = 0; @@ -155,6 +156,10 @@ const double KTabFontMul = 0.72; QS60StylePrivate::~QS60StylePrivate() { clearCaches(); //deletes also background image + if (m_placeHolderTexture) { + delete m_placeHolderTexture; + m_placeHolderTexture = 0; + } deleteThemePalette(); #ifdef Q_WS_S60 removeAnimations(); @@ -505,7 +510,10 @@ void QS60StylePrivate::setBackgroundTexture(QApplication *app) const { Q_UNUSED(app) QPalette applicationPalette = QApplication::palette(); - applicationPalette.setBrush(QPalette::Window, backgroundTexture()); + // The initial QPalette::Window is just a placeHolder QPixmap to save RAM + // if the actual texture is not needed. The real texture is created just before + // painting it in qt_s60_fill_background(). + applicationPalette.setBrush(QPalette::Window, placeHolderTexture()); setThemePalette(&applicationPalette); } @@ -700,8 +708,10 @@ void QS60StylePrivate::setThemePalette(QPalette *palette) const palette->setColor(QPalette::LinkVisited, palette->color(QPalette::Link).darker()); palette->setColor(QPalette::Highlight, s60Color(QS60StyleEnums::CL_QsnHighlightColors, 2, 0)); - // set background image as a texture brush - palette->setBrush(QPalette::Window, backgroundTexture()); + // The initial QPalette::Window is just a placeHolder QPixmap to save RAM + // if the actual texture is not needed. The real texture is created just before + // painting it in qt_s60_fill_background(). + palette->setBrush(QPalette::Window, placeHolderTexture()); // set as transparent so that styled full screen theme background is visible palette->setBrush(QPalette::Base, Qt::transparent); // set button color based on pixel colors @@ -3529,10 +3539,12 @@ extern QPoint qt_s60_fill_background_offset(const QWidget *targetWidget); bool qt_s60_fill_background(QPainter *painter, const QRegion &rgn, const QBrush &brush) { - const QPixmap backgroundTexture(QS60StylePrivate::backgroundTexture()); - if (backgroundTexture.cacheKey() != brush.texture().cacheKey()) + const QPixmap placeHolder(QS60StylePrivate::placeHolderTexture()); + if (placeHolder.cacheKey() != brush.texture().cacheKey()) return false; + const QPixmap backgroundTexture(QS60StylePrivate::backgroundTexture()); + const QPaintDevice *target = painter->device(); if (target->devType() == QInternal::Widget) { const QWidget *widget = static_cast<const QWidget *>(target); diff --git a/src/gui/styles/qs60style_p.h b/src/gui/styles/qs60style_p.h index c64cbb1..8c023bf 100644 --- a/src/gui/styles/qs60style_p.h +++ b/src/gui/styles/qs60style_p.h @@ -555,6 +555,7 @@ public: static QPixmap frame(SkinFrameElements frame, const QSize &size, SkinElementFlags flags = KDefaultSkinElementFlags); static QPixmap backgroundTexture(); + static QPixmap placeHolderTexture(); #ifdef Q_WS_S60 void handleDynamicLayoutVariantSwitch(); @@ -614,6 +615,9 @@ private: // Contains background texture. static QPixmap *m_background; + // Placeholder pixmap for the real background texture. + static QPixmap *m_placeHolderTexture; + const static SkinElementFlags KDefaultSkinElementFlags; // defined theme palette static QPalette *m_themePalette; diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp index 8e442bf..1ff195d 100644 --- a/src/gui/styles/qs60style_s60.cpp +++ b/src/gui/styles/qs60style_s60.cpp @@ -66,7 +66,6 @@ #include <aknnavi.h> #include <gulicon.h> #include <AknBitmapAnimation.h> - #include <centralrepository.h> #if !defined(QT_NO_STYLE_S60) || defined(QT_PLUGIN) @@ -1408,12 +1407,23 @@ QPixmap QS60StylePrivate::backgroundTexture() if (createNewBackground) { QPixmap background = part(QS60StyleEnums::SP_QsnBgScreen, - QSize(applicationRect.Width(), applicationRect.Height()), 0, SkinElementFlags()); + QSize(applicationRect.Width(), applicationRect.Height()), 0, SkinElementFlags()); m_background = new QPixmap(background); } return *m_background; } +// Generates 1*1 red pixmap as a placeholder for real texture. +// The actual theme texture is drawn in qt_s60_fill_background(). +QPixmap QS60StylePrivate::placeHolderTexture() +{ + if (!m_placeHolderTexture) { + m_placeHolderTexture = new QPixmap(1,1); + m_placeHolderTexture->fill(Qt::red); + } + return *m_placeHolderTexture; +} + QSize QS60StylePrivate::screenSize() { return QSize(S60->screenWidthInPixels, S60->screenHeightInPixels); -- cgit v0.12 From f9a297d9b2331adab2116210d3c527fae22e336e Mon Sep 17 00:00:00 2001 From: Laszlo Agocs <laszlo.p.agocs@nokia.com> Date: Tue, 15 Mar 2011 13:42:20 +0200 Subject: Avoid panics in QDesktopWidget on Symbian emulator. There is usually only one screen on the emulator and it was incorrectly assumed that ScreenDevice() would return null for a non-existing screen. It panics instead so the entire call must be skipped. Reviewed-by: Sami Merila --- src/gui/kernel/qdesktopwidget_s60.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/gui/kernel/qdesktopwidget_s60.cpp b/src/gui/kernel/qdesktopwidget_s60.cpp index c3963f4..62a4d40 100644 --- a/src/gui/kernel/qdesktopwidget_s60.cpp +++ b/src/gui/kernel/qdesktopwidget_s60.cpp @@ -188,12 +188,14 @@ void QDesktopWidgetPrivate::cleanup() void QDesktopWidgetPrivate::init_sys() { #if defined(Q_SYMBIAN_SUPPORTS_MULTIPLE_SCREENS) - CWsScreenDevice *dev = S60->screenDevice(1); - if (dev) { - displayControl = static_cast<MDisplayControl *>( - dev->GetInterface(MDisplayControl::ETypeId)); - if (displayControl) { - displayControl->EnableDisplayChangeEvents(ETrue); + if (S60->screenCount() > 1) { + CWsScreenDevice *dev = S60->screenDevice(1); + if (dev) { + displayControl = static_cast<MDisplayControl *>( + dev->GetInterface(MDisplayControl::ETypeId)); + if (displayControl) { + displayControl->EnableDisplayChangeEvents(ETrue); + } } } #endif -- cgit v0.12 From b3b332a50a6288164ca86d0691e9615f9c19abda Mon Sep 17 00:00:00 2001 From: Liang Qi <liang.qi@nokia.com> Date: Tue, 15 Mar 2011 13:46:46 +0100 Subject: Fix the license info for bin/elf2e32_qtwrapper.pl. Reviewed-by: TrustMe --- bin/elf2e32_qtwrapper.pl | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/bin/elf2e32_qtwrapper.pl b/bin/elf2e32_qtwrapper.pl index 64d485b..a2aff75 100755 --- a/bin/elf2e32_qtwrapper.pl +++ b/bin/elf2e32_qtwrapper.pl @@ -1,4 +1,44 @@ #!/usr/bin/perl -w +############################################################################# +## +## Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +## All rights reserved. +## Contact: Nokia Corporation (qt-info@nokia.com) +## +## This file is part of the S60 port of the Qt Toolkit. +## +## $QT_BEGIN_LICENSE:LGPL$ +## No Commercial Usage +## This file contains pre-release code and may not be distributed. +## You may use this file in accordance with the terms and conditions +## contained in the Technology Preview License Agreement accompanying +## this package. +## +## 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, Nokia gives you certain additional +## rights. These rights are described in the Nokia Qt LGPL Exception +## version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +## +## If you have questions regarding the use of this file, please contact +## Nokia at qt-info@nokia.com. +## +## +## +## +## +## +## +## +## $QT_END_LICENSE$ +## +############################################################################# # A script to get around some shortcomings in elf2e32, namely: # - Returning 0 even when there are errors. -- cgit v0.12 From fd8183129d0efe99e0d28f524264c59fb9155b80 Mon Sep 17 00:00:00 2001 From: Jiang Jiang <jiang.jiang@nokia.com> Date: Tue, 15 Mar 2011 14:54:42 +0100 Subject: Adjust right bearing when breaking with line separators If we found a forced line break with line separator (e.g. '\n'), take the right bearing of previous glyph into account, otherwise the resulting text width will be slightly smaller than the one without a line separator. Task-number: QTBUG-17020 Reviewed-by: Eskil --- src/gui/text/qtextlayout.cpp | 47 ++++++++++++++++-------------- tests/auto/qtextlayout/tst_qtextlayout.cpp | 17 +++++++++++ 2 files changed, 42 insertions(+), 22 deletions(-) diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index a996f59..905f81b 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -1682,6 +1682,7 @@ namespace { int glyphCount; int maxGlyphs; int currentPosition; + glyph_t previousGlyph; QFixed minw; QFixed softHyphenWidth; @@ -1709,6 +1710,15 @@ namespace { return glyphs.glyphs[logClusters[currentPosition - 1]]; } + inline void saveCurrentGlyph() + { + previousGlyph = 0; + if (currentPosition > 0 && + logClusters[currentPosition - 1] < glyphs.numGlyphs) { + previousGlyph = currentGlyph(); // needed to calculate right bearing later + } + } + inline void adjustRightBearing(glyph_t glyph) { qreal rb; @@ -1723,6 +1733,12 @@ namespace { adjustRightBearing(currentGlyph()); } + inline void adjustPreviousRightBearing() + { + if (previousGlyph > 0) + adjustRightBearing(previousGlyph); + } + inline void resetRightBearing() { rightBearing = QFixed(1); // Any positive number is defined as invalid since only @@ -1798,22 +1814,7 @@ void QTextLine::layout_helper(int maxGlyphs) lbh.manualWrap = (wrapMode == QTextOption::ManualWrap || wrapMode == QTextOption::NoWrap); int item = -1; - int newItem = -1; - int left = 0; - int right = eng->layoutData->items.size()-1; - while(left <= right) { - int middle = ((right-left)/2)+left; - if (line.from > eng->layoutData->items[middle].position) - left = middle+1; - else if(line.from < eng->layoutData->items[middle].position) - right = middle-1; - else { - newItem = middle; - break; - } - } - if (newItem == -1) - newItem = right; + int newItem = eng->findItem(line.from); LB_DEBUG("from: %d: item=%d, total %d, width available %f", line.from, newItem, eng->layoutData->items.size(), line.width.toReal()); @@ -1825,6 +1826,7 @@ void QTextLine::layout_helper(int maxGlyphs) lbh.currentPosition = line.from; int end = 0; lbh.logClusters = eng->layoutData->logClustersPtr; + lbh.previousGlyph = 0; while (newItem < eng->layoutData->items.size()) { lbh.resetRightBearing(); @@ -1885,6 +1887,7 @@ void QTextLine::layout_helper(int maxGlyphs) current, lbh.logClusters, lbh.glyphs); } else { lbh.tmpData.length++; + lbh.adjustPreviousRightBearing(); } line += lbh.tmpData; goto found; @@ -1915,9 +1918,7 @@ void QTextLine::layout_helper(int maxGlyphs) } else { lbh.whiteSpaceOrObject = false; bool sb_or_ws = false; - glyph_t previousGlyph = 0; - if (lbh.currentPosition > 0 && lbh.logClusters[lbh.currentPosition - 1] <lbh.glyphs.numGlyphs) - previousGlyph = lbh.currentGlyph(); // needed to calculate right bearing later + lbh.saveCurrentGlyph(); do { addNextCluster(lbh.currentPosition, end, lbh.tmpData, lbh.glyphCount, current, lbh.logClusters, lbh.glyphs); @@ -1942,7 +1943,7 @@ void QTextLine::layout_helper(int maxGlyphs) // b) if we are so short of available width that the // soft hyphen is the first breakable position, then // we don't want to show it. However we initially - // have to take the width for it into accoun so that + // have to take the width for it into account so that // the text document layout sees the overflow and // switch to break-anywhere mode, in which we // want the soft-hyphen to slip into the next line @@ -1970,8 +1971,9 @@ void QTextLine::layout_helper(int maxGlyphs) // we are too wide, fix right bearing if (rightBearing <= 0) lbh.rightBearing = rightBearing; // take from cache - else if (previousGlyph > 0) - lbh.adjustRightBearing(previousGlyph); + else + lbh.adjustPreviousRightBearing(); + if (!breakany) { line.textWidth += lbh.softHyphenWidth; } @@ -1979,6 +1981,7 @@ void QTextLine::layout_helper(int maxGlyphs) goto found; } } + lbh.saveCurrentGlyph(); } if (lbh.currentPosition == end) newItem = item + 1; diff --git a/tests/auto/qtextlayout/tst_qtextlayout.cpp b/tests/auto/qtextlayout/tst_qtextlayout.cpp index 0f1ff66..2d15566 100644 --- a/tests/auto/qtextlayout/tst_qtextlayout.cpp +++ b/tests/auto/qtextlayout/tst_qtextlayout.cpp @@ -124,6 +124,7 @@ private slots: void lineWidthFromBOM(); void textWidthVsWIdth(); void textWidthWithStackedTextEngine(); + void textWidthWithLineSeparator(); private: QFont testFont; @@ -1399,5 +1400,21 @@ void tst_QTextLayout::textWidthWithStackedTextEngine() QCOMPARE(line.naturalTextWidth(), fm.width(text)); } +void tst_QTextLayout::textWidthWithLineSeparator() +{ + QString s1("Save Project"), s2("Save Project\ntest"); + s2.replace('\n', QChar::LineSeparator); + + QTextLayout layout1(s1), layout2(s2); + layout1.beginLayout(); + layout2.beginLayout(); + + QTextLine line1 = layout1.createLine(); + QTextLine line2 = layout2.createLine(); + line1.setLineWidth(0x1000); + line2.setLineWidth(0x1000); + QCOMPARE(line1.naturalTextWidth(), line2.naturalTextWidth()); +} + QTEST_MAIN(tst_QTextLayout) #include "tst_qtextlayout.moc" -- cgit v0.12 From c35f610219b1d09f6d05215a2e2fe4f2f6bd966c Mon Sep 17 00:00:00 2001 From: Joerg Bornemann <joerg.bornemann@nokia.com> Date: Mon, 14 Feb 2011 15:57:01 +0100 Subject: qmake vcproj generator: support PCHs with other extensions than .h Task-number: QTBUG-16639 Reviewed-by: Marius Storm-Olsen --- qmake/generators/win32/msvc_objectmodel.cpp | 2 +- qmake/option.h | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/qmake/generators/win32/msvc_objectmodel.cpp b/qmake/generators/win32/msvc_objectmodel.cpp index 69cfc0d..3253c3b 100644 --- a/qmake/generators/win32/msvc_objectmodel.cpp +++ b/qmake/generators/win32/msvc_objectmodel.cpp @@ -2104,7 +2104,7 @@ void VCFilter::modifyPCHstage(QString str) break; } } - bool isHFile = str.endsWith(".h") && (str == Project->precompH); + bool isHFile = Option::hasFileExtension(str, Option::h_ext) && (str == Project->precompH); bool isCPPFile = pchThroughSourceFile && (str == Project->precompCPP); if(!isCFile && !isHFile && !isCPPFile) diff --git a/qmake/option.h b/qmake/option.h index e3ddc9a..bc87343 100644 --- a/qmake/option.h +++ b/qmake/option.h @@ -139,6 +139,14 @@ struct Option return fixString(in, flags); } + inline static bool hasFileExtension(const QString &str, const QStringList &extensions) + { + foreach (const QString &ext, extensions) + if (str.endsWith(ext)) + return true; + return false; + } + //global qmake mode, can only be in one mode per invocation! enum QMAKE_MODE { QMAKE_GENERATE_NOTHING, QMAKE_GENERATE_PROJECT, QMAKE_GENERATE_MAKEFILE, QMAKE_GENERATE_PRL, QMAKE_SET_PROPERTY, QMAKE_QUERY_PROPERTY }; @@ -195,7 +203,6 @@ private: inline QString fixEnvVariables(const QString &x) { return Option::fixString(x, Option::FixEnvVars); } inline QStringList splitPathList(const QString &paths) { return paths.split(Option::dirlist_sep); } - // this is a stripped down version of the one found in QtCore class QLibraryInfo { -- cgit v0.12 From a60bd37c08300201bb2a259f390b92e35808843e Mon Sep 17 00:00:00 2001 From: Joerg Bornemann <joerg.bornemann@nokia.com> Date: Mon, 14 Feb 2011 16:20:23 +0100 Subject: qmake vc(x)proj generator: fix reading of /YX, /Yc, /Yu compiler flags Controlling the PCH settings manually via the MSVC compiler flags was broken. Task-number: QTBUG-15594 Reviewed-by: Marius Storm-Olsen --- qmake/generators/win32/msvc_objectmodel.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/qmake/generators/win32/msvc_objectmodel.cpp b/qmake/generators/win32/msvc_objectmodel.cpp index 3253c3b..020c3d8 100644 --- a/qmake/generators/win32/msvc_objectmodel.cpp +++ b/qmake/generators/win32/msvc_objectmodel.cpp @@ -857,11 +857,11 @@ bool VCCLCompilerTool::parseOption(const char* option) break; case 'X': UsePrecompiledHeader = pchGenerateAuto; - PrecompiledHeaderFile = option+3; + PrecompiledHeaderThrough = option+3; break; case 'c': UsePrecompiledHeader = pchCreateUsingSpecific; - PrecompiledHeaderFile = option+3; + PrecompiledHeaderThrough = option+3; break; case 'd': case 'l': @@ -869,7 +869,7 @@ bool VCCLCompilerTool::parseOption(const char* option) break; case 'u': UsePrecompiledHeader = pchUseUsingSpecific; - PrecompiledHeaderFile = option+3; + PrecompiledHeaderThrough = option+3; break; default: found = false; break; -- cgit v0.12 From fef94ecbfb1c5b576247f2e203d0dd8c2c8f2ae1 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann <joerg.bornemann@nokia.com> Date: Mon, 14 Feb 2011 17:00:02 +0100 Subject: qmake vc(x)proj generator: set the output directory The configuration property OutDir was always set to ".\\". We're now referencing "$(OutDir)" instead of building the path every time from DESTDIR. Also, VCConfiguration::PrimaryOutput was always empty for VS < 2010 and is now unused. The variable MSVCPROJ_LIBOPTIONS was removed. Task-number: QTBUG-16490 Reviewed-by: Marius Storm-Olsen --- qmake/generators/win32/msvc_vcproj.cpp | 45 ++++++---------------------------- 1 file changed, 8 insertions(+), 37 deletions(-) diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index 0df33d0..b2e5959 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp @@ -878,22 +878,16 @@ void VcprojGenerator::initConfiguration() break; } + conf.OutputDirectory = project->first("DESTDIR"); + if (conf.OutputDirectory.isEmpty()) + conf.OutputDirectory = ".\\"; + if (!conf.OutputDirectory.endsWith("\\")) + conf.OutputDirectory += '\\'; if (conf.CompilerVersion >= NET2010) { - conf.OutputDirectory = project->first("DESTDIR"); - - if(conf.OutputDirectory.isEmpty()) - conf.OutputDirectory = ".\\"; - - if(!conf.OutputDirectory.endsWith("\\")) - conf.OutputDirectory += '\\'; - // The target name could have been changed. conf.PrimaryOutput = project->first("TARGET"); if ( !conf.PrimaryOutput.isEmpty() && !project->first("TARGET_VERSION_EXT").isEmpty() && project->isActiveConfig("shared")) conf.PrimaryOutput.append(project->first("TARGET_VERSION_EXT")); - } else { - conf.PrimaryOutput = project->first("PrimaryOutput"); - conf.OutputDirectory = "."; } conf.Name = project->values("BUILD_NAME").join(" "); @@ -982,13 +976,7 @@ void VcprojGenerator::initCompilerTool() void VcprojGenerator::initLibrarianTool() { VCConfiguration &conf = vcProject.Configuration; - conf.librarian.OutputFile = project->first("DESTDIR"); - if(conf.librarian.OutputFile.isEmpty()) - conf.librarian.OutputFile = ".\\"; - - if(!conf.librarian.OutputFile.endsWith("\\")) - conf.librarian.OutputFile += '\\'; - + conf.librarian.OutputFile = "$(OutDir)\\"; conf.librarian.OutputFile += project->first("MSVCPROJ_TARGET"); conf.librarian.AdditionalOptions += project->values("QMAKE_LIBFLAGS"); } @@ -1018,24 +1006,7 @@ void VcprojGenerator::initLinkerTool() } } - switch (projectTarget) { - case Application: - conf.linker.OutputFile = project->first("DESTDIR"); - break; - case SharedLib: - conf.linker.parseOptions(project->values("MSVCPROJ_LIBOPTIONS")); - conf.linker.OutputFile = project->first("DESTDIR"); - break; - case StaticLib: //unhandled - added to remove warnings.. - break; - } - - if(conf.linker.OutputFile.isEmpty()) - conf.linker.OutputFile = ".\\"; - - if(!conf.linker.OutputFile.endsWith("\\")) - conf.linker.OutputFile += '\\'; - + conf.linker.OutputFile = "$(OutDir)\\"; conf.linker.OutputFile += project->first("MSVCPROJ_TARGET"); if(project->isActiveConfig("dll")){ @@ -1054,7 +1025,7 @@ void VcprojGenerator::initResourceTool() if(project->isActiveConfig("debug")) conf.resource.PreprocessorDefinitions += "_DEBUG"; if(project->isActiveConfig("staticlib")) - conf.resource.ResourceOutputFileName = project->first("DESTDIR") + "/$(InputName).res"; + conf.resource.ResourceOutputFileName = "$(OutDir)\\$(InputName).res"; } void VcprojGenerator::initIDLTool() -- cgit v0.12 From 613d24096e78f8ef161ee0c63f7fda034534f3cd Mon Sep 17 00:00:00 2001 From: Joerg Bornemann <joerg.bornemann@nokia.com> Date: Mon, 14 Feb 2011 17:17:16 +0100 Subject: qmake vc(x)proj generator: fix handling of DEFINES from .prl files There was some ancient code putting those defines into MSVCPROJ_DEFINES. This variable was used for the VC6 generator. We just let MakefileGenerator handle the variables of a .prl file now. Task-number: QTBUG-16024 Reviewed-by: Marius Storm-Olsen --- qmake/generators/win32/msvc_vcproj.cpp | 13 ------------- qmake/generators/win32/msvc_vcproj.h | 1 - 2 files changed, 14 deletions(-) diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index b2e5959..f243e86 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp @@ -1548,19 +1548,6 @@ QString VcprojGenerator::findTemplate(QString file) return ret; } -void VcprojGenerator::processPrlVariable(const QString &var, const QStringList &l) -{ - if(var == "QMAKE_PRL_DEFINES") { - QStringList &out = project->values("MSVCPROJ_DEFINES"); - for(QStringList::ConstIterator it = l.begin(); it != l.end(); ++it) { - if(out.indexOf((*it)) == -1) - out.append((" /D " + *it)); - } - } else { - MakefileGenerator::processPrlVariable(var, l); - } -} - void VcprojGenerator::outputVariables() { #if 0 diff --git a/qmake/generators/win32/msvc_vcproj.h b/qmake/generators/win32/msvc_vcproj.h index 656afa9..fdcd73f 100644 --- a/qmake/generators/win32/msvc_vcproj.h +++ b/qmake/generators/win32/msvc_vcproj.h @@ -92,7 +92,6 @@ protected: virtual bool mergeBuildProject(MakefileGenerator *other); virtual bool openOutput(QFile &file, const QString &build) const; - virtual void processPrlVariable(const QString &, const QStringList &); virtual bool findLibraries(); virtual void outputVariables(); QString fixFilename(QString ofile) const; -- cgit v0.12 From 5ccd3443fb4604d67a8f65588cc2e3b61c9e1b5c Mon Sep 17 00:00:00 2001 From: Joerg Bornemann <joerg.bornemann@nokia.com> Date: Mon, 14 Feb 2011 17:23:50 +0100 Subject: qmake: fix the language settings generated Windows resource files On Windows > XP the version information of for example the Qt DLLs are not visible in the Windows explorer. That's due to missing language information in the version resource. Task-number: QT-4054 Task-number: QTBUG-12249 Reviewed-by: Marius Storm-Olsen --- qmake/generators/win32/winmakefile.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/qmake/generators/win32/winmakefile.cpp b/qmake/generators/win32/winmakefile.cpp index c85533b..ef234ec 100644 --- a/qmake/generators/win32/winmakefile.cpp +++ b/qmake/generators/win32/winmakefile.cpp @@ -456,6 +456,10 @@ void Win32MakefileGenerator::processRcFileVar() ts << "\t\t\t\tVALUE \"ProductName\", \"" << productName << "\\0\"" << endl; ts << "\t\t\tEND" << endl; ts << "\t\tEND" << endl; + ts << "\t\tBLOCK \"VarFileInfo\"" << endl; + ts << "\t\tBEGIN" << endl; + ts << "\t\t\tVALUE \"Translation\", 0x409, 1200" << endl; + ts << "\t\tEND" << endl; ts << "\tEND" << endl; ts << "/* End of Version info */" << endl; ts << endl; -- cgit v0.12 From 400f151126e2208882875987943a3c8d919ec7f4 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann <joerg.bornemann@nokia.com> Date: Mon, 14 Feb 2011 18:04:15 +0100 Subject: qmake nmake / mingw32-make generators: fix DEF_FILE for shadow builds Task-number: QTBUG-11643 Reviewed-by: Marius Storm-Olsen --- qmake/generators/win32/mingw_make.cpp | 6 ++++-- qmake/generators/win32/msvc_nmake.cpp | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/qmake/generators/win32/mingw_make.cpp b/qmake/generators/win32/mingw_make.cpp index 2639332..462920e 100644 --- a/qmake/generators/win32/mingw_make.cpp +++ b/qmake/generators/win32/mingw_make.cpp @@ -302,8 +302,10 @@ void MingwMakefileGenerator::init() project->values("QMAKE_LFLAGS").append(QString("-Wl,--out-implib,") + project->first("MINGW_IMPORT_LIB")); } - if(!project->values("DEF_FILE").isEmpty() && project->values("QMAKE_SYMBIAN_SHLIB").isEmpty()) - project->values("QMAKE_LFLAGS").append(QString("-Wl,") + project->first("DEF_FILE")); + if(!project->values("DEF_FILE").isEmpty() && project->values("QMAKE_SYMBIAN_SHLIB").isEmpty()) { + QString defFileName = fileFixify(project->values("DEF_FILE")).first(); + project->values("QMAKE_LFLAGS").append(QString("-Wl,") + escapeFilePath(defFileName)); + } MakefileGenerator::init(); diff --git a/qmake/generators/win32/msvc_nmake.cpp b/qmake/generators/win32/msvc_nmake.cpp index 1b2cd18..c55806d 100644 --- a/qmake/generators/win32/msvc_nmake.cpp +++ b/qmake/generators/win32/msvc_nmake.cpp @@ -218,8 +218,10 @@ void NmakeMakefileGenerator::init() project->values("QMAKE_LIBS") += escapeFilePaths(project->values("RES_FILE")); } - if(!project->values("DEF_FILE").isEmpty()) - project->values("QMAKE_LFLAGS").append(QString("/DEF:") + escapeFilePath(project->first("DEF_FILE"))); + if (!project->values("DEF_FILE").isEmpty()) { + QString defFileName = fileFixify(project->values("DEF_FILE")).first(); + project->values("QMAKE_LFLAGS").append(QString("/DEF:") + escapeFilePath(defFileName)); + } if(!project->values("VERSION").isEmpty()) { QString version = project->values("VERSION")[0]; -- cgit v0.12 From fcfd06409768916ef10c7048a87b2328ec5d45f7 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann <joerg.bornemann@nokia.com> Date: Mon, 14 Feb 2011 18:33:27 +0100 Subject: qmake/Mac: replace @SHORT_VERSION@ in QMAKE_INFO_PLIST file not only for libs Task-number: QTBUG-7993 Reviewed-by: Marius Storm-Olsen --- qmake/generators/mac/pbuilder_pbx.cpp | 2 ++ qmake/generators/unix/unixmake2.cpp | 18 +++++++++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/qmake/generators/mac/pbuilder_pbx.cpp b/qmake/generators/mac/pbuilder_pbx.cpp index 0ec946e..19667cd 100644 --- a/qmake/generators/mac/pbuilder_pbx.cpp +++ b/qmake/generators/mac/pbuilder_pbx.cpp @@ -1272,6 +1272,8 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) plist_in_text = plist_in_text.replace("@EXECUTABLE@", project->first("QMAKE_ORIG_TARGET")); } else { plist_in_text = plist_in_text.replace("@LIBRARY@", project->first("QMAKE_ORIG_TARGET")); + } + if (!project->values("VERSION").isEmpty()) { plist_in_text = plist_in_text.replace("@SHORT_VERSION@", project->first("VER_MAJ") + "." + project->first("VER_MIN")); } diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp index 5ea13f4..212f8bd 100644 --- a/qmake/generators/unix/unixmake2.cpp +++ b/qmake/generators/unix/unixmake2.cpp @@ -712,11 +712,18 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) t << info_plist_out << ": " << "\n\t"; if(!destdir.isEmpty()) t << mkdir_p_asstring(destdir) << "\n\t"; + QStringList commonSedArgs; + if (!project->values("VERSION").isEmpty()) + commonSedArgs << "-e \"s,@SHORT_VERSION@," << project->first("VER_MAJ") << "." << project->first("VER_MIN") << ",g\" "; + commonSedArgs << "-e \"s,@TYPEINFO@,"<< (project->isEmpty("QMAKE_PKGINFO_TYPEINFO") ? + QString::fromLatin1("????") : project->first("QMAKE_PKGINFO_TYPEINFO").left(4)) << ",g\" "; if(project->first("TEMPLATE") == "app") { QString icon = fileFixify(var("ICON")); t << "@$(DEL_FILE) " << info_plist_out << "\n\t" - << "@sed " - << "-e \"s,@ICON@," << icon.section(Option::dir_sep, -1) << ",g\" " + << "@sed "; + foreach (const QString &arg, commonSedArgs) + t << arg; + t << "-e \"s,@ICON@," << icon.section(Option::dir_sep, -1) << ",g\" " << "-e \"s,@EXECUTABLE@," << var("QMAKE_ORIG_TARGET") << ",g\" " << "-e \"s,@TYPEINFO@,"<< (project->isEmpty("QMAKE_PKGINFO_TYPEINFO") ? QString::fromLatin1("????") : project->first("QMAKE_PKGINFO_TYPEINFO").left(4)) << ",g\" " @@ -732,9 +739,10 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) } } else { t << "@$(DEL_FILE) " << info_plist_out << "\n\t" - << "@sed " - << "-e \"s,@LIBRARY@," << var("QMAKE_ORIG_TARGET") << ",g\" " - << "-e \"s,@SHORT_VERSION@," << project->first("VER_MAJ") << "." << project->first("VER_MIN") << ",g\" " + << "@sed "; + foreach (const QString &arg, commonSedArgs) + t << arg; + t << "-e \"s,@LIBRARY@," << var("QMAKE_ORIG_TARGET") << ",g\" " << "-e \"s,@TYPEINFO@," << (project->isEmpty("QMAKE_PKGINFO_TYPEINFO") ? QString::fromLatin1("????") : project->first("QMAKE_PKGINFO_TYPEINFO").left(4)) << ",g\" " -- cgit v0.12 From e22c6eb32c4c4c189ba5c11ce61adc8a59a0847b Mon Sep 17 00:00:00 2001 From: Joerg Bornemann <joerg.bornemann@nokia.com> Date: Tue, 15 Mar 2011 15:53:10 +0100 Subject: qmake vcproj generator: do not insert $(INHERIT) This will remove the warnings about undefined environment variables when building with IncrediBuild. Done-with: Marius Storm-Olsen --- qmake/generators/win32/msvc_objectmodel.cpp | 12 ++++++------ qmake/generators/win32/msvc_objectmodel.h | 1 + 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/qmake/generators/win32/msvc_objectmodel.cpp b/qmake/generators/win32/msvc_objectmodel.cpp index 020c3d8..5b62b5e 100644 --- a/qmake/generators/win32/msvc_objectmodel.cpp +++ b/qmake/generators/win32/msvc_objectmodel.cpp @@ -355,7 +355,7 @@ VCCLCompilerTool::VCCLCompilerTool() TreatWChar_tAsBuiltInType(unset), TurnOffAssemblyGeneration(unset), UndefineAllPreprocessorDefinitions(unset), - UsePrecompiledHeader(pchNone), + UsePrecompiledHeader(pchUnset), UseUnicodeForAssemblerListing(unset), WarnAsError(unset), WarningLevel(warningLevel_0), @@ -389,7 +389,7 @@ inline XmlOutput::xml_output xformUsePrecompiledHeaderForNET2005(pchOption whatP if (whatPch == pchGenerateAuto) whatPch = (pchOption)0; if (whatPch == pchUseUsingSpecific) whatPch = (pchOption)2; } - return attrE(_UsePrecompiledHeader, whatPch); + return attrE(_UsePrecompiledHeader, whatPch, /*ifNot*/ pchUnset); } inline XmlOutput::xml_output xformExceptionHandlingNET2005(exceptionHandling eh, DotNET compilerVersion) @@ -2145,9 +2145,9 @@ void VCFilter::modifyPCHstage(QString str) useCompilerTool = true; // Setup PCH options - CompilerTool.UsePrecompiledHeader = (isCFile ? pchNone : pchCreateUsingSpecific); - CompilerTool.PrecompiledHeaderThrough = (isCPPFile ? QString("$(INHERIT)") : QString("$(NOINHERIT)")); - CompilerTool.ForcedIncludeFiles = QStringList("$(NOINHERIT)"); + CompilerTool.UsePrecompiledHeader = (isCFile ? pchNone : pchCreateUsingSpecific); + if (!isCPPFile) + CompilerTool.ForcedIncludeFiles = QStringList("$(NOINHERIT)"); } bool VCFilter::addExtraCompiler(const VCFilterFile &info) @@ -2514,7 +2514,7 @@ void VCProjectWriter::write(XmlOutput &xml, const VCCLCompilerTool &tool) << attrT(_TurnOffAssemblyGeneration, tool.TurnOffAssemblyGeneration) << attrT(_UndefineAllPreprocessorDefinitions, tool.UndefineAllPreprocessorDefinitions) << attrX(_UndefinePreprocessorDefinitions, tool.UndefinePreprocessorDefinitions) - << (!tool.PrecompiledHeaderFile.isEmpty() || !tool.PrecompiledHeaderThrough.isEmpty() ? xformUsePrecompiledHeaderForNET2005(tool.UsePrecompiledHeader, tool.config->CompilerVersion) : noxml()) + << xformUsePrecompiledHeaderForNET2005(tool.UsePrecompiledHeader, tool.config->CompilerVersion) << attrT(_WarnAsError, tool.WarnAsError) << attrE(_WarningLevel, tool.WarningLevel, /*ifNot*/ warningLevelUnknown) << attrT(_WholeProgramOptimization, tool.WholeProgramOptimization) diff --git a/qmake/generators/win32/msvc_objectmodel.h b/qmake/generators/win32/msvc_objectmodel.h index 5431ce0..3e62fb4 100644 --- a/qmake/generators/win32/msvc_objectmodel.h +++ b/qmake/generators/win32/msvc_objectmodel.h @@ -366,6 +366,7 @@ enum optLinkTimeCodeGenType { optLTCGUpdate }; enum pchOption { + pchUnset = -1, pchNone, pchCreateUsingSpecific, pchGenerateAuto, -- cgit v0.12 From b17ee2af5e3453191bb4568a388ea042562e1abc Mon Sep 17 00:00:00 2001 From: Friedemann Kleint <Friedemann.Kleint@nokia.com> Date: Tue, 15 Mar 2011 16:29:26 +0100 Subject: Designer: Fix a bug clearing the Z-Order when adding a new widget. Wrong list was used when adding widgets. Task-number: QTBUG-18120 Reviewed-by: Jarek Kobus <jaroslaw.kobus@nokia.com> --- tools/designer/src/components/formeditor/qdesigner_resource.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/designer/src/components/formeditor/qdesigner_resource.cpp b/tools/designer/src/components/formeditor/qdesigner_resource.cpp index 430b070..6d718bb 100644 --- a/tools/designer/src/components/formeditor/qdesigner_resource.cpp +++ b/tools/designer/src/components/formeditor/qdesigner_resource.cpp @@ -1190,7 +1190,7 @@ QWidget *QDesignerResource::createWidget(const QString &widgetName, QWidget *par parentWidget->setProperty("_q_widgetOrder", qVariantFromValue(list)); QList<QWidget *> zOrder = qVariantValue<QWidgetList>(parentWidget->property("_q_zOrder")); zOrder.append(w); - parentWidget->setProperty("_q_zOrder", qVariantFromValue(list)); + parentWidget->setProperty("_q_zOrder", qVariantFromValue(zOrder)); } } else { core()->metaDataBase()->add(w); -- cgit v0.12 From f4244785cb8875b177274db485a346605f05ed7c Mon Sep 17 00:00:00 2001 From: Friedemann Kleint <Friedemann.Kleint@nokia.com> Date: Tue, 15 Mar 2011 16:32:53 +0100 Subject: Designer: Fix a bug affecting tab reordering of promoted tab widgets. Event filter was added twice due to widget initialization being done twice caused by recursion of WidgetFactory::createWidget() in the case of a fallback to promotion when a custom widget plugin is missing. Task-number: QTBUG-18121 Reviewed-by: Jarek Kobus <jaroslaw.kobus@nokia.com> --- tools/designer/src/lib/shared/widgetfactory.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/designer/src/lib/shared/widgetfactory.cpp b/tools/designer/src/lib/shared/widgetfactory.cpp index 887bb04..36f795e 100644 --- a/tools/designer/src/lib/shared/widgetfactory.cpp +++ b/tools/designer/src/lib/shared/widgetfactory.cpp @@ -412,8 +412,10 @@ QWidget *WidgetFactory::createWidget(const QString &widgetName, QWidget *parentW // Currently happens in the case of Q3-Support widgets baseClass =fallBackBaseClass; } - w = createWidget(baseClass, parentWidget); - promoteWidget(core(),w,widgetName); + if (QWidget *promotedWidget = createWidget(baseClass, parentWidget)) { + promoteWidget(core(), promotedWidget, widgetName); + return promotedWidget; // Do not initialize twice. + } } while (false); Q_ASSERT(w != 0); -- cgit v0.12 From 2355774b061d9e7213634ddec3c50280c4b10b70 Mon Sep 17 00:00:00 2001 From: Jani Hautakangas <jani.hautakangas@nokia.com> Date: Tue, 8 Mar 2011 00:26:05 +0200 Subject: Initial implementation of GLES2.0 resource pooling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Keep the implementation in separate qpixmapdata_poolgl.cpp file until the pooling has been verified and confirmed to work ok. Task-number: QTBUG-15253 QTBUG-17850 Reviewed-by: Samuel Rødal --- src/gui/kernel/qwidget.cpp | 4 +- .../gl2paintengineex/qpaintengineex_opengl2.cpp | 28 +- src/opengl/opengl.pro | 9 +- src/opengl/qgl.cpp | 19 +- src/opengl/qgl.h | 1 + src/opengl/qgl_symbian.cpp | 1 + src/opengl/qgltexturepool.cpp | 241 ++++++ src/opengl/qgltexturepool_p.h | 147 ++++ src/opengl/qgraphicssystem_gl.cpp | 11 +- src/opengl/qgraphicssystem_gl_p.h | 4 + src/opengl/qpixmapdata_gl_p.h | 42 +- src/opengl/qpixmapdata_poolgl.cpp | 902 +++++++++++++++++++++ src/opengl/qwindowsurface_gl.cpp | 79 +- src/s60installs/bwins/QtOpenGLu.def | 7 + src/s60installs/eabi/QtOpenGLu.def | 6 + 15 files changed, 1482 insertions(+), 19 deletions(-) create mode 100644 src/opengl/qgltexturepool.cpp create mode 100644 src/opengl/qgltexturepool_p.h create mode 100644 src/opengl/qpixmapdata_poolgl.cpp diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 1786e65..e8d9efd 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -1326,8 +1326,8 @@ void QWidgetPrivate::init(QWidget *parentWidget, Qt::WindowFlags f) //give potential windows a bigger "pre-initial" size; create_sys() will give them a new size later #ifdef Q_OS_SYMBIAN if (isGLWidget) { - // Don't waste GPU mem for unnecessary large egl surface - data.crect = QRect(0,0,2,2); + // Don't waste GPU mem for unnecessary large egl surface until resized by application + data.crect = QRect(0,0,1,1); } else { data.crect = parentWidget ? QRect(0,0,100,30) : QRect(0,0,360,640); } diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index cda31e5..c8786fb 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -1335,11 +1335,14 @@ void QGL2PaintEngineEx::drawPixmap(const QRectF& dest, const QPixmap & pixmap, c ensureActive(); d->transferMode(ImageDrawingMode); + QGLContext::BindOptions bindOptions = QGLContext::InternalBindOption|QGLContext::CanFlipNativePixmapBindOption; +#ifdef QGL_USE_TEXTURE_POOL + bindOptions |= QGLContext::TemporarilyCachedBindOption; +#endif + glActiveTexture(GL_TEXTURE0 + QT_IMAGE_TEXTURE_UNIT); QGLTexture *texture = - ctx->d_func()->bindTexture(pixmap, GL_TEXTURE_2D, GL_RGBA, - QGLContext::InternalBindOption - | QGLContext::CanFlipNativePixmapBindOption); + ctx->d_func()->bindTexture(pixmap, GL_TEXTURE_2D, GL_RGBA, bindOptions); GLfloat top = texture->options & QGLContext::InvertedYBindOption ? (pixmap.height() - src.top()) : src.top(); GLfloat bottom = texture->options & QGLContext::InvertedYBindOption ? (pixmap.height() - src.bottom()) : src.bottom(); @@ -1351,6 +1354,12 @@ void QGL2PaintEngineEx::drawPixmap(const QRectF& dest, const QPixmap & pixmap, c d->updateTextureFilter(GL_TEXTURE_2D, GL_CLAMP_TO_EDGE, state()->renderHints & QPainter::SmoothPixmapTransform, texture->id); d->drawTexture(dest, srcRect, pixmap.size(), isOpaque, isBitmap); + + if (texture->options&QGLContext::TemporarilyCachedBindOption) { + // pixmap was temporarily cached as a QImage texture by pooling system + // and should be destroyed immediately + QGLTextureCache::instance()->remove(ctx, texture->id); + } } void QGL2PaintEngineEx::drawImage(const QRectF& dest, const QImage& image, const QRectF& src, @@ -1375,12 +1384,23 @@ void QGL2PaintEngineEx::drawImage(const QRectF& dest, const QImage& image, const glActiveTexture(GL_TEXTURE0 + QT_IMAGE_TEXTURE_UNIT); - QGLTexture *texture = ctx->d_func()->bindTexture(image, GL_TEXTURE_2D, GL_RGBA, QGLContext::InternalBindOption); + QGLContext::BindOptions bindOptions = QGLContext::InternalBindOption; +#ifdef QGL_USE_TEXTURE_POOL + bindOptions |= QGLContext::TemporarilyCachedBindOption; +#endif + + QGLTexture *texture = ctx->d_func()->bindTexture(image, GL_TEXTURE_2D, GL_RGBA, bindOptions); GLuint id = texture->id; d->updateTextureFilter(GL_TEXTURE_2D, GL_CLAMP_TO_EDGE, state()->renderHints & QPainter::SmoothPixmapTransform, id); d->drawTexture(dest, src, image.size(), !image.hasAlphaChannel()); + + if (texture->options&QGLContext::TemporarilyCachedBindOption) { + // image was temporarily cached by texture pooling system + // and should be destroyed immediately + QGLTextureCache::instance()->remove(ctx, texture->id); + } } void QGL2PaintEngineEx::drawStaticTextItem(QStaticTextItem *textItem) diff --git a/src/opengl/opengl.pro b/src/opengl/opengl.pro index 0e82467..6bbf99b 100644 --- a/src/opengl/opengl.pro +++ b/src/opengl/opengl.pro @@ -148,11 +148,16 @@ embedded { } symbian { + DEFINES += QGL_USE_TEXTURE_POOL + SOURCES -= qpixmapdata_gl.cpp SOURCES += qgl_symbian.cpp \ + qpixmapdata_poolgl.cpp \ qglpixelbuffer_egl.cpp \ - qgl_egl.cpp + qgl_egl.cpp \ + qgltexturepool.cpp - HEADERS += qgl_egl_p.h + HEADERS += qgl_egl_p.h \ + qgltexturepool_p.h symbian:TARGET.UID3 = 0x2002131A } diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 062218c..ded7aa8 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -93,6 +93,10 @@ #include "qlibrary.h" #include <qmutex.h> +#ifdef QGL_USE_TEXTURE_POOL +#include <private/qgltexturepool_p.h> +#endif + QT_BEGIN_NAMESPACE @@ -2022,6 +2026,10 @@ struct DDSFormat { the pixmap/image that it stems from, e.g. installing destruction hooks in them. + \omitvalue TemporarilyCachedBindOption Used by paint engines on some + platforms to indicate that the pixmap or image texture is possibly + cached only temporarily and must be destroyed immediately after the use. + \omitvalue InternalBindOption */ @@ -2529,8 +2537,18 @@ QGLTexture* QGLContextPrivate::bindTexture(const QImage &image, GLenum target, G #endif const QImage &constRef = img; // to avoid detach in bits()... +#ifdef QGL_USE_TEXTURE_POOL + QGLTexturePool::instance()->createPermanentTexture(tx_id, + target, + 0, internalFormat, + img.width(), img.height(), + externalFormat, + pixel_type, + constRef.bits()); +#else glTexImage2D(target, 0, internalFormat, img.width(), img.height(), 0, externalFormat, pixel_type, constRef.bits()); +#endif #if defined(QT_OPENGL_ES_2) if (genMipmap) glGenerateMipmap(target); @@ -2569,7 +2587,6 @@ QGLTexture *QGLContextPrivate::textureCacheLookup(const qint64 key, GLenum targe return 0; } - /*! \internal */ QGLTexture *QGLContextPrivate::bindTexture(const QPixmap &pixmap, GLenum target, GLint format, QGLContext::BindOptions options) { diff --git a/src/opengl/qgl.h b/src/opengl/qgl.h index 9443c74..7d72c8a 100644 --- a/src/opengl/qgl.h +++ b/src/opengl/qgl.h @@ -329,6 +329,7 @@ public: MemoryManagedBindOption = 0x0010, // internal flag CanFlipNativePixmapBindOption = 0x0020, // internal flag + TemporarilyCachedBindOption = 0x0040, // internal flag DefaultBindOption = LinearFilteringBindOption | InvertedYBindOption diff --git a/src/opengl/qgl_symbian.cpp b/src/opengl/qgl_symbian.cpp index a9e2248..2978514 100644 --- a/src/opengl/qgl_symbian.cpp +++ b/src/opengl/qgl_symbian.cpp @@ -52,6 +52,7 @@ #include <private/qwidget_p.h> // to access QWExtra #include "qgl_egl_p.h" #include "qpixmapdata_gl_p.h" +#include "qgltexturepool_p.h" #include "qcolormap.h" #include <QDebug> diff --git a/src/opengl/qgltexturepool.cpp b/src/opengl/qgltexturepool.cpp new file mode 100644 index 0000000..61a88c3 --- /dev/null +++ b/src/opengl/qgltexturepool.cpp @@ -0,0 +1,241 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qgltexturepool_p.h" +#include "qpixmapdata_gl_p.h" + +QT_BEGIN_NAMESPACE + +Q_OPENGL_EXPORT extern QGLWidget* qt_gl_share_widget(); + +static QGLTexturePool *qt_gl_texture_pool = 0; + +class QGLTexturePoolPrivate +{ +public: + QGLTexturePoolPrivate() : lruFirst(0), lruLast(0) {} + + QGLPixmapData *lruFirst; + QGLPixmapData *lruLast; +}; + +QGLTexturePool::QGLTexturePool() + : d_ptr(new QGLTexturePoolPrivate()) +{ +} + +QGLTexturePool::~QGLTexturePool() +{ +} + +QGLTexturePool *QGLTexturePool::instance() +{ + if (!qt_gl_texture_pool) + qt_gl_texture_pool = new QGLTexturePool(); + return qt_gl_texture_pool; +} + +GLuint QGLTexturePool::createTextureForPixmap(GLenum target, + GLint level, + GLint internalformat, + GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + QGLPixmapData *data) +{ + GLuint texture; + glGenTextures(1, &texture); + glBindTexture(target, texture); + do { + glTexImage2D(target, level, internalformat, width, height, 0, format, type, 0); + GLenum error = glGetError(); + if (error == GL_NO_ERROR) { + if (data) + moveToHeadOfLRU(data); + return texture; + } else if (error != GL_OUT_OF_MEMORY) { + qWarning("QGLTexturePool: cannot create temporary texture because of invalid params"); + return 0; + } + } while (reclaimSpace(internalformat, width, height, format, type, data)); + qWarning("QGLTexturePool: cannot reclaim sufficient space for a %dx%d pixmap", + width, height); + return 0; +} + +bool QGLTexturePool::createPermanentTexture(GLuint texture, + GLenum target, + GLint level, + GLint internalformat, + GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + const GLvoid *data) +{ + glBindTexture(target, texture); + do { + glTexImage2D(target, level, internalformat, width, height, 0, format, type, data); + + GLenum error = glGetError(); + if (error == GL_NO_ERROR) { + return true; + } else if (error != GL_OUT_OF_MEMORY) { + qWarning("QGLTexturePool: cannot create permanent texture because of invalid params"); + return false; + } + } while (reclaimSpace(internalformat, width, height, format, type, 0)); + qWarning("QGLTexturePool: cannot reclaim sufficient space for a %dx%d pixmap", + width, height); + return 0; +} + +void QGLTexturePool::releaseTexture(QGLPixmapData *data, GLuint texture) +{ + // Very simple strategy at the moment: just destroy the texture. + if (data) + removeFromLRU(data); + + QGLShareContextScope ctx(qt_gl_share_widget()->context()); + glDeleteTextures(1, &texture); +} + +void QGLTexturePool::useTexture(QGLPixmapData *data) +{ + moveToHeadOfLRU(data); +} + +void QGLTexturePool::detachTexture(QGLPixmapData *data) +{ + removeFromLRU(data); +} + +bool QGLTexturePool::reclaimSpace(GLint internalformat, + GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + QGLPixmapData *data) +{ + Q_UNUSED(internalformat); // For future use in picking the best texture to eject. + Q_UNUSED(width); + Q_UNUSED(height); + Q_UNUSED(format); + Q_UNUSED(type); + + bool succeeded = false; + bool wasInLRU = false; + if (data) { + wasInLRU = data->inLRU; + moveToHeadOfLRU(data); + } + + QGLPixmapData *lrudata = pixmapLRU(); + if (lrudata && lrudata != data) { + lrudata->reclaimTexture(); + succeeded = true; + } + + if (data && !wasInLRU) + removeFromLRU(data); + + return succeeded; +} + +void QGLTexturePool::hibernate() +{ + Q_D(QGLTexturePool); + QGLPixmapData *pd = d->lruLast; + while (pd) { + QGLPixmapData *prevLRU = pd->prevLRU; + pd->inTexturePool = false; + pd->inLRU = false; + pd->nextLRU = 0; + pd->prevLRU = 0; + pd->hibernate(); + pd = prevLRU; + } + d->lruFirst = 0; + d->lruLast = 0; +} + +void QGLTexturePool::moveToHeadOfLRU(QGLPixmapData *data) +{ + Q_D(QGLTexturePool); + if (data->inLRU) { + if (!data->prevLRU) + return; // Already at the head of the list. + removeFromLRU(data); + } + data->inLRU = true; + data->nextLRU = d->lruFirst; + data->prevLRU = 0; + if (d->lruFirst) + d->lruFirst->prevLRU = data; + else + d->lruLast = data; + d->lruFirst = data; +} + +void QGLTexturePool::removeFromLRU(QGLPixmapData *data) +{ + Q_D(QGLTexturePool); + if (!data->inLRU) + return; + if (data->nextLRU) + data->nextLRU->prevLRU = data->prevLRU; + else + d->lruLast = data->prevLRU; + if (data->prevLRU) + data->prevLRU->nextLRU = data->nextLRU; + else + d->lruFirst = data->nextLRU; + data->inLRU = false; +} + +QGLPixmapData *QGLTexturePool::pixmapLRU() +{ + Q_D(QGLTexturePool); + return d->lruLast; +} + +QT_END_NAMESPACE diff --git a/src/opengl/qgltexturepool_p.h b/src/opengl/qgltexturepool_p.h new file mode 100644 index 0000000..8b6f726 --- /dev/null +++ b/src/opengl/qgltexturepool_p.h @@ -0,0 +1,147 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QGLTEXTUREPOOL_P_H +#define QGLTEXTUREPOOL_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of other Qt classes. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include "qgl.h" +#include <QtCore/qscopedpointer.h> + +QT_BEGIN_NAMESPACE + +class QGLPixmapData; +class QGLTexturePoolPrivate; + +class QGLTexturePool +{ +public: + QGLTexturePool(); + virtual ~QGLTexturePool(); + + static QGLTexturePool *instance(); + + // Create a new texture with the specified parameters and associate + // it with "data". The QGLPixmapData will be notified when the + // texture needs to be reclaimed by the pool. + // + // This function will call reclaimSpace() when texture creation fails. + GLuint createTextureForPixmap(GLenum target, + GLint level, + GLint internalformat, + GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + QGLPixmapData *data); + + // Create a permanent texture with the specified parameters. + // If there is insufficient space for the texture, + // then this function will call reclaimSpace() and try again. + // + // The caller is responsible for calling glDeleteTextures() + // when it no longer needs the texture, as the texture is not + // recorded in the texture pool. + bool createPermanentTexture(GLuint texture, + GLenum target, + GLint level, + GLint internalformat, + GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + const GLvoid *data); + + // Release a texture that is no longer required. + void releaseTexture(QGLPixmapData *data, GLuint texture); + + // Notify the pool that a QGLPixmapData object is using + // an texture again. This allows the pool to move the texture + // within a least-recently-used list of QGLPixmapData objects. + void useTexture(QGLPixmapData *data); + + // Notify the pool that the texture associated with a + // QGLPixmapData is being detached from the pool. The caller + // will become responsible for calling glDeleteTextures(). + void detachTexture(QGLPixmapData *data); + + // Reclaim space for an image allocation with the specified parameters. + // Returns true if space was reclaimed, or false if there is no + // further space that can be reclaimed. The "data" parameter + // indicates the pixmap that is trying to obtain space which should + // not itself be reclaimed. + bool reclaimSpace(GLint internalformat, + GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + QGLPixmapData *data); + + // Hibernate the image pool because the context is about to be + // destroyed. All textures left in the pool should be released. + void hibernate(); + +protected: + // Helper functions for managing the LRU list of QGLPixmapData objects. + void moveToHeadOfLRU(QGLPixmapData *data); + void removeFromLRU(QGLPixmapData *data); + QGLPixmapData *pixmapLRU(); + +private: + QScopedPointer<QGLTexturePoolPrivate> d_ptr; + + Q_DECLARE_PRIVATE(QGLTexturePool) + Q_DISABLE_COPY(QGLTexturePool) +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/opengl/qgraphicssystem_gl.cpp b/src/opengl/qgraphicssystem_gl.cpp index 3574756..0aa3c2e 100644 --- a/src/opengl/qgraphicssystem_gl.cpp +++ b/src/opengl/qgraphicssystem_gl.cpp @@ -57,6 +57,10 @@ #include <QtGui/private/qapplication_p.h> #endif +#ifdef QGL_USE_TEXTURE_POOL +#include "private/qgltexturepool_p.h" +#endif + QT_BEGIN_NAMESPACE extern QGLWidget *qt_gl_getShareWidget(); @@ -100,6 +104,11 @@ QWindowSurface *QGLGraphicsSystem::createWindowSurface(QWidget *widget) const return new QGLWindowSurface(widget); } - +#ifdef QGL_USE_TEXTURE_POOL +void QGLGraphicsSystem::releaseCachedResources() +{ + QGLTexturePool::instance()->hibernate(); +} +#endif QT_END_NAMESPACE diff --git a/src/opengl/qgraphicssystem_gl_p.h b/src/opengl/qgraphicssystem_gl_p.h index 4630da1..5829dcc 100644 --- a/src/opengl/qgraphicssystem_gl_p.h +++ b/src/opengl/qgraphicssystem_gl_p.h @@ -66,6 +66,10 @@ public: QPixmapData *createPixmapData(QPixmapData::PixelType type) const; QWindowSurface *createWindowSurface(QWidget *widget) const; + +#ifdef QGL_USE_TEXTURE_POOL + void releaseCachedResources(); +#endif private: bool m_useX11GL; }; diff --git a/src/opengl/qpixmapdata_gl_p.h b/src/opengl/qpixmapdata_gl_p.h index a4066fd..55cc29d 100644 --- a/src/opengl/qpixmapdata_gl_p.h +++ b/src/opengl/qpixmapdata_gl_p.h @@ -66,6 +66,12 @@ class QGLFramebufferObject; class QGLFramebufferObjectFormat; class QGLPixmapData; +#ifdef QGL_USE_TEXTURE_POOL +void qt_gl_register_pixmap(QGLPixmapData *pd); +void qt_gl_unregister_pixmap(QGLPixmapData *pd); +void qt_gl_hibernate_pixmaps(); +#endif + class QGLFramebufferObjectPool { public: @@ -129,7 +135,24 @@ public: GLuint bind(bool copyBack = true) const; QGLTexture *texture() const; -#if defined(Q_OS_SYMBIAN) +#ifdef QGL_USE_TEXTURE_POOL + void destroyTexture(); + // Detach this image from the image pool. + void detachTextureFromPool(); + // Release the GL resources associated with this pixmap and copy + // the pixmap's contents out of the GPU back into main memory. + // The GL resource will be automatically recreated the next time + // ensureCreated() is called. Does nothing if the pixmap cannot be + // hibernated for some reason (e.g. texture is shared with another + // process via a SgImage). + void hibernate(); + // Called when the QGLTexturePool wants to reclaim this pixmap's + // texture objects to reuse storage. + void reclaimTexture(); + void forceToImage(); +#endif + +#ifdef Q_OS_SYMBIAN void* toNativeType(NativeType type); void fromNativeType(void* pixmap, NativeType type); #endif @@ -176,6 +199,23 @@ private: mutable QGLPixmapGLPaintDevice m_glDevice; +#ifdef QGL_USE_TEXTURE_POOL + QGLPixmapData *nextLRU; + QGLPixmapData *prevLRU; + mutable bool inLRU; + mutable bool failedToAlloc; + mutable bool inTexturePool; + + QGLPixmapData *next; + QGLPixmapData *prev; + + friend class QGLTexturePool; + + friend void qt_gl_register_pixmap(QGLPixmapData *pd); + friend void qt_gl_unregister_pixmap(QGLPixmapData *pd); + friend void qt_gl_hibernate_pixmaps(); +#endif + friend class QGLPixmapGLPaintDevice; friend class QMeeGoPixmapData; friend class QMeeGoLivePixmapData; diff --git a/src/opengl/qpixmapdata_poolgl.cpp b/src/opengl/qpixmapdata_poolgl.cpp new file mode 100644 index 0000000..f1220b1 --- /dev/null +++ b/src/opengl/qpixmapdata_poolgl.cpp @@ -0,0 +1,902 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenGL module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qpixmap.h" +#include "qglframebufferobject.h" + +#include <private/qpaintengine_raster_p.h> + +#include "qpixmapdata_gl_p.h" + +#include <private/qgl_p.h> +#include <private/qdrawhelper_p.h> +#include <private/qimage_p.h> + +#include <private/qpaintengineex_opengl2_p.h> + +#include <qdesktopwidget.h> +#include <qfile.h> +#include <qimagereader.h> +#include <qbuffer.h> + +#include "qgltexturepool_p.h" + +QT_BEGIN_NAMESPACE + +Q_OPENGL_EXPORT extern QGLWidget* qt_gl_share_widget(); + +/*! + \class QGLFramebufferObjectPool + \since 4.6 + + \brief The QGLFramebufferObject class provides a pool of framebuffer + objects for offscreen rendering purposes. + + When requesting an FBO of a given size and format, an FBO of the same + format and a size at least as big as the requested size will be returned. + + \internal +*/ + +static inline int areaDiff(const QSize &size, const QGLFramebufferObject *fbo) +{ + return qAbs(size.width() * size.height() - fbo->width() * fbo->height()); +} + +extern int qt_next_power_of_two(int v); + +static inline QSize maybeRoundToNextPowerOfTwo(const QSize &sz) +{ +#ifdef QT_OPENGL_ES_2 + QSize rounded(qt_next_power_of_two(sz.width()), qt_next_power_of_two(sz.height())); + if (rounded.width() * rounded.height() < 1.20 * sz.width() * sz.height()) + return rounded; +#endif + return sz; +} + + +QGLFramebufferObject *QGLFramebufferObjectPool::acquire(const QSize &requestSize, const QGLFramebufferObjectFormat &requestFormat, bool strictSize) +{ + QGLFramebufferObject *chosen = 0; + QGLFramebufferObject *candidate = 0; + for (int i = 0; !chosen && i < m_fbos.size(); ++i) { + QGLFramebufferObject *fbo = m_fbos.at(i); + + if (strictSize) { + if (fbo->size() == requestSize && fbo->format() == requestFormat) { + chosen = fbo; + break; + } else { + continue; + } + } + + if (fbo->format() == requestFormat) { + // choose the fbo with a matching format and the closest size + if (!candidate || areaDiff(requestSize, candidate) > areaDiff(requestSize, fbo)) + candidate = fbo; + } + + if (candidate) { + m_fbos.removeOne(candidate); + + const QSize fboSize = candidate->size(); + QSize sz = fboSize; + + if (sz.width() < requestSize.width()) + sz.setWidth(qMax(requestSize.width(), qRound(sz.width() * 1.5))); + if (sz.height() < requestSize.height()) + sz.setHeight(qMax(requestSize.height(), qRound(sz.height() * 1.5))); + + // wasting too much space? + if (sz.width() * sz.height() > requestSize.width() * requestSize.height() * 4) + sz = requestSize; + + if (sz != fboSize) { + delete candidate; + candidate = new QGLFramebufferObject(maybeRoundToNextPowerOfTwo(sz), requestFormat); + } + + chosen = candidate; + } + } + + if (!chosen) { + if (strictSize) + chosen = new QGLFramebufferObject(requestSize, requestFormat); + else + chosen = new QGLFramebufferObject(maybeRoundToNextPowerOfTwo(requestSize), requestFormat); + } + + if (!chosen->isValid()) { + delete chosen; + chosen = 0; + } + + return chosen; +} + +void QGLFramebufferObjectPool::release(QGLFramebufferObject *fbo) +{ + if (fbo) + m_fbos << fbo; +} + + +QPaintEngine* QGLPixmapGLPaintDevice::paintEngine() const +{ + return data->paintEngine(); +} + +void QGLPixmapGLPaintDevice::beginPaint() +{ + if (!data->isValid()) + return; + + // QGLPaintDevice::beginPaint will store the current binding and replace + // it with m_thisFBO: + m_thisFBO = data->m_renderFbo->handle(); + QGLPaintDevice::beginPaint(); + + Q_ASSERT(data->paintEngine()->type() == QPaintEngine::OpenGL2); + + // QPixmap::fill() is deferred until now, where we actually need to do the fill: + if (data->needsFill()) { + const QColor &c = data->fillColor(); + float alpha = c.alphaF(); + glDisable(GL_SCISSOR_TEST); + glClearColor(c.redF() * alpha, c.greenF() * alpha, c.blueF() * alpha, alpha); + glClear(GL_COLOR_BUFFER_BIT); + } + else if (!data->isUninitialized()) { + // If the pixmap (GL Texture) has valid content (it has been + // uploaded from an image or rendered into before), we need to + // copy it from the texture to the render FBO. + + glDisable(GL_DEPTH_TEST); + glDisable(GL_SCISSOR_TEST); + glDisable(GL_BLEND); + +#if !defined(QT_OPENGL_ES_2) + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glOrtho(0, data->width(), data->height(), 0, -999999, 999999); +#endif + + glViewport(0, 0, data->width(), data->height()); + + // Pass false to bind so it doesn't copy the FBO into the texture! + context()->drawTexture(QRect(0, 0, data->width(), data->height()), data->bind(false)); + } +} + +void QGLPixmapGLPaintDevice::endPaint() +{ + if (!data->isValid()) + return; + + data->copyBackFromRenderFbo(false); + + // Base's endPaint will restore the previous FBO binding + QGLPaintDevice::endPaint(); + + qgl_fbo_pool()->release(data->m_renderFbo); + data->m_renderFbo = 0; +} + +QGLContext* QGLPixmapGLPaintDevice::context() const +{ + data->ensureCreated(); + return data->m_ctx; +} + +QSize QGLPixmapGLPaintDevice::size() const +{ + return data->size(); +} + +bool QGLPixmapGLPaintDevice::alphaRequested() const +{ + return data->m_hasAlpha; +} + +void QGLPixmapGLPaintDevice::setPixmapData(QGLPixmapData* d) +{ + data = d; +} + +static int qt_gl_pixmap_serial = 0; + +QGLPixmapData::QGLPixmapData(PixelType type) + : QPixmapData(type, OpenGLClass) + , m_renderFbo(0) + , m_engine(0) + , m_ctx(0) + , m_dirty(false) + , m_hasFillColor(false) + , m_hasAlpha(false) + , inLRU(false) + , failedToAlloc(false) + , inTexturePool(false) +{ + setSerialNumber(++qt_gl_pixmap_serial); + m_glDevice.setPixmapData(this); + + qt_gl_register_pixmap(this); +} + +QGLPixmapData::~QGLPixmapData() +{ + delete m_engine; + + destroyTexture(); + qt_gl_unregister_pixmap(this); +} + +void QGLPixmapData::destroyTexture() +{ + if (inTexturePool) { + QGLTexturePool *pool = QGLTexturePool::instance(); + if (m_texture.id) + pool->releaseTexture(this, m_texture.id); + } else { + if (m_texture.id) { + QGLWidget *shareWidget = qt_gl_share_widget(); + if (shareWidget) { + QGLShareContextScope ctx(shareWidget->context()); + glDeleteTextures(1, &m_texture.id); + } + } + } + m_texture.id = 0; + inTexturePool = false; +} + +QPixmapData *QGLPixmapData::createCompatiblePixmapData() const +{ + return new QGLPixmapData(pixelType()); +} + +bool QGLPixmapData::isValid() const +{ + return w > 0 && h > 0; +} + +bool QGLPixmapData::isValidContext(const QGLContext *ctx) const +{ + if (ctx == m_ctx) + return true; + + const QGLContext *share_ctx = qt_gl_share_widget()->context(); + return ctx == share_ctx || QGLContext::areSharing(ctx, share_ctx); +} + +void QGLPixmapData::resize(int width, int height) +{ + if (width == w && height == h) + return; + + if (width <= 0 || height <= 0) { + width = 0; + height = 0; + } + + w = width; + h = height; + is_null = (w <= 0 || h <= 0); + d = pixelType() == QPixmapData::PixmapType ? 32 : 1; + + destroyTexture(); + + m_source = QImage(); + m_dirty = isValid(); + setSerialNumber(++qt_gl_pixmap_serial); +} + +void QGLPixmapData::ensureCreated() const +{ + if (!m_dirty) + return; + + m_dirty = false; + + QGLShareContextScope ctx(qt_gl_share_widget()->context()); + m_ctx = ctx; + + const GLenum internal_format = m_hasAlpha ? GL_RGBA : GL_RGB; +#ifdef QT_OPENGL_ES_2 + const GLenum external_format = internal_format; +#else + const GLenum external_format = qt_gl_preferredTextureFormat(); +#endif + const GLenum target = GL_TEXTURE_2D; + + m_texture.options &= ~QGLContext::MemoryManagedBindOption; + + if (!m_texture.id) { + m_texture.id = QGLTexturePool::instance()->createTextureForPixmap( + target, + 0, internal_format, + w, h, + external_format, + GL_UNSIGNED_BYTE, + const_cast<QGLPixmapData*>(this)); + if (!m_texture.id) { + failedToAlloc = true; + return; + } + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + + inTexturePool = true; + } else if (inTexturePool) { + glBindTexture(target, m_texture.id); + QGLTexturePool::instance()->useTexture(const_cast<QGLPixmapData*>(this)); + } + + if (!m_source.isNull() && m_texture.id) { + if (external_format == GL_RGB) { + const QImage tx = m_source.convertToFormat(QImage::Format_RGB888).mirrored(false, true); + + glBindTexture(target, m_texture.id); + glTexSubImage2D(target, 0, 0, 0, w, h, external_format, + GL_UNSIGNED_BYTE, tx.bits()); + } else { + // do byte swizzling ARGB -> RGBA + const QImage tx = ctx->d_func()->convertToGLFormat(m_source, true, external_format); + glBindTexture(target, m_texture.id); + glTexSubImage2D(target, 0, 0, 0, w, h, external_format, + GL_UNSIGNED_BYTE, tx.bits()); + } + + if (useFramebufferObjects()) + m_source = QImage(); + } +} + + +void QGLPixmapData::fromImage(const QImage &image, + Qt::ImageConversionFlags flags) +{ + QImage img = image; + createPixmapForImage(img, flags, false); +} + +void QGLPixmapData::fromImageReader(QImageReader *imageReader, + Qt::ImageConversionFlags flags) +{ + QImage image = imageReader->read(); + if (image.isNull()) + return; + + createPixmapForImage(image, flags, true); +} + +bool QGLPixmapData::fromFile(const QString &filename, const char *format, + Qt::ImageConversionFlags flags) +{ + if (pixelType() == QPixmapData::BitmapType) + return QPixmapData::fromFile(filename, format, flags); + QFile file(filename); + if (file.open(QIODevice::ReadOnly)) { + QByteArray data = file.peek(64); + bool alpha; + if (m_texture.canBindCompressedTexture + (data.constData(), data.size(), format, &alpha)) { + resize(0, 0); + data = file.readAll(); + file.close(); + QGLShareContextScope ctx(qt_gl_share_widget()->context()); + QSize size = m_texture.bindCompressedTexture + (data.constData(), data.size(), format); + if (!size.isEmpty()) { + w = size.width(); + h = size.height(); + is_null = false; + d = 32; + m_hasAlpha = alpha; + m_source = QImage(); + m_dirty = isValid(); + return true; + } + return false; + } + } + + QImage image = QImageReader(filename, format).read(); + if (image.isNull()) + return false; + + createPixmapForImage(image, flags, true); + + return !isNull(); +} + +bool QGLPixmapData::fromData(const uchar *buffer, uint len, const char *format, + Qt::ImageConversionFlags flags) +{ + bool alpha; + const char *buf = reinterpret_cast<const char *>(buffer); + if (m_texture.canBindCompressedTexture(buf, int(len), format, &alpha)) { + resize(0, 0); + QGLShareContextScope ctx(qt_gl_share_widget()->context()); + QSize size = m_texture.bindCompressedTexture(buf, int(len), format); + if (!size.isEmpty()) { + w = size.width(); + h = size.height(); + is_null = false; + d = 32; + m_hasAlpha = alpha; + m_source = QImage(); + m_dirty = isValid(); + return true; + } + } + + QByteArray a = QByteArray::fromRawData(reinterpret_cast<const char *>(buffer), len); + QBuffer b(&a); + b.open(QIODevice::ReadOnly); + QImage image = QImageReader(&b, format).read(); + if (image.isNull()) + return false; + + createPixmapForImage(image, flags, true); + + return !isNull(); +} + +/*! + out-of-place conversion (inPlace == false) will always detach() + */ +void QGLPixmapData::createPixmapForImage(QImage &image, Qt::ImageConversionFlags flags, bool inPlace) +{ + if (image.size() == QSize(w, h)) + setSerialNumber(++qt_gl_pixmap_serial); + + resize(image.width(), image.height()); + + if (pixelType() == BitmapType) { + m_source = image.convertToFormat(QImage::Format_MonoLSB); + + } else { + QImage::Format format = QImage::Format_RGB32; + if (qApp->desktop()->depth() == 16) + format = QImage::Format_RGB16; + + if (image.hasAlphaChannel() + && ((flags & Qt::NoOpaqueDetection) + || const_cast<QImage &>(image).data_ptr()->checkForAlphaPixels())) + format = QImage::Format_ARGB32_Premultiplied; + + if (inPlace && image.data_ptr()->convertInPlace(format, flags)) { + m_source = image; + } else { + m_source = image.convertToFormat(format); + + // convertToFormat won't detach the image if format stays the same. + if (image.format() == format) + m_source.detach(); + } + } + + m_dirty = true; + m_hasFillColor = false; + + m_hasAlpha = m_source.hasAlphaChannel(); + w = image.width(); + h = image.height(); + is_null = (w <= 0 || h <= 0); + d = m_source.depth(); + + destroyTexture(); +} + +bool QGLPixmapData::scroll(int dx, int dy, const QRect &rect) +{ + Q_UNUSED(dx); + Q_UNUSED(dy); + Q_UNUSED(rect); + return false; +} + +void QGLPixmapData::copy(const QPixmapData *data, const QRect &rect) +{ + if (data->classId() != QPixmapData::OpenGLClass || !static_cast<const QGLPixmapData *>(data)->useFramebufferObjects()) { + QPixmapData::copy(data, rect); + return; + } + + const QGLPixmapData *other = static_cast<const QGLPixmapData *>(data); + if (other->m_renderFbo) { + QGLShareContextScope ctx(qt_gl_share_widget()->context()); + + resize(rect.width(), rect.height()); + m_hasAlpha = other->m_hasAlpha; + ensureCreated(); + + if (!ctx->d_ptr->fbo) + glGenFramebuffers(1, &ctx->d_ptr->fbo); + + glBindFramebuffer(GL_DRAW_FRAMEBUFFER_EXT, ctx->d_ptr->fbo); + glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, + GL_TEXTURE_2D, m_texture.id, 0); + + if (!other->m_renderFbo->isBound()) + glBindFramebuffer(GL_READ_FRAMEBUFFER_EXT, other->m_renderFbo->handle()); + + glDisable(GL_SCISSOR_TEST); + if (ctx->d_ptr->active_engine && ctx->d_ptr->active_engine->type() == QPaintEngine::OpenGL2) + static_cast<QGL2PaintEngineEx *>(ctx->d_ptr->active_engine)->invalidateState(); + + glBlitFramebufferEXT(rect.x(), rect.y(), rect.x() + rect.width(), rect.y() + rect.height(), + 0, 0, w, h, + GL_COLOR_BUFFER_BIT, + GL_NEAREST); + + glBindFramebuffer(GL_FRAMEBUFFER_EXT, ctx->d_ptr->current_fbo); + } else { + QPixmapData::copy(data, rect); + } +} + +void QGLPixmapData::fill(const QColor &color) +{ + if (!isValid()) + return; + + bool hasAlpha = color.alpha() != 255; + if (hasAlpha && !m_hasAlpha) { + if (m_texture.id) { + destroyTexture(); + m_dirty = true; + } + m_hasAlpha = color.alpha() != 255; + } + + if (useFramebufferObjects()) { + m_source = QImage(); + m_hasFillColor = true; + m_fillColor = color; + } else { + + if (m_source.isNull()) { + m_fillColor = color; + m_hasFillColor = true; + + } else if (m_source.depth() == 32) { + m_source.fill(PREMUL(color.rgba())); + + } else if (m_source.depth() == 1) { + if (color == Qt::color1) + m_source.fill(1); + else + m_source.fill(0); + } + } +} + +bool QGLPixmapData::hasAlphaChannel() const +{ + return m_hasAlpha; +} + +QImage QGLPixmapData::fillImage(const QColor &color) const +{ + QImage img; + if (pixelType() == BitmapType) { + img = QImage(w, h, QImage::Format_MonoLSB); + + img.setColorCount(2); + img.setColor(0, QColor(Qt::color0).rgba()); + img.setColor(1, QColor(Qt::color1).rgba()); + + if (color == Qt::color1) + img.fill(1); + else + img.fill(0); + } else { + img = QImage(w, h, + m_hasAlpha + ? QImage::Format_ARGB32_Premultiplied + : QImage::Format_RGB32); + img.fill(PREMUL(color.rgba())); + } + return img; +} + +extern QImage qt_gl_read_texture(const QSize &size, bool alpha_format, bool include_alpha); + +QImage QGLPixmapData::toImage() const +{ + if (!isValid()) + return QImage(); + + if (m_renderFbo) { + copyBackFromRenderFbo(true); + } else if (!m_source.isNull()) { + QImageData *data = const_cast<QImage &>(m_source).data_ptr(); + if (data->paintEngine && data->paintEngine->isActive() + && data->paintEngine->paintDevice() == &m_source) + { + return m_source.copy(); + } + return m_source; + } else if (m_dirty || m_hasFillColor) { + return fillImage(m_fillColor); + } else { + ensureCreated(); + } + + QGLShareContextScope ctx(qt_gl_share_widget()->context()); + glBindTexture(GL_TEXTURE_2D, m_texture.id); + return qt_gl_read_texture(QSize(w, h), true, true); +} + +struct TextureBuffer +{ + QGLFramebufferObject *fbo; + QGL2PaintEngineEx *engine; +}; + +Q_GLOBAL_STATIC(QGLFramebufferObjectPool, _qgl_fbo_pool) +QGLFramebufferObjectPool* qgl_fbo_pool() +{ + return _qgl_fbo_pool(); +} + +void QGLPixmapData::copyBackFromRenderFbo(bool keepCurrentFboBound) const +{ + if (!isValid()) + return; + + m_hasFillColor = false; + + const QGLContext *share_ctx = qt_gl_share_widget()->context(); + QGLShareContextScope ctx(share_ctx); + + ensureCreated(); + + if (!ctx->d_ptr->fbo) + glGenFramebuffers(1, &ctx->d_ptr->fbo); + + glBindFramebuffer(GL_DRAW_FRAMEBUFFER_EXT, ctx->d_ptr->fbo); + glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, + GL_TEXTURE_2D, m_texture.id, 0); + + const int x0 = 0; + const int x1 = w; + const int y0 = 0; + const int y1 = h; + + if (!m_renderFbo->isBound()) + glBindFramebuffer(GL_READ_FRAMEBUFFER_EXT, m_renderFbo->handle()); + + glDisable(GL_SCISSOR_TEST); + + glBlitFramebufferEXT(x0, y0, x1, y1, + x0, y0, x1, y1, + GL_COLOR_BUFFER_BIT, + GL_NEAREST); + + if (keepCurrentFboBound) { + glBindFramebuffer(GL_FRAMEBUFFER_EXT, ctx->d_ptr->current_fbo); + } else { + glBindFramebuffer(GL_DRAW_FRAMEBUFFER_EXT, m_renderFbo->handle()); + ctx->d_ptr->current_fbo = m_renderFbo->handle(); + } +} + +bool QGLPixmapData::useFramebufferObjects() const +{ +#ifdef Q_OS_SYMBIAN + // We don't want to use FBOs on Symbian + return false; +#else + return QGLFramebufferObject::hasOpenGLFramebufferObjects() + && QGLFramebufferObject::hasOpenGLFramebufferBlit() + && qt_gl_preferGL2Engine() + && (w * h > 32*32); // avoid overhead of FBOs for small pixmaps +#endif +} + +QPaintEngine* QGLPixmapData::paintEngine() const +{ + if (!isValid()) + return 0; + + if (m_renderFbo) + return m_engine; + + if (useFramebufferObjects()) { + extern QGLWidget* qt_gl_share_widget(); + + if (!QGLContext::currentContext()) + qt_gl_share_widget()->makeCurrent(); + QGLShareContextScope ctx(qt_gl_share_widget()->context()); + + QGLFramebufferObjectFormat format; + format.setAttachment(QGLFramebufferObject::CombinedDepthStencil); + format.setSamples(4); + format.setInternalTextureFormat(GLenum(m_hasAlpha ? GL_RGBA : GL_RGB)); + + m_renderFbo = qgl_fbo_pool()->acquire(size(), format); + + if (m_renderFbo) { + if (!m_engine) + m_engine = new QGL2PaintEngineEx; + return m_engine; + } + + qWarning() << "Failed to create pixmap texture buffer of size " << size() << ", falling back to raster paint engine"; + } + + // If the application wants to paint into the QPixmap, we first + // force it to QImage format and then paint into that. + // This is simpler than juggling multiple GL contexts. + const_cast<QGLPixmapData *>(this)->forceToImage(); + + if (m_hasFillColor) { + m_source.fill(PREMUL(m_fillColor.rgba())); + m_hasFillColor = false; + } + return m_source.paintEngine(); +} + +extern QRgb qt_gl_convertToGLFormat(QRgb src_pixel, GLenum texture_format); + +// If copyBack is true, bind will copy the contents of the render +// FBO to the texture (which is not bound to the texture, as it's +// a multisample FBO). +GLuint QGLPixmapData::bind(bool copyBack) const +{ + if (m_renderFbo && copyBack) { + copyBackFromRenderFbo(true); + } else { + ensureCreated(); + } + + GLuint id = m_texture.id; + glBindTexture(GL_TEXTURE_2D, id); + + if (m_hasFillColor) { + if (!useFramebufferObjects()) { + m_source = QImage(w, h, QImage::Format_ARGB32_Premultiplied); + m_source.fill(PREMUL(m_fillColor.rgba())); + } + + m_hasFillColor = false; + + GLenum format = qt_gl_preferredTextureFormat(); + QImage tx(w, h, QImage::Format_ARGB32_Premultiplied); + tx.fill(qt_gl_convertToGLFormat(m_fillColor.rgba(), format)); + glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, w, h, format, GL_UNSIGNED_BYTE, tx.bits()); + } + + return id; +} + +QGLTexture* QGLPixmapData::texture() const +{ + return &m_texture; +} + +void QGLPixmapData::detachTextureFromPool() +{ + if (inTexturePool) { + QGLTexturePool::instance()->detachTexture(this); + inTexturePool = false; + } +} + +void QGLPixmapData::hibernate() +{ + // If the texture was imported (e.g, from an SgImage under Symbian), + // then we cannot copy it back to main memory for storage. + if (m_texture.id && m_source.isNull()) + return; + + forceToImage(); + destroyTexture(); +} + +void QGLPixmapData::reclaimTexture() +{ + if (!inTexturePool) + return; + forceToImage(); + destroyTexture(); +} + +Q_GUI_EXPORT int qt_defaultDpiX(); +Q_GUI_EXPORT int qt_defaultDpiY(); + +int QGLPixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const +{ + if (w == 0) + return 0; + + switch (metric) { + case QPaintDevice::PdmWidth: + return w; + case QPaintDevice::PdmHeight: + return h; + case QPaintDevice::PdmNumColors: + return 0; + case QPaintDevice::PdmDepth: + return d; + case QPaintDevice::PdmWidthMM: + return qRound(w * 25.4 / qt_defaultDpiX()); + case QPaintDevice::PdmHeightMM: + return qRound(h * 25.4 / qt_defaultDpiY()); + case QPaintDevice::PdmDpiX: + case QPaintDevice::PdmPhysicalDpiX: + return qt_defaultDpiX(); + case QPaintDevice::PdmDpiY: + case QPaintDevice::PdmPhysicalDpiY: + return qt_defaultDpiY(); + default: + qWarning("QGLPixmapData::metric(): Invalid metric"); + return 0; + } +} + +// Force the pixmap data to be backed by some valid data. +void QGLPixmapData::forceToImage() +{ + if (!isValid()) + return; + + if (m_source.isNull()) + m_source = QImage(w, h, QImage::Format_ARGB32_Premultiplied); + + m_dirty = true; +} + +QGLPaintDevice *QGLPixmapData::glDevice() const +{ + return &m_glDevice; +} + +QT_END_NAMESPACE diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp index 0bffbda..340f75a 100644 --- a/src/opengl/qwindowsurface_gl.cpp +++ b/src/opengl/qwindowsurface_gl.cpp @@ -181,16 +181,14 @@ QGLGraphicsSystem::QGLGraphicsSystem(bool useX11GL) // // QGLWindowSurface // - class QGLGlobalShareWidget { public: - QGLGlobalShareWidget() : widget(0), initializing(false) {} + QGLGlobalShareWidget() : firstPixmap(0), widgetRefCount(0), widget(0), initializing(false) {} QGLWidget *shareWidget() { if (!initializing && !widget && !cleanedUp) { initializing = true; - widget = new QGLWidget(QGLFormat(QGL::SingleBuffer | QGL::NoDepthBuffer | QGL::NoStencilBuffer)); widget->resize(1, 1); @@ -226,6 +224,9 @@ public: static bool cleanedUp; + QGLPixmapData *firstPixmap; + int widgetRefCount; + private: QGLWidget *widget; bool initializing; @@ -256,6 +257,41 @@ void qt_destroy_gl_share_widget() _qt_gl_share_widget()->destroy(); } +void qt_gl_register_pixmap(QGLPixmapData *pd) +{ + QGLGlobalShareWidget *shared = _qt_gl_share_widget(); + pd->next = shared->firstPixmap; + pd->prev = 0; + if (shared->firstPixmap) + shared->firstPixmap->prev = pd; + shared->firstPixmap = pd; +} + +void qt_gl_unregister_pixmap(QGLPixmapData *pd) +{ + if (pd->next) + pd->next->prev = pd->prev; + if (pd->prev) { + pd->prev->next = pd->next; + } else { + QGLGlobalShareWidget *shared = _qt_gl_share_widget(); + if (shared) + shared->firstPixmap = pd->next; + } +} + +void qt_gl_hibernate_pixmaps() +{ + QGLGlobalShareWidget *shared = _qt_gl_share_widget(); + + // Scan all QGLPixmapData objects in the system and hibernate them. + QGLPixmapData *pd = shared->firstPixmap; + while (pd != 0) { + pd->hibernate(); + pd = pd->next; + } +} + struct QGLWindowSurfacePrivate { QGLFramebufferObject *fbo; @@ -347,6 +383,27 @@ QGLWindowSurface::~QGLWindowSurface() delete d_ptr->pb; delete d_ptr->fbo; delete d_ptr; + + if (QGLGlobalShareWidget::cleanedUp) + return; + + --(_qt_gl_share_widget()->widgetRefCount); + +#ifdef QGL_USE_TEXTURE_POOL + if (_qt_gl_share_widget()->widgetRefCount <= 0) { + // All of the widget window surfaces have been destroyed + // but we still have GL pixmaps active. Ask them to hibernate + // to free up GPU resources until a widget is shown again. + // This may eventually cause the EGLContext to be destroyed + // because nothing in the system needs a context, which will + // free up even more GPU resources. + qt_gl_hibernate_pixmaps(); + + // Destroy the context if necessary. + if (!qt_gl_share_widget()->context()->isSharing()) + qt_destroy_gl_share_widget(); + } +#endif } void QGLWindowSurface::deleted(QObject *object) @@ -394,6 +451,9 @@ void QGLWindowSurface::hijackWindow(QWidget *widget) ctx->create(qt_gl_share_widget()->context()); + if (widget != qt_gl_share_widget()) + ++(_qt_gl_share_widget()->widgetRefCount); + #ifndef QT_NO_EGL static bool checkedForNOKSwapRegion = false; static bool haveNOKSwapRegion = false; @@ -405,9 +465,9 @@ void QGLWindowSurface::hijackWindow(QWidget *widget) if (haveNOKSwapRegion) qDebug() << "Found EGL_NOK_swap_region2 extension. Using partial updates."; } - - if (ctx->d_func()->eglContext->configAttrib(EGL_SWAP_BEHAVIOR) != EGL_BUFFER_PRESERVED && - ! haveNOKSwapRegion) + bool swapBehaviourPreserved = (ctx->d_func()->eglContext->configAttrib(EGL_SWAP_BEHAVIOR) + || (ctx->d_func()->eglContext->configAttrib(EGL_SURFACE_TYPE)&EGL_SWAP_BEHAVIOR_PRESERVED_BIT)); + if (!swapBehaviourPreserved && !haveNOKSwapRegion) setPartialUpdateSupport(false); // Force full-screen updates else setPartialUpdateSupport(true); @@ -421,7 +481,9 @@ void QGLWindowSurface::hijackWindow(QWidget *widget) voidPtr = &widgetPrivate->extraData()->glContext; d_ptr->contexts << ctxPtr; +#ifndef Q_OS_SYMBIAN qDebug() << "hijackWindow() context created for" << widget << d_ptr->contexts.size(); +#endif } QGLContext *QGLWindowSurface::context() const @@ -908,8 +970,9 @@ void QGLWindowSurface::updateGeometry() { if (d_ptr->destructive_swap_buffers) initializeOffscreenTexture(surfSize); #endif - - qDebug() << "QGLWindowSurface: Using plain widget as window surface" << this;; +#ifndef Q_OS_SYMBIAN + qDebug() << "QGLWindowSurface: Using plain widget as window surface" << this; +#endif d_ptr->ctx = ctx; d_ptr->ctx->d_ptr->internal_context = true; } diff --git a/src/s60installs/bwins/QtOpenGLu.def b/src/s60installs/bwins/QtOpenGLu.def index 3eb1512..87d1b56 100644 --- a/src/s60installs/bwins/QtOpenGLu.def +++ b/src/s60installs/bwins/QtOpenGLu.def @@ -711,4 +711,11 @@ EXPORTS ?createPixmapForImage@QGLPixmapData@@AAEXAAVQImage@@V?$QFlags@W4ImageConversionFlag@Qt@@@@_N@Z @ 710 NONAME ; void QGLPixmapData::createPixmapForImage(class QImage &, class QFlags<enum Qt::ImageConversionFlag>, bool) ?fromImageReader@QGLPixmapData@@UAEXPAVQImageReader@@V?$QFlags@W4ImageConversionFlag@Qt@@@@@Z @ 711 NONAME ; void QGLPixmapData::fromImageReader(class QImageReader *, class QFlags<enum Qt::ImageConversionFlag>) ?setContext@QGLTextureGlyphCache@@QAEXPAVQGLContext@@@Z @ 712 NONAME ; void QGLTextureGlyphCache::setContext(class QGLContext *) + ?hibernate@QGLPixmapData@@QAEXXZ @ 713 NONAME ; void QGLPixmapData::hibernate(void) + ?detachTextureFromPool@QGLPixmapData@@QAEXXZ @ 714 NONAME ; void QGLPixmapData::detachTextureFromPool(void) + ?reclaimTexture@QGLPixmapData@@QAEXXZ @ 715 NONAME ; void QGLPixmapData::reclaimTexture(void) + ?destroyTexture@QGLPixmapData@@QAEXXZ @ 716 NONAME ; void QGLPixmapData::destroyTexture(void) + ?releaseCachedResources@QGLGraphicsSystem@@UAEXXZ @ 717 NONAME ; void QGLGraphicsSystem::releaseCachedResources(void) + ?serialNumber@QGLTextureGlyphCache@@QBEHXZ @ 718 NONAME ; int QGLTextureGlyphCache::serialNumber(void) const + ?forceToImage@QGLPixmapData@@QAEXXZ @ 719 NONAME ; void QGLPixmapData::forceToImage(void) diff --git a/src/s60installs/eabi/QtOpenGLu.def b/src/s60installs/eabi/QtOpenGLu.def index 33d40fd..4c5dca9 100644 --- a/src/s60installs/eabi/QtOpenGLu.def +++ b/src/s60installs/eabi/QtOpenGLu.def @@ -714,4 +714,10 @@ EXPORTS _ZN16QGLWindowSurface12swapBehaviorE @ 713 NONAME DATA 4 _ZN20QGLTextureGlyphCache10setContextEP10QGLContext @ 714 NONAME _ZN20QGLTextureGlyphCache5clearEv @ 715 NONAME + _ZN13QGLPixmapData12forceToImageEv @ 716 NONAME + _ZN13QGLPixmapData14destroyTextureEv @ 717 NONAME + _ZN13QGLPixmapData14reclaimTextureEv @ 718 NONAME + _ZN13QGLPixmapData21detachTextureFromPoolEv @ 719 NONAME + _ZN13QGLPixmapData9hibernateEv @ 720 NONAME + _ZN17QGLGraphicsSystem22releaseCachedResourcesEv @ 721 NONAME -- cgit v0.12 From 2bd6dec008693b48430b8f29c564fa8a24158370 Mon Sep 17 00:00:00 2001 From: Jani Hautakangas <jani.hautakangas@nokia.com> Date: Tue, 15 Mar 2011 19:31:38 +0200 Subject: Hot fix for compilation without QGL_USE_TEXTURE_POOL Reviewed-by: TRUSTME --- src/opengl/qwindowsurface_gl.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp index 340f75a..11a9eb0 100644 --- a/src/opengl/qwindowsurface_gl.cpp +++ b/src/opengl/qwindowsurface_gl.cpp @@ -257,6 +257,7 @@ void qt_destroy_gl_share_widget() _qt_gl_share_widget()->destroy(); } +#ifdef QGL_USE_TEXTURE_POOL void qt_gl_register_pixmap(QGLPixmapData *pd) { QGLGlobalShareWidget *shared = _qt_gl_share_widget(); @@ -291,6 +292,7 @@ void qt_gl_hibernate_pixmaps() pd = pd->next; } } +#endif struct QGLWindowSurfacePrivate { -- cgit v0.12 From 29b596c647d2339496458231e8eec6c63ccf4641 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann <joerg.bornemann@nokia.com> Date: Tue, 15 Mar 2011 19:00:00 +0100 Subject: Revert "qmake vcproj generator: do not insert $(INHERIT)" This reverts commit e22c6eb32c4c4c189ba5c11ce61adc8a59a0847b. --- qmake/generators/win32/msvc_objectmodel.cpp | 12 ++++++------ qmake/generators/win32/msvc_objectmodel.h | 1 - 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/qmake/generators/win32/msvc_objectmodel.cpp b/qmake/generators/win32/msvc_objectmodel.cpp index 5b62b5e..020c3d8 100644 --- a/qmake/generators/win32/msvc_objectmodel.cpp +++ b/qmake/generators/win32/msvc_objectmodel.cpp @@ -355,7 +355,7 @@ VCCLCompilerTool::VCCLCompilerTool() TreatWChar_tAsBuiltInType(unset), TurnOffAssemblyGeneration(unset), UndefineAllPreprocessorDefinitions(unset), - UsePrecompiledHeader(pchUnset), + UsePrecompiledHeader(pchNone), UseUnicodeForAssemblerListing(unset), WarnAsError(unset), WarningLevel(warningLevel_0), @@ -389,7 +389,7 @@ inline XmlOutput::xml_output xformUsePrecompiledHeaderForNET2005(pchOption whatP if (whatPch == pchGenerateAuto) whatPch = (pchOption)0; if (whatPch == pchUseUsingSpecific) whatPch = (pchOption)2; } - return attrE(_UsePrecompiledHeader, whatPch, /*ifNot*/ pchUnset); + return attrE(_UsePrecompiledHeader, whatPch); } inline XmlOutput::xml_output xformExceptionHandlingNET2005(exceptionHandling eh, DotNET compilerVersion) @@ -2145,9 +2145,9 @@ void VCFilter::modifyPCHstage(QString str) useCompilerTool = true; // Setup PCH options - CompilerTool.UsePrecompiledHeader = (isCFile ? pchNone : pchCreateUsingSpecific); - if (!isCPPFile) - CompilerTool.ForcedIncludeFiles = QStringList("$(NOINHERIT)"); + CompilerTool.UsePrecompiledHeader = (isCFile ? pchNone : pchCreateUsingSpecific); + CompilerTool.PrecompiledHeaderThrough = (isCPPFile ? QString("$(INHERIT)") : QString("$(NOINHERIT)")); + CompilerTool.ForcedIncludeFiles = QStringList("$(NOINHERIT)"); } bool VCFilter::addExtraCompiler(const VCFilterFile &info) @@ -2514,7 +2514,7 @@ void VCProjectWriter::write(XmlOutput &xml, const VCCLCompilerTool &tool) << attrT(_TurnOffAssemblyGeneration, tool.TurnOffAssemblyGeneration) << attrT(_UndefineAllPreprocessorDefinitions, tool.UndefineAllPreprocessorDefinitions) << attrX(_UndefinePreprocessorDefinitions, tool.UndefinePreprocessorDefinitions) - << xformUsePrecompiledHeaderForNET2005(tool.UsePrecompiledHeader, tool.config->CompilerVersion) + << (!tool.PrecompiledHeaderFile.isEmpty() || !tool.PrecompiledHeaderThrough.isEmpty() ? xformUsePrecompiledHeaderForNET2005(tool.UsePrecompiledHeader, tool.config->CompilerVersion) : noxml()) << attrT(_WarnAsError, tool.WarnAsError) << attrE(_WarningLevel, tool.WarningLevel, /*ifNot*/ warningLevelUnknown) << attrT(_WholeProgramOptimization, tool.WholeProgramOptimization) diff --git a/qmake/generators/win32/msvc_objectmodel.h b/qmake/generators/win32/msvc_objectmodel.h index 3e62fb4..5431ce0 100644 --- a/qmake/generators/win32/msvc_objectmodel.h +++ b/qmake/generators/win32/msvc_objectmodel.h @@ -366,7 +366,6 @@ enum optLinkTimeCodeGenType { optLTCGUpdate }; enum pchOption { - pchUnset = -1, pchNone, pchCreateUsingSpecific, pchGenerateAuto, -- cgit v0.12 From 733578aec105c2d2bdb3f6ef57ee3195ebb79696 Mon Sep 17 00:00:00 2001 From: Martin Jones <martin.jones@nokia.com> Date: Wed, 16 Mar 2011 12:08:42 +1000 Subject: Disabled non-QDeclarativeItems in Flickable break flicking Allow Flickable to steal grab from items that are disabled. Change-Id: I71e401cd78695ecb2c3d47abde1c3d13e722d848 Task-number: QT-4677 Reviewed-by: Michael Brasser --- .../graphicsitems/qdeclarativeflickable.cpp | 8 +++-- .../qdeclarativeflickable/data/disabledcontent.qml | 8 +++++ .../tst_qdeclarativeflickable.cpp | 39 ++++++++++++++++++++++ 3 files changed, 52 insertions(+), 3 deletions(-) create mode 100644 tests/auto/declarative/qdeclarativeflickable/data/disabledcontent.qml diff --git a/src/declarative/graphicsitems/qdeclarativeflickable.cpp b/src/declarative/graphicsitems/qdeclarativeflickable.cpp index d64c347..f854262 100644 --- a/src/declarative/graphicsitems/qdeclarativeflickable.cpp +++ b/src/declarative/graphicsitems/qdeclarativeflickable.cpp @@ -1430,8 +1430,10 @@ bool QDeclarativeFlickable::sendMouseEvent(QGraphicsSceneMouseEvent *event) QGraphicsScene *s = scene(); QDeclarativeItem *grabber = s ? qobject_cast<QDeclarativeItem*>(s->mouseGrabberItem()) : 0; + QGraphicsItem *grabberItem = s ? s->mouseGrabberItem() : 0; + bool disabledItem = grabberItem && !grabberItem->isEnabled(); bool stealThisEvent = d->stealMouse; - if ((stealThisEvent || myRect.contains(event->scenePos().toPoint())) && (!grabber || !grabber->keepMouseGrab())) { + if ((stealThisEvent || myRect.contains(event->scenePos().toPoint())) && (!grabber || !grabber->keepMouseGrab() || disabledItem)) { mouseEvent.setAccepted(false); for (int i = 0x1; i <= 0x10; i <<= 1) { if (event->buttons() & i) { @@ -1478,12 +1480,12 @@ bool QDeclarativeFlickable::sendMouseEvent(QGraphicsSceneMouseEvent *event) break; } grabber = qobject_cast<QDeclarativeItem*>(s->mouseGrabberItem()); - if (grabber && stealThisEvent && !grabber->keepMouseGrab() && grabber != this) { + if ((grabber && stealThisEvent && !grabber->keepMouseGrab() && grabber != this) || disabledItem) { d->clearDelayedPress(); grabMouse(); } - return stealThisEvent || d->delayedPressEvent; + return stealThisEvent || d->delayedPressEvent || disabledItem; } else if (d->lastPosTime.isValid()) { d->lastPosTime.invalidate(); } diff --git a/tests/auto/declarative/qdeclarativeflickable/data/disabledcontent.qml b/tests/auto/declarative/qdeclarativeflickable/data/disabledcontent.qml new file mode 100644 index 0000000..dcbb20b --- /dev/null +++ b/tests/auto/declarative/qdeclarativeflickable/data/disabledcontent.qml @@ -0,0 +1,8 @@ +import QtQuick 1.0 + +Flickable { + width: 100; height: 100 + contentWidth: 200; contentHeight: 300 + + QGraphicsWidget { width: 200; height: 300; enabled: false } +} diff --git a/tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp b/tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp index 65ba316..d499edf 100644 --- a/tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp +++ b/tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp @@ -69,6 +69,7 @@ private slots: void maximumFlickVelocity(); void flickDeceleration(); void pressDelay(); + void disabledContent(); void nestedPressDelay(); void flickableDirection(); void qgraphicswidget(); @@ -247,6 +248,44 @@ void tst_qdeclarativeflickable::pressDelay() QCOMPARE(spy.count(),1); } +// QT-4677 +void tst_qdeclarativeflickable::disabledContent() +{ + QDeclarativeView *canvas = new QDeclarativeView; + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/disabledcontent.qml")); + canvas->show(); + canvas->setFocus(); + QVERIFY(canvas->rootObject() != 0); + + QDeclarativeFlickable *flickable = qobject_cast<QDeclarativeFlickable*>(canvas->rootObject()); + QVERIFY(flickable != 0); + + QVERIFY(flickable->contentX() == 0); + QVERIFY(flickable->contentY() == 0); + + QTest::mousePress(canvas->viewport(), Qt::LeftButton, 0, canvas->mapFromScene(QPoint(50, 50))); + { + QMouseEvent mv(QEvent::MouseMove, canvas->mapFromScene(QPoint(70,70)), Qt::LeftButton, Qt::LeftButton,Qt::NoModifier); + QApplication::sendEvent(canvas->viewport(), &mv); + } + { + QMouseEvent mv(QEvent::MouseMove, canvas->mapFromScene(QPoint(90,90)), Qt::LeftButton, Qt::LeftButton,Qt::NoModifier); + QApplication::sendEvent(canvas->viewport(), &mv); + } + { + QMouseEvent mv(QEvent::MouseMove, canvas->mapFromScene(QPoint(100,100)), Qt::LeftButton, Qt::LeftButton,Qt::NoModifier); + QApplication::sendEvent(canvas->viewport(), &mv); + } + + QVERIFY(flickable->contentX() < 0); + QVERIFY(flickable->contentY() < 0); + + QTest::mouseRelease(canvas->viewport(), Qt::LeftButton, 0, canvas->mapFromScene(QPoint(90, 90))); + + delete canvas; +} + + // QTBUG-17361 void tst_qdeclarativeflickable::nestedPressDelay() { -- cgit v0.12 From 234a4b614e30ec2ad3e161c0dcd4d339182ff9ec Mon Sep 17 00:00:00 2001 From: Martin Jones <martin.jones@nokia.com> Date: Wed, 16 Mar 2011 13:09:21 +1000 Subject: Qt.include() used in WorkerScript is broken on Windows. The script local filename was used to resolve the source URL rather than the script URL. Change-Id: I78aa23eadbd76e100bb872b6ac9459aa9a5ee5ce Task-number: QTBUG-17977 Reviewed-by: Aaron Kennedy --- src/declarative/qml/qdeclarativescriptparser.cpp | 2 +- src/declarative/qml/qdeclarativeworkerscript.cpp | 2 +- .../qdeclarativeworkerscript/data/Global.js | 1 + .../qdeclarativeworkerscript/data/script_include.js | 5 +++++ .../qdeclarativeworkerscript/data/worker_include.qml | 5 +++++ .../tst_qdeclarativeworkerscript.cpp | 19 +++++++++++++++++++ 6 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 tests/auto/declarative/qdeclarativeworkerscript/data/Global.js create mode 100644 tests/auto/declarative/qdeclarativeworkerscript/data/script_include.js create mode 100644 tests/auto/declarative/qdeclarativeworkerscript/data/worker_include.qml diff --git a/src/declarative/qml/qdeclarativescriptparser.cpp b/src/declarative/qml/qdeclarativescriptparser.cpp index b604706..d9e3ebf 100644 --- a/src/declarative/qml/qdeclarativescriptparser.cpp +++ b/src/declarative/qml/qdeclarativescriptparser.cpp @@ -940,7 +940,7 @@ QDeclarativeParser::Object::ScriptBlock::Pragmas QDeclarativeScriptParser::extra if (l.currentLineNo() == startLine) return rv; - if (pragmaValue == QLatin1String("library")) { + if (pragmaValue == library) { rv |= QDeclarativeParser::Object::ScriptBlock::Shared; replaceWithSpace(script, startOffset, endOffset - startOffset); } else { diff --git a/src/declarative/qml/qdeclarativeworkerscript.cpp b/src/declarative/qml/qdeclarativeworkerscript.cpp index f8d52b5..1ff0caa 100644 --- a/src/declarative/qml/qdeclarativeworkerscript.cpp +++ b/src/declarative/qml/qdeclarativeworkerscript.cpp @@ -313,7 +313,7 @@ void QDeclarativeWorkerScriptEnginePrivate::processLoad(int id, const QUrl &url) QScriptContext *ctxt = QScriptDeclarativeClass::pushCleanContext(workerEngine); QScriptValue urlContext = workerEngine->newObject(); - urlContext.setData(QScriptValue(workerEngine, fileName)); + urlContext.setData(QScriptValue(workerEngine, url.toString())); ctxt->pushScope(urlContext); ctxt->pushScope(activation); ctxt->setActivationObject(activation); diff --git a/tests/auto/declarative/qdeclarativeworkerscript/data/Global.js b/tests/auto/declarative/qdeclarativeworkerscript/data/Global.js new file mode 100644 index 0000000..6bdb4a5 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeworkerscript/data/Global.js @@ -0,0 +1 @@ +var data = "World" diff --git a/tests/auto/declarative/qdeclarativeworkerscript/data/script_include.js b/tests/auto/declarative/qdeclarativeworkerscript/data/script_include.js new file mode 100644 index 0000000..0385d91 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeworkerscript/data/script_include.js @@ -0,0 +1,5 @@ +WorkerScript.onMessage = function(msg) { + var res = Qt.include("Global.js"); + WorkerScript.sendMessage(msg + " " + data) +} + diff --git a/tests/auto/declarative/qdeclarativeworkerscript/data/worker_include.qml b/tests/auto/declarative/qdeclarativeworkerscript/data/worker_include.qml new file mode 100644 index 0000000..595cb2b --- /dev/null +++ b/tests/auto/declarative/qdeclarativeworkerscript/data/worker_include.qml @@ -0,0 +1,5 @@ +import QtQuick 1.0 + +BaseWorker { + source: "script_include.js" +} diff --git a/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp b/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp index 4b922fb..b64e10c 100644 --- a/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp +++ b/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp @@ -79,6 +79,7 @@ private slots: void messaging_sendQObjectList(); void messaging_sendJsObject(); void script_with_pragma(); + void script_included(); void scriptError_onLoad(); void scriptError_onCall(); @@ -226,6 +227,24 @@ void tst_QDeclarativeWorkerScript::script_with_pragma() delete worker; } +void tst_QDeclarativeWorkerScript::script_included() +{ + QDeclarativeComponent component(&m_engine, SRCDIR "/data/worker_include.qml"); + QDeclarativeWorkerScript *worker = qobject_cast<QDeclarativeWorkerScript*>(component.create()); + QVERIFY(worker != 0); + + QString value("Hello"); + + QVERIFY(QMetaObject::invokeMethod(worker, "testSend", Q_ARG(QVariant, value))); + waitForEchoMessage(worker); + + const QMetaObject *mo = worker->metaObject(); + QCOMPARE(mo->property(mo->indexOfProperty("response")).read(worker).toString(), value + " World"); + + qApp->processEvents(); + delete worker; +} + static QString qdeclarativeworkerscript_lastWarning; static void qdeclarativeworkerscript_warningsHandler(QtMsgType type, const char *msg) { -- cgit v0.12 From 7c99a5273bea6f071efcd8441bedc1b768cc1d7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= <samuel.rodal@nokia.com> Date: Thu, 10 Mar 2011 12:03:45 +0100 Subject: Added automatic graphicssystem switching on meego when app is minimized. When all top-level widgets are minimized we switch to raster to reduce GPU memory consumption. We switch back to graphicssystem meego when at least one top-level widget is shown normally again. The switching only applies when the runtime graphicssystem is being used. The switching only applies when the runtime graphicssystem is being used. Task-number: QTBUG-18013 Reviewed-by: Armin Berres --- src/gui/painting/qgraphicssystem_runtime.cpp | 5 +- .../graphicssystems/meego/qmeegographicssystem.cpp | 170 +++++++++++++++++++-- .../graphicssystems/meego/qmeegographicssystem.h | 18 ++- .../qmeegographicssystemhelper.cpp | 44 +----- .../qmeegographicssystemhelper.h | 17 ++- tools/qmeegographicssystemhelper/qmeegoruntime.cpp | 49 +++++- tools/qmeegographicssystemhelper/qmeegoruntime.h | 4 + 7 files changed, 249 insertions(+), 58 deletions(-) diff --git a/src/gui/painting/qgraphicssystem_runtime.cpp b/src/gui/painting/qgraphicssystem_runtime.cpp index 5841d40..33652ee 100644 --- a/src/gui/painting/qgraphicssystem_runtime.cpp +++ b/src/gui/painting/qgraphicssystem_runtime.cpp @@ -394,7 +394,10 @@ void QRuntimeGraphicsSystem::setGraphicsSystem(const QString &name) if(m_windowSurfaceDestroyPolicy == DestroyAfterFirstFlush) proxy->m_pendingWindowSurface.reset(proxy->m_windowSurface.take()); - proxy->m_windowSurface.reset(m_graphicsSystem->createWindowSurface(widget)); + QWindowSurface *newWindowSurface = m_graphicsSystem->createWindowSurface(widget); + newWindowSurface->setGeometry(proxy->geometry()); + + proxy->m_windowSurface.reset(newWindowSurface); qt_widget_private(widget)->invalidateBuffer(widget->rect()); } diff --git a/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp b/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp index 13eab7f..18a0944 100644 --- a/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp +++ b/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp @@ -63,6 +63,8 @@ bool QMeeGoGraphicsSystem::surfaceWasCreated = false; QHash <Qt::HANDLE, QPixmap*> QMeeGoGraphicsSystem::liveTexturePixmaps; +QList<QMeeGoSwitchCallback> QMeeGoGraphicsSystem::switchCallbacks; + QMeeGoGraphicsSystem::QMeeGoGraphicsSystem() { qDebug("Using the meego graphics system"); @@ -74,6 +76,78 @@ QMeeGoGraphicsSystem::~QMeeGoGraphicsSystem() qt_destroy_gl_share_widget(); } +class QMeeGoGraphicsSystemSwitchHandler : public QObject +{ + Q_OBJECT +public: + QMeeGoGraphicsSystemSwitchHandler(); + + void addWidget(QWidget *widget); + bool eventFilter(QObject *, QEvent *); + +private slots: + void removeWidget(QObject *object); + +private: + int visibleWidgets() const; + +private: + QList<QWidget *> m_widgets; +}; + +QMeeGoGraphicsSystemSwitchHandler::QMeeGoGraphicsSystemSwitchHandler() +{ +} + +void QMeeGoGraphicsSystemSwitchHandler::addWidget(QWidget *widget) +{ + if (!m_widgets.contains(widget)) { + widget->installEventFilter(this); + connect(widget, SIGNAL(destroyed(QObject *)), this, SLOT(removeWidget(QObject *))); + m_widgets << widget; + } +} + +void QMeeGoGraphicsSystemSwitchHandler::removeWidget(QObject *object) +{ + m_widgets.removeOne(static_cast<QWidget *>(object)); +} + +int QMeeGoGraphicsSystemSwitchHandler::visibleWidgets() const +{ + int count = 0; + for (int i = 0; i < m_widgets.size(); ++i) + count += m_widgets.at(i)->isVisible() && !(m_widgets.at(i)->windowState() & Qt::WindowMinimized); + return count; +} + +bool QMeeGoGraphicsSystemSwitchHandler::eventFilter(QObject *object, QEvent *event) +{ + if (event->type() == QEvent::WindowStateChange) { + QWindowStateChangeEvent *change = static_cast<QWindowStateChangeEvent *>(event); + QWidget *widget = static_cast<QWidget *>(object); + + Qt::WindowStates current = widget->windowState(); + Qt::WindowStates old = change->oldState(); + + // did minimized flag change? + if ((current ^ old) & Qt::WindowMinimized) { + if (current & Qt::WindowMinimized) { + if (visibleWidgets() == 0) + QMeeGoGraphicsSystem::switchToRaster(); + } else { + if (visibleWidgets() == 1) + QMeeGoGraphicsSystem::switchToMeeGo(); + } + } + } + + // resume processing of event + return false; +} + +Q_GLOBAL_STATIC(QMeeGoGraphicsSystemSwitchHandler, switch_handler) + QWindowSurface* QMeeGoGraphicsSystem::createWindowSurface(QWidget *widget) const { QGLWidget *shareWidget = qt_gl_share_widget(); @@ -83,6 +157,9 @@ QWindowSurface* QMeeGoGraphicsSystem::createWindowSurface(QWidget *widget) const QGLShareContextScope ctx(shareWidget->context()); + if (QApplicationPrivate::instance()->graphics_system_name == QLatin1String("runtime")) + switch_handler()->addWidget(widget); + QMeeGoGraphicsSystem::surfaceWasCreated = true; QWindowSurface *surface = new QGLWindowSurface(widget); return surface; @@ -203,18 +280,7 @@ QPixmapData *QMeeGoGraphicsSystem::pixmapDataWithGLTexture(int w, int h) bool QMeeGoGraphicsSystem::meeGoRunning() { - if (! QApplicationPrivate::instance()) { - qWarning("Application not running just yet... hard to know what system running!"); - return false; - } - - QString name = QApplicationPrivate::instance()->graphics_system_name; - if (name == "runtime") { - QRuntimeGraphicsSystem *rsystem = (QRuntimeGraphicsSystem *) QApplicationPrivate::instance()->graphics_system; - name = rsystem->graphicsSystemName(); - } - - return (name == "meego"); + return runningGraphicsSystemName() == "meego"; } QPixmapData* QMeeGoGraphicsSystem::pixmapDataWithNewLiveTexture(int w, int h, QImage::Format format) @@ -259,6 +325,69 @@ void QMeeGoGraphicsSystem::destroyFenceSync(void *fenceSync) QMeeGoExtensions::eglDestroySyncKHR(QEgl::display(), fenceSync); } +QString QMeeGoGraphicsSystem::runningGraphicsSystemName() +{ + if (!QApplicationPrivate::instance()) { + qWarning("Querying graphics system but application not running yet!"); + return QString(); + } + + QString name = QApplicationPrivate::instance()->graphics_system_name; + if (name == QLatin1String("runtime")) { + QRuntimeGraphicsSystem *rsystem = (QRuntimeGraphicsSystem *) QApplicationPrivate::instance()->graphics_system; + name = rsystem->graphicsSystemName(); + } + + return name; +} + +void QMeeGoGraphicsSystem::switchToMeeGo() +{ + if (meeGoRunning()) + return; + + if (QApplicationPrivate::instance()->graphics_system_name != QLatin1String("runtime")) + qWarning("Can't switch to meego - switching only supported with 'runtime' graphics system."); + else { + triggerSwitchCallbacks(0, "meego"); + + QApplication *app = static_cast<QApplication *>(QCoreApplication::instance()); + app->setGraphicsSystem(QLatin1String("meego")); + + triggerSwitchCallbacks(1, "meego"); + } +} + +void QMeeGoGraphicsSystem::switchToRaster() +{ + if (runningGraphicsSystemName() == QLatin1String("raster")) + return; + + if (QApplicationPrivate::instance()->graphics_system_name != QLatin1String("runtime")) + qWarning("Can't switch to raster - switching only supported with 'runtime' graphics system."); + else { + triggerSwitchCallbacks(0, "raster"); + + QApplication *app = static_cast<QApplication *>(QCoreApplication::instance()); + app->setGraphicsSystem(QLatin1String("raster")); + + QMeeGoLivePixmapData::invalidateSurfaces(); + + triggerSwitchCallbacks(1, "raster"); + } +} + +void QMeeGoGraphicsSystem::registerSwitchCallback(QMeeGoSwitchCallback callback) +{ + switchCallbacks << callback; +} + +void QMeeGoGraphicsSystem::triggerSwitchCallbacks(int type, const char *name) +{ + for (int i = 0; i < switchCallbacks.size(); ++i) + switchCallbacks.at(i)(type, name); +} + /* C API */ int qt_meego_image_to_egl_shared_image(const QImage &image) @@ -340,3 +469,20 @@ void qt_meego_invalidate_live_surfaces(void) { return QMeeGoLivePixmapData::invalidateSurfaces(); } + +void qt_meego_switch_to_raster(void) +{ + QMeeGoGraphicsSystem::switchToRaster(); +} + +void qt_meego_switch_to_meego(void) +{ + QMeeGoGraphicsSystem::switchToMeeGo(); +} + +void qt_meego_register_switch_callback(QMeeGoSwitchCallback callback) +{ + QMeeGoGraphicsSystem::registerSwitchCallback(callback); +} + +#include "qmeegographicssystem.moc" diff --git a/src/plugins/graphicssystems/meego/qmeegographicssystem.h b/src/plugins/graphicssystems/meego/qmeegographicssystem.h index 27a4e7a..ecc85b2 100644 --- a/src/plugins/graphicssystems/meego/qmeegographicssystem.h +++ b/src/plugins/graphicssystems/meego/qmeegographicssystem.h @@ -47,6 +47,8 @@ #include <GLES2/gl2.h> #include <GLES2/gl2ext.h> +extern "C" typedef void (*QMeeGoSwitchCallback)(int type, const char *name); + class QMeeGoGraphicsSystem : public QGraphicsSystem { public: @@ -76,13 +78,22 @@ public: static void* createFenceSync(); static void destroyFenceSync(void* fenceSync); + static void switchToRaster(); + static void switchToMeeGo(); + static QString runningGraphicsSystemName(); + + static void registerSwitchCallback(QMeeGoSwitchCallback callback); + private: static bool meeGoRunning(); static EGLSurface getSurfaceForLiveTexturePixmap(QPixmap *pixmap); static void destroySurfaceForLiveTexturePixmap(QPixmapData* pmd); + static void triggerSwitchCallbacks(int type, const char *name); static bool surfaceWasCreated; - static QHash <Qt::HANDLE, QPixmap*> liveTexturePixmaps; + static QHash<Qt::HANDLE, QPixmap*> liveTexturePixmaps; + static QList<QMeeGoSwitchCallback> switchCallbacks; + }; /* C api */ @@ -95,7 +106,7 @@ extern "C" { Q_DECL_EXPORT bool qt_meego_destroy_egl_shared_image(Qt::HANDLE handle); Q_DECL_EXPORT void qt_meego_set_surface_fixed_size(int width, int height); Q_DECL_EXPORT void qt_meego_set_surface_scaling(int x, int y, int width, int height); - Q_DECL_EXPORT void qt_meego_set_translucent(bool translucent); + Q_DECL_EXPORT void qt_meego_set_translucent(bool translucent); Q_DECL_EXPORT QPixmapData* qt_meego_pixmapdata_with_new_live_texture(int w, int h, QImage::Format format); Q_DECL_EXPORT QPixmapData* qt_meego_pixmapdata_from_live_texture_handle(Qt::HANDLE handle); Q_DECL_EXPORT QImage* qt_meego_live_texture_lock(QPixmap *pixmap, void *fenceSync); @@ -104,6 +115,9 @@ extern "C" { Q_DECL_EXPORT void* qt_meego_create_fence_sync(void); Q_DECL_EXPORT void qt_meego_destroy_fence_sync(void* fs); Q_DECL_EXPORT void qt_meego_invalidate_live_surfaces(void); + Q_DECL_EXPORT void qt_meego_switch_to_raster(void); + Q_DECL_EXPORT void qt_meego_switch_to_meego(void); + Q_DECL_EXPORT void qt_meego_register_switch_callback(QMeeGoSwitchCallback callback); } #endif diff --git a/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.cpp b/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.cpp index ac32995..3f39bda 100644 --- a/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.cpp +++ b/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.cpp @@ -47,7 +47,6 @@ #include <private/qpixmap_raster_p.h> #include <private/qwindowsurface_gl_p.h> #include "qmeegoruntime.h" -#include "qmeegoswitchevent.h" QString QMeeGoGraphicsSystemHelper::runningGraphicsSystemName() { @@ -77,46 +76,12 @@ bool QMeeGoGraphicsSystemHelper::isRunningRuntime() void QMeeGoGraphicsSystemHelper::switchToMeeGo() { - if (isRunningMeeGo()) - return; - - if (QApplicationPrivate::instance()->graphics_system_name != QLatin1String("runtime")) - qWarning("Can't switch to meego - switching only supported with 'runtime' graphics system."); - else { - QMeeGoSwitchEvent willSwitchEvent(QLatin1String("meego"), QMeeGoSwitchEvent::WillSwitch); - foreach (QWidget *widget, QApplication::topLevelWidgets()) - QCoreApplication::sendEvent(widget, &willSwitchEvent); - - QApplication *app = static_cast<QApplication *>(QCoreApplication::instance()); - app->setGraphicsSystem(QLatin1String("meego")); - - QMeeGoSwitchEvent didSwitchEvent(QLatin1String("meego"), QMeeGoSwitchEvent::DidSwitch); - foreach (QWidget *widget, QApplication::topLevelWidgets()) - QCoreApplication::sendEvent(widget, &didSwitchEvent); - } + QMeeGoRuntime::switchToMeeGo(); } void QMeeGoGraphicsSystemHelper::switchToRaster() { - if (runningGraphicsSystemName() == QLatin1String("raster")) - return; - - if (QApplicationPrivate::instance()->graphics_system_name != QLatin1String("runtime")) - qWarning("Can't switch to raster - switching only supported with 'runtime' graphics system."); - else { - QMeeGoSwitchEvent willSwitchEvent(QLatin1String("raster"), QMeeGoSwitchEvent::WillSwitch); - foreach (QWidget *widget, QApplication::topLevelWidgets()) - QCoreApplication::sendEvent(widget, &willSwitchEvent); - - QApplication *app = static_cast<QApplication *>(QCoreApplication::instance()); - app->setGraphicsSystem(QLatin1String("raster")); - - QMeeGoRuntime::invalidateLiveSurfaces(); - - QMeeGoSwitchEvent didSwitchEvent(QLatin1String("raster"), QMeeGoSwitchEvent::DidSwitch); - foreach (QWidget *widget, QApplication::topLevelWidgets()) - QCoreApplication::sendEvent(widget, &didSwitchEvent); - } + QMeeGoRuntime::switchToRaster(); } Qt::HANDLE QMeeGoGraphicsSystemHelper::imageToEGLSharedImage(const QImage &image) @@ -170,3 +135,8 @@ void QMeeGoGraphicsSystemHelper::setSwapBehavior(SwapMode mode) else if (mode == KillSwap) QGLWindowSurface::swapBehavior = QGLWindowSurface::KillSwap; } + +void QMeeGoGraphicsSystemHelper::enableSwitchEvents() +{ + QMeeGoRuntime::enableSwitchEvents(); +} diff --git a/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.h b/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.h index 5a3b57e..9e50652 100644 --- a/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.h +++ b/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.h @@ -97,14 +97,21 @@ public: */ static bool isRunningRuntime(); + //! Enables the sending of QMeeGoSwitchEvent's when the graphicssystem switches. + /*! + An application that wishes to start receive QMeegoSwitchEvents must call this function. + */ + static void enableSwitchEvents(); + //! Switches to meego graphics system. /*! When running with the 'runtime' graphics system, sets the currently active system to 'meego'. The window surface and all the resources are automatically migrated to OpenGL. Will fail if the active graphics system is not 'runtime'. Calling this function will emit QMeeGoSwitchEvent to the top level widgets. - Two events will be emitted for each switch -- one before the switch (QMeeGoSwitchEvent::WillSwitch) - and one after the switch (QMeeGoSwitchEvent::DidSwitch). + If switch events are enabled, two events will be emitted for each switch -- + one before the switch (QMeeGoSwitchEvent::WillSwitch) and one after the + switch (QMeeGoSwitchEvent::DidSwitch). */ static void switchToMeeGo(); @@ -114,9 +121,9 @@ public: system to 'raster'. The window surface and the graphics resources (including the EGL shared image resources) are automatically migrated back to the CPU. All OpenGL resources (surface, context, cache, font cache) are automaticall anihilated. - Calling this function will emit QMeeGoSwitchEvent to the top level widgets. - Two events will be emitted for each switch -- one before the switch (QMeeGoSwitchEvent::WillSwitch) - and one after the switch (QMeeGoSwitchEvent::DidSwitch). + Calling this function will emit QMeeGoSwitchEvent to the top level widgets. If switch + events are enabled, two events will be emitted for each switch -- one before the + switch (QMeeGoSwitchEvent::WillSwitch) and one after the switch (QMeeGoSwitchEvent::DidSwitch). */ static void switchToRaster(); diff --git a/tools/qmeegographicssystemhelper/qmeegoruntime.cpp b/tools/qmeegographicssystemhelper/qmeegoruntime.cpp index 7c81d51..15f9cdf 100644 --- a/tools/qmeegographicssystemhelper/qmeegoruntime.cpp +++ b/tools/qmeegographicssystemhelper/qmeegoruntime.cpp @@ -41,6 +41,11 @@ #include "qmeegoruntime.h" +#include "qmeegoswitchevent.h" + +#include <QtGui/QApplication> +#include <QtGui/QWidget> + #include <private/qlibrary_p.h> #include <private/qfactoryloader_p.h> #include <private/qgraphicssystemplugin_p.h> @@ -49,6 +54,7 @@ #define ENSURE_INITIALIZED {if (!initialized) initialize();} bool QMeeGoRuntime::initialized = false; +bool QMeeGoRuntime::switchEventsEnabled = false; typedef int (*QMeeGoImageToEglSharedImageFunc) (const QImage&); typedef QPixmapData* (*QMeeGoPixmapDataFromEglSharedImageFunc) (Qt::HANDLE handle, const QImage&); @@ -66,6 +72,9 @@ typedef Qt::HANDLE (*QMeeGoLiveTextureGetHandleFunc) (QPixmap*); typedef void* (*QMeeGoCreateFenceSyncFunc) (void); typedef void (*QMeeGoDestroyFenceSyncFunc) (void *fs); typedef void (*QMeeGoInvalidateLiveSurfacesFunc) (void); +typedef void (*QMeeGoSwitchToRasterFunc) (void); +typedef void (*QMeeGoSwitchToMeeGoFunc) (void); +typedef void (*QMeeGoRegisterSwitchCallbackFunc) (void (*callback)(int type, const char *name)); static QMeeGoImageToEglSharedImageFunc qt_meego_image_to_egl_shared_image = NULL; static QMeeGoPixmapDataFromEglSharedImageFunc qt_meego_pixmapdata_from_egl_shared_image = NULL; @@ -83,6 +92,16 @@ static QMeeGoLiveTextureGetHandleFunc qt_meego_live_texture_get_handle = NULL; static QMeeGoCreateFenceSyncFunc qt_meego_create_fence_sync = NULL; static QMeeGoDestroyFenceSyncFunc qt_meego_destroy_fence_sync = NULL; static QMeeGoInvalidateLiveSurfacesFunc qt_meego_invalidate_live_surfaces = NULL; +static QMeeGoSwitchToRasterFunc qt_meego_switch_to_raster = NULL; +static QMeeGoSwitchToMeeGoFunc qt_meego_switch_to_meego = NULL; +static QMeeGoRegisterSwitchCallbackFunc qt_meego_register_switch_callback = NULL; + +extern "C" void handleSwitch(int type, const char *name) +{ + QMeeGoSwitchEvent switchEvent((QLatin1String(name)), QMeeGoSwitchEvent::State(type)); + foreach (QWidget *widget, QApplication::topLevelWidgets()) + QCoreApplication::sendEvent(widget, &switchEvent); +} void QMeeGoRuntime::initialize() { @@ -112,13 +131,17 @@ void QMeeGoRuntime::initialize() qt_meego_create_fence_sync = (QMeeGoCreateFenceSyncFunc) library.resolve("qt_meego_create_fence_sync"); qt_meego_destroy_fence_sync = (QMeeGoDestroyFenceSyncFunc) library.resolve("qt_meego_destroy_fence_sync"); qt_meego_invalidate_live_surfaces = (QMeeGoInvalidateLiveSurfacesFunc) library.resolve("qt_meego_invalidate_live_surfaces"); + qt_meego_switch_to_raster = (QMeeGoSwitchToRasterFunc) library.resolve("qt_meego_switch_to_raster"); + qt_meego_switch_to_meego = (QMeeGoSwitchToMeeGoFunc) library.resolve("qt_meego_switch_to_meego"); + qt_meego_register_switch_callback = (QMeeGoRegisterSwitchCallbackFunc) library.resolve("qt_meego_register_switch_callback"); if (qt_meego_image_to_egl_shared_image && qt_meego_pixmapdata_from_egl_shared_image && qt_meego_pixmapdata_with_gl_texture && qt_meego_destroy_egl_shared_image && qt_meego_update_egl_shared_image_pixmap && qt_meego_set_surface_fixed_size && qt_meego_set_surface_scaling && qt_meego_set_translucent && qt_meego_pixmapdata_with_new_live_texture && qt_meego_pixmapdata_from_live_texture_handle && qt_meego_live_texture_lock && qt_meego_live_texture_release && qt_meego_live_texture_get_handle && - qt_meego_create_fence_sync && qt_meego_destroy_fence_sync && qt_meego_invalidate_live_surfaces) + qt_meego_create_fence_sync && qt_meego_destroy_fence_sync && qt_meego_invalidate_live_surfaces && + qt_meego_switch_to_raster && qt_meego_switch_to_meego && qt_meego_register_switch_callback) { qDebug("Successfully resolved MeeGo graphics system: %s %s\n", qPrintable(libraryPrivate->fileName), qPrintable(libraryPrivate->fullVersion)); } else { @@ -242,3 +265,27 @@ void QMeeGoRuntime::invalidateLiveSurfaces() Q_ASSERT(qt_meego_invalidate_live_surfaces); qt_meego_invalidate_live_surfaces(); } + +void QMeeGoRuntime::switchToRaster() +{ + ENSURE_INITIALIZED; + Q_ASSERT(qt_meego_switch_to_raster); + qt_meego_switch_to_raster(); +} + +void QMeeGoRuntime::switchToMeeGo() +{ + ENSURE_INITIALIZED; + Q_ASSERT(qt_meego_switch_to_meego); + qt_meego_switch_to_meego(); +} + +void QMeeGoRuntime::enableSwitchEvents() +{ + ENSURE_INITIALIZED; + if (!switchEventsEnabled) { + Q_ASSERT(qt_meego_register_switch_callback); + qt_meego_register_switch_callback(handleSwitch); + switchEventsEnabled = true; + } +} diff --git a/tools/qmeegographicssystemhelper/qmeegoruntime.h b/tools/qmeegographicssystemhelper/qmeegoruntime.h index b91efae..6279b4c 100644 --- a/tools/qmeegographicssystemhelper/qmeegoruntime.h +++ b/tools/qmeegographicssystemhelper/qmeegoruntime.h @@ -63,7 +63,11 @@ public: static void* createFenceSync(); static void destroyFenceSync(void *fs); static void invalidateLiveSurfaces(); + static void switchToRaster(); + static void switchToMeeGo(); + static void enableSwitchEvents(); private: static bool initialized; + static bool switchEventsEnabled; }; -- cgit v0.12 From 60bec281fe0a82556c07db3f8e13587d47b8449e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tapani=20P=C3=A4lli?= <tapani.palli@nokia.com> Date: Wed, 16 Mar 2011 08:25:45 +0100 Subject: QMeeGoLivePixmapData : when creating QImage, use constructor with pitch. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As the data may be aligned/padded by the X driver. Fixes: NB#231246 : Incorrect stride used when QMeeGoLivePixmap width not multiple of eight Merge-request: 1115 Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com> --- src/plugins/graphicssystems/meego/qmeegolivepixmapdata.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/graphicssystems/meego/qmeegolivepixmapdata.cpp b/src/plugins/graphicssystems/meego/qmeegolivepixmapdata.cpp index 2a2a098..0970b89 100644 --- a/src/plugins/graphicssystems/meego/qmeegolivepixmapdata.cpp +++ b/src/plugins/graphicssystems/meego/qmeegolivepixmapdata.cpp @@ -219,7 +219,7 @@ QImage* QMeeGoLivePixmapData::lock(EGLSyncKHR fenceSync) return &lockedImage; } - lockedImage = QImage((uchar *) data, width(), height(), format); + lockedImage = QImage((uchar *) data, width(), height(), pitch, format); return &lockedImage; } -- cgit v0.12 From f58fea162bf20ba42c57a7bf81d0b4de9cbae725 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= <morten.sorvig@nokia.com> Date: Fri, 25 Feb 2011 09:07:10 +0100 Subject: Update NaCl mkspecs. Less duplication, use the common unix and gcc conf files. --- mkspecs/qws/linux-nacl-g++/qmake.conf | 69 ++-------- mkspecs/qws/linux-nacl-g++/qplatformdefs.h | 122 +---------------- mkspecs/qws/macx-nacl-g++/qmake.conf | 94 ++------------ mkspecs/qws/macx-nacl-g++/qplatformdefs.h | 201 +++++++---------------------- 4 files changed, 79 insertions(+), 407 deletions(-) diff --git a/mkspecs/qws/linux-nacl-g++/qmake.conf b/mkspecs/qws/linux-nacl-g++/qmake.conf index 83ce65b..7293a1a 100644 --- a/mkspecs/qws/linux-nacl-g++/qmake.conf +++ b/mkspecs/qws/linux-nacl-g++/qmake.conf @@ -2,73 +2,28 @@ # qmake configuration for building with nacl-g++ # -include(../../common/unix.conf) +include(../../common/linux.conf) include(../../common/qws.conf) +include(../../common/gcc-base-unix.conf) +include(../../common/g++-unix.conf) QT = core gui -# copy of ../../common/g++.conf, with modifications: - QMAKE_CC = nacl-gcc QMAKE_CXX = nacl-g++ QMAKE_LINK = nacl-g++ QMAKE_LINK_SHLIB = nacl-g++ - -#QMAKE_CC = gcc -QMAKE_CFLAGS += -pipe -DXP_UNIX -DNACL_STANDALONE=1 -QMAKE_CFLAGS_DEPS += -M -QMAKE_CFLAGS_WARN_ON += -Wall -W -QMAKE_CFLAGS_WARN_OFF += -w -QMAKE_CFLAGS_RELEASE += -O2 -QMAKE_CFLAGS_DEBUG += -g -QMAKE_CFLAGS_SHLIB += -fPIC -#QMAKE_CFLAGS_STATIC_LIB += -fPIC -QMAKE_CFLAGS_YACC += -Wno-unused -Wno-parentheses -QMAKE_CFLAGS_HIDESYMS += -fvisibility=hidden -QMAKE_CFLAGS_PRECOMPILE += -x c-header -c ${QMAKE_PCH_INPUT} -o ${QMAKE_PCH_OUTPUT} -QMAKE_CFLAGS_USE_PRECOMPILE += -include ${QMAKE_PCH_OUTPUT_BASE} - -#QMAKE_CXX = g++ -QMAKE_CXXFLAGS += $$QMAKE_CFLAGS -QMAKE_CXXFLAGS_DEPS += $$QMAKE_CFLAGS_DEPS -QMAKE_CXXFLAGS_WARN_ON += $$QMAKE_CFLAGS_WARN_ON -QMAKE_CXXFLAGS_WARN_OFF += $$QMAKE_CFLAGS_WARN_OFF -QMAKE_CXXFLAGS_RELEASE += $$QMAKE_CFLAGS_RELEASE -QMAKE_CXXFLAGS_DEBUG += $$QMAKE_CFLAGS_DEBUG -QMAKE_CXXFLAGS_SHLIB += $$QMAKE_CFLAGS_SHLIB -QMAKE_CXXFLAGS_STATIC_LIB += $$QMAKE_CFLAGS_STATIC_LIB -QMAKE_CXXFLAGS_YACC += $$QMAKE_CFLAGS_YACC -QMAKE_CXXFLAGS_HIDESYMS += $$QMAKE_CFLAGS_HIDESYMS -fvisibility-inlines-hidden -QMAKE_CXXFLAGS_PRECOMPILE += -x c++-header -c ${QMAKE_PCH_INPUT} -o ${QMAKE_PCH_OUTPUT} -QMAKE_CXXFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE - -#QMAKE_LINK = g++ -#QMAKE_LINK_SHLIB = g++ -QMAKE_LINK_C = gcc -QMAKE_LINK_C_SHLIB = gcc -QMAKE_LFLAGS += -QMAKE_LFLAGS_RELEASE += -Wl,-O1 -QMAKE_LFLAGS_DEBUG += -QMAKE_LFLAGS_APP += -QMAKE_LFLAGS_SHLIB += -shared -QMAKE_LFLAGS_PLUGIN += $$QMAKE_LFLAGS_SHLIB -QMAKE_LFLAGS_SONAME += -Wl,-soname, -QMAKE_LFLAGS_THREAD += -QMAKE_LFLAGS_NOUNDEF += -Wl,--no-undefined -QMAKE_LFLAGS_RPATH = -Wl,-rpath, - -QMAKE_LIBS = -lgoogle_nacl_imc -lgoogle_nacl_npruntime -lgoogle_nacl_pgl -lgoogle_nacl_gpu -lpthread -lsrpc - -QMAKE_PCH_OUTPUT_EXT = .gch - -# -Bsymbolic-functions (ld) support -QMAKE_LFLAGS_BSYMBOLIC_FUNC = -Wl,-Bsymbolic-functions -QMAKE_LFLAGS_DYNAMIC_LIST = -Wl,--dynamic-list, - -# modifications to linux.conf QMAKE_AR = nacl-ar q QMAKE_OBJCOPY = nacl-objcopy QMAKE_STRIP = nacl-strip -QMAKE_LIBS_DYNLOAD = + +# work around linker crash when using PIC +QMAKE_CFLAGS_STATIC_LIB -= -fPIC +QMAKE_CFLAGS_SHLIB -= -fPIC +QMAKE_CXXFLAGS_STATIC_LIB -= -fPIC +QMAKE_CXXFLAGS_SHLIB -= -fPIC + +#QMAKE_CFLAGS += -pipe -DXP_UNIX -DNACL_STANDALONE=1 +QMAKE_LIBS_DYNLOAD -= -ldl load(qt_config) diff --git a/mkspecs/qws/linux-nacl-g++/qplatformdefs.h b/mkspecs/qws/linux-nacl-g++/qplatformdefs.h index 01b26d9..70572bf 100644 --- a/mkspecs/qws/linux-nacl-g++/qplatformdefs.h +++ b/mkspecs/qws/linux-nacl-g++/qplatformdefs.h @@ -48,128 +48,20 @@ #include "qglobal.h" - -#define _POSIX_TIMERS -// Set any POSIX/XOPEN defines at the top of this file to turn on specific APIs - -// 1) need to reset default environment if _BSD_SOURCE is defined -// 2) need to specify POSIX thread interfaces explicitly in glibc 2.0 -// 3) it seems older glibc need this to include the X/Open stuff -#ifndef _GNU_SOURCE -# define _GNU_SOURCE -#endif - -#include <unistd.h> - - -// We are hot - unistd.h should have turned on the specific APIs we requested - -#include <sys/features.h> -#include <pthread.h> -#include <dirent.h> -#include <fcntl.h> -#include <grp.h> -#include <pwd.h> -#include <signal.h> -//#include <dlfcn.h> - -#include <sys/types.h> -//#include <sys/ioctl.h> -//#include <sys/ipc.h> - -#include <sys/time.h> -//#include <sys/shm.h> -//#include <sys/socket.h> -#include <sys/stat.h> -#include <sys/wait.h> -//#include <netinet/in.h> -#ifndef QT_NO_IPV6IFNAME -#include <net/if.h> -#endif - // extra disabling. -#ifdef __native_client__ +#ifdef __native_client__ #define QT_NO_FSFILEENGINE -#define QT_NO_TRANSLATION #endif -#ifdef QT_LARGEFILE_SUPPORT -#define QT_STATBUF struct stat64 -#define QT_STATBUF4TSTAT struct stat64 -#define QT_STAT ::stat64 -#define QT_FSTAT ::fstat64 -#define QT_LSTAT ::lstat64 -#define QT_OPEN ::open64 -#define QT_TRUNCATE ::truncate64 -#define QT_FTRUNCATE ::ftruncate64 -#define QT_LSEEK ::lseek64 -#else -#define QT_STATBUF struct stat -#define QT_STATBUF4TSTAT struct stat -#define QT_STAT ::stat -#define QT_FSTAT ::fstat -#define QT_LSTAT ::lstat -#define QT_OPEN ::open -#define QT_TRUNCATE ::truncate -#define QT_FTRUNCATE ::ftruncate -#define QT_LSEEK ::lseek -#endif +#define QT_NO_SOCKET_H -#ifdef QT_LARGEFILE_SUPPORT -#define QT_FOPEN ::fopen64 -#define QT_FSEEK ::fseeko64 -#define QT_FTELL ::ftello64 -#define QT_FGETPOS ::fgetpos64 -#define QT_FSETPOS ::fsetpos64 -#define QT_FPOS_T fpos64_t -#define QT_OFF_T off64_t -#else -#define QT_FOPEN ::fopen -#define QT_FSEEK ::fseek -#define QT_FTELL ::ftell -#define QT_FGETPOS ::fgetpos -#define QT_FSETPOS ::fsetpos -#define QT_FPOS_T fpos_t -#define QT_OFF_T long -#endif +#define DIR void * +#define PATH_MAX 256 -#define QT_STAT_REG S_IFREG -#define QT_STAT_DIR S_IFDIR -#define QT_STAT_MASK S_IFMT -#define QT_STAT_LNK S_IFLNK -#define QT_SOCKET_CONNECT ::connect -#define QT_SOCKET_BIND ::bind -#define QT_FILENO fileno -#define QT_CLOSE ::close -#define QT_READ ::read -#define QT_WRITE ::write -#define QT_ACCESS ::access -#define QT_GETCWD ::getcwd -#define QT_CHDIR ::chdir -#define QT_MKDIR ::mkdir -#define QT_RMDIR ::rmdir -#define QT_OPEN_LARGEFILE O_LARGEFILE -#define QT_OPEN_RDONLY O_RDONLY -#define QT_OPEN_WRONLY O_WRONLY -#define QT_OPEN_RDWR O_RDWR -#define QT_OPEN_CREAT O_CREAT -#define QT_OPEN_TRUNC O_TRUNC -#define QT_OPEN_APPEND O_APPEND +#include "../../common/posix/qplatformdefs.h" -#define QT_SIGNAL_RETTYPE void -#define QT_SIGNAL_ARGS int -#define QT_SIGNAL_IGNORE SIG_IGN - -#if defined(__GLIBC__) && (__GLIBC__ >= 2) -#define QT_SOCKLEN_T socklen_t -#else -#define QT_SOCKLEN_T int -#endif - -#if defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 500) -#define QT_SNPRINTF ::snprintf -#define QT_VSNPRINTF ::vsnprintf -#endif +#undef QT_LSTAT +#define QT_LSTAT QT_STAT #endif // QPLATFORMDEFS_H diff --git a/mkspecs/qws/macx-nacl-g++/qmake.conf b/mkspecs/qws/macx-nacl-g++/qmake.conf index 0a54b4b..7293a1a 100644 --- a/mkspecs/qws/macx-nacl-g++/qmake.conf +++ b/mkspecs/qws/macx-nacl-g++/qmake.conf @@ -1,95 +1,29 @@ # -# qmake configuration for macx-nacl-g++ with embedded-lite +# qmake configuration for building with nacl-g++ # -include(../../common/unix.conf) - -MAKEFILE_GENERATOR = UNIX -TEMPLATE = app -CONFIG += qt warn_on release link_prl -QT += core gui -QMAKE_INCREMENTAL_STYLE = sublib -QMAKE_EXTENSION_SHLIB = dylib +include(../../common/linux.conf) +include(../../common/qws.conf) +include(../../common/gcc-base-unix.conf) +include(../../common/g++-unix.conf) +QT = core gui QMAKE_CC = nacl-gcc QMAKE_CXX = nacl-g++ QMAKE_LINK = nacl-g++ QMAKE_LINK_SHLIB = nacl-g++ - -#QMAKE_CC = $(TB)cc -QMAKE_LEX = flex -QMAKE_LEXFLAGS = -QMAKE_YACC = yacc -QMAKE_YACCFLAGS = -d -QMAKE_CFLAGS = -pipe -DXP_UNIX -DNACL_STANDALONE=1 -QMAKE_CFLAGS_WARN_ON = -Wall -W -QMAKE_CFLAGS_WARN_OFF = -QMAKE_CFLAGS_RELEASE = -O2 -QMAKE_CFLAGS_DEBUG = -g -QMAKE_CFLAGS_SHLIB = -fPIC -QMAKE_CFLAGS_YACC = -Wno-unused -Wno-parentheses -QMAKE_CFLAGS_THREAD = -D_REENTRANT -QMAKE_CFLAGS_HIDESYMS = -fvisibility=hidden - -#QMAKE_CXX = $(TB)c++ -QMAKE_CXXFLAGS = $$QMAKE_CFLAGS -DQT_NO_QWS_TRANSFORMED -QMAKE_CXXFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON -QMAKE_CXXFLAGS_WARN_OFF = $$QMAKE_CFLAGS_WARN_OFF -QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE -fno-default-inline -QMAKE_CXXFLAGS_DEBUG = $$QMAKE_CFLAGS_DEBUG -QMAKE_CXXFLAGS_SHLIB = $$QMAKE_CFLAGS_SHLIB -QMAKE_CXXFLAGS_YACC = $$QMAKE_CFLAGS_YACC -QMAKE_CXXFLAGS_THREAD = $$QMAKE_CFLAGS_THREAD -QMAKE_CXXFLAGS_HIDESYMS = $$QMAKE_CFLAGS_HIDESYMS -fvisibility-inlines-hidden - -QMAKE_INCDIR = -QMAKE_LIBDIR = -QMAKE_INCDIR_X11 = -QMAKE_LIBDIR_X11 = -QMAKE_INCDIR_QT = $$[QT_INSTALL_HEADERS] -QMAKE_LIBDIR_QT = $$[QT_INSTALL_LIBS] -QMAKE_INCDIR_OPENGL = -QMAKE_LIBDIR_OPENGL = -QMAKE_INCDIR_QTOPIA = $(QPEDIR)/include -QMAKE_LIBDIR_QTOPIA = $(QPEDIR)/lib - -#QMAKE_LINK = $$QMAKE_CXX -#QMAKE_LINK_SHLIB = $$QMAKE_CXX -QMAKE_LFLAGS = -QMAKE_LFLAGS_RELEASE = -QMAKE_LFLAGS_DEBUG = -QMAKE_LFLAGS_SHLIB = -dynamiclib -QMAKE_LFLAGS_INCREMENTAL = -undefined suppress -flat_namespace -QMAKE_LFLAGS_PLUGIN = -bundle -QMAKE_LFLAGS_SONAME = -QMAKE_LFLAGS_THREAD = - -QMAKE_LIBS = -lgoogle_nacl_imc -lgoogle_nacl_npruntime -lgoogle_nacl_pgl -lgoogle_nacl_gpu -lpthread -lsrpc -QMAKE_LIBS_X11 = -QMAKE_LIBS_X11SM = -QMAKE_LIBS_QT = -lqte -QMAKE_LIBS_QT_THREAD = -lqte-mt -QMAKE_LIBS_QT_OPENGL = -lqgl -QMAKE_LIBS_QTOPIA = -lqpe -lqtopia -QMAKE_LIBS_THREAD = -QMAKE_LIBS_OPENGL = - -QMAKE_MOC = $$[QT_INSTALL_BINS]/moc -QMAKE_UIC = $$[QT_INSTALL_BINS]/uic - QMAKE_AR = nacl-ar q QMAKE_OBJCOPY = nacl-objcopy QMAKE_STRIP = nacl-strip -QMAKE_RANLIB = -QMAKE_TAR = tar -cf -QMAKE_GZIP = gzip -9f +# work around linker crash when using PIC +QMAKE_CFLAGS_STATIC_LIB -= -fPIC +QMAKE_CFLAGS_SHLIB -= -fPIC +QMAKE_CXXFLAGS_STATIC_LIB -= -fPIC +QMAKE_CXXFLAGS_SHLIB -= -fPIC + +#QMAKE_CFLAGS += -pipe -DXP_UNIX -DNACL_STANDALONE=1 +QMAKE_LIBS_DYNLOAD -= -ldl -QMAKE_COPY = cp -f -QMAKE_MOVE = mv -f -QMAKE_DEL_FILE = rm -f -QMAKE_DEL_DIR = rmdir -QMAKE_CHK_DIR_EXISTS = test -d -QMAKE_MKDIR = mkdir -p load(qt_config) diff --git a/mkspecs/qws/macx-nacl-g++/qplatformdefs.h b/mkspecs/qws/macx-nacl-g++/qplatformdefs.h index 01b26d9..f893238 100644 --- a/mkspecs/qws/macx-nacl-g++/qplatformdefs.h +++ b/mkspecs/qws/macx-nacl-g++/qplatformdefs.h @@ -1,175 +1,66 @@ /**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the qmake spec of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ + ** + ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). + ** All rights reserved. + ** Contact: Nokia Corporation (qt-info@nokia.com) + ** + ** This file is part of the qmake spec of the Qt Toolkit. + ** + ** $QT_BEGIN_LICENSE:LGPL$ + ** No Commercial Usage + ** This file contains pre-release code and may not be distributed. + ** You may use this file in accordance with the terms and conditions + ** contained in the Technology Preview License Agreement accompanying + ** this package. + ** + ** 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, Nokia gives you certain additional + ** rights. These rights are described in the Nokia Qt LGPL Exception + ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. + ** + ** If you have questions regarding the use of this file, please contact + ** Nokia at qt-info@nokia.com. + ** + ** + ** + ** + ** + ** + ** + ** + ** $QT_END_LICENSE$ + ** + ****************************************************************************/ #ifndef QPLATFORMDEFS_H #define QPLATFORMDEFS_H -// Get Qt defines/settings #define _POSIX_TIMERS #include "qglobal.h" - -#define _POSIX_TIMERS -// Set any POSIX/XOPEN defines at the top of this file to turn on specific APIs - -// 1) need to reset default environment if _BSD_SOURCE is defined -// 2) need to specify POSIX thread interfaces explicitly in glibc 2.0 -// 3) it seems older glibc need this to include the X/Open stuff -#ifndef _GNU_SOURCE -# define _GNU_SOURCE -#endif - -#include <unistd.h> - - -// We are hot - unistd.h should have turned on the specific APIs we requested - -#include <sys/features.h> -#include <pthread.h> -#include <dirent.h> -#include <fcntl.h> -#include <grp.h> -#include <pwd.h> -#include <signal.h> -//#include <dlfcn.h> - -#include <sys/types.h> -//#include <sys/ioctl.h> -//#include <sys/ipc.h> - -#include <sys/time.h> -//#include <sys/shm.h> -//#include <sys/socket.h> -#include <sys/stat.h> -#include <sys/wait.h> -//#include <netinet/in.h> -#ifndef QT_NO_IPV6IFNAME -#include <net/if.h> -#endif - // extra disabling. -#ifdef __native_client__ +#ifdef __native_client__ #define QT_NO_FSFILEENGINE -#define QT_NO_TRANSLATION #endif -#ifdef QT_LARGEFILE_SUPPORT -#define QT_STATBUF struct stat64 -#define QT_STATBUF4TSTAT struct stat64 -#define QT_STAT ::stat64 -#define QT_FSTAT ::fstat64 -#define QT_LSTAT ::lstat64 -#define QT_OPEN ::open64 -#define QT_TRUNCATE ::truncate64 -#define QT_FTRUNCATE ::ftruncate64 -#define QT_LSEEK ::lseek64 -#else -#define QT_STATBUF struct stat -#define QT_STATBUF4TSTAT struct stat -#define QT_STAT ::stat -#define QT_FSTAT ::fstat -#define QT_LSTAT ::lstat -#define QT_OPEN ::open -#define QT_TRUNCATE ::truncate -#define QT_FTRUNCATE ::ftruncate -#define QT_LSEEK ::lseek -#endif +#define QT_NO_SOCKET_H -#ifdef QT_LARGEFILE_SUPPORT -#define QT_FOPEN ::fopen64 -#define QT_FSEEK ::fseeko64 -#define QT_FTELL ::ftello64 -#define QT_FGETPOS ::fgetpos64 -#define QT_FSETPOS ::fsetpos64 -#define QT_FPOS_T fpos64_t -#define QT_OFF_T off64_t -#else -#define QT_FOPEN ::fopen -#define QT_FSEEK ::fseek -#define QT_FTELL ::ftell -#define QT_FGETPOS ::fgetpos -#define QT_FSETPOS ::fsetpos -#define QT_FPOS_T fpos_t -#define QT_OFF_T long -#endif +#define DIR void * +#define PATH_MAX 256 -#define QT_STAT_REG S_IFREG -#define QT_STAT_DIR S_IFDIR -#define QT_STAT_MASK S_IFMT -#define QT_STAT_LNK S_IFLNK -#define QT_SOCKET_CONNECT ::connect -#define QT_SOCKET_BIND ::bind -#define QT_FILENO fileno -#define QT_CLOSE ::close -#define QT_READ ::read -#define QT_WRITE ::write -#define QT_ACCESS ::access -#define QT_GETCWD ::getcwd -#define QT_CHDIR ::chdir -#define QT_MKDIR ::mkdir -#define QT_RMDIR ::rmdir -#define QT_OPEN_LARGEFILE O_LARGEFILE -#define QT_OPEN_RDONLY O_RDONLY -#define QT_OPEN_WRONLY O_WRONLY -#define QT_OPEN_RDWR O_RDWR -#define QT_OPEN_CREAT O_CREAT -#define QT_OPEN_TRUNC O_TRUNC -#define QT_OPEN_APPEND O_APPEND +#include "../../common/posix/qplatformdefs.h" -#define QT_SIGNAL_RETTYPE void -#define QT_SIGNAL_ARGS int -#define QT_SIGNAL_IGNORE SIG_IGN - -#if defined(__GLIBC__) && (__GLIBC__ >= 2) -#define QT_SOCKLEN_T socklen_t -#else -#define QT_SOCKLEN_T int -#endif - -#if defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 500) -#define QT_SNPRINTF ::snprintf -#define QT_VSNPRINTF ::vsnprintf -#endif +#undef QT_LSTAT +#define QT_LSTAT QT_STAT #endif // QPLATFORMDEFS_H -- cgit v0.12 From 66f30105ef15579c13b5574cc11bbe49f1615f41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= <morten.sorvig@nokia.com> Date: Fri, 25 Feb 2011 09:16:20 +0100 Subject: Fix CoreServices framework addition for qpa. Test against the coreservices QT_CONFIG on qpa, unconditionally add CoreFoundation for mac and darwin --- src/corelib/corelib.pro | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/corelib/corelib.pro b/src/corelib/corelib.pro index f03550d..58d2c7b 100644 --- a/src/corelib/corelib.pro +++ b/src/corelib/corelib.pro @@ -20,14 +20,13 @@ include(statemachine/statemachine.pri) include(xml/xml.pri) !qpa:mac|darwin:LIBS_PRIVATE += -framework ApplicationServices -qpa:mac|darwin { - contains(QT_CONFIG, coreservices) { - LIBS_PRIVATE += -framework CoreServices - } else { - LIBS_PRIVATE += -framework CoreFoundation - } +qpa { + contains(QT_CONFIG, coreservices) { + LIBS_PRIVATE += -framework CoreServices + } +} else:mac|darwin { + LIBS_PRIVATE += -framework CoreFoundation } - mac:lib_bundle:DEFINES += QT_NO_DEBUG_PLUGIN_CHECK win32:DEFINES-=QT_NO_CAST_TO_ASCII -- cgit v0.12 From 2eddefa0d26e32e1f8e2dd93998ff14ff9c912d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= <morten.sorvig@nokia.com> Date: Fri, 25 Feb 2011 09:18:20 +0100 Subject: Compile. --- src/corelib/global/qnaclunimplemented.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/corelib/global/qnaclunimplemented.h b/src/corelib/global/qnaclunimplemented.h index 2d3d426..921667e 100644 --- a/src/corelib/global/qnaclunimplemented.h +++ b/src/corelib/global/qnaclunimplemented.h @@ -44,6 +44,8 @@ #ifdef Q_OS_NACL +#include <sys/types.h> + // pthread #include <pthread.h> #define PTHREAD_CANCEL_DISABLE 1 -- cgit v0.12 From 517290f73be74d1cf08fbd603870d3dacc379ff3 Mon Sep 17 00:00:00 2001 From: Michael Hasselmann <michaelh@openismus.com> Date: Thu, 10 Feb 2011 19:14:45 +0100 Subject: Introduce QGraphicsItem::ItemStopsFocusHandling flag MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When set for an item, QGraphicsScene will skip focus handling for this item and everything underneath it (including focus-out). Allows users to reimplement custom focus handling. Use case: touch devices that implement panning. Here, focus-in has to happen only if no panning was triggered. Analogous, no focus-out should happen when panning was detected. Fixes the alternative proposal ("black holes for focus changes") of QTBUG-16343: QGraphicsView doesn't support focus change on mouse release. The previous test was only testing one scenario, which didn't give a good idea whether the flag was actually working as intended. Task-number: QTBUG-17505 Reviewed-by: Yoann Lopes Reviewed-by: Jan-Arve Sæther --- src/gui/graphicsview/qgraphicsitem.cpp | 8 +++ src/gui/graphicsview/qgraphicsitem.h | 3 +- src/gui/graphicsview/qgraphicsitem_p.h | 6 +-- src/gui/graphicsview/qgraphicsscene.cpp | 17 +++++-- tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp | 69 ++++++++++++++++++++++---- 5 files changed, 84 insertions(+), 19 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index f463887..4e2d4e2 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -417,6 +417,11 @@ click focus to items underneath when being clicked on. This flag allows you create a non-focusable item that can be clicked on without changing the focus. \endomit + + \omitvalue ItemStopsFocusHandling \omit Same as + ItemStopsClickFocusPropagation, but also suppresses focus-out. This flag + allows you to completely take over focus handling. + This flag was introduced in Qt 4.7. */ /*! @@ -11549,6 +11554,9 @@ QDebug operator<<(QDebug debug, QGraphicsItem::GraphicsItemFlag flag) case QGraphicsItem::ItemStopsClickFocusPropagation: str = "ItemStopsClickFocusPropagation"; break; + case QGraphicsItem::ItemStopsFocusHandling: + str = "ItemStopsFocusHandling"; + break; } debug << str; return debug; diff --git a/src/gui/graphicsview/qgraphicsitem.h b/src/gui/graphicsview/qgraphicsitem.h index e59a7c9..67c9cd3 100644 --- a/src/gui/graphicsview/qgraphicsitem.h +++ b/src/gui/graphicsview/qgraphicsitem.h @@ -107,7 +107,8 @@ public: ItemIsPanel = 0x4000, ItemIsFocusScope = 0x8000, // internal ItemSendsScenePositionChanges = 0x10000, - ItemStopsClickFocusPropagation = 0x20000 + ItemStopsClickFocusPropagation = 0x20000, + ItemStopsFocusHandling = 0x40000 // NB! Don't forget to increase the d_ptr->flags bit field by 1 when adding a new flag. }; Q_DECLARE_FLAGS(GraphicsItemFlags, GraphicsItemFlag) diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h index 5c82116..90ff43f 100644 --- a/src/gui/graphicsview/qgraphicsitem_p.h +++ b/src/gui/graphicsview/qgraphicsitem_p.h @@ -559,7 +559,7 @@ public: quint32 dirtyChildrenBoundingRect : 1; // Packed 32 bits - quint32 flags : 18; + quint32 flags : 19; quint32 paintedViewBoundingRectsNeedRepaint : 1; quint32 dirtySceneTransform : 1; quint32 geometryChanged : 1; @@ -573,9 +573,9 @@ public: quint32 sceneTransformTranslateOnly : 1; quint32 notifyBoundingRectChanged : 1; quint32 notifyInvalidated : 1; - quint32 mouseSetsFocus : 1; // New 32 bits + quint32 mouseSetsFocus : 1; quint32 explicitActivate : 1; quint32 wantsActive : 1; quint32 holesInSiblingIndex : 1; @@ -586,7 +586,7 @@ public: quint32 mayHaveChildWithGraphicsEffect : 1; quint32 isDeclarativeItem : 1; quint32 sendParentChangeNotification : 1; - quint32 padding : 22; + quint32 padding : 21; // Optional stacking order int globalStackingOrder; diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index f997fc2..2d85de6 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -1317,8 +1317,10 @@ void QGraphicsScenePrivate::mousePressEventHandler(QGraphicsSceneMouseEvent *mou // Set focus on the topmost enabled item that can take focus. bool setFocus = false; + foreach (QGraphicsItem *item, cachedItemsUnderMouse) { - if (item->isBlockedByModalPanel()) { + if (item->isBlockedByModalPanel() + || (item->d_ptr->flags & QGraphicsItem::ItemStopsFocusHandling)) { // Make sure we don't clear focus. setFocus = true; break; @@ -1331,10 +1333,10 @@ void QGraphicsScenePrivate::mousePressEventHandler(QGraphicsSceneMouseEvent *mou break; } } - if (item->d_ptr->flags & QGraphicsItem::ItemStopsClickFocusPropagation) - break; if (item->isPanel()) break; + if (item->d_ptr->flags & QGraphicsItem::ItemStopsClickFocusPropagation) + break; } // Check for scene modality. @@ -5925,6 +5927,7 @@ bool QGraphicsScenePrivate::sendTouchBeginEvent(QGraphicsItem *origin, QTouchEve // Set focus on the topmost enabled item that can take focus. bool setFocus = false; + foreach (QGraphicsItem *item, cachedItemsUnderMouse) { if (item->isEnabled() && ((item->flags() & QGraphicsItem::ItemIsFocusable) && item->d_ptr->mouseSetsFocus)) { if (!item->isWidget() || ((QGraphicsWidget *)item)->focusPolicy() & Qt::ClickFocus) { @@ -5938,6 +5941,11 @@ bool QGraphicsScenePrivate::sendTouchBeginEvent(QGraphicsItem *origin, QTouchEve break; if (item->d_ptr->flags & QGraphicsItem::ItemStopsClickFocusPropagation) break; + if (item->d_ptr->flags & QGraphicsItem::ItemStopsFocusHandling) { + // Make sure we don't clear focus. + setFocus = true; + break; + } } // If nobody could take focus, clear it. @@ -5970,7 +5978,8 @@ bool QGraphicsScenePrivate::sendTouchBeginEvent(QGraphicsItem *origin, QTouchEve } if (item && item->isPanel()) break; - if (item && (item->d_ptr->flags & QGraphicsItem::ItemStopsClickFocusPropagation)) + if (item && (item->d_ptr->flags + & (QGraphicsItem::ItemStopsClickFocusPropagation | QGraphicsItem::ItemStopsFocusHandling))) break; } diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index dacb61e..168f75e 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -447,7 +447,8 @@ private slots: void updateMicroFocus(); void textItem_shortcuts(); void scroll(); - void stopClickFocusPropagation(); + void focusHandling_data(); + void focusHandling(); void deviceCoordinateCache_simpleRotations(); // task specific tests below me @@ -10537,8 +10538,39 @@ void tst_QGraphicsItem::scroll() QCOMPARE(item2->lastExposedRect, expectedItem2Expose); } -void tst_QGraphicsItem::stopClickFocusPropagation() +Q_DECLARE_METATYPE(QGraphicsItem::GraphicsItemFlag); + +void tst_QGraphicsItem::focusHandling_data() { + QTest::addColumn<QGraphicsItem::GraphicsItemFlag>("focusFlag"); + QTest::addColumn<bool>("useStickyFocus"); + QTest::addColumn<int>("expectedFocusItem"); // 0: none, 1: focusableUnder, 2: itemWithFocus + + QTest::newRow("Focus goes through.") + << static_cast<QGraphicsItem::GraphicsItemFlag>(0x0) << false << 1; + + QTest::newRow("Focus goes through, even with sticky scene.") + << static_cast<QGraphicsItem::GraphicsItemFlag>(0x0) << true << 1; + + QTest::newRow("With ItemStopsClickFocusPropagation, we cannot focus the item beneath the flagged one (but can still focus-out).") + << QGraphicsItem::ItemStopsClickFocusPropagation << false << 0; + + QTest::newRow("With ItemStopsClickFocusPropagation, we cannot focus the item beneath the flagged one (and cannot focus-out if scene is sticky).") + << QGraphicsItem::ItemStopsClickFocusPropagation << true << 2; + + QTest::newRow("With ItemStopsFocusHandling, focus cannot be changed by presses.") + << QGraphicsItem::ItemStopsFocusHandling << false << 2; + + QTest::newRow("With ItemStopsFocusHandling, focus cannot be changed by presses (even if scene is sticky).") + << QGraphicsItem::ItemStopsFocusHandling << true << 2; +} + +void tst_QGraphicsItem::focusHandling() +{ + QFETCH(QGraphicsItem::GraphicsItemFlag, focusFlag); + QFETCH(bool, useStickyFocus); + QFETCH(int, expectedFocusItem); + class MyItem : public QGraphicsRectItem { public: @@ -10549,12 +10581,9 @@ void tst_QGraphicsItem::stopClickFocusPropagation() } }; - QGraphicsScene scene(-50, -50, 400, 400); - scene.setStickyFocus(true); - QGraphicsRectItem *noFocusOnTop = new MyItem; + noFocusOnTop->setFlag(QGraphicsItem::ItemIsFocusable, false); noFocusOnTop->setBrush(Qt::yellow); - noFocusOnTop->setFlag(QGraphicsItem::ItemStopsClickFocusPropagation); QGraphicsRectItem *focusableUnder = new MyItem; focusableUnder->setBrush(Qt::blue); @@ -10566,9 +10595,13 @@ void tst_QGraphicsItem::stopClickFocusPropagation() itemWithFocus->setFlag(QGraphicsItem::ItemIsFocusable); itemWithFocus->setPos(250, 10); + QGraphicsScene scene(-50, -50, 400, 400); scene.addItem(noFocusOnTop); scene.addItem(focusableUnder); scene.addItem(itemWithFocus); + scene.setStickyFocus(useStickyFocus); + + noFocusOnTop->setFlag(focusFlag); focusableUnder->stackBefore(noFocusOnTop); itemWithFocus->setFocus(); @@ -10580,14 +10613,28 @@ void tst_QGraphicsItem::stopClickFocusPropagation() QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&view)); QVERIFY(itemWithFocus->hasFocus()); - QPointF mousePressPoint = noFocusOnTop->mapToScene(QPointF()); - mousePressPoint.rx() += 60; - mousePressPoint.ry() += 60; + const QPointF mousePressPoint = noFocusOnTop->mapToScene(noFocusOnTop->boundingRect().center()); const QList<QGraphicsItem *> itemsAtMousePressPosition = scene.items(mousePressPoint); - QVERIFY(itemsAtMousePressPosition.contains(focusableUnder)); + QVERIFY(itemsAtMousePressPosition.contains(noFocusOnTop)); sendMousePress(&scene, mousePressPoint); - QVERIFY(itemWithFocus->hasFocus()); + + switch (expectedFocusItem) { + case 0: + QCOMPARE(scene.focusItem(), static_cast<QGraphicsRectItem *>(0)); + break; + case 1: + QCOMPARE(scene.focusItem(), focusableUnder); + break; + case 2: + QCOMPARE(scene.focusItem(), itemWithFocus); + break; + } + + // Sanity check - manually setting the focus must work regardless of our + // focus handling flags: + focusableUnder->setFocus(); + QCOMPARE(scene.focusItem(), focusableUnder); } void tst_QGraphicsItem::deviceCoordinateCache_simpleRotations() -- cgit v0.12 From 451d1c58913404e27b63395996a2e4b9aab65b95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= <morten.sorvig@nokia.com> Date: Fri, 25 Feb 2011 09:28:36 +0100 Subject: Lighthouse: Support Q_NO_CLIPBOARD. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Jørgen Lind --- src/gui/kernel/qplatformclipboard_qpa.cpp | 4 ++++ src/gui/kernel/qplatformclipboard_qpa.h | 3 +++ src/gui/kernel/qplatformintegration_qpa.cpp | 5 +++++ src/gui/kernel/qplatformintegration_qpa.h | 2 ++ 4 files changed, 14 insertions(+) diff --git a/src/gui/kernel/qplatformclipboard_qpa.cpp b/src/gui/kernel/qplatformclipboard_qpa.cpp index fff4e19..8321e94 100644 --- a/src/gui/kernel/qplatformclipboard_qpa.cpp +++ b/src/gui/kernel/qplatformclipboard_qpa.cpp @@ -40,6 +40,8 @@ ****************************************************************************/ #include "qplatformclipboard_qpa.h" +#ifndef QT_NO_CLIPBOARD + QT_BEGIN_NAMESPACE class QClipboardData @@ -99,3 +101,5 @@ bool QPlatformClipboard::supportsMode(QClipboard::Mode mode) const } QT_END_NAMESPACE + +#endif //QT_NO_CLIPBOARD diff --git a/src/gui/kernel/qplatformclipboard_qpa.h b/src/gui/kernel/qplatformclipboard_qpa.h index 3f7bfbb..51371cb 100644 --- a/src/gui/kernel/qplatformclipboard_qpa.h +++ b/src/gui/kernel/qplatformclipboard_qpa.h @@ -44,6 +44,8 @@ #include <qplatformdefs.h> +#ifndef QT_NO_CLIPBOARD + #include <QtGui/QClipboard> QT_BEGIN_HEADER @@ -66,5 +68,6 @@ QT_END_NAMESPACE QT_END_HEADER +#endif // QT_NO_CLIPBOARD #endif //QPLATFORMCLIPBOARD_QPA_H diff --git a/src/gui/kernel/qplatformintegration_qpa.cpp b/src/gui/kernel/qplatformintegration_qpa.cpp index f43e141..06ac40f 100644 --- a/src/gui/kernel/qplatformintegration_qpa.cpp +++ b/src/gui/kernel/qplatformintegration_qpa.cpp @@ -102,6 +102,9 @@ QPlatformFontDatabase *QPlatformIntegration::fontDatabase() const \sa QPlatformClipboard */ + +#ifndef QT_NO_CLIPBOARD + QPlatformClipboard *QPlatformIntegration::clipboard() const { static QPlatformClipboard *clipboard = 0; @@ -111,6 +114,8 @@ QPlatformClipboard *QPlatformIntegration::clipboard() const return clipboard; } +#endif + QPlatformNativeInterface * QPlatformIntegration::nativeInterface() const { return 0; diff --git a/src/gui/kernel/qplatformintegration_qpa.h b/src/gui/kernel/qplatformintegration_qpa.h index 1d69af4..357e4de 100644 --- a/src/gui/kernel/qplatformintegration_qpa.h +++ b/src/gui/kernel/qplatformintegration_qpa.h @@ -86,7 +86,9 @@ public: //Deeper window system integrations virtual QPlatformFontDatabase *fontDatabase() const; +#ifndef QT_NO_CLIPBOARD virtual QPlatformClipboard *clipboard() const; +#endif // Experimental in mainthread eventloop integration // This should only be used if it is only possible to do window system event processing in -- cgit v0.12 From a2ba87d1edfe1008f96a99f24c2c52c521e404e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= <morten.sorvig@nokia.com> Date: Fri, 25 Feb 2011 09:29:22 +0100 Subject: qpnghandler: Compile with QT_NO_IMAGE_TEXT. --- src/gui/image/qpnghandler.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/image/qpnghandler.cpp b/src/gui/image/qpnghandler.cpp index a9aad51..7e0355a 100644 --- a/src/gui/image/qpnghandler.cpp +++ b/src/gui/image/qpnghandler.cpp @@ -492,8 +492,10 @@ bool Q_INTERNAL_WIN_NO_THROW QPngHandlerPrivate::readPngImage(QImage *outImage) outImage->setDotsPerMeterX(png_get_x_pixels_per_meter(png_ptr,info_ptr)); outImage->setDotsPerMeterY(png_get_y_pixels_per_meter(png_ptr,info_ptr)); +#ifndef QT_NO_IMAGE_TEXT for (int i = 0; i < readTexts.size()-1; i+=2) outImage->setText(readTexts.at(i), readTexts.at(i+1)); +#endif state = ReadingEnd; png_read_end(png_ptr, end_info); -- cgit v0.12 From 294ce2967d3e205c920965464642847ce014ab67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= <morten.sorvig@nokia.com> Date: Fri, 25 Feb 2011 09:43:04 +0100 Subject: posix platformdefs: Add QT_NO_SOCKET_H. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Prevents including <sys/socket.h> Reviewed-by: Jørgen Lind --- mkspecs/common/posix/qplatformdefs.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mkspecs/common/posix/qplatformdefs.h b/mkspecs/common/posix/qplatformdefs.h index 103ce89..60bc041 100644 --- a/mkspecs/common/posix/qplatformdefs.h +++ b/mkspecs/common/posix/qplatformdefs.h @@ -45,7 +45,9 @@ #include <signal.h> #include <sys/types.h> -#include <sys/socket.h> +#ifndef QT_NO_SOCKET_H +# include <sys/socket.h> +#endif #include <sys/stat.h> #if defined(QT_USE_XOPEN_LFS_EXTENSIONS) && defined(QT_LARGEFILE_SUPPORT) -- cgit v0.12 From fa5731a3591034723df192d869cd9ff7c1b52428 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= <morten.sorvig@nokia.com> Date: Fri, 25 Feb 2011 09:44:25 +0100 Subject: NaCl: disable libtiff. (libtiff doesn't compile) --- configure | 1 + 1 file changed, 1 insertion(+) diff --git a/configure b/configure index 1922728..070447b 100755 --- a/configure +++ b/configure @@ -983,6 +983,7 @@ if [ "$CFG_EMBEDDED" = "nacl" ]; then CFG_SCRIPT=no CFG_SQLITE=no CFG_SQL_sqlite=no + CFG_LIBTIFF=no CFG_NOBUILD_PARTS="$CFG_NOBUILD_PARTS tests" QT_CONFIG="$QT_CONFIG nacl" fi -- cgit v0.12 From 3ed39aceda261d7c6b247d39cafff5931b168e07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= <morten.sorvig@nokia.com> Date: Fri, 25 Feb 2011 09:45:35 +0100 Subject: NaCl: Dont force release builds. --- configure | 2 -- 1 file changed, 2 deletions(-) diff --git a/configure b/configure index 070447b..ffc93d8 100755 --- a/configure +++ b/configure @@ -960,8 +960,6 @@ if [ "$CFG_EMBEDDED" = "nacl" ]; then PLATFORM_QPA=yes echo "-fast" OPT_FAST=yes - echo "-release" - CFG_DEBUG=no echo "-qconfig minimal-system-dependencies" CFG_QCONFIG=minimal-system-dependencies -- cgit v0.12 From 5ba2675a33922cdd4ccef7de968e77b05bc1d556 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= <morten.sorvig@nokia.com> Date: Fri, 25 Feb 2011 09:53:43 +0100 Subject: Compile. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Respect the system-zlib QT_CONFIG setting. Reviewed-by: Jørgen Lind --- src/plugins/platforms/fontdatabases/basicunix/basicunix.pri | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/fontdatabases/basicunix/basicunix.pri b/src/plugins/platforms/fontdatabases/basicunix/basicunix.pri index 21aedba..da4698d 100644 --- a/src/plugins/platforms/fontdatabases/basicunix/basicunix.pri +++ b/src/plugins/platforms/fontdatabases/basicunix/basicunix.pri @@ -73,7 +73,11 @@ contains(QT_CONFIG, freetype) { $$QT_SOURCE_TREE/src/3rdparty/freetype/src \ $$QT_SOURCE_TREE/src/3rdparty/freetype/include - DEFINES += FT2_BUILD_LIBRARY FT_CONFIG_OPTION_SYSTEM_ZLIB + DEFINES += FT2_BUILD_LIBRARY + contains(QT_CONFIG, system-zlib) { + DEFINES += FT_CONFIG_OPTION_SYSTEM_ZLIB + } + } else:contains(QT_CONFIG, system-freetype) { # pull in the proper freetype2 include directory include($$QT_SOURCE_TREE/config.tests/unix/freetype/freetype.pri) -- cgit v0.12 From 468142db15fe99c70505f507f6c2941706172853 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= <morten.sorvig@nokia.com> Date: Fri, 25 Feb 2011 11:03:19 +0100 Subject: Add QT_NO_DYNAMIC_LIBRARY. Set it for nacl, replace the Q_OS defines vxworks already has in place. Motivation: Support static plugins on platforms that does not support dynamic plugins. Static plugin support is implemented in QPluginLoader, which has a QLibraryPrivate d pointer. The easiest way to untangle this seems to be to compile in QLibrary and then disable the ports of it that uses dlopen. Reviewed-By: Harald Fernengel --- src/corelib/plugin/qlibrary_unix.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/corelib/plugin/qlibrary_unix.cpp b/src/corelib/plugin/qlibrary_unix.cpp index 466350e..e32729a 100644 --- a/src/corelib/plugin/qlibrary_unix.cpp +++ b/src/corelib/plugin/qlibrary_unix.cpp @@ -56,9 +56,13 @@ #include <string.h> #endif +#if defined(Q_OS_VXWORKS) || defined (Q_OS_NACL) +#define QT_NO_DYNAMIC_LIBRARY +#endif + QT_BEGIN_NAMESPACE -#if !defined(QT_HPUX_LD) && !defined(Q_OS_VXWORKS) +#if !defined(QT_HPUX_LD) && !defined(QT_NO_DYNAMIC_LIBRARY) QT_BEGIN_INCLUDE_NAMESPACE #include <dlfcn.h> QT_END_INCLUDE_NAMESPACE @@ -66,8 +70,8 @@ QT_END_INCLUDE_NAMESPACE static QString qdlerror() { -#if defined(Q_OS_VXWORKS) - const char *err = "VxWorks does not support dynamic libraries."; +#if defined(QT_NO_DYNAMIC_LIBRARY) + const char *err = "This platform does not support dynamic libraries."; #elif !defined(QT_HPUX_LD) const char *err = dlerror(); #else @@ -79,7 +83,7 @@ static QString qdlerror() bool QLibraryPrivate::load_sys() { QString attempt; -#if !defined(Q_OS_VXWORKS) +#if !defined(QT_NO_DYNAMIC_LIBRARY) QFileInfo fi(fileName); #if defined(Q_OS_SYMBIAN) @@ -235,7 +239,7 @@ bool QLibraryPrivate::load_sys() } } #endif -#endif // Q_OS_VXWORKS +#endif // QT_NO_DYNAMIC_LIBRARY if (!pHnd) { errorString = QLibrary::tr("Cannot load library %1: %2").arg(fileName).arg(qdlerror()); } @@ -248,7 +252,7 @@ bool QLibraryPrivate::load_sys() bool QLibraryPrivate::unload_sys() { -#if !defined(Q_OS_VXWORKS) +#if !defined(QT_NO_DYNAMIC_LIBRARY) # if defined(QT_HPUX_LD) if (shl_unload((shl_t)pHnd)) { # else @@ -282,7 +286,7 @@ void* QLibraryPrivate::resolve_sys(const char* symbol) void* address = 0; if (shl_findsym((shl_t*)&pHnd, symbol, TYPE_UNDEFINED, &address) < 0) address = 0; -#elif defined(Q_OS_VXWORKS) +#elif defined (QT_NO_DYNAMIC_LIBRARY) void *address = 0; #else void* address = dlsym(pHnd, symbol); -- cgit v0.12 From f0fc5b8a9ab3f4bca0022771e576722d63a78ca2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= <morten.sorvig@nokia.com> Date: Fri, 25 Feb 2011 11:22:00 +0100 Subject: Add QT_NO_FILESYSTEMITERATOR. This makes it possible to use the file-related classes on platforms that does not have a native QFileSystemIterator implementation. One use case is that we want to use the Qt resource system even if the platform file system support is limited. Reviewed-by: joao --- src/corelib/global/qfeatures.h | 3 +++ src/corelib/global/qfeatures.txt | 8 ++++++++ src/corelib/io/qdiriterator.cpp | 10 ++++++++++ src/corelib/io/qfilesystemiterator_p.h | 5 +++++ src/corelib/io/qfilesystemiterator_unix.cpp | 4 ++++ 5 files changed, 30 insertions(+) diff --git a/src/corelib/global/qfeatures.h b/src/corelib/global/qfeatures.h index d1a73a6..604d08a 100644 --- a/src/corelib/global/qfeatures.h +++ b/src/corelib/global/qfeatures.h @@ -79,6 +79,9 @@ // Effects //#define QT_NO_EFFECTS +// QFileSystemIterator +//#define QT_NO_FILESYSTEMITERATOR + // QFileSystemWatcher //#define QT_NO_FILESYSTEMWATCHER diff --git a/src/corelib/global/qfeatures.txt b/src/corelib/global/qfeatures.txt index 4d938a9..6b861d4 100644 --- a/src/corelib/global/qfeatures.txt +++ b/src/corelib/global/qfeatures.txt @@ -242,6 +242,14 @@ Requires: Name: QFileSystemWatcher SeeAlso: ??? +Feature: FILESYSTEMITERATOR +Description: Provides fast file-system iteration. +for modications. +Section: File I/O +Requires: +Name: QFileSystemIterator +SeeAlso: ??? + # Widgets Feature: TREEWIDGET diff --git a/src/corelib/io/qdiriterator.cpp b/src/corelib/io/qdiriterator.cpp index d293791..c7e56bd 100644 --- a/src/corelib/io/qdiriterator.cpp +++ b/src/corelib/io/qdiriterator.cpp @@ -142,7 +142,9 @@ public: #endif QDirIteratorPrivateIteratorStack<QAbstractFileEngineIterator> fileEngineIterators; +#ifndef QT_NO_FILESYSTEMITERATOR QDirIteratorPrivateIteratorStack<QFileSystemIterator> nativeIterators; +#endif QFileInfo currentFileInfo; QFileInfo nextFileInfo; @@ -204,9 +206,11 @@ void QDirIteratorPrivate::pushDirectory(const QFileInfo &fileInfo) // No iterator; no entry list. } } else { +#ifndef QT_NO_FILESYSTEMITERATOR QFileSystemIterator *it = new QFileSystemIterator(fileInfo.d_ptr->fileEntry, filters, nameFilters, iteratorFlags); nativeIterators << it; +#endif } } @@ -244,6 +248,7 @@ void QDirIteratorPrivate::advance() delete it; } } else { +#ifndef QT_NO_FILESYSTEMITERATOR QFileSystemEntry nextEntry; QFileSystemMetaData nextMetaData; @@ -260,6 +265,7 @@ void QDirIteratorPrivate::advance() nativeIterators.pop(); delete it; } +#endif } currentFileInfo = nextFileInfo; @@ -500,7 +506,11 @@ bool QDirIterator::hasNext() const if (d->engine) return !d->fileEngineIterators.isEmpty(); else +#ifndef QT_NO_FILESYSTEMITERATOR return !d->nativeIterators.isEmpty(); +#else + return false; +#endif } /*! diff --git a/src/corelib/io/qfilesystemiterator_p.h b/src/corelib/io/qfilesystemiterator_p.h index 66f4b1e..3477242 100644 --- a/src/corelib/io/qfilesystemiterator_p.h +++ b/src/corelib/io/qfilesystemiterator_p.h @@ -54,6 +54,9 @@ // #include <QtCore/qglobal.h> + +#ifndef QT_NO_FILESYSTEMITERATOR + #include <QtCore/qdir.h> #include <QtCore/qdiriterator.h> #include <QtCore/qstringlist.h> @@ -112,4 +115,6 @@ private: QT_END_NAMESPACE +#endif // QT_NO_FILESYSTEMITERATOR + #endif // include guard diff --git a/src/corelib/io/qfilesystemiterator_unix.cpp b/src/corelib/io/qfilesystemiterator_unix.cpp index 00ccd41..7c5fc29 100644 --- a/src/corelib/io/qfilesystemiterator_unix.cpp +++ b/src/corelib/io/qfilesystemiterator_unix.cpp @@ -42,6 +42,8 @@ #include "qplatformdefs.h" #include "qfilesystemiterator_p.h" +#ifndef QT_NO_FILESYSTEMITERATOR + #include <stdlib.h> #include <errno.h> @@ -111,3 +113,5 @@ bool QFileSystemIterator::advance(QFileSystemEntry &fileEntry, QFileSystemMetaDa } QT_END_NAMESPACE + +#endif // QT_NO_FILESYSTEMITERATOR -- cgit v0.12 From 8ec40d6de585315e0a4bd4f533a9113e836c8436 Mon Sep 17 00:00:00 2001 From: Morten Sorvig <msorvig@trolltech.com> Date: Wed, 16 Mar 2011 12:13:20 +0100 Subject: Rename qconfig-minimal-system-depenencies.h Rename to qconfig.nacl.h. This reflects that the config now enables all dependencies NaCl can support, not necessarily the minimal set. --- configure | 4 +- .../global/qconfig-minimal-system-dependencies.h | 371 --------------------- src/corelib/global/qconfig-nacl.h | 371 +++++++++++++++++++++ 3 files changed, 373 insertions(+), 373 deletions(-) delete mode 100644 src/corelib/global/qconfig-minimal-system-dependencies.h create mode 100644 src/corelib/global/qconfig-nacl.h diff --git a/configure b/configure index ffc93d8..2ea3689 100755 --- a/configure +++ b/configure @@ -960,8 +960,8 @@ if [ "$CFG_EMBEDDED" = "nacl" ]; then PLATFORM_QPA=yes echo "-fast" OPT_FAST=yes - echo "-qconfig minimal-system-dependencies" - CFG_QCONFIG=minimal-system-dependencies + echo "-qconfig nacl" + CFG_QCONFIG=nacl if [ `uname` = "Linux" ]; then I_FLAGS="$I_FLAGS -I${CFG_NACL_PATH}/toolchain/linux_x86/sdk/nacl-sdk/include" diff --git a/src/corelib/global/qconfig-minimal-system-dependencies.h b/src/corelib/global/qconfig-minimal-system-dependencies.h deleted file mode 100644 index 63319b9..0000000 --- a/src/corelib/global/qconfig-minimal-system-dependencies.h +++ /dev/null @@ -1,371 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtCore module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#define QT_FONTS_ARE_RESOURCES - -/* Data structures */ -#ifndef QT_NO_QUUID_STRING -# define QT_NO_QUUID_STRING -#endif -#ifndef QT_NO_STL -# define QT_NO_STL -#endif -#ifndef QT_NO_TEXTDATE -# define QT_NO_TEXTDATE -#endif -#ifndef QT_NO_DATESTRING -# define QT_NO_DATESTRING -#endif - -/* Dialogs */ -#ifndef QT_NO_FILEDIALOG -# define QT_NO_FILEDIALOG -#endif -#ifndef QT_NO_PRINTDIALOG -# define QT_NO_PRINTDIALOG -#endif -#ifndef QT_NO_PRINTPREVIEWDIALOG -# define QT_NO_PRINTPREVIEWDIALOG -#endif - - -/* File I/O */ -#ifndef QT_NO_DOM -# define QT_NO_DOM -#endif -#ifndef QT_NO_FILESYSTEMWATCHER -# define QT_NO_FILESYSTEMWATCHER -#endif -#ifndef QT_NO_FSFILEENGINE -# define QT_NO_FSFILEENGINE -#endif -#ifndef QT_NO_FILESYSTEMMODEL -# define QT_NO_FILESYSTEMMODEL -#endif -#ifndef QT_NO_FILESYSTEMMODEL -# define QT_NO_FILESYSTEMMODEL -#endif -#ifndef QT_NO_PROCESS -# define QT_NO_PROCESS -#endif -#ifndef QT_NO_TEMPORARYFILE -# define QT_NO_TEMPORARYFILE -#endif -#ifndef QT_NO_SETTINGS -# define QT_NO_SETTINGS -#endif -#ifndef QT_NO_LIBRARY -# define QT_NO_LIBRARY -#endif - -/* Fonts */ -#ifndef QT_NO_QWS_QPF2 -# define QT_NO_QWS_QPF2 -#endif - -/* Images */ -#ifndef QT_NO_IMAGEFORMATPLUGIN -# define QT_NO_IMAGEFORMATPLUGIN -#endif -#ifndef QT_NO_IMAGE_HEURISTIC_MASK -# define QT_NO_IMAGE_HEURISTIC_MASK -#endif -#ifndef QT_NO_IMAGE_TEXT -# define QT_NO_IMAGE_TEXT -#endif -#ifndef QT_NO_MOVIE -# define QT_NO_MOVIE -#endif - -/* Internationalization */ -#ifndef QT_NO_BIG_CODECS -# define QT_NO_BIG_CODECS -#endif -#ifndef QT_NO_QWS_INPUTMETHODS -# define QT_NO_QWS_INPUTMETHODS -#endif -#ifndef QT_NO_TEXTCODEC -# define QT_NO_TEXTCODEC -#endif -#ifndef QT_NO_CODECS -# define QT_NO_CODECS -#endif -#ifndef QT_NO_TEXTCODECPLUGIN -# define QT_NO_TEXTCODECPLUGIN -#endif -#ifndef QT_NO_TRANSLATION -# define QT_NO_TRANSLATION -#endif -#ifndef QT_NO_TRANSLATION_UTF8 -# define QT_NO_TRANSLATION_UTF8 -#endif - -/* ItemViews */ - -#ifndef QT_NO_DIRMODEL -# define QT_NO_DIRMODEL -#endif - -/* Kernel */ -#ifndef QT_NO_CLIPBOARD -# define QT_NO_CLIPBOARD -#endif -#ifndef QT_NO_CSSPARSER -# define QT_NO_CSSPARSER -#endif -#ifndef QT_NO_CURSOR -# define QT_NO_CURSOR -#endif -#ifndef QT_NO_DRAGANDDROP -# define QT_NO_DRAGANDDROP -#endif -#ifndef QT_NO_EFFECTS -# define QT_NO_EFFECTS -#endif -#ifndef QT_NO_SESSIONMANAGER -# define QT_NO_SESSIONMANAGER -#endif -#ifndef QT_NO_SHAREDMEMORY -# define QT_NO_SHAREDMEMORY -#endif -#ifndef QT_NO_SOUND -# define QT_NO_SOUND -#endif -#ifndef QT_NO_SYSTEMLOCALE -# define QT_NO_SYSTEMSEMAPHORE -#endif -#ifndef QT_NO_SYSTEMSEMAPHORE -# define QT_NO_SYSTEMSEMAPHORE -#endif -#ifndef QT_NO_TABLETEVENT -# define QT_NO_TABLETEVENT -#endif -#ifndef QT_NO_CRASHHANDLER -# define QT_NO_CRASHHANDLER -#endif -#ifndef QT_NO_CONCURRENT -# define QT_NO_CONCURRENT -#endif -#ifndef QT_NO_XMLSTREAM -# define QT_NO_XMLSTREAM -#endif -#ifndef QT_NO_XMLSTREAMREADER -# define QT_NO_XMLSTREAMREADER -#endif -#ifndef QT_NO_XMLSTREAMWRITER -# define QT_NO_XMLSTREAMWRITER -#endif - -/* Networking */ -#ifndef QT_NO_COP -# define QT_NO_COP -#endif -#ifndef QT_NO_HOSTINFO -# define QT_NO_HOSTINFO -#endif -#ifndef QT_NO_HTTP -# define QT_NO_HTTP -#endif -#ifndef QT_NO_NETWORKPROXY -# define QT_NO_NETWORKPROXY -#endif -#ifndef QT_NO_SOCKS5 -# define QT_NO_SOCKS5 -#endif -#ifndef QT_NO_UDPSOCKET -# define QT_NO_UDPSOCKET -#endif -#ifndef QT_NO_URLINFO -# define QT_NO_URLINFO -#endif -#ifndef QT_NO_FTP -# define QT_NO_FTP -#endif - -/* Painting */ -#ifndef QT_NO_COLORNAMES -# define QT_NO_COLORNAMES -#endif -#ifndef QT_NO_DIRECTPAINTER -# define QT_NO_DIRECTPAINTER -#endif -#ifndef QT_NO_PAINTONSCREEN -# define QT_NO_PAINTONSCREEN -#endif -#ifndef QT_NO_PAINT_DEBUG -# define QT_NO_PAINT_DEBUG -#endif -#ifndef QT_NO_PICTURE -# define QT_NO_PICTURE -#endif -#ifndef QT_NO_PRINTER -# define QT_NO_PRINTER -#endif -#ifndef QT_NO_CUPS -# define QT_NO_CUPS -#endif - -/* Qt for Embedded Linux */ -#ifndef QT_NO_QWSEMBEDWIDGET -# define QT_NO_QWSEMBEDWIDGET -#endif -#ifndef QT_NO_QWS_ALPHA_CURSOR -# define QT_NO_QWS_ALPHA_CURSOR -#endif -#ifndef QT_NO_QWS_CURSOR -# define QT_NO_QWS_CURSOR -#endif -#ifndef QT_NO_QWS_DECORATION_DEFAULT -# define QT_NO_QWS_DECORATION_DEFAULT -#endif -#ifndef QT_NO_QWS_DECORATION_STYLED -# define QT_NO_QWS_DECORATION_STYLED -#endif -#ifndef QT_NO_QWS_DECORATION_WINDOWS -# define QT_NO_QWS_DECORATION_WINDOWS -#endif -#ifndef QT_NO_QWS_MANAGER -# define QT_NO_QWS_MANAGER -#endif -#ifndef QT_NO_QWS_KEYBOARD -# define QT_NO_QWS_KEYBOARD -#endif -#ifndef QT_NO_QWS_MOUSE -# define QT_NO_QWS_MOUSE -#endif -#ifndef QT_NO_QWS_MOUSE_AUTO -# define QT_NO_QWS_MOUSE_AUTO -#endif -#ifndef QT_NO_QWS_MOUSE_MANUAL -# define QT_NO_QWS_MOUSE_MANUAL -#endif -#ifndef QT_NO_QWS_MULTIPROCESS -# define QT_NO_QWS_MULTIPROCESS -#endif -#ifndef QT_NO_QWS_SOUNDSERVER -# define QT_NO_QWS_SOUNDSERVER -#endif -#ifndef QT_NO_SXE -# define QT_NO_SXE -#endif -#ifndef QT_NO_QWS_PROPERTIES -# define QT_NO_QWS_PROPERTIES -#endif -#ifndef QT_NO_QWS_PROXYSCREEN -# define QT_NO_QWS_PROXYSCREEN -#endif -#ifndef QT_NO_QWS_DYNAMICSCREENTRANSFORMATION -# define QT_NO_QWS_DYNAMICSCREENTRANSFORMATION -#endif -#ifndef QT_NO_QWS_LINUXFB -# define QT_NO_QWS_LINUXFB -#endif -#ifndef QT_NO_QWS_MOUSE_PC -# define QT_NO_QWS_MOUSE_PC -#endif -#ifndef QT_NO_QWS_MOUSE_LINUXTP -# define QT_NO_QWS_MOUSE_LINUXTP -#endif -#ifndef QT_NO_QWS_QPF -# define QT_NO_QWS_QPF -#endif - -/* SVG */ -#ifndef QT_NO_SVG -# define QT_NO_SVG -#endif -#ifndef QT_NO_GRAPHICSSVGITEM -# define QT_NO_GRAPHICSSVGITEM -#endif -#ifndef QT_NO_SVGGENERATOR -# define QT_NO_SVGGENERATOR -#endif -#ifndef QT_NO_SVGRENDERER -# define QT_NO_SVGRENDERER -#endif -#ifndef QT_NO_SVGWIDGET -# define QT_NO_SVGWIDGET -#endif - -/* Styles */ -#ifndef QT_NO_STYLE_MOTIF -# define QT_NO_STYLE_MOTIF -#endif -#ifndef QT_NO_STYLE_CDE -# define QT_NO_STYLE_CDE -#endif -#ifndef QT_NO_STYLE_STYLESHEET -# define QT_NO_STYLE_STYLESHEET -#endif -#ifndef QT_NO_STYLE_WINDOWSCE -# define QT_NO_STYLE_WINDOWSCE -#endif -#ifndef QT_NO_STYLE_WINDOWSMOBILE -# define QT_NO_STYLE_WINDOWSMOBILE -#endif -#ifndef QT_NO_STYLE_WINDOWSVISTA -# define QT_NO_STYLE_WINDOWSVISTA -#endif -#ifndef QT_NO_STYLE_WINDOWSXP -# define QT_NO_STYLE_WINDOWSXP -#endif - -/* Utilities */ -#ifndef QT_NO_ACCESSIBILITY -# define QT_NO_ACCESSIBILITY -#endif -#ifndef QT_NO_COMPLETER -# define QT_NO_COMPLETER -#endif -#ifndef QT_NO_DESKTOPSERVICES -# define QT_NO_DESKTOPSERVICES -#endif -#ifndef QT_NO_SCRIPT -# define QT_NO_SCRIPT -#endif -#ifndef QT_NO_SYSTEMTRAYICON -# define QT_NO_SYSTEMTRAYICON -#endif - -/* Windows */ -#ifndef QT_NO_WIN_ACTIVEQT -# define QT_NO_WIN_ACTIVEQT -#endif diff --git a/src/corelib/global/qconfig-nacl.h b/src/corelib/global/qconfig-nacl.h new file mode 100644 index 0000000..63319b9 --- /dev/null +++ b/src/corelib/global/qconfig-nacl.h @@ -0,0 +1,371 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#define QT_FONTS_ARE_RESOURCES + +/* Data structures */ +#ifndef QT_NO_QUUID_STRING +# define QT_NO_QUUID_STRING +#endif +#ifndef QT_NO_STL +# define QT_NO_STL +#endif +#ifndef QT_NO_TEXTDATE +# define QT_NO_TEXTDATE +#endif +#ifndef QT_NO_DATESTRING +# define QT_NO_DATESTRING +#endif + +/* Dialogs */ +#ifndef QT_NO_FILEDIALOG +# define QT_NO_FILEDIALOG +#endif +#ifndef QT_NO_PRINTDIALOG +# define QT_NO_PRINTDIALOG +#endif +#ifndef QT_NO_PRINTPREVIEWDIALOG +# define QT_NO_PRINTPREVIEWDIALOG +#endif + + +/* File I/O */ +#ifndef QT_NO_DOM +# define QT_NO_DOM +#endif +#ifndef QT_NO_FILESYSTEMWATCHER +# define QT_NO_FILESYSTEMWATCHER +#endif +#ifndef QT_NO_FSFILEENGINE +# define QT_NO_FSFILEENGINE +#endif +#ifndef QT_NO_FILESYSTEMMODEL +# define QT_NO_FILESYSTEMMODEL +#endif +#ifndef QT_NO_FILESYSTEMMODEL +# define QT_NO_FILESYSTEMMODEL +#endif +#ifndef QT_NO_PROCESS +# define QT_NO_PROCESS +#endif +#ifndef QT_NO_TEMPORARYFILE +# define QT_NO_TEMPORARYFILE +#endif +#ifndef QT_NO_SETTINGS +# define QT_NO_SETTINGS +#endif +#ifndef QT_NO_LIBRARY +# define QT_NO_LIBRARY +#endif + +/* Fonts */ +#ifndef QT_NO_QWS_QPF2 +# define QT_NO_QWS_QPF2 +#endif + +/* Images */ +#ifndef QT_NO_IMAGEFORMATPLUGIN +# define QT_NO_IMAGEFORMATPLUGIN +#endif +#ifndef QT_NO_IMAGE_HEURISTIC_MASK +# define QT_NO_IMAGE_HEURISTIC_MASK +#endif +#ifndef QT_NO_IMAGE_TEXT +# define QT_NO_IMAGE_TEXT +#endif +#ifndef QT_NO_MOVIE +# define QT_NO_MOVIE +#endif + +/* Internationalization */ +#ifndef QT_NO_BIG_CODECS +# define QT_NO_BIG_CODECS +#endif +#ifndef QT_NO_QWS_INPUTMETHODS +# define QT_NO_QWS_INPUTMETHODS +#endif +#ifndef QT_NO_TEXTCODEC +# define QT_NO_TEXTCODEC +#endif +#ifndef QT_NO_CODECS +# define QT_NO_CODECS +#endif +#ifndef QT_NO_TEXTCODECPLUGIN +# define QT_NO_TEXTCODECPLUGIN +#endif +#ifndef QT_NO_TRANSLATION +# define QT_NO_TRANSLATION +#endif +#ifndef QT_NO_TRANSLATION_UTF8 +# define QT_NO_TRANSLATION_UTF8 +#endif + +/* ItemViews */ + +#ifndef QT_NO_DIRMODEL +# define QT_NO_DIRMODEL +#endif + +/* Kernel */ +#ifndef QT_NO_CLIPBOARD +# define QT_NO_CLIPBOARD +#endif +#ifndef QT_NO_CSSPARSER +# define QT_NO_CSSPARSER +#endif +#ifndef QT_NO_CURSOR +# define QT_NO_CURSOR +#endif +#ifndef QT_NO_DRAGANDDROP +# define QT_NO_DRAGANDDROP +#endif +#ifndef QT_NO_EFFECTS +# define QT_NO_EFFECTS +#endif +#ifndef QT_NO_SESSIONMANAGER +# define QT_NO_SESSIONMANAGER +#endif +#ifndef QT_NO_SHAREDMEMORY +# define QT_NO_SHAREDMEMORY +#endif +#ifndef QT_NO_SOUND +# define QT_NO_SOUND +#endif +#ifndef QT_NO_SYSTEMLOCALE +# define QT_NO_SYSTEMSEMAPHORE +#endif +#ifndef QT_NO_SYSTEMSEMAPHORE +# define QT_NO_SYSTEMSEMAPHORE +#endif +#ifndef QT_NO_TABLETEVENT +# define QT_NO_TABLETEVENT +#endif +#ifndef QT_NO_CRASHHANDLER +# define QT_NO_CRASHHANDLER +#endif +#ifndef QT_NO_CONCURRENT +# define QT_NO_CONCURRENT +#endif +#ifndef QT_NO_XMLSTREAM +# define QT_NO_XMLSTREAM +#endif +#ifndef QT_NO_XMLSTREAMREADER +# define QT_NO_XMLSTREAMREADER +#endif +#ifndef QT_NO_XMLSTREAMWRITER +# define QT_NO_XMLSTREAMWRITER +#endif + +/* Networking */ +#ifndef QT_NO_COP +# define QT_NO_COP +#endif +#ifndef QT_NO_HOSTINFO +# define QT_NO_HOSTINFO +#endif +#ifndef QT_NO_HTTP +# define QT_NO_HTTP +#endif +#ifndef QT_NO_NETWORKPROXY +# define QT_NO_NETWORKPROXY +#endif +#ifndef QT_NO_SOCKS5 +# define QT_NO_SOCKS5 +#endif +#ifndef QT_NO_UDPSOCKET +# define QT_NO_UDPSOCKET +#endif +#ifndef QT_NO_URLINFO +# define QT_NO_URLINFO +#endif +#ifndef QT_NO_FTP +# define QT_NO_FTP +#endif + +/* Painting */ +#ifndef QT_NO_COLORNAMES +# define QT_NO_COLORNAMES +#endif +#ifndef QT_NO_DIRECTPAINTER +# define QT_NO_DIRECTPAINTER +#endif +#ifndef QT_NO_PAINTONSCREEN +# define QT_NO_PAINTONSCREEN +#endif +#ifndef QT_NO_PAINT_DEBUG +# define QT_NO_PAINT_DEBUG +#endif +#ifndef QT_NO_PICTURE +# define QT_NO_PICTURE +#endif +#ifndef QT_NO_PRINTER +# define QT_NO_PRINTER +#endif +#ifndef QT_NO_CUPS +# define QT_NO_CUPS +#endif + +/* Qt for Embedded Linux */ +#ifndef QT_NO_QWSEMBEDWIDGET +# define QT_NO_QWSEMBEDWIDGET +#endif +#ifndef QT_NO_QWS_ALPHA_CURSOR +# define QT_NO_QWS_ALPHA_CURSOR +#endif +#ifndef QT_NO_QWS_CURSOR +# define QT_NO_QWS_CURSOR +#endif +#ifndef QT_NO_QWS_DECORATION_DEFAULT +# define QT_NO_QWS_DECORATION_DEFAULT +#endif +#ifndef QT_NO_QWS_DECORATION_STYLED +# define QT_NO_QWS_DECORATION_STYLED +#endif +#ifndef QT_NO_QWS_DECORATION_WINDOWS +# define QT_NO_QWS_DECORATION_WINDOWS +#endif +#ifndef QT_NO_QWS_MANAGER +# define QT_NO_QWS_MANAGER +#endif +#ifndef QT_NO_QWS_KEYBOARD +# define QT_NO_QWS_KEYBOARD +#endif +#ifndef QT_NO_QWS_MOUSE +# define QT_NO_QWS_MOUSE +#endif +#ifndef QT_NO_QWS_MOUSE_AUTO +# define QT_NO_QWS_MOUSE_AUTO +#endif +#ifndef QT_NO_QWS_MOUSE_MANUAL +# define QT_NO_QWS_MOUSE_MANUAL +#endif +#ifndef QT_NO_QWS_MULTIPROCESS +# define QT_NO_QWS_MULTIPROCESS +#endif +#ifndef QT_NO_QWS_SOUNDSERVER +# define QT_NO_QWS_SOUNDSERVER +#endif +#ifndef QT_NO_SXE +# define QT_NO_SXE +#endif +#ifndef QT_NO_QWS_PROPERTIES +# define QT_NO_QWS_PROPERTIES +#endif +#ifndef QT_NO_QWS_PROXYSCREEN +# define QT_NO_QWS_PROXYSCREEN +#endif +#ifndef QT_NO_QWS_DYNAMICSCREENTRANSFORMATION +# define QT_NO_QWS_DYNAMICSCREENTRANSFORMATION +#endif +#ifndef QT_NO_QWS_LINUXFB +# define QT_NO_QWS_LINUXFB +#endif +#ifndef QT_NO_QWS_MOUSE_PC +# define QT_NO_QWS_MOUSE_PC +#endif +#ifndef QT_NO_QWS_MOUSE_LINUXTP +# define QT_NO_QWS_MOUSE_LINUXTP +#endif +#ifndef QT_NO_QWS_QPF +# define QT_NO_QWS_QPF +#endif + +/* SVG */ +#ifndef QT_NO_SVG +# define QT_NO_SVG +#endif +#ifndef QT_NO_GRAPHICSSVGITEM +# define QT_NO_GRAPHICSSVGITEM +#endif +#ifndef QT_NO_SVGGENERATOR +# define QT_NO_SVGGENERATOR +#endif +#ifndef QT_NO_SVGRENDERER +# define QT_NO_SVGRENDERER +#endif +#ifndef QT_NO_SVGWIDGET +# define QT_NO_SVGWIDGET +#endif + +/* Styles */ +#ifndef QT_NO_STYLE_MOTIF +# define QT_NO_STYLE_MOTIF +#endif +#ifndef QT_NO_STYLE_CDE +# define QT_NO_STYLE_CDE +#endif +#ifndef QT_NO_STYLE_STYLESHEET +# define QT_NO_STYLE_STYLESHEET +#endif +#ifndef QT_NO_STYLE_WINDOWSCE +# define QT_NO_STYLE_WINDOWSCE +#endif +#ifndef QT_NO_STYLE_WINDOWSMOBILE +# define QT_NO_STYLE_WINDOWSMOBILE +#endif +#ifndef QT_NO_STYLE_WINDOWSVISTA +# define QT_NO_STYLE_WINDOWSVISTA +#endif +#ifndef QT_NO_STYLE_WINDOWSXP +# define QT_NO_STYLE_WINDOWSXP +#endif + +/* Utilities */ +#ifndef QT_NO_ACCESSIBILITY +# define QT_NO_ACCESSIBILITY +#endif +#ifndef QT_NO_COMPLETER +# define QT_NO_COMPLETER +#endif +#ifndef QT_NO_DESKTOPSERVICES +# define QT_NO_DESKTOPSERVICES +#endif +#ifndef QT_NO_SCRIPT +# define QT_NO_SCRIPT +#endif +#ifndef QT_NO_SYSTEMTRAYICON +# define QT_NO_SYSTEMTRAYICON +#endif + +/* Windows */ +#ifndef QT_NO_WIN_ACTIVEQT +# define QT_NO_WIN_ACTIVEQT +#endif -- cgit v0.12 From 48629ab39aa4e20b21a359dc251569a98606983d Mon Sep 17 00:00:00 2001 From: Laszlo Agocs <laszlo.p.agocs@nokia.com> Date: Wed, 16 Mar 2011 13:52:28 +0200 Subject: Fix for wrong dpi metrics for raster pixmaps on Symbian. The original implementation relied on SizeInTwips() for the underlying bitmap which unfortunately returns 0, leading to incorrect results from QPixmap::logicalDpiX/Y(). This caused issues in text rendering onto pixmaps (QTBUG-17628). This fix changes QS60PixmapData to use a slightly different metrics() implementation (the one VG and GL PixmapData are using). Task-number: QTBUG-18154 Reviewed-by: Jani Hautakangas --- src/gui/image/qpixmap_s60.cpp | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/src/gui/image/qpixmap_s60.cpp b/src/gui/image/qpixmap_s60.cpp index fbdebf3..32d8dd7 100644 --- a/src/gui/image/qpixmap_s60.cpp +++ b/src/gui/image/qpixmap_s60.cpp @@ -601,6 +601,9 @@ bool QS60PixmapData::scroll(int dx, int dy, const QRect &rect) return res; } +Q_GUI_EXPORT int qt_defaultDpiX(); +Q_GUI_EXPORT int qt_defaultDpiY(); + int QS60PixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const { if (!cfbsBitmap) @@ -611,28 +614,18 @@ int QS60PixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const return cfbsBitmap->SizeInPixels().iWidth; case QPaintDevice::PdmHeight: return cfbsBitmap->SizeInPixels().iHeight; - case QPaintDevice::PdmWidthMM: { - TInt twips = cfbsBitmap->SizeInTwips().iWidth; - return (int)(twips * (25.4/KTwipsPerInch)); - } - case QPaintDevice::PdmHeightMM: { - TInt twips = cfbsBitmap->SizeInTwips().iHeight; - return (int)(twips * (25.4/KTwipsPerInch)); - } + case QPaintDevice::PdmWidthMM: + return qRound(cfbsBitmap->SizeInPixels().iWidth * 25.4 / qt_defaultDpiX()); + case QPaintDevice::PdmHeightMM: + return qRound(cfbsBitmap->SizeInPixels().iHeight * 25.4 / qt_defaultDpiY()); case QPaintDevice::PdmNumColors: return TDisplayModeUtils::NumDisplayModeColors(cfbsBitmap->DisplayMode()); case QPaintDevice::PdmDpiX: - case QPaintDevice::PdmPhysicalDpiX: { - TReal inches = cfbsBitmap->SizeInTwips().iWidth / (TReal)KTwipsPerInch; - TInt pixels = cfbsBitmap->SizeInPixels().iWidth; - return pixels / inches; - } + case QPaintDevice::PdmPhysicalDpiX: + return qt_defaultDpiX(); case QPaintDevice::PdmDpiY: - case QPaintDevice::PdmPhysicalDpiY: { - TReal inches = cfbsBitmap->SizeInTwips().iHeight / (TReal)KTwipsPerInch; - TInt pixels = cfbsBitmap->SizeInPixels().iHeight; - return pixels / inches; - } + case QPaintDevice::PdmPhysicalDpiY: + return qt_defaultDpiY(); case QPaintDevice::PdmDepth: return TDisplayModeUtils::NumDisplayModeBitsPerPixel(cfbsBitmap->DisplayMode()); default: -- cgit v0.12 From 76f84c7a91751b4ddc5d9c4c59b6e5158d7ea998 Mon Sep 17 00:00:00 2001 From: Markus Goetz <Markus.Goetz@nokia.com> Date: Wed, 16 Mar 2011 13:06:08 +0100 Subject: QTcpSocket: Fix for disconnect in Unbuffered mode. We need to set the state properly after we have been disconnected. Also fix the HTTP layer, it needs to handle the disconnect when reading. Reviewed-by: Peter Hartmann --- src/network/access/qhttpnetworkconnectionchannel.cpp | 13 ++++++++----- src/network/socket/qabstractsocket.cpp | 2 ++ 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp index 2076d72..c735801 100644 --- a/src/network/access/qhttpnetworkconnectionchannel.cpp +++ b/src/network/access/qhttpnetworkconnectionchannel.cpp @@ -905,15 +905,18 @@ bool QHttpNetworkConnectionChannel::isSocketReading() const //private slots void QHttpNetworkConnectionChannel::_q_readyRead() { - // We got a readyRead but no bytes are available.. - // This happens for the Unbuffered QTcpSocket - // Also check if socket is in ConnectedState since - // this function may also be invoked via the event loop. if (socket->state() == QAbstractSocket::ConnectedState && socket->bytesAvailable() == 0) { + // We got a readyRead but no bytes are available.. + // This happens for the Unbuffered QTcpSocket + // Also check if socket is in ConnectedState since + // this function may also be invoked via the event loop. char c; qint64 ret = socket->peek(&c, 1); if (ret < 0) { - socket->disconnectFromHost(); + _q_error(socket->error()); + // We still need to handle the reply so it emits its signals etc. + if (reply) + _q_receiveReply(); return; } } diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp index 2a942cc..c7c2e82 100644 --- a/src/network/socket/qabstractsocket.cpp +++ b/src/network/socket/qabstractsocket.cpp @@ -2210,6 +2210,8 @@ qint64 QAbstractSocket::readData(char *data, qint64 maxSize) } else if (readBytes < 0) { d->socketError = d->socketEngine->error(); setErrorString(d->socketEngine->errorString()); + d->resetSocketLayer(); + d->state = QAbstractSocket::UnconnectedState; } else if (!d->socketEngine->isReadNotificationEnabled()) { // Only do this when there was no error d->socketEngine->setReadNotificationEnabled(true); -- cgit v0.12 From eac5573dff483dfefb2deb028850c3ab6f01c555 Mon Sep 17 00:00:00 2001 From: Eckhart Koppen <eckhart.koppen@nokia.com> Date: Wed, 16 Mar 2011 14:39:14 +0200 Subject: Temporarily removed Harmattan specific patches Patches are not applying properly yet, so no use to release them. Reviewed-by: TrustMe --- .../harmattan/patches/default_widget_size.diff | 13 - .../harmattan/patches/glshadercache.diff | 1003 -------------------- config.profiles/harmattan/patches/icu.diff | 732 -------------- .../patches/no_read_pro_from_quilt_dir.diff | 13 - .../patches/pinch_gesture_sent_twice.diff | 56 -- .../harmattan/patches/qgltexturecache.diff | 23 - config.profiles/harmattan/patches/qwidget_x11.diff | 39 - .../harmattan/patches/qwidget_x11_mapping.diff | 17 - .../patches/runtime-window-geometry-revert.diff | 12 - config.profiles/harmattan/patches/series | 14 - .../harmattan/patches/signon_authenticator4.diff | 230 ----- config.profiles/harmattan/patches/temppath.diff | 28 - .../harmattan/patches/tst_qprogressbar.diff | 19 - .../harmattan/patches/tst_qscrollbar.diff | 12 - .../harmattan/patches/tst_qvariant.diff | 21 - 15 files changed, 2232 deletions(-) delete mode 100644 config.profiles/harmattan/patches/default_widget_size.diff delete mode 100644 config.profiles/harmattan/patches/glshadercache.diff delete mode 100644 config.profiles/harmattan/patches/icu.diff delete mode 100644 config.profiles/harmattan/patches/no_read_pro_from_quilt_dir.diff delete mode 100644 config.profiles/harmattan/patches/pinch_gesture_sent_twice.diff delete mode 100644 config.profiles/harmattan/patches/qgltexturecache.diff delete mode 100644 config.profiles/harmattan/patches/qwidget_x11.diff delete mode 100644 config.profiles/harmattan/patches/qwidget_x11_mapping.diff delete mode 100644 config.profiles/harmattan/patches/runtime-window-geometry-revert.diff delete mode 100644 config.profiles/harmattan/patches/series delete mode 100644 config.profiles/harmattan/patches/signon_authenticator4.diff delete mode 100644 config.profiles/harmattan/patches/temppath.diff delete mode 100644 config.profiles/harmattan/patches/tst_qprogressbar.diff delete mode 100644 config.profiles/harmattan/patches/tst_qscrollbar.diff delete mode 100644 config.profiles/harmattan/patches/tst_qvariant.diff diff --git a/config.profiles/harmattan/patches/default_widget_size.diff b/config.profiles/harmattan/patches/default_widget_size.diff deleted file mode 100644 index 1f72881..0000000 --- a/config.profiles/harmattan/patches/default_widget_size.diff +++ /dev/null @@ -1,13 +0,0 @@ -Index: qt-maemo-qtp/src/gui/kernel/qwidget.cpp -=================================================================== ---- qt-maemo-qtp.orig/src/gui/kernel/qwidget.cpp -+++ qt-maemo-qtp/src/gui/kernel/qwidget.cpp -@@ -1326,7 +1326,7 @@ - data.crect = parentWidget ? QRect(0,0,100,30) : QRect(0,0,360,640); - } - #else -- data.crect = parentWidget ? QRect(0,0,100,30) : QRect(0,0,640,480); -+ data.crect = parentWidget ? QRect(0,0,100,30) : QRect(0,0,854,480); - #endif - - focus_next = focus_prev = q; diff --git a/config.profiles/harmattan/patches/glshadercache.diff b/config.profiles/harmattan/patches/glshadercache.diff deleted file mode 100644 index 2c6ad9a..0000000 --- a/config.profiles/harmattan/patches/glshadercache.diff +++ /dev/null @@ -1,1003 +0,0 @@ -Index: qt-maemo-qtp/src/opengl/gl2paintengineex/qglengineshadermanager.cpp -=================================================================== ---- qt-maemo-qtp.orig/src/opengl/gl2paintengineex/qglengineshadermanager.cpp -+++ qt-maemo-qtp/src/opengl/gl2paintengineex/qglengineshadermanager.cpp -@@ -42,12 +42,12 @@ - #include "qglengineshadermanager_p.h" - #include "qglengineshadersource_p.h" - #include "qpaintengineex_opengl2_p.h" -+#include "qglshadercache_p.h" - - #if defined(QT_DEBUG) - #include <QMetaEnum> - #endif - -- - QT_BEGIN_NAMESPACE - - static void qt_shared_shaders_free(void *data) -@@ -165,62 +165,89 @@ - - QGLShader* fragShader; - QGLShader* vertexShader; -- QByteArray source; -+ QByteArray vertexSource; -+ QByteArray fragSource; - - // Compile up the simple shader: -- source.clear(); -- source.append(qShaderSnippets[MainVertexShader]); -- source.append(qShaderSnippets[PositionOnlyVertexShader]); -- vertexShader = new QGLShader(QGLShader::Vertex, context, this); -- if (!vertexShader->compileSourceCode(source)) -- qWarning("Vertex shader for simpleShaderProg (MainVertexShader & PositionOnlyVertexShader) failed to compile"); -- -- source.clear(); -- source.append(qShaderSnippets[MainFragmentShader]); -- source.append(qShaderSnippets[ShockingPinkSrcFragmentShader]); -- fragShader = new QGLShader(QGLShader::Fragment, context, this); -- if (!fragShader->compileSourceCode(source)) -- qWarning("Fragment shader for simpleShaderProg (MainFragmentShader & ShockingPinkSrcFragmentShader) failed to compile"); -+ vertexSource.append(qShaderSnippets[MainVertexShader]); -+ vertexSource.append(qShaderSnippets[PositionOnlyVertexShader]); -+ -+ fragSource.append(qShaderSnippets[MainFragmentShader]); -+ fragSource.append(qShaderSnippets[ShockingPinkSrcFragmentShader]); - - simpleShaderProg = new QGLShaderProgram(context, this); -- simpleShaderProg->addShader(vertexShader); -- simpleShaderProg->addShader(fragShader); -- simpleShaderProg->bindAttributeLocation("vertexCoordsArray", QT_VERTEX_COORDS_ATTR); -- simpleShaderProg->bindAttributeLocation("pmvMatrix1", QT_PMV_MATRIX_1_ATTR); -- simpleShaderProg->bindAttributeLocation("pmvMatrix2", QT_PMV_MATRIX_2_ATTR); -- simpleShaderProg->bindAttributeLocation("pmvMatrix3", QT_PMV_MATRIX_3_ATTR); -+ -+ CachedShader simpleShaderCache(fragSource, vertexSource); -+ -+ bool inCache = simpleShaderCache.load(simpleShaderProg, context); -+ -+ if (!inCache) { -+ vertexShader = new QGLShader(QGLShader::Vertex, context, this); -+ if (!vertexShader->compileSourceCode(vertexSource)) -+ qWarning("Vertex shader for simpleShaderProg (MainVertexShader & PositionOnlyVertexShader) failed to compile"); -+ -+ fragShader = new QGLShader(QGLShader::Fragment, context, this); -+ if (!fragShader->compileSourceCode(fragSource)) -+ qWarning("Fragment shader for simpleShaderProg (MainFragmentShader & ShockingPinkSrcFragmentShader) failed to compile"); -+ -+ simpleShaderProg->addShader(vertexShader); -+ simpleShaderProg->addShader(fragShader); -+ -+ simpleShaderProg->bindAttributeLocation("vertexCoordsArray", QT_VERTEX_COORDS_ATTR); -+ simpleShaderProg->bindAttributeLocation("pmvMatrix1", QT_PMV_MATRIX_1_ATTR); -+ simpleShaderProg->bindAttributeLocation("pmvMatrix2", QT_PMV_MATRIX_2_ATTR); -+ simpleShaderProg->bindAttributeLocation("pmvMatrix3", QT_PMV_MATRIX_3_ATTR); -+ } -+ - simpleShaderProg->link(); -- if (!simpleShaderProg->isLinked()) { -+ -+ if (simpleShaderProg->isLinked()) { -+ if (!inCache) -+ simpleShaderCache.store(simpleShaderProg, context); -+ } else { - qCritical() << "Errors linking simple shader:" - << simpleShaderProg->log(); - } - - // Compile the blit shader: -- source.clear(); -- source.append(qShaderSnippets[MainWithTexCoordsVertexShader]); -- source.append(qShaderSnippets[UntransformedPositionVertexShader]); -- vertexShader = new QGLShader(QGLShader::Vertex, context, this); -- if (!vertexShader->compileSourceCode(source)) -- qWarning("Vertex shader for blitShaderProg (MainWithTexCoordsVertexShader & UntransformedPositionVertexShader) failed to compile"); -- -- source.clear(); -- source.append(qShaderSnippets[MainFragmentShader]); -- source.append(qShaderSnippets[ImageSrcFragmentShader]); -- fragShader = new QGLShader(QGLShader::Fragment, context, this); -- if (!fragShader->compileSourceCode(source)) -- qWarning("Fragment shader for blitShaderProg (MainFragmentShader & ImageSrcFragmentShader) failed to compile"); -+ vertexSource.clear(); -+ vertexSource.append(qShaderSnippets[MainWithTexCoordsVertexShader]); -+ vertexSource.append(qShaderSnippets[UntransformedPositionVertexShader]); -+ -+ fragSource.clear(); -+ fragSource.append(qShaderSnippets[MainFragmentShader]); -+ fragSource.append(qShaderSnippets[ImageSrcFragmentShader]); - - blitShaderProg = new QGLShaderProgram(context, this); -- blitShaderProg->addShader(vertexShader); -- blitShaderProg->addShader(fragShader); -- blitShaderProg->bindAttributeLocation("textureCoordArray", QT_TEXTURE_COORDS_ATTR); -- blitShaderProg->bindAttributeLocation("vertexCoordsArray", QT_VERTEX_COORDS_ATTR); -+ -+ CachedShader blitShaderCache(fragSource, vertexSource); -+ -+ inCache = blitShaderCache.load(blitShaderProg, context); -+ -+ if (!inCache) { -+ vertexShader = new QGLShader(QGLShader::Vertex, context, this); -+ if (!vertexShader->compileSourceCode(vertexSource)) -+ qWarning("Vertex shader for blitShaderProg (MainWithTexCoordsVertexShader & UntransformedPositionVertexShader) failed to compile"); -+ -+ fragShader = new QGLShader(QGLShader::Fragment, context, this); -+ if (!fragShader->compileSourceCode(fragSource)) -+ qWarning("Fragment shader for blitShaderProg (MainFragmentShader & ImageSrcFragmentShader) failed to compile"); -+ -+ blitShaderProg->addShader(vertexShader); -+ blitShaderProg->addShader(fragShader); -+ -+ blitShaderProg->bindAttributeLocation("textureCoordArray", QT_TEXTURE_COORDS_ATTR); -+ blitShaderProg->bindAttributeLocation("vertexCoordsArray", QT_VERTEX_COORDS_ATTR); -+ } -+ - blitShaderProg->link(); -- if (!blitShaderProg->isLinked()) { -+ if (blitShaderProg->isLinked()) { -+ if (!inCache) -+ blitShaderCache.store(blitShaderProg, context); -+ } else { - qCritical() << "Errors linking blit shader:" -- << simpleShaderProg->log(); -+ << blitShaderProg->log(); - } -- - } - - QGLEngineSharedShaders::~QGLEngineSharedShaders() -@@ -262,99 +289,108 @@ - } - } - -- QGLShader *vertexShader = 0; -- QGLShader *fragShader = 0; -- QGLEngineShaderProg *newProg = 0; -- bool success = false; -+ QScopedPointer<QGLEngineShaderProg> newProg; - - do { -- QByteArray source; -+ QByteArray fragSource; - // Insert the custom stage before the srcPixel shader to work around an ATI driver bug - // where you cannot forward declare a function that takes a sampler as argument. - if (prog.srcPixelFragShader == CustomImageSrcFragmentShader) -- source.append(prog.customStageSource); -- source.append(qShaderSnippets[prog.mainFragShader]); -- source.append(qShaderSnippets[prog.srcPixelFragShader]); -+ fragSource.append(prog.customStageSource); -+ fragSource.append(qShaderSnippets[prog.mainFragShader]); -+ fragSource.append(qShaderSnippets[prog.srcPixelFragShader]); - if (prog.compositionFragShader) -- source.append(qShaderSnippets[prog.compositionFragShader]); -+ fragSource.append(qShaderSnippets[prog.compositionFragShader]); - if (prog.maskFragShader) -- source.append(qShaderSnippets[prog.maskFragShader]); -- fragShader = new QGLShader(QGLShader::Fragment, ctxGuard.context(), this); -- QByteArray description; -+ fragSource.append(qShaderSnippets[prog.maskFragShader]); -+ -+ QByteArray vertexSource; -+ vertexSource.append(qShaderSnippets[prog.mainVertexShader]); -+ vertexSource.append(qShaderSnippets[prog.positionVertexShader]); -+ -+ QScopedPointer<QGLShaderProgram> shaderProgram(new QGLShaderProgram(ctxGuard.context(), this)); -+ -+ CachedShader shaderCache(fragSource, vertexSource); -+ bool inCache = shaderCache.load(shaderProgram.data(), ctxGuard.context()); -+ -+ if (!inCache) { -+ -+ QScopedPointer<QGLShader> fragShader(new QGLShader(QGLShader::Fragment, ctxGuard.context(), this)); -+ QByteArray description; - #if defined(QT_DEBUG) -- // Name the shader for easier debugging -- description.append("Fragment shader: main="); -- description.append(snippetNameStr(prog.mainFragShader)); -- description.append(", srcPixel="); -- description.append(snippetNameStr(prog.srcPixelFragShader)); -- if (prog.compositionFragShader) { -- description.append(", composition="); -- description.append(snippetNameStr(prog.compositionFragShader)); -- } -- if (prog.maskFragShader) { -- description.append(", mask="); -- description.append(snippetNameStr(prog.maskFragShader)); -- } -- fragShader->setObjectName(QString::fromLatin1(description)); -+ // Name the shader for easier debugging -+ description.append("Fragment shader: main="); -+ description.append(snippetNameStr(prog.mainFragShader)); -+ description.append(", srcPixel="); -+ description.append(snippetNameStr(prog.srcPixelFragShader)); -+ if (prog.compositionFragShader) { -+ description.append(", composition="); -+ description.append(snippetNameStr(prog.compositionFragShader)); -+ } -+ if (prog.maskFragShader) { -+ description.append(", mask="); -+ description.append(snippetNameStr(prog.maskFragShader)); -+ } -+ fragShader->setObjectName(QString::fromLatin1(description)); - #endif -- if (!fragShader->compileSourceCode(source)) { -- qWarning() << "Warning:" << description << "failed to compile!"; -- break; -- } -+ if (!fragShader->compileSourceCode(fragSource)) { -+ qWarning() << "Warning:" << description << "failed to compile!"; -+ break; -+ } - -- source.clear(); -- source.append(qShaderSnippets[prog.mainVertexShader]); -- source.append(qShaderSnippets[prog.positionVertexShader]); -- vertexShader = new QGLShader(QGLShader::Vertex, ctxGuard.context(), this); -+ QScopedPointer<QGLShader> vertexShader(new QGLShader(QGLShader::Vertex, ctxGuard.context(), this)); - #if defined(QT_DEBUG) -- // Name the shader for easier debugging -- description.clear(); -- description.append("Vertex shader: main="); -- description.append(snippetNameStr(prog.mainVertexShader)); -- description.append(", position="); -- description.append(snippetNameStr(prog.positionVertexShader)); -- vertexShader->setObjectName(QString::fromLatin1(description)); -+ // Name the shader for easier debugging -+ description.clear(); -+ description.append("Vertex shader: main="); -+ description.append(snippetNameStr(prog.mainVertexShader)); -+ description.append(", position="); -+ description.append(snippetNameStr(prog.positionVertexShader)); -+ vertexShader->setObjectName(QString::fromLatin1(description)); - #endif -- if (!vertexShader->compileSourceCode(source)) { -- qWarning() << "Warning:" << description << "failed to compile!"; -- break; -- } -+ if (!vertexShader->compileSourceCode(vertexSource)) { -+ qWarning() << "Warning:" << description << "failed to compile!"; -+ break; -+ } - -- newProg = new QGLEngineShaderProg(prog); -+ shaderProgram->addShader(vertexShader.take()); -+ shaderProgram->addShader(fragShader.take()); - -- // If the shader program's not found in the cache, create it now. -- newProg->program = new QGLShaderProgram(ctxGuard.context(), this); -- newProg->program->addShader(vertexShader); -- newProg->program->addShader(fragShader); -- -- // We have to bind the vertex attribute names before the program is linked: -- newProg->program->bindAttributeLocation("vertexCoordsArray", QT_VERTEX_COORDS_ATTR); -- if (newProg->useTextureCoords) -- newProg->program->bindAttributeLocation("textureCoordArray", QT_TEXTURE_COORDS_ATTR); -- if (newProg->useOpacityAttribute) -- newProg->program->bindAttributeLocation("opacityArray", QT_OPACITY_ATTR); -- if (newProg->usePmvMatrixAttribute) { -- newProg->program->bindAttributeLocation("pmvMatrix1", QT_PMV_MATRIX_1_ATTR); -- newProg->program->bindAttributeLocation("pmvMatrix2", QT_PMV_MATRIX_2_ATTR); -- newProg->program->bindAttributeLocation("pmvMatrix3", QT_PMV_MATRIX_3_ATTR); -+ // We have to bind the vertex attribute names before the program is linked: -+ shaderProgram->bindAttributeLocation("vertexCoordsArray", QT_VERTEX_COORDS_ATTR); -+ if (prog.useTextureCoords) -+ shaderProgram->bindAttributeLocation("textureCoordArray", QT_TEXTURE_COORDS_ATTR); -+ if (prog.useOpacityAttribute) -+ shaderProgram->bindAttributeLocation("opacityArray", QT_OPACITY_ATTR); -+ if (prog.usePmvMatrixAttribute) { -+ shaderProgram->bindAttributeLocation("pmvMatrix1", QT_PMV_MATRIX_1_ATTR); -+ shaderProgram->bindAttributeLocation("pmvMatrix2", QT_PMV_MATRIX_2_ATTR); -+ shaderProgram->bindAttributeLocation("pmvMatrix3", QT_PMV_MATRIX_3_ATTR); -+ } - } - -+ newProg.reset(new QGLEngineShaderProg(prog)); -+ newProg->program = shaderProgram.take(); -+ - newProg->program->link(); -- if (!newProg->program->isLinked()) { -+ if (newProg->program->isLinked()) { -+ if (!inCache) -+ shaderCache.store(newProg->program, ctxGuard.context()); -+ } else { - QLatin1String none("none"); - QLatin1String br("\n"); - QString error; -- error = QLatin1String("Shader program failed to link,") -+ error = QLatin1String("Shader program failed to link,"); - #if defined(QT_DEBUG) -- + br -- + QLatin1String(" Shaders Used:") + br -- + QLatin1String(" ") + vertexShader->objectName() + QLatin1String(": ") + br -- + QLatin1String(vertexShader->sourceCode()) + br -- + QLatin1String(" ") + fragShader->objectName() + QLatin1String(": ") + br -- + QLatin1String(fragShader->sourceCode()) + br -+ error += QLatin1String("\n Shaders Used:\n"); -+ for (int i = 0; i < newProg->program->shaders().count(); ++i) { -+ QGLShader *shader = newProg->program->shaders().at(i); -+ error += QLatin1String(" ") + shader->objectName() + QLatin1String(": \n") -+ + QLatin1String(shader->sourceCode()) + br; -+ } - #endif -- + QLatin1String(" Error Log:\n") -- + QLatin1String(" ") + newProg->program->log(); -+ error += QLatin1String(" Error Log:\n") -+ + QLatin1String(" ") + newProg->program->log(); - qWarning() << error; - break; - } -@@ -376,26 +412,10 @@ - } - } - -- cachedPrograms.insert(0, newProg); -- -- success = true; -+ cachedPrograms.insert(0, newProg.data()); - } while (false); - -- // Clean up everything if we weren't successful -- if (!success) { -- if (newProg) { -- delete newProg; // Also deletes the QGLShaderProgram which in turn deletes the QGLShaders -- newProg = 0; -- } -- else { -- if (vertexShader) -- delete vertexShader; -- if (fragShader) -- delete fragShader; -- } -- } -- -- return newProg; -+ return newProg.take(); - } - - void QGLEngineSharedShaders::cleanupCustomStage(QGLCustomShaderStage* stage) -Index: qt-maemo-qtp/src/opengl/gl2paintengineex/qglshadercache_meego_p.h -=================================================================== ---- /dev/null -+++ qt-maemo-qtp/src/opengl/gl2paintengineex/qglshadercache_meego_p.h -@@ -0,0 +1,457 @@ -+/**************************************************************************** -+** -+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -+** All rights reserved. -+** Contact: Nokia Corporation (qt-info@nokia.com) -+** -+** This file is part of the QtOpenGL module of the Qt Toolkit. -+** -+** $QT_BEGIN_LICENSE:LGPL$ -+** No Commercial Usage -+** This file contains pre-release code and may not be distributed. -+** You may use this file in accordance with the terms and conditions -+** contained in the Technology Preview License Agreement accompanying -+** this package. -+** -+** 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, Nokia gives you certain additional -+** rights. These rights are described in the Nokia Qt LGPL Exception -+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -+** -+** If you have questions regarding the use of this file, please contact -+** Nokia at qt-info@nokia.com. -+** -+** -+** -+** -+** -+** -+** -+** -+** $QT_END_LICENSE$ -+** -+****************************************************************************/ -+ -+// -+// W A R N I N G -+// ------------- -+// -+// This file is not part of the Qt API. It exists purely as an -+// implementation detail. This header file may change from version to -+// version without notice, or even be removed. -+// -+// We mean it. -+// -+ -+#ifndef QGLSHADERCACHE_MEEGO_P_H -+#define QGLSHADERCACHE_MEEGO_P_H -+ -+#include <QtCore/qglobal.h> -+ -+#if defined(QT_MEEGO_EXPERIMENTAL_SHADERCACHE) && defined(QT_OPENGL_ES_2) -+ -+#include <QtCore/qcryptographichash.h> -+#include <QtCore/qsharedmemory.h> -+#include <QtCore/qsystemsemaphore.h> -+ -+#ifndef QT_BOOTSTRAPPED -+# include <GLES2/gl2ext.h> -+#endif -+#if defined(QT_DEBUG) || defined(QT_MEEGO_EXPERIMENTAL_SHADERCACHE_TRACE) -+# include <syslog.h> -+#endif -+ -+QT_BEGIN_HEADER -+ -+/* -+ This cache stores internal Qt shader programs in shared memory. -+ -+ This header file is ugly on purpose and can only be included once. It is only to be used -+ for the internal shader cache, not as a generic cache for anyone's shaders. -+ -+ The cache stores either ShaderCacheMaxEntries shader programs or ShaderCacheDataSize kilobytes -+ of shader programs, whatever limit is reached first. -+ -+ The layout of the cache is as outlined in the CachedShaders struct. After some -+ integers, an array of headers is reserved, then comes the space for the actual binaries. -+ -+ Shader Programs are identified by the md5sum of their frag and vertex shader source code. -+ -+ Shader Programs are never removed. The cache never shrinks or re-shuffles. This is done -+ on purpose to ensure minimum amount of locking, no alignment problems and very few write -+ operations. -+ -+ Note: Locking the shader cache could be expensive, because the entire system might hang. -+ That's why the cache is immutable to minimize the time we need to keep it locked. -+ -+ Why is it Meego specific? -+ -+ First, the size is chosen so that it fits to generic meego usage. Second, on Meego, there's -+ always at least one Qt application active (the launcher), so the cache will never be destroyed. -+ Only when the last Qt app exits, the cache dies, which should only be when someone kills the -+ X11 server. And last but not least it was only tested with Meego's SGX driver. -+ -+ There's a small tool in src/opengl/util/meego that dumps the contents of the cache. -+ */ -+ -+// anonymous namespace, prevent exporting of the private symbols -+namespace -+{ -+ -+struct CachedShaderHeader -+{ -+ /* the index in the data[] member of CachedShaders */ -+ int index; -+ /* the size of the binary shader */ -+ GLsizei size; -+ /* the format of the binary shader */ -+ GLenum format; -+ /* the md5sum of the frag+vertex shaders */ -+ char md5Sum[16]; -+}; -+ -+enum -+{ -+ /* The maximum amount of shader programs the cache can hold */ -+ ShaderCacheMaxEntries = 20 -+}; -+ -+typedef CachedShaderHeader CachedShaderHeaders[ShaderCacheMaxEntries]; -+ -+enum -+{ -+ // ShaderCacheDataSize is 20k minus the other data members of CachedShaders -+ ShaderCacheDataSize = 1024 * ShaderCacheMaxEntries - sizeof(CachedShaderHeaders) - 2 * sizeof(int) -+}; -+ -+struct CachedShaders -+{ -+ /* How much space is still available in the cache */ -+ inline int availableSize() const { return ShaderCacheDataSize - dataSize; } -+ -+ /* The current amount of cached shaders */ -+ int shaderCount; -+ -+ /* The current amount (in bytes) of cached data */ -+ int dataSize; -+ -+ /* The headers describing the shaders */ -+ CachedShaderHeaders headers; -+ -+ /* The actual binary data of the shader programs */ -+ char data[ShaderCacheDataSize]; -+}; -+ -+//#define QT_DEBUG_SHADER_CACHE -+#ifdef QT_DEBUG_SHADER_CACHE -+static QDebug shaderCacheDebug() -+{ -+ return QDebug(QtDebugMsg); -+} -+#else -+static inline QNoDebug shaderCacheDebug() { return QNoDebug(); } -+#endif -+ -+class ShaderCacheSharedMemory -+{ -+public: -+ ShaderCacheSharedMemory() -+ : shm(QLatin1String("qt_gles2_shadercache_" QT_VERSION_STR)) -+ { -+ // we need a system semaphore here, since cache creation and initialization must be atomic -+ QSystemSemaphore attachSemaphore(QLatin1String("qt_gles2_shadercache_mutex_" QT_VERSION_STR), 1); -+ -+ if (!attachSemaphore.acquire()) { -+ shaderCacheDebug() << "Unable to require shader cache semaphore:" << attachSemaphore.errorString(); -+ return; -+ } -+ -+ if (shm.attach()) { -+ // success! -+ shaderCacheDebug() << "Attached to shader cache"; -+ } else { -+ -+ // no cache exists - create and initialize it -+ if (shm.create(sizeof(CachedShaders))) { -+ shaderCacheDebug() << "Created new shader cache"; -+ initializeCache(); -+ } else { -+ shaderCacheDebug() << "Unable to create shader cache:" << shm.errorString(); -+ } -+ } -+ -+ attachSemaphore.release(); -+ } -+ -+ inline bool isAttached() const { return shm.isAttached(); } -+ -+ inline bool lock() { return shm.lock(); } -+ inline bool unlock() { return shm.unlock(); } -+ inline void *data() { return shm.data(); } -+ inline QString errorString() { return shm.errorString(); } -+ -+ ~ShaderCacheSharedMemory() -+ { -+ if (!shm.detach()) -+ shaderCacheDebug() << "Unable to detach shader cache" << shm.errorString(); -+ } -+ -+private: -+ void initializeCache() -+ { -+ // no need to lock the shared memory since we're already protected by the -+ // attach system semaphore. -+ -+ void *data = shm.data(); -+ Q_ASSERT(data); -+ -+ memset(data, 0, sizeof(CachedShaders)); -+ } -+ -+ QSharedMemory shm; -+}; -+ -+class ShaderCacheLocker -+{ -+public: -+ inline ShaderCacheLocker(ShaderCacheSharedMemory *cache) -+ : shm(cache->lock() ? cache : (ShaderCacheSharedMemory *)0) -+ { -+ if (!shm) -+ shaderCacheDebug() << "Unable to lock shader cache" << cache->errorString(); -+ } -+ -+ inline bool isLocked() const { return shm; } -+ -+ inline ~ShaderCacheLocker() -+ { -+ if (!shm) -+ return; -+ if (!shm->unlock()) -+ shaderCacheDebug() << "Unable to unlock shader cache" << shm->errorString(); -+ } -+ -+private: -+ ShaderCacheSharedMemory *shm; -+}; -+ -+#ifdef QT_BOOTSTRAPPED -+} // end namespace -+#else -+ -+static void traceCacheOverflow(const char *message) -+{ -+#if defined(QT_DEBUG) || defined (QT_MEEGO_EXPERIMENTAL_SHADERCACHE_TRACE) -+ openlog(qPrintable(QCoreApplication::applicationName()), LOG_PID | LOG_ODELAY, LOG_USER); -+ syslog(LOG_DEBUG, message); -+ closelog(); -+#endif -+ shaderCacheDebug() << message; -+} -+ -+Q_GLOBAL_STATIC(ShaderCacheSharedMemory, shaderCacheSharedMemory) -+ -+/* -+ Finds the index of the shader program identified by md5Sum in the cache. -+ Note: Does NOT lock the cache for reading, the cache must already be locked! -+ -+ Returns -1 when no shader was found. -+ */ -+static int qt_cache_index_unlocked(const QByteArray &md5Sum, CachedShaders *cache) -+{ -+ for (int i = 0; i < cache->shaderCount; ++i) { -+ if (qstrncmp(md5Sum.constData(), cache->headers[i].md5Sum, 16) == 0) { -+ return i; -+ } -+ } -+ return -1; -+} -+ -+/* Returns the index of the shader identified by md5Sum */ -+static int qt_cache_index(const QByteArray &md5Sum) -+{ -+ ShaderCacheSharedMemory *shm = shaderCacheSharedMemory(); -+ if (!shm || !shm->isAttached()) -+ return false; -+ -+ Q_ASSERT(md5Sum.length() == 16); -+ -+ ShaderCacheLocker locker(shm); -+ if (!locker.isLocked()) -+ return false; -+ -+ void *data = shm->data(); -+ Q_ASSERT(data); -+ -+ CachedShaders *cache = reinterpret_cast<CachedShaders *>(data); -+ -+ return qt_cache_index_unlocked(md5Sum, cache); -+} -+ -+/* Loads the cached shader at index \a shaderIndex into \a program -+ * Note: Since the cache is immutable, this operation doesn't lock the shared memory. -+ */ -+static bool qt_cached_shader(QGLShaderProgram *program, const QGLContext *ctx, int shaderIndex) -+{ -+ Q_ASSERT(shaderIndex >= 0 && shaderIndex <= ShaderCacheMaxEntries); -+ Q_ASSERT(program); -+ -+ ShaderCacheSharedMemory *shm = shaderCacheSharedMemory(); -+ if (!shm || !shm->isAttached()) -+ return false; -+ -+ void *data = shm->data(); -+ Q_ASSERT(data); -+ -+ CachedShaders *cache = reinterpret_cast<CachedShaders *>(data); -+ -+ shaderCacheDebug() << "fetching cached shader at index" << shaderIndex -+ << "dataIndex" << cache->headers[shaderIndex].index -+ << "size" << cache->headers[shaderIndex].size -+ << "format" << cache->headers[shaderIndex].format; -+ -+ // call program->programId first, since that resolves the glProgramBinaryOES symbol -+ GLuint programId = program->programId(); -+ glProgramBinaryOES(programId, cache->headers[shaderIndex].format, -+ cache->data + cache->headers[shaderIndex].index, -+ cache->headers[shaderIndex].size); -+ -+ return true; -+} -+ -+/* Stores the shader program in the cache. Returns false if there's an error with the cache, or -+ if the cache is too small to hold the shader. */ -+static bool qt_cache_shader(const QGLShaderProgram *shader, const QGLContext *ctx, const QByteArray &md5Sum) -+{ -+ ShaderCacheSharedMemory *shm = shaderCacheSharedMemory(); -+ if (!shm || !shm->isAttached()) -+ return false; -+ -+ void *data = shm->data(); -+ Q_ASSERT(data); -+ -+ CachedShaders *cache = reinterpret_cast<CachedShaders *>(data); -+ -+ ShaderCacheLocker locker(shm); -+ if (!locker.isLocked()) -+ return false; -+ -+ int cacheIdx = cache->shaderCount; -+ if (cacheIdx >= ShaderCacheMaxEntries) { -+ traceCacheOverflow("Qt OpenGL shader cache index overflow!"); -+ return false; -+ } -+ -+ // now that we have the lock on the shared memory, make sure no one -+ // inserted the shader already while we were unlocked -+ if (qt_cache_index_unlocked(md5Sum, cache) != -1) -+ return true; // already cached -+ -+ shaderCacheDebug() << "Caching shader at index" << cacheIdx; -+ -+ GLint binaryLength = 0; -+ glGetProgramiv(shader->programId(), GL_PROGRAM_BINARY_LENGTH_OES, &binaryLength); -+ -+ if (!binaryLength) { -+ shaderCacheDebug() << "Unable to determine binary shader size!"; -+ return false; -+ } -+ -+ if (binaryLength > cache->availableSize()) { -+ traceCacheOverflow("Qt OpenGL shader cache data overflow!"); -+ return false; -+ } -+ -+ GLsizei size = 0; -+ GLenum format = 0; -+ glGetProgramBinaryOES(shader->programId(), binaryLength, &size, &format, -+ cache->data + cache->dataSize); -+ -+ if (!size) { -+ shaderCacheDebug() << "Unable to get binary shader!"; -+ return false; -+ } -+ -+ cache->headers[cacheIdx].index = cache->dataSize; -+ cache->dataSize += binaryLength; -+ ++cache->shaderCount; -+ cache->headers[cacheIdx].size = binaryLength; -+ cache->headers[cacheIdx].format = format; -+ -+ memcpy(cache->headers[cacheIdx].md5Sum, md5Sum.constData(), 16); -+ -+ shaderCacheDebug() << "cached shader size" << size -+ << "format" << format -+ << "binarySize" << binaryLength -+ << "cache index" << cacheIdx -+ << "data index" << cache->headers[cacheIdx].index; -+ -+ return true; -+} -+ -+} // namespace -+ -+QT_BEGIN_NAMESPACE -+ -+QT_MODULE(OpenGL) -+ -+class CachedShader -+{ -+public: -+ CachedShader(const QByteArray &fragSource, const QByteArray &vertexSource) -+ : cacheIdx(-1) -+ { -+ QCryptographicHash md5Hash(QCryptographicHash::Md5); -+ -+ md5Hash.addData(fragSource); -+ md5Hash.addData(vertexSource); -+ -+ md5Sum = md5Hash.result(); -+ } -+ -+ bool isCached() -+ { -+ return cacheIndex() != -1; -+ } -+ -+ int cacheIndex() -+ { -+ if (cacheIdx != -1) -+ return cacheIdx; -+ cacheIdx = qt_cache_index(md5Sum); -+ return cacheIdx; -+ } -+ -+ bool load(QGLShaderProgram *program, const QGLContext *ctx) -+ { -+ if (cacheIndex() == -1) -+ return false; -+ return qt_cached_shader(program, ctx, cacheIdx); -+ } -+ -+ bool store(QGLShaderProgram *program, const QGLContext *ctx) -+ { -+ return qt_cache_shader(program, ctx, md5Sum); -+ } -+ -+private: -+ QByteArray md5Sum; -+ int cacheIdx; -+}; -+ -+ -+QT_END_NAMESPACE -+ -+#endif -+ -+QT_END_HEADER -+ -+#endif -+#endif -Index: qt-maemo-qtp/src/opengl/gl2paintengineex/qglshadercache_p.h -=================================================================== ---- /dev/null -+++ qt-maemo-qtp/src/opengl/gl2paintengineex/qglshadercache_p.h -@@ -0,0 +1,98 @@ -+/**************************************************************************** -+** -+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -+** All rights reserved. -+** Contact: Nokia Corporation (qt-info@nokia.com) -+** -+** This file is part of the QtOpenGL module of the Qt Toolkit. -+** -+** $QT_BEGIN_LICENSE:LGPL$ -+** No Commercial Usage -+** This file contains pre-release code and may not be distributed. -+** You may use this file in accordance with the terms and conditions -+** contained in the Technology Preview License Agreement accompanying -+** this package. -+** -+** 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, Nokia gives you certain additional -+** rights. These rights are described in the Nokia Qt LGPL Exception -+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -+** -+** If you have questions regarding the use of this file, please contact -+** Nokia at qt-info@nokia.com. -+** -+** -+** -+** -+** -+** -+** -+** -+** $QT_END_LICENSE$ -+** -+****************************************************************************/ -+ -+// -+// W A R N I N G -+// ------------- -+// -+// This file is not part of the Qt API. It exists purely as an -+// implementation detail. This header file may change from version to -+// version without notice, or even be removed. -+// -+// We mean it. -+// -+ -+#ifndef QGLSHADERCACHE_P_H -+#define QGLSHADERCACHE_P_H -+ -+#include <QtCore/qglobal.h> -+ -+#if defined(QT_MEEGO_EXPERIMENTAL_SHADERCACHE) && defined(QT_OPENGL_ES_2) -+# include "qglshadercache_meego_p.h" -+#else -+ -+QT_BEGIN_HEADER -+ -+QT_BEGIN_NAMESPACE -+ -+QT_MODULE(OpenGL) -+ -+class QGLShaderProgram; -+class QGLContext; -+ -+class CachedShader -+{ -+public: -+ inline CachedShader(const QByteArray &, const QByteArray &) -+ {} -+ -+ inline bool isCached() -+ { -+ return false; -+ } -+ -+ inline bool load(QGLShaderProgram *, const QGLContext *) -+ { -+ return false; -+ } -+ -+ inline bool store(QGLShaderProgram *, const QGLContext *) -+ { -+ return false; -+ } -+}; -+ -+QT_END_NAMESPACE -+ -+QT_END_HEADER -+ -+#endif -+#endif -Index: qt-maemo-qtp/src/opengl/opengl.pro -=================================================================== ---- qt-maemo-qtp.orig/src/opengl/opengl.pro -+++ qt-maemo-qtp/src/opengl/opengl.pro -@@ -58,7 +58,9 @@ - gl2paintengineex/qglcustomshaderstage_p.h \ - gl2paintengineex/qtriangulatingstroker_p.h \ - gl2paintengineex/qtriangulator_p.h \ -- gl2paintengineex/qtextureglyphcache_gl_p.h -+ gl2paintengineex/qtextureglyphcache_gl_p.h \ -+ gl2paintengineex/qglshadercache_p.h \ -+ gl2paintengineex/qglshadercache_meego_p.h - - SOURCES += qglshaderprogram.cpp \ - qglpixmapfilter.cpp \ -Index: qt-maemo-qtp/src/opengl/util/meego/main.cpp -=================================================================== ---- /dev/null -+++ qt-maemo-qtp/src/opengl/util/meego/main.cpp -@@ -0,0 +1,48 @@ -+#include <QtCore/qdebug.h> -+ -+#define QT_DEBUG_SHADER_CACHE -+#define QT_MEEGO_EXPERIMENTAL_SHADERCACHE -+#define QT_OPENGL_ES_2 -+#define QT_BOOTSTRAPPED -+ -+typedef int GLsizei; -+typedef unsigned int GLenum; -+ -+#include "../../gl2paintengineex/qglshadercache_meego_p.h" -+ -+#include <stdlib.h> -+#include <stdio.h> -+ -+int main() -+{ -+ ShaderCacheSharedMemory shm; -+ -+ if (!shm.isAttached()) { -+ fprintf(stderr, "Unable to attach to shared memory\n"); -+ return EXIT_FAILURE; -+ } -+ -+ ShaderCacheLocker locker(&shm); -+ if (!locker.isLocked()) { -+ fprintf(stderr, "Unable to lock shared memory\n"); -+ return EXIT_FAILURE; -+ } -+ -+ void *data = shm.data(); -+ Q_ASSERT(data); -+ -+ CachedShaders *cache = reinterpret_cast<CachedShaders *>(data); -+ -+ for (int i = 0; i < cache->shaderCount; ++i) { -+ printf("Shader %d: %d bytes\n", i, cache->headers[i].size); -+ } -+ -+ printf("\nSummary:\n\n" -+ " Amount of cached shaders: %d\n" -+ " Bytes used: %d\n" -+ " Bytes available: %d\n", -+ cache->shaderCount, cache->dataSize, cache->availableSize()); -+ -+ return EXIT_SUCCESS; -+} -+ -Index: qt-maemo-qtp/src/opengl/util/meego/shader-cache-introspector.pro -=================================================================== ---- /dev/null -+++ qt-maemo-qtp/src/opengl/util/meego/shader-cache-introspector.pro -@@ -0,0 +1,7 @@ -+TEMPLATE = app -+ -+SOURCES += main.cpp -+ -+TARGET = shader-cache-introspector -+ -+QT = core diff --git a/config.profiles/harmattan/patches/icu.diff b/config.profiles/harmattan/patches/icu.diff deleted file mode 100644 index 16a17fd..0000000 --- a/config.profiles/harmattan/patches/icu.diff +++ /dev/null @@ -1,732 +0,0 @@ -diff --git a/configure b/configure -index 3a748e2..77232dc 100755 ---- a/configure -+++ b/configure -@@ -779,6 +779,7 @@ CFG_PULSEAUDIO=auto - CFG_COREWLAN=auto - CFG_ICD=auto - CFG_NOPROCESS=no -+CFG_ICU=no - - # initalize variables used for installation - QT_INSTALL_PREFIX= -@@ -940,7 +941,7 @@ while [ "$#" -gt 0 ]; do - VAL=no - ;; - #Qt style yes options -- -incremental|-qvfb|-profile|-shared|-static|-sm|-xinerama|-xshape|-xsync|-xinput|-xinput2|-egl|-reduce-exports|-pch|-separate-debug-info|-stl|-freetype|-xcursor|-xfixes|-xrandr|-xrender|-mitshm|-fontconfig|-xkb|-nis|-qdbus|-dbus|-dbus-linked|-glib|-gstreamer|-gtkstyle|-cups|-iconv|-largefile|-h|-help|-v|-verbose|-debug|-release|-fast|-accessibility|-confirm-license|-gnumake|-framework|-qt3support|-debug-and-release|-exceptions|-cocoa|-carbon|-universal|-prefix-install|-silent|-armfpa|-optimized-qmake|-dwarf2|-reduce-relocations|-sse|-openssl|-openssl-linked|-ptmalloc|-xmlpatterns|-phonon|-phonon-backend|-multimedia|-audio-backend|-svg|-declarative|-javascript-jit|-script|-scripttools|-rpath|-force-pkg-config|-s60|-usedeffiles) -+ -incremental|-qvfb|-profile|-shared|-static|-sm|-xinerama|-xshape|-xsync|-xinput|-xinput2|-egl|-reduce-exports|-pch|-separate-debug-info|-stl|-freetype|-xcursor|-xfixes|-xrandr|-xrender|-mitshm|-fontconfig|-xkb|-nis|-qdbus|-dbus|-dbus-linked|-glib|-gstreamer|-gtkstyle|-cups|-iconv|-largefile|-h|-help|-v|-verbose|-debug|-release|-fast|-accessibility|-confirm-license|-gnumake|-framework|-qt3support|-debug-and-release|-exceptions|-cocoa|-carbon|-universal|-prefix-install|-silent|-armfpa|-optimized-qmake|-dwarf2|-reduce-relocations|-sse|-openssl|-openssl-linked|-ptmalloc|-xmlpatterns|-phonon|-phonon-backend|-multimedia|-audio-backend|-svg|-declarative|-javascript-jit|-script|-scripttools|-rpath|-force-pkg-config|-s60|-usedeffiles|-icu) - VAR=`echo $1 | sed "s,^-\(.*\),\1,"` - VAL=yes - ;; -@@ -2242,6 +2243,13 @@ while [ "$#" -gt 0 ]; do - QT_CFLAGS_FPU=$VAL - fi - ;; -+ icu) -+ if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then -+ CFG_ICU="$VAL" -+ else -+ UNKNOWN_OPT=yes -+ fi -+ ;; - *) - UNKNOWN_OPT=yes - ;; -@@ -7040,6 +7048,10 @@ if [ "$CFG_ICD" = "yes" ]; then - QT_CONFIG="$QT_CONFIG icd" - fi - -+if [ "$CFG_ICU" = "yes" ]; then -+ QT_CONFIG="$QT_CONFIG icu" -+fi -+ - # - # Some Qt modules are too advanced in C++ for some old compilers - # Detect here the platforms where they are known to work. -diff --git a/src/corelib/tools/qchar.cpp b/src/corelib/tools/qchar.cpp -index 7cdc256..11a85d5 100644 ---- a/src/corelib/tools/qchar.cpp -+++ b/src/corelib/tools/qchar.cpp -@@ -57,6 +57,12 @@ - - QT_BEGIN_NAMESPACE - -+#ifdef QT_USE_ICU -+// from qlocale_icu.cpp -+extern uint qt_u_toUpper(uint c); -+extern uint qt_u_toLower(uint c); -+#endif -+ - #ifndef QT_NO_CODEC_FOR_C_STRINGS - # ifdef QT_NO_TEXTCODEC - # define QT_NO_CODEC_FOR_C_STRINGS -@@ -1076,6 +1082,12 @@ QChar::UnicodeVersion QChar::unicodeVersion(ushort ucs2) - */ - QChar QChar::toLower() const - { -+#ifdef QT_USE_ICU -+ uint res = qt_u_toLower(ucs); -+ if (res) -+ return QChar(res); -+ // else fall through -+#endif - const QUnicodeTables::Properties *p = qGetProp(ucs); - if (!p->lowerCaseSpecial) - return ucs + p->lowerCaseDiff; -@@ -1090,6 +1102,12 @@ QChar QChar::toLower() const - */ - uint QChar::toLower(uint ucs4) - { -+#ifdef QT_USE_ICU -+ uint res = qt_u_toLower(ucs4); -+ if (res) -+ return res; -+ // else fall through -+#endif - if (ucs4 > UNICODE_LAST_CODEPOINT) - return ucs4; - const QUnicodeTables::Properties *p = qGetProp(ucs4); -@@ -1106,6 +1124,12 @@ uint QChar::toLower(uint ucs4) - */ - ushort QChar::toLower(ushort ucs2) - { -+#ifdef QT_USE_ICU -+ uint res = qt_u_toLower(ucs2); -+ if (res) -+ return res & 0xffff; -+ // else fall through -+#endif - const QUnicodeTables::Properties *p = qGetProp(ucs2); - if (!p->lowerCaseSpecial) - return ucs2 + p->lowerCaseDiff; -@@ -1118,6 +1142,12 @@ ushort QChar::toLower(ushort ucs2) - */ - QChar QChar::toUpper() const - { -+#ifdef QT_USE_ICU -+ uint res = qt_u_toUpper(ucs); -+ if (res) -+ return QChar(res); -+ // else fall through -+#endif - const QUnicodeTables::Properties *p = qGetProp(ucs); - if (!p->upperCaseSpecial) - return ucs + p->upperCaseDiff; -@@ -1132,6 +1162,12 @@ QChar QChar::toUpper() const - */ - uint QChar::toUpper(uint ucs4) - { -+#ifdef QT_USE_ICU -+ uint res = qt_u_toUpper(ucs4); -+ if (res) -+ return res; -+ // else fall through -+#endif - if (ucs4 > UNICODE_LAST_CODEPOINT) - return ucs4; - const QUnicodeTables::Properties *p = qGetProp(ucs4); -@@ -1148,6 +1184,12 @@ uint QChar::toUpper(uint ucs4) - */ - ushort QChar::toUpper(ushort ucs2) - { -+#ifdef QT_USE_ICU -+ uint res = qt_u_toUpper(ucs2); -+ if (res) -+ return res & 0xffff; -+ // else fall through -+#endif - const QUnicodeTables::Properties *p = qGetProp(ucs2); - if (!p->upperCaseSpecial) - return ucs2 + p->upperCaseDiff; -diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp -index 6515edb..5470048 100644 ---- a/src/corelib/tools/qlocale.cpp -+++ b/src/corelib/tools/qlocale.cpp -@@ -134,6 +134,10 @@ void qt_symbianUpdateSystemPrivate(); - void qt_symbianInitSystemLocale(); - #endif - -+#ifdef QT_USE_ICU -+extern bool qt_initIcu(const QString &localeName); -+#endif -+ - /****************************************************************************** - ** Helpers for accessing Qt locale database - */ -@@ -2346,6 +2350,10 @@ void QLocale::setDefault(const QLocale &locale) - { - default_lp = locale.d(); - default_number_options = locale.numberOptions(); -+ -+#ifdef QT_USE_ICU -+ qt_initIcu(locale.name()); -+#endif - } - - /*! -diff --git a/src/corelib/tools/qlocale_icu.cpp b/src/corelib/tools/qlocale_icu.cpp -new file mode 100644 -index 0000000..7fe3801 ---- /dev/null -+++ b/src/corelib/tools/qlocale_icu.cpp -@@ -0,0 +1,247 @@ -+/**************************************************************************** -+** -+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -+** All rights reserved. -+** Contact: Nokia Corporation (qt-info@nokia.com) -+** -+** This file is part of the QtCore module of the Qt Toolkit. -+** -+** $QT_BEGIN_LICENSE:LGPL$ -+** No Commercial Usage -+** This file contains pre-release code and may not be distributed. -+** You may use this file in accordance with the terms and conditions -+** contained in the Technology Preview License Agreement accompanying -+** this package. -+** -+** 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, Nokia gives you certain additional -+** rights. These rights are described in the Nokia Qt LGPL Exception -+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -+** -+** If you have questions regarding the use of this file, please contact -+** Nokia at qt-info@nokia.com. -+** -+** -+** -+** -+** -+** -+** -+** -+** $QT_END_LICENSE$ -+** -+****************************************************************************/ -+ -+#include "qglobal.h" -+#include "qlibrary.h" -+#include "qdebug.h" -+ -+#include "unicode/uversion.h" -+#include "unicode/ucol.h" -+ -+QT_BEGIN_NAMESPACE -+ -+typedef UCollator *(*Ptr_ucol_open)(const char *loc, UErrorCode *status); -+typedef void (*Ptr_ucol_close)(UCollator *coll); -+typedef UCollationResult (*Ptr_ucol_strcoll)(const UCollator *coll, const UChar *source, int32_t sourceLength, const UChar *target, int32_t targetLength); -+typedef int32_t (*Ptr_u_strToCase)(UChar *dest, int32_t destCapacity, const UChar *src, int32_t srcLength, const char *locale, UErrorCode *pErrorCode); -+ -+static Ptr_ucol_open ptr_ucol_open = 0; -+static Ptr_ucol_strcoll ptr_ucol_strcoll = 0; -+static Ptr_ucol_close ptr_ucol_close = 0; -+static Ptr_u_strToCase ptr_u_strToUpper = 0; -+static Ptr_u_strToCase ptr_u_strToLower = 0; -+ -+enum LibLoadStatus -+{ -+ ErrorLoading = -1, -+ NotLoaded = 0, -+ Loaded = 1 -+}; -+ -+static LibLoadStatus status = NotLoaded; -+ -+static UCollator *icuCollator = 0; -+ -+#define STRINGIFY2(x) #x -+#define STRINGIFY(x) STRINGIFY2(x) -+ -+bool qt_initIcu(const QString &localeString) -+{ -+ if (status == ErrorLoading) -+ return false; -+ -+ if (status == NotLoaded) { -+ -+ // resolve libicui18n -+ QLibrary lib(QLatin1String("icui18n"), QLatin1String(U_ICU_VERSION_SHORT)); -+ if (!lib.load()) { -+ qWarning() << "Unable to load library icui18n" << lib.errorString(); -+ status = ErrorLoading; -+ return false; -+ } -+ -+ ptr_ucol_open = (Ptr_ucol_open)lib.resolve("ucol_open"); -+ ptr_ucol_close = (Ptr_ucol_close)lib.resolve("ucol_close"); -+ ptr_ucol_strcoll = (Ptr_ucol_strcoll)lib.resolve("ucol_strcoll"); -+ -+ if (!ptr_ucol_open || !ptr_ucol_close || !ptr_ucol_strcoll) { -+ // try again with decorated symbol names -+ ptr_ucol_open = (Ptr_ucol_open)lib.resolve("ucol_open" STRINGIFY(U_ICU_VERSION_SUFFIX)); -+ ptr_ucol_close = (Ptr_ucol_close)lib.resolve("ucol_close" STRINGIFY(U_ICU_VERSION_SUFFIX)); -+ ptr_ucol_strcoll = (Ptr_ucol_strcoll)lib.resolve("ucol_strcoll" STRINGIFY(U_ICU_VERSION_SUFFIX)); -+ } -+ -+ if (!ptr_ucol_open || !ptr_ucol_close || !ptr_ucol_strcoll) { -+ ptr_ucol_open = 0; -+ ptr_ucol_close = 0; -+ ptr_ucol_strcoll = 0; -+ -+ qWarning("Unable to find symbols in icui18n"); -+ status = ErrorLoading; -+ return false; -+ } -+ -+ // resolve libicuuc -+ QLibrary ucLib(QLatin1String("icuuc"), QLatin1String(U_ICU_VERSION_SHORT)); -+ if (!ucLib.load()) { -+ qWarning() << "Unable to load library icuuc" << ucLib.errorString(); -+ status = ErrorLoading; -+ return false; -+ } -+ -+ ptr_u_strToUpper = (Ptr_u_strToCase)ucLib.resolve("u_strToUpper"); -+ ptr_u_strToLower = (Ptr_u_strToCase)ucLib.resolve("u_strToLower"); -+ -+ if (!ptr_u_strToUpper || !ptr_u_strToLower) { -+ ptr_u_strToUpper = (Ptr_u_strToCase)ucLib.resolve("u_strToUpper" STRINGIFY(U_ICU_VERSION_SUFFIX)); -+ ptr_u_strToLower = (Ptr_u_strToCase)ucLib.resolve("u_strToLower" STRINGIFY(U_ICU_VERSION_SUFFIX)); -+ } -+ -+ if (!ptr_u_strToUpper || !ptr_u_strToLower) { -+ ptr_u_strToUpper = 0; -+ ptr_u_strToLower = 0; -+ -+ qWarning("Unable to find symbols in icuuc"); -+ status = ErrorLoading; -+ return false; -+ } -+ -+ // success :) -+ status = Loaded; -+ } -+ -+ if (icuCollator) { -+ ptr_ucol_close(icuCollator); -+ icuCollator = 0; -+ } -+ -+ UErrorCode icuStatus = U_ZERO_ERROR; -+ icuCollator = ptr_ucol_open(localeString.toLatin1().constData(), &icuStatus); -+ -+ if (!icuCollator) { -+ qWarning("Unable to open locale %s in ICU, error code %d", qPrintable(localeString), icuStatus); -+ return false; -+ } -+ -+ return true; -+} -+ -+bool qt_ucol_strcoll(const QChar *source, int sourceLength, const QChar *target, int targetLength, int *result) -+{ -+ Q_ASSERT(result); -+ Q_ASSERT(source); -+ Q_ASSERT(target); -+ -+ if (!icuCollator) -+ return false; -+ -+ *result = ptr_ucol_strcoll(icuCollator, reinterpret_cast<const UChar *>(source), int32_t(sourceLength), -+ reinterpret_cast<const UChar *>(target), int32_t(targetLength)); -+ -+ return true; -+} -+ -+// caseFunc can either be u_strToUpper or u_strToLower -+static bool qt_u_strToCase(const QString &str, QString *out, const QLocale &locale, Ptr_u_strToCase caseFunc) -+{ -+ Q_ASSERT(out); -+ -+ if (!icuCollator) -+ return false; -+ -+ QString result(str.size(), Qt::Uninitialized); -+ -+ UErrorCode status = U_ZERO_ERROR; -+ -+ int32_t size = caseFunc(reinterpret_cast<UChar *>(result.data()), result.size(), -+ reinterpret_cast<const UChar *>(str.constData()), str.size(), -+ locale.name().toLatin1().constData(), &status); -+ -+ if (U_FAILURE(status)) -+ return false; -+ -+ if (size < result.size()) { -+ result.resize(size); -+ } else if (size > result.size()) { -+ qDebug() << "RESULT SIZE MISMATCH"; -+ // the resulting string is larger than our source string -+ result.resize(size); -+ -+ status = U_ZERO_ERROR; -+ size = caseFunc(reinterpret_cast<UChar *>(result.data()), result.size(), -+ reinterpret_cast<const UChar *>(str.constData()), str.size(), -+ locale.name().toLatin1().constData(), &status); -+ -+ if (U_FAILURE(status)) -+ return false; -+ -+ // if the sizes don't match now, we give up. -+ if (size != result.size()) -+ return false; -+ } -+ -+ *out = result; -+ return true; -+} -+ -+bool qt_u_strToUpper(const QString &str, QString *out, const QLocale &locale) -+{ -+ return qt_u_strToCase(str, out, locale, ptr_u_strToUpper); -+} -+ -+bool qt_u_strToLower(const QString &str, QString *out, const QLocale &locale) -+{ -+ return qt_u_strToCase(str, out, locale, ptr_u_strToLower); -+} -+ -+uint qt_u_toUpper(uint c) -+{ -+ if (c > 0xffff) -+ return 0; -+ -+ QString out; -+ if (qt_u_strToUpper(QChar(c), &out, QLocale()) && !out.isEmpty()) -+ return out.at(0).unicode(); -+ return 0; -+} -+ -+uint qt_u_toLower(uint c) -+{ -+ if (c > 0xffff) -+ return 0; -+ -+ QString out; -+ if (qt_u_strToLower(QChar(c), &out, QLocale()) && !out.isEmpty()) -+ return out.at(0).unicode(); -+ return 0; -+} -+ -+QT_END_NAMESPACE -diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp -index d641d74..0f5cee1 100644 ---- a/src/corelib/tools/qstring.cpp -+++ b/src/corelib/tools/qstring.cpp -@@ -112,6 +112,13 @@ int qFindString(const QChar *haystack, int haystackLen, int from, - int qFindStringBoyerMoore(const QChar *haystack, int haystackLen, int from, - const QChar *needle, int needleLen, Qt::CaseSensitivity cs); - -+#ifdef QT_USE_ICU -+// qlocale_icu.cpp -+extern bool qt_ucol_strcoll(const QChar *source, int sourceLength, const QChar *target, int targetLength, int *result); -+extern bool qt_u_strToUpper(const QString &str, QString *out, const QLocale &locale); -+extern bool qt_u_strToLower(const QString &str, QString *out, const QLocale &locale); -+#endif -+ - - // Unicode case-insensitive comparison - static int ucstricmp(const ushort *a, const ushort *ae, const ushort *b, const ushort *be) -@@ -4808,6 +4815,14 @@ int QString::localeAwareCompare_helper(const QChar *data1, int length1, - TPtrC p2 = TPtrC16(reinterpret_cast<const TUint16 *>(data2), length2); - return p1.CompareC(p2); - #elif defined(Q_OS_UNIX) -+# if defined(QT_USE_ICU) -+ int res; -+ if (qt_ucol_strcoll(data1, length1, data2, length2, &res)) { -+ if (res == 0) -+ res = ucstrcmp(data1, length1, data2, length2); -+ return res; -+ } // else fall through -+# endif - // declared in <string.h> - int delta = strcoll(toLocal8Bit_helper(data1, length1), toLocal8Bit_helper(data2, length2)); - if (delta == 0) -@@ -4943,6 +4958,15 @@ QString QString::toLower() const - if (!d->size) - return *this; - -+#ifdef QT_USE_ICU -+ { -+ QString result; -+ if (qt_u_strToLower(*this, &result, QLocale())) -+ return result; -+ // else fall through and use Qt's toUpper -+ } -+#endif -+ - const ushort *e = d->data + d->size; - - // this avoids one out of bounds check in the loop -@@ -5034,6 +5058,15 @@ QString QString::toUpper() const - if (!d->size) - return *this; - -+#ifdef QT_USE_ICU -+ { -+ QString result; -+ if (qt_u_strToUpper(*this, &result, QLocale())) -+ return result; -+ // else fall through and use Qt's toUpper -+ } -+#endif -+ - const ushort *e = d->data + d->size; - - // this avoids one out of bounds check in the loop -diff --git a/src/corelib/tools/tools.pri b/src/corelib/tools/tools.pri -index d81ab04..46c39f3 100644 ---- a/src/corelib/tools/tools.pri -+++ b/src/corelib/tools/tools.pri -@@ -92,6 +92,11 @@ else:SOURCES += tools/qelapsedtimer_generic.cpp - contains(QT_CONFIG, zlib):include($$PWD/../../3rdparty/zlib.pri) - else:include($$PWD/../../3rdparty/zlib_dependency.pri) - -+contains(QT_CONFIG,icu) { -+ SOURCES += tools/qlocale_icu.cpp -+ DEFINES += QT_USE_ICU -+} -+ - DEFINES += HB_EXPORT=Q_CORE_EXPORT - INCLUDEPATH += ../3rdparty/harfbuzz/src - HEADERS += ../3rdparty/harfbuzz/src/harfbuzz.h -diff --git a/tests/auto/qchar/qchar.pro b/tests/auto/qchar/qchar.pro -index 3813e4e..d991365 100644 ---- a/tests/auto/qchar/qchar.pro -+++ b/tests/auto/qchar/qchar.pro -@@ -13,3 +13,5 @@ symbian: { - } else { - DEFINES += SRCDIR=\\\"$$PWD/\\\" - } -+ -+contains(QT_CONFIG,icu):DEFINES += QT_USE_ICU -diff --git a/tests/auto/qchar/tst_qchar.cpp b/tests/auto/qchar/tst_qchar.cpp -index 45dd7eb..514a836 100644 ---- a/tests/auto/qchar/tst_qchar.cpp -+++ b/tests/auto/qchar/tst_qchar.cpp -@@ -103,7 +103,8 @@ tst_QChar::~tst_QChar() - { } - - void tst_QChar::initTestCase() --{ } -+{ -+} - - void tst_QChar::cleanupTestCase() - { } -@@ -114,6 +115,7 @@ void tst_QChar::init() - int argc = 0; - app = new QCoreApplication(argc, NULL); - #endif -+ QLocale::setDefault(QLocale::C); - } - - void tst_QChar::cleanup() -@@ -143,9 +145,36 @@ void tst_QChar::toUpper() - QVERIFY(QChar::toUpper((uint)0x1c8) == 0x1c7); - QVERIFY(QChar::toUpper((uint)0x1c9) == 0x1c7); - -- QVERIFY(QChar::toUpper((uint)0x10400) == 0x10400); -- QVERIFY(QChar::toUpper((uint)0x10428) == 0x10400); -+ QCOMPARE(QChar::toUpper((uint)0x10400), 0x10400u); -+ QCOMPARE(QChar::toUpper((uint)0x10428), 0x10400u); -+ -+#ifdef QT_USE_ICU -+ QCOMPARE(QChar('i').toUpper(), QChar('I')); -+ QCOMPARE(QChar::toUpper(ushort('i')), ushort('I')); -+ QCOMPARE(QChar::toUpper(uint('i')), uint('I')); -+ -+ QLocale::setDefault(QLocale(QLocale::Turkish, QLocale::Turkey)); -+ -+ // in Turkish locale, upper-caseing a 'i' will result in a capital I plus dot (0x0130) -+ QCOMPARE(QChar('i').toUpper(), QChar(0x0130u)); -+ QCOMPARE(QChar::toUpper(ushort('i')), ushort(0x0130u)); -+ QCOMPARE(QChar::toUpper(uint('i')), 0x0130u); -+ -+ // upper-casing a lower-case i without dot (0x0131) will result in 'I' -+ QCOMPARE(QChar(0x0131u).toUpper(), QChar('I')); -+ QCOMPARE(QChar::toUpper(ushort(0x0131u)), ushort('I')); -+ QCOMPARE(QChar::toUpper(uint(0x0131u)), uint('I')); -+ -+ // upper-casing an upper-case 0x0130 should do nothing -+ QCOMPARE(QChar(0x0130u).toUpper(), QChar(0x0130u)); -+ QCOMPARE(QChar::toUpper(ushort(0x0130u)), ushort(0x0130u)); -+ QCOMPARE(QChar::toUpper(uint(0x0130u)), uint(0x0130u)); - -+ // upper-casing an upper-case I should do nothing -+ QCOMPARE(QChar('I').toUpper(), QChar('I')); -+ QCOMPARE(QChar::toUpper(ushort('I')), ushort('I')); -+ QCOMPARE(QChar::toUpper(uint('I')), uint('I')); -+#endif - } - - void tst_QChar::toLower() -@@ -170,6 +199,34 @@ void tst_QChar::toLower() - - QVERIFY(QChar::toLower((uint)0x10400) == 0x10428); - QVERIFY(QChar::toLower((uint)0x10428) == 0x10428); -+ -+#ifdef QT_USE_ICU -+ QCOMPARE(QChar('I').toLower(), QChar('i')); -+ QCOMPARE(QChar::toLower(ushort('I')), ushort('i')); -+ QCOMPARE(QChar::toLower(uint('I')), uint('i')); -+ -+ QLocale::setDefault(QLocale(QLocale::Turkish, QLocale::Turkey)); -+ -+ // in turkish locale, lower-casing an 'I' will result with a lower-case i without dot (0x0131) -+ QCOMPARE(QChar('I').toLower(), QChar(0x0131u)); -+ QCOMPARE(QChar::toLower(ushort('I')), ushort(0x0131u)); -+ QCOMPARE(QChar::toLower(uint('I')), uint(0x0131u)); -+ -+ // lower-casing a captial I with dot (0x0130) will result in 'i' -+ QCOMPARE(QChar(0x0130u).toLower(), QChar('i')); -+ QCOMPARE(QChar::toLower(ushort(0x0130u)), ushort('i')); -+ QCOMPARE(QChar::toLower(uint(0x0130u)), uint('i')); -+ -+ // lower-casing a lower-case i should do nothing -+ QCOMPARE(QChar('i').toLower(), QChar('i')); -+ QCOMPARE(QChar::toLower(ushort('i')), ushort('i')); -+ QCOMPARE(QChar::toLower(uint('i')), uint('i')); -+ -+ // lower-casing a lower-case i without dot (0x0131) should do nothing -+ QCOMPARE(QChar(0x0131u).toLower(), QChar(0x0131u)); -+ QCOMPARE(QChar::toLower(ushort(0x0131u)), ushort(0x0131u)); -+ QCOMPARE(QChar::toLower(uint(0x0131u)), uint(0x0131u)); -+#endif - } - - void tst_QChar::toTitle() -diff --git a/tests/auto/qstring/qstring.pro b/tests/auto/qstring/qstring.pro -index ed758c6..92dd755 100644 ---- a/tests/auto/qstring/qstring.pro -+++ b/tests/auto/qstring/qstring.pro -@@ -6,3 +6,5 @@ symbian:LIBS += -llibm - QT = core - - DEFINES += QT_NO_CAST_TO_ASCII -+ -+contains(QT_CONFIG,icu):DEFINES += QT_USE_ICU -diff --git a/tests/auto/qstring/tst_qstring.cpp b/tests/auto/qstring/tst_qstring.cpp -index ecae3d8..6baf9fc 100644 ---- a/tests/auto/qstring/tst_qstring.cpp -+++ b/tests/auto/qstring/tst_qstring.cpp -@@ -210,6 +210,8 @@ private slots: - void task262677remove(); - void QTBUG10404_compareRef(); - void QTBUG9281_arg_locale(); -+ -+ void toUpperLower_icu(); - }; - - typedef QList<int> IntList; -@@ -1544,6 +1546,11 @@ void tst_QString::toUpper() - QCOMPARE( lower.toUpper(), upper); - - -+#ifdef QT_USE_ICU -+ // test doesn't work with ICU support, since QChar is unaware of any locale -+ QEXPECT_FAIL("", "test doesn't work with ICU support, since QChar is unaware of any locale", Continue); -+ QVERIFY(false); -+#else - for (int i = 0; i < 65536; ++i) { - QString str(1, QChar(i)); - QString upper = str.toUpper(); -@@ -1551,6 +1558,7 @@ void tst_QString::toUpper() - if (upper.length() == 1) - QVERIFY(upper == QString(1, QChar(i).toUpper())); - } -+#endif - } - - void tst_QString::toLower() -@@ -1582,6 +1590,11 @@ void tst_QString::toLower() - upper += QChar(QChar::lowSurrogate(0x10400)); - QCOMPARE( upper.toLower(), lower); - -+#ifdef QT_USE_ICU -+ // test doesn't work with ICU support, since QChar is unaware of any locale -+ QEXPECT_FAIL("", "test doesn't work with ICU support, since QChar is unaware of any locale", Continue); -+ QVERIFY(false); -+#else - for (int i = 0; i < 65536; ++i) { - QString str(1, QChar(i)); - QString lower = str.toLower(); -@@ -1589,6 +1602,7 @@ void tst_QString::toLower() - if (lower.length() == 1) - QVERIFY(str.toLower() == QString(1, QChar(i).toLower())); - } -+#endif - } - - void tst_QString::trimmed() -@@ -4200,6 +4214,8 @@ void tst_QString::localeAwareCompare() - - #elif defined (Q_WS_MAC) - QSKIP("Setting the locale is not supported on OS X (you can set the C locale, but that won't affect CFStringCompare which is used to compare strings)", SkipAll); -+#elif defined(QT_USE_ICU) -+ QLocale::setDefault(QLocale(locale)); - #else - if (!locale.isEmpty()) { - const char *newLocale = setlocale(LC_ALL, locale.toLatin1()); -@@ -4211,6 +4227,11 @@ void tst_QString::localeAwareCompare() - } - #endif - -+#ifdef QT_USE_ICU -+ // ### for c1, ICU disagrees with libc on how to compare -+ QEXPECT_FAIL("c1", "ICU disagrees with test", Abort); -+#endif -+ - int testres = QString::localeAwareCompare(s1, s2); - if (result < 0) { - QVERIFY(testres < 0); -@@ -4912,6 +4933,40 @@ void tst_QString::QTBUG9281_arg_locale() - QLocale::setDefault(QLocale::C); - } - -+void tst_QString::toUpperLower_icu() -+{ -+#ifndef QT_USE_ICU -+ QSKIP("Qt was built without ICU support", QTest::SkipAll); -+#endif -+ -+ QString s = QString::fromLatin1("i"); -+ -+ QCOMPARE(s.toUpper(), QString::fromLatin1("I")); -+ QCOMPARE(s.toLower(), QString::fromLatin1("i")); -+ -+ QLocale::setDefault(QLocale(QLocale::Turkish, QLocale::Turkey)); -+ -+ // turkish locale has a capital I with a dot (U+0130, utf8 c4b0) -+ -+ QCOMPARE(s.toUpper(), QString::fromUtf8("\xc4\xb0")); -+ QCOMPARE(QString::fromUtf8("\xc4\xb0").toLower(), s); -+ -+ // nothing should happen here -+ QCOMPARE(s.toLower(), s); -+ QCOMPARE(QString::fromLatin1("I").toUpper(), QString::fromLatin1("I")); -+ -+ // U+0131, utf8 c4b1 is the lower-case i without a dot -+ QString sup = QString::fromUtf8("\xc4\xb1"); -+ -+ QCOMPARE(sup.toUpper(), QString::fromLatin1("I")); -+ QCOMPARE(QString::fromLatin1("I").toLower(), sup); -+ -+ // nothing should happen here -+ QCOMPARE(sup.toLower(), sup); -+ QCOMPARE(QString::fromLatin1("i").toLower(), QString::fromLatin1("i")); -+ -+ // the cleanup function will restore the default locale -+} - - - QTEST_APPLESS_MAIN(tst_QString) diff --git a/config.profiles/harmattan/patches/no_read_pro_from_quilt_dir.diff b/config.profiles/harmattan/patches/no_read_pro_from_quilt_dir.diff deleted file mode 100644 index f5ddb67..0000000 --- a/config.profiles/harmattan/patches/no_read_pro_from_quilt_dir.diff +++ /dev/null @@ -1,13 +0,0 @@ -Index: qt-maemo-qtp/configure -=================================================================== ---- qt-maemo-qtp.orig/configure -+++ qt-maemo-qtp/configure -@@ -8465,7 +8465,7 @@ - # .projects.3 -> the rest - rm -f .projects .projects.1 .projects.2 .projects.3 - --QMAKE_PROJECTS=`find "$relpath/." -name '*.pro' -print | sed 's-/\./-/-'` -+QMAKE_PROJECTS=`find "$relpath/." -name '*.pro' -a ! -path '*/.pc/*' -print | sed 's-/\./-/-'` - if [ -z "$AWK" ]; then - for p in `echo $QMAKE_PROJECTS`; do - echo "$p" >> .projects diff --git a/config.profiles/harmattan/patches/pinch_gesture_sent_twice.diff b/config.profiles/harmattan/patches/pinch_gesture_sent_twice.diff deleted file mode 100644 index 61dfbf9..0000000 --- a/config.profiles/harmattan/patches/pinch_gesture_sent_twice.diff +++ /dev/null @@ -1,56 +0,0 @@ -Index: qt-maemo-qtp/src/gui/kernel/qstandardgestures.cpp -=================================================================== ---- qt-maemo-qtp.orig/src/gui/kernel/qstandardgestures.cpp -+++ qt-maemo-qtp/src/gui/kernel/qstandardgestures.cpp -@@ -66,6 +66,9 @@ - #else - static_cast<QWidget *>(target)->setAttribute(Qt::WA_AcceptTouchEvents); - #endif -+ } else if (target) { -+ return 0; // this assumes the target is a QGraphicsObject, so we return -+ // NULL to indicate that the recognizer doesn't support graphicsobject - } - return new QPanGesture; - } -@@ -157,7 +160,11 @@ - { - if (target && target->isWidgetType()) { - static_cast<QWidget *>(target)->setAttribute(Qt::WA_AcceptTouchEvents); -+ } else if (target) { -+ return 0; // this assumes the target is a QGraphicsObject, so we return -+ // NULL to indicate that the recognizer doesn't support graphicsobject - } -+ - return new QPinchGesture; - } - -@@ -286,6 +293,9 @@ - { - if (target && target->isWidgetType()) { - static_cast<QWidget *>(target)->setAttribute(Qt::WA_AcceptTouchEvents); -+ } else if (target) { -+ return 0; // this assumes the target is a QGraphicsObject, so we return -+ // NULL to indicate that the recognizer doesn't support graphicsobject - } - return new QSwipeGesture; - } -@@ -424,6 +434,9 @@ - { - if (target && target->isWidgetType()) { - static_cast<QWidget *>(target)->setAttribute(Qt::WA_AcceptTouchEvents); -+ } else if (target) { -+ return 0; // this assumes the target is a QGraphicsObject, so we return -+ // NULL to indicate that the recognizer doesn't support graphicsobject - } - return new QTapGesture; - } -@@ -495,6 +508,9 @@ - { - if (target && target->isWidgetType()) { - static_cast<QWidget *>(target)->setAttribute(Qt::WA_AcceptTouchEvents); -+ } else if (target) { -+ return 0; // this assumes the target is a QGraphicsObject, so we return -+ // NULL to indicate that the recognizer doesn't support graphicsobject - } - return new QTapAndHoldGesture; - } diff --git a/config.profiles/harmattan/patches/qgltexturecache.diff b/config.profiles/harmattan/patches/qgltexturecache.diff deleted file mode 100644 index 0fa8ad2..0000000 --- a/config.profiles/harmattan/patches/qgltexturecache.diff +++ /dev/null @@ -1,23 +0,0 @@ -Index: qt-maemo-qtp/src/opengl/qgl.cpp -=================================================================== ---- qt-maemo-qtp.orig/src/opengl/qgl.cpp -+++ qt-maemo-qtp/src/opengl/qgl.cpp -@@ -1831,18 +1831,6 @@ - void QGLTextureCache::insert(QGLContext* ctx, qint64 key, QGLTexture* texture, int cost) - { - QWriteLocker locker(&m_lock); -- if (m_cache.totalCost() + cost > m_cache.maxCost()) { -- // the cache is full - make an attempt to remove something -- const QList<QGLTextureCacheKey> keys = m_cache.keys(); -- int i = 0; -- while (i < m_cache.count() -- && (m_cache.totalCost() + cost > m_cache.maxCost())) { -- QGLTexture *tex = m_cache.object(keys.at(i)); -- if (tex->context == ctx) -- m_cache.remove(keys.at(i)); -- ++i; -- } -- } - const QGLTextureCacheKey cacheKey = {key, QGLContextPrivate::contextGroup(ctx)}; - m_cache.insert(cacheKey, texture, cost); - } diff --git a/config.profiles/harmattan/patches/qwidget_x11.diff b/config.profiles/harmattan/patches/qwidget_x11.diff deleted file mode 100644 index 8bcb011..0000000 --- a/config.profiles/harmattan/patches/qwidget_x11.diff +++ /dev/null @@ -1,39 +0,0 @@ -commit 4ecc45086102807901a3bd2b9e02a169ca212716 -Author: Harald Fernengel <harald.fernengel@nokia.com> -Date: Thu Dec 9 10:51:01 2010 +0100 - - Fix a rare race condition when showing windows - - When setting a window to translucent shortly before showing it with the - OpenGL graphics system, the hijacking would call XDestroyWindow without - resetting the internal state. This might lead to the window waiting for - a map notify message forever. - - The patch now properly resets the internal state when destroying the old - window, so it'll get mapped correctly when show() is called. - - Reviewed-by: Denis Dzyubenko - -Index: qt-maemo-qtp/src/gui/kernel/qwidget_x11.cpp -=================================================================== ---- qt-maemo-qtp.orig/src/gui/kernel/qwidget_x11.cpp -+++ qt-maemo-qtp/src/gui/kernel/qwidget_x11.cpp -@@ -961,8 +961,17 @@ - inputContext->setFocusWidget(q); - } - -- if (destroyw) -+ if (destroyw) { - qt_XDestroyWindow(q, dpy, destroyw); -+ if (QTLWExtra *topData = maybeTopData()) { -+#ifndef QT_NO_XSYNC -+ if (topData->syncUpdateCounter) -+ XSyncDestroyCounter(dpy, topData->syncUpdateCounter); -+#endif -+ // we destroyed our old window - reset the top-level state -+ createTLSysExtra(); -+ } -+ } - - // newly created windows are positioned at the window system's - // (0,0) position. If the parent uses wrect mapping to expand the diff --git a/config.profiles/harmattan/patches/qwidget_x11_mapping.diff b/config.profiles/harmattan/patches/qwidget_x11_mapping.diff deleted file mode 100644 index 4866cfb..0000000 --- a/config.profiles/harmattan/patches/qwidget_x11_mapping.diff +++ /dev/null @@ -1,17 +0,0 @@ -Index: qt-maemo-qtp/src/gui/kernel/qwidget_x11.cpp -=================================================================== ---- qt-maemo-qtp.orig/src/gui/kernel/qwidget_x11.cpp -+++ qt-maemo-qtp/src/gui/kernel/qwidget_x11.cpp -@@ -1353,6 +1353,12 @@ - //cannot trust that !isWindow() implies parentWidget() before create - return (q->isWindow() || !q->parentWidget()) ? p : q->parentWidget()->d_func()->mapToGlobal(p); - } -+ -+ // we're not embedded - use the client rect to compute the global position -+ if (!q->window()->d_func()->topData()->embedded) -+ return mapFromWS(QPoint(pos.x() - q->data->crect.left(), pos.y() - q->data->crect.top())); -+ -+ // otherwise, go through the (slow-ish) X11 round-trip - int x, y; - Window child; - QPoint p = mapToWS(pos); diff --git a/config.profiles/harmattan/patches/runtime-window-geometry-revert.diff b/config.profiles/harmattan/patches/runtime-window-geometry-revert.diff deleted file mode 100644 index af55a60..0000000 --- a/config.profiles/harmattan/patches/runtime-window-geometry-revert.diff +++ /dev/null @@ -1,12 +0,0 @@ -Index: qt-maemo-qtp/src/gui/painting/qgraphicssystem_runtime.cpp -=================================================================== ---- qt-maemo-qtp.orig/src/gui/painting/qgraphicssystem_runtime.cpp -+++ qt-maemo-qtp/src/gui/painting/qgraphicssystem_runtime.cpp -@@ -285,7 +285,6 @@ - - void QRuntimeWindowSurface::setGeometry(const QRect &rect) - { -- QWindowSurface::setGeometry(rect); - m_windowSurface->setGeometry(rect); - } - diff --git a/config.profiles/harmattan/patches/series b/config.profiles/harmattan/patches/series deleted file mode 100644 index f2ee5f9..0000000 --- a/config.profiles/harmattan/patches/series +++ /dev/null @@ -1,14 +0,0 @@ -tst_qscrollbar.diff -signon_authenticator4.diff -pinch_gesture_sent_twice.diff -no_read_pro_from_quilt_dir.diff -tst_qvariant.diff -icu.diff -qgltexturecache.diff -qwidget_x11.diff -qwidget_x11_mapping.diff -glshadercache.diff -temppath.diff -tst_qprogressbar.diff -default_widget_size.diff -runtime-window-geometry-revert.diff diff --git a/config.profiles/harmattan/patches/signon_authenticator4.diff b/config.profiles/harmattan/patches/signon_authenticator4.diff deleted file mode 100644 index 63e8d51..0000000 --- a/config.profiles/harmattan/patches/signon_authenticator4.diff +++ /dev/null @@ -1,230 +0,0 @@ -Index: qt-maemo-qtp/src/3rdparty/signon/signon.pri -=================================================================== ---- /dev/null -+++ qt-maemo-qtp/src/3rdparty/signon/signon.pri -@@ -0,0 +1,2 @@ -+# signon dependency -+CONFIG += qdbus -Index: qt-maemo-qtp/src/network/access/access.pri -=================================================================== ---- qt-maemo-qtp.orig/src/network/access/access.pri -+++ qt-maemo-qtp/src/network/access/access.pri -@@ -61,3 +61,4 @@ - access/qnetworkdiskcache.cpp - - include($$PWD/../../3rdparty/zlib_dependency.pri) -+include($$PWD/../../3rdparty/signon/signon.pri) -Index: qt-maemo-qtp/src/network/kernel/qauthenticator.cpp -=================================================================== ---- qt-maemo-qtp.orig/src/network/kernel/qauthenticator.cpp -+++ qt-maemo-qtp/src/network/kernel/qauthenticator.cpp -@@ -129,6 +129,9 @@ - \sa QSslSocket - */ - -+#ifndef QT_NO_SIGNON -+#include <QtDBus/QtDBus> -+#endif //QT_NO_SIGNON - - /*! - Constructs an empty authentication object -@@ -421,17 +424,40 @@ - { - QByteArray response; - const char *methodString = 0; -+#ifndef QT_NO_SIGNON -+ bool valid = false; -+ qint32 id = 0; -+#endif //QT_NO_SIGNON -+ - switch(method) { - case QAuthenticatorPrivate::None: - methodString = ""; - phase = Done; - break; - case QAuthenticatorPrivate::Plain: -+#ifndef QT_NO_SIGNON -+ id = this->options.value(QLatin1String("identity")).toInt(&valid); -+ if (valid) { -+ //get response from sso -+ QVariantMap signon = signonResponse(id, QLatin1String("password"),QVariantMap()); -+ response = '\0' + signon.value(QLatin1String("UserName")).toString().toUtf8() -+ + '\0' + signon.value(QLatin1String("Secret")).toString().toUtf8(); -+ } else -+#endif //QT_NO_SIGNON - response = '\0' + user.toUtf8() + '\0' + password.toUtf8(); - phase = Done; - break; - case QAuthenticatorPrivate::Basic: - methodString = "Basic "; -+#ifndef QT_NO_SIGNON -+ id = this->options.value(QLatin1String("identity")).toInt(&valid); -+ if (valid) { -+ //get response from sso -+ QVariantMap signon = signonResponse(id, QLatin1String("password"),QVariantMap()); -+ response = signon.value(QLatin1String("UserName")).toString().toLatin1() -+ + ':' + signon.value(QLatin1String("Secret")).toString().toLatin1(); -+ } else -+#endif //QT_NO_SIGNON - response = user.toLatin1() + ':' + password.toLatin1(); - response = response.toBase64(); - phase = Done; -@@ -613,6 +639,90 @@ - return hash.result().toHex(); - } - -+#ifndef QT_NO_SIGNON -+ -+static QVariantMap signonResponse(const quint32 id, const QString &method, QVariantMap args) -+{ -+ //check dbus connection -+ QDBusConnection connection = QDBusConnection::sessionBus(); -+ if (!QDBusConnection::sessionBus().isConnected()) { -+ qCritical() << "DBus connection failed"; -+ return QVariantMap(); -+ } -+ -+ QDBusMessage msg = -+ QDBusMessage::createMethodCall(QLatin1String("com.nokia.SingleSignOn"), -+ QLatin1String("/com/nokia/SingleSignOn") , -+ QLatin1String("com.nokia.SingleSignOn.AuthService"), -+ QLatin1String("getAuthSessionObjectPath")); -+ msg << id << method; -+ QDBusReply<QString> pathReply = connection.call(msg); -+ -+ QString sessionPath; -+ if (pathReply.isValid()) { -+ sessionPath = pathReply.value(); -+ } else { -+ qDebug() << pathReply.error(); -+ return QVariantMap(); -+ } -+ -+ //authenticate using auth session -+ msg = QDBusMessage::createMethodCall(QLatin1String("com.nokia.SingleSignOn"), -+ sessionPath, QString(), -+ QLatin1String("process")); -+ msg << args << method; -+ QDBusReply<QVariantMap> reply = connection.call(msg); -+ -+ if (reply.isValid()) { -+ QVariantMap map = reply.value(); -+ return map; -+ } else { -+ qDebug() << reply.error(); -+ return QVariantMap(); -+ } -+ return QVariantMap(); -+} -+ -+static QByteArray signonDigestMd5( -+ const quint32 id, -+ const QByteArray &alg, -+ QString &user, -+ const QByteArray &realm, -+ const QByteArray &nonce, /* nonce from server */ -+ QByteArray &nonceCount, /* 8 hex digits */ -+ QByteArray &cNonce, /* client nonce */ -+ const QByteArray &qop, /* qop-value: "", "auth", "auth-int" */ -+ const QByteArray &method, /* method from the request */ -+ const QByteArray &digestUri, /* requested URL */ -+ const QByteArray &hEntity /* H(entity body) if qop="auth-int" */ -+ ) -+{ -+ QByteArray digest = QByteArray(); -+ nonceCount = "00000001"; -+ -+ QVariantMap args; -+ args.insert(QLatin1String("Algorithm"), alg); -+ args.insert(QLatin1String("Realm"), QLatin1String(realm)); -+ args.insert(QLatin1String("nonce"), nonce); -+ args.insert(QLatin1String("nonceCount"), nonceCount); -+ args.insert(QLatin1String("cNonce"), cNonce); -+ args.insert(QLatin1String("qop"), qop); -+ args.insert(QLatin1String("method"), method); -+ args.insert(QLatin1String("digestUri"), digestUri); -+ args.insert(QLatin1String("Entity"), hEntity); -+ -+ QVariantMap response = signonResponse(id, QLatin1String("digest"), args); -+ -+ if (response.isEmpty()) -+ return digest; -+ digest = response.value(QLatin1String("Digest")).toByteArray(); -+ user = response.value(QLatin1String("UserName")).toString(); -+ cNonce = response.value(QLatin1String("cNonce")).toByteArray(); -+ -+ return digest; -+} -+#endif //QT_NO_SIGNON -+ - QByteArray QAuthenticatorPrivate::digestMd5Response(const QByteArray &challenge, const QByteArray &method, const QByteArray &path) - { - QHash<QByteArray,QByteArray> options = parseDigestAuthenticationChallenge(challenge); -@@ -625,9 +735,23 @@ - QByteArray nonce = options.value("nonce"); - QByteArray opaque = options.value("opaque"); - QByteArray qop = options.value("qop"); -+ QByteArray response; - - // qDebug() << "calculating digest: method=" << method << "path=" << path; -- QByteArray response = digestMd5ResponseHelper(options.value("algorithm"), user.toLatin1(), -+ -+#ifndef QT_NO_SIGNON -+ bool valid = false; -+ qint32 id = this->options.value(QLatin1String("identity")).toInt(&valid); -+ if (valid) { -+ //get response from sso -+ response = signonDigestMd5(id, options.value("algorithm"), user, -+ realm.toLatin1(), -+ nonce, nonceCountString, -+ cnonce, qop, method, -+ path, QByteArray()); -+ } else -+#endif //QT_NO_SIGNON -+ response = digestMd5ResponseHelper(options.value("algorithm"), user.toLatin1(), - realm.toLatin1(), password.toLatin1(), - nonce, nonceCountString, - cnonce, qop, method, -Index: qt-maemo-qtp/src/network/kernel/qauthenticator_p.h -=================================================================== ---- qt-maemo-qtp.orig/src/network/kernel/qauthenticator_p.h -+++ qt-maemo-qtp/src/network/kernel/qauthenticator_p.h -@@ -109,6 +109,23 @@ - - }; - -+#ifndef QT_NO_SIGNON -+ static QVariantMap signonResponse(const quint32 id, const QString &method, QVariantMap args); -+ static QByteArray signonDigestMd5( -+ const quint32 id, -+ const QByteArray &alg, -+ QString &user, -+ const QByteArray &realm, -+ const QByteArray &nonce, /* nonce from server */ -+ QByteArray &nonceCount, /* 8 hex digits */ -+ QByteArray &cNonce, /* client nonce */ -+ const QByteArray &qop, /* qop-value: "", "auth", "auth-int" */ -+ const QByteArray &method, /* method from the request */ -+ const QByteArray &digestUri, /* requested URL */ -+ const QByteArray &hEntity /* H(entity body) if qop="auth-int" */ -+ ); -+#endif //QT_NO_SIGNON -+ - - QT_END_NAMESPACE - -Index: qt-maemo-qtp/src/src.pro -=================================================================== ---- qt-maemo-qtp.orig/src/src.pro -+++ qt-maemo-qtp/src/src.pro -@@ -4,8 +4,9 @@ - unset(SRC_SUBDIRS) - win32:SRC_SUBDIRS += src_winmain - symbian:SRC_SUBDIRS += src_s60main --SRC_SUBDIRS += src_corelib src_xml src_network src_sql src_testlib -+SRC_SUBDIRS += src_corelib src_xml - !symbian:contains(QT_CONFIG, dbus):SRC_SUBDIRS += src_dbus -+SRC_SUBDIRS += src_network src_sql src_testlib - !contains(QT_CONFIG, no-gui): SRC_SUBDIRS += src_gui - !wince*:!symbian:!vxworks:contains(QT_CONFIG, qt3support): SRC_SUBDIRS += src_qt3support - diff --git a/config.profiles/harmattan/patches/temppath.diff b/config.profiles/harmattan/patches/temppath.diff deleted file mode 100644 index 065c2d0..0000000 --- a/config.profiles/harmattan/patches/temppath.diff +++ /dev/null @@ -1,28 +0,0 @@ -Index: qt-maemo-qtp/mkspecs/linux-g++-maemo/qplatformdefs.h -=================================================================== ---- qt-maemo-qtp.orig/mkspecs/linux-g++-maemo/qplatformdefs.h -+++ qt-maemo-qtp/mkspecs/linux-g++-maemo/qplatformdefs.h -@@ -43,3 +43,8 @@ - - #define QT_GUI_DOUBLE_CLICK_RADIUS 20 - #define QT_GUI_DRAG_DISTANCE 16 -+ -+// TMPDIR sometimes points to /tmp and sometimes to /var/tmp -+// To guarantee native platform key generation for QSharedMemory and friends, -+// we must hard code the temp path to /var/tmp here. -+#define QT_UNIX_TEMP_PATH_OVERRIDE "/var/tmp" -Index: qt-maemo-qtp/src/corelib/io/qfsfileengine_unix.cpp -=================================================================== ---- qt-maemo-qtp.orig/src/corelib/io/qfsfileengine_unix.cpp -+++ qt-maemo-qtp/src/corelib/io/qfsfileengine_unix.cpp -@@ -643,7 +643,9 @@ - - QString QFSFileEngine::tempPath() - { --#if defined(Q_OS_SYMBIAN) -+#if defined(QT_UNIX_TEMP_PATH_OVERRIDE) -+ QString temp = QLatin1String(QT_UNIX_TEMP_PATH_OVERRIDE); -+#elif defined(Q_OS_SYMBIAN) - TFileName symbianPath = PathInfo::PhoneMemoryRootPath(); - QString temp = QDir::fromNativeSeparators(qt_TDesC2QString(symbianPath)); - temp += QLatin1String( "temp/"); diff --git a/config.profiles/harmattan/patches/tst_qprogressbar.diff b/config.profiles/harmattan/patches/tst_qprogressbar.diff deleted file mode 100644 index d252fe3..0000000 --- a/config.profiles/harmattan/patches/tst_qprogressbar.diff +++ /dev/null @@ -1,19 +0,0 @@ -Index: qt-maemo-qtp/tests/auto/qprogressbar/tst_qprogressbar.cpp -=================================================================== ---- qt-maemo-qtp.orig/tests/auto/qprogressbar/tst_qprogressbar.cpp -+++ qt-maemo-qtp/tests/auto/qprogressbar/tst_qprogressbar.cpp -@@ -179,10 +179,14 @@ - bar.repainted = false; - bar.setFormat("%v of %m (%p%)"); - qApp->processEvents(); -+ -+#if 0 // Removed - #ifndef Q_WS_MAC - // The Mac scroll bar is animated, which means we get paint events all the time. - QVERIFY(!bar.repainted); - #endif -+#endif -+ - QCOMPARE(bar.text(), QString("1 of 10 (10%)")); - bar.setRange(5, 5); - bar.setValue(5); diff --git a/config.profiles/harmattan/patches/tst_qscrollbar.diff b/config.profiles/harmattan/patches/tst_qscrollbar.diff deleted file mode 100644 index 3c777a9..0000000 --- a/config.profiles/harmattan/patches/tst_qscrollbar.diff +++ /dev/null @@ -1,12 +0,0 @@ -Index: qt-maemo-qtp/tests/auto/qscrollbar/tst_qscrollbar.cpp -=================================================================== ---- qt-maemo-qtp.orig/tests/auto/qscrollbar/tst_qscrollbar.cpp -+++ qt-maemo-qtp/tests/auto/qscrollbar/tst_qscrollbar.cpp -@@ -104,6 +104,7 @@ - - void tst_QScrollBar::task_209492() - { -+ QSKIP("Unstable test on Harmattan", SkipSingle); - class MyScrollArea : public QScrollArea - { - public: diff --git a/config.profiles/harmattan/patches/tst_qvariant.diff b/config.profiles/harmattan/patches/tst_qvariant.diff deleted file mode 100644 index bcded52..0000000 --- a/config.profiles/harmattan/patches/tst_qvariant.diff +++ /dev/null @@ -1,21 +0,0 @@ -Index: qt-maemo-qtp/tests/auto/qvariant/tst_qvariant.cpp -=================================================================== ---- qt-maemo-qtp.orig/tests/auto/qvariant/tst_qvariant.cpp -+++ qt-maemo-qtp/tests/auto/qvariant/tst_qvariant.cpp -@@ -3122,6 +3122,7 @@ - - void tst_QVariant::numericalConvert() - { -+ int low_int = 3; - QVariant vfloat(float(5.3)); - QVariant vdouble(double(5.3)); - QVariant vreal(qreal(5.3)); -@@ -3137,7 +3138,7 @@ - - for(int i = 0; i < vect.size(); i++) { - double num = 5.3; -- if (i >= 3 && i <= 7) -+ if (i >= low_int && i <= 7) - num = 5; - QVariant *v = vect.at(i); - QCOMPARE(v->toFloat() , float(num)); -- cgit v0.12 From d376a506cc25dc2beb5c88ded145bc5e807f9f85 Mon Sep 17 00:00:00 2001 From: Morten Sorvig <msorvig@trolltech.com> Date: Wed, 16 Mar 2011 12:19:45 +0100 Subject: Rename qnaclunimplemented -> qfunctions_nacl (Match the existing files for wince and vxworks.) --- mkspecs/qws/linux-nacl-g++/qplatformdefs.h | 2 + mkspecs/qws/macx-nacl-g++/qplatformdefs.h | 2 + src/corelib/global/global.pri | 4 - src/corelib/global/qglobal.h | 4 - src/corelib/global/qnaclunimplemented.cpp | 156 ----------------------------- src/corelib/global/qnaclunimplemented.h | 97 ------------------ src/corelib/kernel/kernel.pri | 7 ++ src/corelib/kernel/qfunctions_nacl.cpp | 156 +++++++++++++++++++++++++++++ src/corelib/kernel/qfunctions_nacl.h | 97 ++++++++++++++++++ src/corelib/kernel/qfunctions_p.h | 2 + 10 files changed, 266 insertions(+), 261 deletions(-) delete mode 100644 src/corelib/global/qnaclunimplemented.cpp delete mode 100644 src/corelib/global/qnaclunimplemented.h create mode 100644 src/corelib/kernel/qfunctions_nacl.cpp create mode 100644 src/corelib/kernel/qfunctions_nacl.h diff --git a/mkspecs/qws/linux-nacl-g++/qplatformdefs.h b/mkspecs/qws/linux-nacl-g++/qplatformdefs.h index 70572bf..ec8ca8f 100644 --- a/mkspecs/qws/linux-nacl-g++/qplatformdefs.h +++ b/mkspecs/qws/linux-nacl-g++/qplatformdefs.h @@ -59,6 +59,8 @@ #define PATH_MAX 256 #include "../../common/posix/qplatformdefs.h" +#include "qfunctions_nacl.h" +#include <pthread.h> #undef QT_LSTAT #define QT_LSTAT QT_STAT diff --git a/mkspecs/qws/macx-nacl-g++/qplatformdefs.h b/mkspecs/qws/macx-nacl-g++/qplatformdefs.h index f893238..05b133f 100644 --- a/mkspecs/qws/macx-nacl-g++/qplatformdefs.h +++ b/mkspecs/qws/macx-nacl-g++/qplatformdefs.h @@ -58,6 +58,8 @@ #define PATH_MAX 256 #include "../../common/posix/qplatformdefs.h" +#include "qfunctions_nacl.h" +#include <pthread.h> #undef QT_LSTAT #define QT_LSTAT QT_STAT diff --git a/src/corelib/global/global.pri b/src/corelib/global/global.pri index 83caa96..d80706a 100644 --- a/src/corelib/global/global.pri +++ b/src/corelib/global/global.pri @@ -13,10 +13,6 @@ SOURCES += \ global/qmalloc.cpp \ global/qnumeric.cpp -nacl { - SOURCES += global/qnaclunimplemented.cpp -} - # qlibraryinfo.cpp includes qconfig.cpp INCLUDEPATH += $$QT_BUILD_TREE/src/corelib/global diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 1879537..0bcaeb5 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -2714,10 +2714,6 @@ QT_LICENSED_MODULE(DBus) # define QT_NO_PROCESS #endif -#ifdef Q_OS_NACL -#include <QtCore/qnaclunimplemented.h> -#endif - #if defined (__ELF__) # if defined (Q_OS_LINUX) || defined (Q_OS_SOLARIS) || defined (Q_OS_FREEBSD) || defined (Q_OS_OPENBSD) || defined (Q_OS_IRIX) # define Q_OF_ELF diff --git a/src/corelib/global/qnaclunimplemented.cpp b/src/corelib/global/qnaclunimplemented.cpp deleted file mode 100644 index 1a89b8df..0000000 --- a/src/corelib/global/qnaclunimplemented.cpp +++ /dev/null @@ -1,156 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtCore module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qnaclunimplemented.h" -#include <pthread.h> -#include <qglobal.h> - -/* - The purpose of this file is to stub out certain functions - that are not provided by the Native Client SDK. This is - done as an alterative to sprinkling the Qt sources with - NACL ifdefs. - - There are two main classes of functions: - - - Functions that are called but can have no effect: - For these we simply give an empty implementation - - - Functions that are referenced in the source code, but - is not/must not be called at run-time: - These we either leave undefined or implement with a - qFatal. - - This is a work in progress. -*/ - -extern "C" { - -void pthread_cleanup_push(void (*)(void *), void *) -{ - -} - -void pthread_cleanup_pop(int) -{ - -} - -int pthread_setcancelstate(int, int *) -{ - return 0; -} - -int pthread_setcanceltype(int, int *) -{ - return 0; -} - -void pthread_testcancel(void) -{ - -} - - -int pthread_cancel(pthread_t) -{ - return 0; -} - -int pthread_attr_setinheritsched(pthread_attr_t *,int) -{ - return 0; -} - - -int pthread_attr_getinheritsched(const pthread_attr_t *, int *) -{ - return 0; -} - -// event dispatcher, select -//struct fd_set; -//struct timeval; - -int fcntl(int, int, ...) -{ - return 0; -} - -int sigaction(int, const struct sigaction *, struct sigaction *) -{ - return 0; -} - -int open(const char *, int, ...) -{ - return 0; -} - -int open64(const char *, int, ...) -{ - return 0; -} - -int access(const char *, int) -{ - return 0; -} - -typedef long off64_t; -off64_t ftello64(void *) -{ - qFatal("ftello64 called"); - return 0; -} - -off64_t lseek64(int, off_t, int) -{ - qFatal("lseek64 called"); - return 0; -} - -} // Extern C - -int select(int, fd_set *, fd_set *, fd_set *, struct timeval *) -{ - return 0; -} diff --git a/src/corelib/global/qnaclunimplemented.h b/src/corelib/global/qnaclunimplemented.h deleted file mode 100644 index 921667e..0000000 --- a/src/corelib/global/qnaclunimplemented.h +++ /dev/null @@ -1,97 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtCore module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QNACLUNIMPLEMENTED_H -#define QNACLUNIMPLEMENTED_H - -#ifdef Q_OS_NACL - -#include <sys/types.h> - -// pthread -#include <pthread.h> -#define PTHREAD_CANCEL_DISABLE 1 -#define PTHREAD_CANCEL_ENABLE 2 -#define PTHREAD_INHERIT_SCHED 3 - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Core) - -extern "C" { - -void pthread_cleanup_push(void (*handler)(void *), void *arg); -void pthread_cleanup_pop(int execute); - -int pthread_setcancelstate(int state, int *oldstate); -int pthread_setcanceltype(int type, int *oldtype); -void pthread_testcancel(void); -int pthread_cancel(pthread_t thread); - -int pthread_attr_setinheritsched(pthread_attr_t *attr, - int inheritsched); -int pthread_attr_getinheritsched(const pthread_attr_t *attr, - int *inheritsched); - -// event dispatcher, select -//struct fd_set; -//struct timeval; -int fcntl(int fildes, int cmd, ...); -int sigaction(int sig, const struct sigaction * act, struct sigaction * oact); - -typedef long off64_t; -off64_t ftello64(void *stream); -off64_t lseek64(int fildes, off_t offset, int whence); -int open64(const char *path, int oflag, ...); - -} - -int select(int nfds, fd_set * readfds, fd_set * writefds, fd_set * errorfds, struct timeval * timeout); - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif //Q_OS_NACL - -#endif //QNACLUNIMPLEMENTED_H diff --git a/src/corelib/kernel/kernel.pri b/src/corelib/kernel/kernel.pri index c3a6721..a3628b1 100644 --- a/src/corelib/kernel/kernel.pri +++ b/src/corelib/kernel/kernel.pri @@ -90,6 +90,13 @@ mac:!nacl { kernel/qcore_mac.cpp } +nacl { + SOURCES += \ + kernel/qfunctions_nacl.cpp + HEADERS += \ + kernel/qfunctions_nacl.h +} + unix:!symbian { SOURCES += \ kernel/qcore_unix.cpp \ diff --git a/src/corelib/kernel/qfunctions_nacl.cpp b/src/corelib/kernel/qfunctions_nacl.cpp new file mode 100644 index 0000000..bc14cf0 --- /dev/null +++ b/src/corelib/kernel/qfunctions_nacl.cpp @@ -0,0 +1,156 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qfunctions_nacl.h" +#include <pthread.h> +#include <qglobal.h> + +/* + The purpose of this file is to stub out certain functions + that are not provided by the Native Client SDK. This is + done as an alterative to sprinkling the Qt sources with + NACL ifdefs. + + There are two main classes of functions: + + - Functions that are called but can have no effect: + For these we simply give an empty implementation + + - Functions that are referenced in the source code, but + is not/must not be called at run-time: + These we either leave undefined or implement with a + qFatal. + + This is a work in progress. +*/ + +extern "C" { + +void pthread_cleanup_push(void (*)(void *), void *) +{ + +} + +void pthread_cleanup_pop(int) +{ + +} + +int pthread_setcancelstate(int, int *) +{ + return 0; +} + +int pthread_setcanceltype(int, int *) +{ + return 0; +} + +void pthread_testcancel(void) +{ + +} + + +int pthread_cancel(pthread_t) +{ + return 0; +} + +int pthread_attr_setinheritsched(pthread_attr_t *,int) +{ + return 0; +} + + +int pthread_attr_getinheritsched(const pthread_attr_t *, int *) +{ + return 0; +} + +// event dispatcher, select +//struct fd_set; +//struct timeval; + +int fcntl(int, int, ...) +{ + return 0; +} + +int sigaction(int, const struct sigaction *, struct sigaction *) +{ + return 0; +} + +int open(const char *, int, ...) +{ + return 0; +} + +int open64(const char *, int, ...) +{ + return 0; +} + +int access(const char *, int) +{ + return 0; +} + +typedef long off64_t; +off64_t ftello64(void *) +{ + qFatal("ftello64 called"); + return 0; +} + +off64_t lseek64(int, off_t, int) +{ + qFatal("lseek64 called"); + return 0; +} + +} // Extern C + +int select(int, fd_set *, fd_set *, fd_set *, struct timeval *) +{ + return 0; +} diff --git a/src/corelib/kernel/qfunctions_nacl.h b/src/corelib/kernel/qfunctions_nacl.h new file mode 100644 index 0000000..921667e --- /dev/null +++ b/src/corelib/kernel/qfunctions_nacl.h @@ -0,0 +1,97 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QNACLUNIMPLEMENTED_H +#define QNACLUNIMPLEMENTED_H + +#ifdef Q_OS_NACL + +#include <sys/types.h> + +// pthread +#include <pthread.h> +#define PTHREAD_CANCEL_DISABLE 1 +#define PTHREAD_CANCEL_ENABLE 2 +#define PTHREAD_INHERIT_SCHED 3 + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +extern "C" { + +void pthread_cleanup_push(void (*handler)(void *), void *arg); +void pthread_cleanup_pop(int execute); + +int pthread_setcancelstate(int state, int *oldstate); +int pthread_setcanceltype(int type, int *oldtype); +void pthread_testcancel(void); +int pthread_cancel(pthread_t thread); + +int pthread_attr_setinheritsched(pthread_attr_t *attr, + int inheritsched); +int pthread_attr_getinheritsched(const pthread_attr_t *attr, + int *inheritsched); + +// event dispatcher, select +//struct fd_set; +//struct timeval; +int fcntl(int fildes, int cmd, ...); +int sigaction(int sig, const struct sigaction * act, struct sigaction * oact); + +typedef long off64_t; +off64_t ftello64(void *stream); +off64_t lseek64(int fildes, off_t offset, int whence); +int open64(const char *path, int oflag, ...); + +} + +int select(int nfds, fd_set * readfds, fd_set * writefds, fd_set * errorfds, struct timeval * timeout); + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif //Q_OS_NACL + +#endif //QNACLUNIMPLEMENTED_H diff --git a/src/corelib/kernel/qfunctions_p.h b/src/corelib/kernel/qfunctions_p.h index 3d41c0c..d27fec3 100644 --- a/src/corelib/kernel/qfunctions_p.h +++ b/src/corelib/kernel/qfunctions_p.h @@ -59,6 +59,8 @@ # include "QtCore/qfunctions_wince.h" #elif defined(Q_OS_VXWORKS) # include "QtCore/qfunctions_vxworks.h" +#elif defined(Q_OS_NACL) +# include "QtCore/qfunctions_nacl.h" #endif #ifdef Q_CC_RVCT -- cgit v0.12 From ce8fd88984f3da545de8132b6094ed519bdbaa11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= <jorgen.lind@nokia.com> Date: Wed, 16 Mar 2011 15:10:01 +0100 Subject: Lighthouse: Add pkg-config check for opengl es2 --- configure | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 2ea3689..bf9d0b4 100755 --- a/configure +++ b/configure @@ -6134,7 +6134,16 @@ if [ "$PLATFORM_QPA" = "yes" ]; then fi elif [ "$CFG_OPENGL" = "es2" ]; then #OpenGL ES 2.x - "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles2 "OpenGL ES 2.x" $L_FLAGS $I_FLAGS $l_FLAGS + if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists glesv2 2>/dev/null; then + QMAKE_INCDIR_OPENGL_ES2=`$PKG_CONFIG --variable=includedir glesv2 2>/dev/null` + QMAKE_LIBDIR_OPENGL_ES2=`$PKG_CONFIG --variable=libdir glesv2 2>/dev/null` + QMAKE_LIBS_OPENGL_ES2=`$PKG_CONFIG --libs glesv2 2>/dev/null` + QMakeVar set QMAKE_INCDIR_OPENGL_ES2 "$QMAKE_INCDIR_OPENGL_ES2" + QMakeVar set QMAKE_LIBDIR_OPENGL_ES2 "$QMAKE_LIBDIR_OPENGL_ES2" + QMakeVar set QMAKE_LIBS_OPENGL_ES2 "$QMAKE_LIBS_OPENGL_ES2" + fi + + "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles2 "OpenGL ES 2.x" $L_FLAGS $I_FLAGS $l_FLAGS -I$QMAKE_INCDIR_OPENGL_ES2 $QMAKE_LIBS_OPENGL_ES2 -L$QMAKE_LIBDIR_OPENGL_ES2 if [ $? != "0" ]; then echo "The OpenGL ES 2.0 functionality test failed!" echo " You might need to modify the include and library search paths by editing" -- cgit v0.12 From f2f545a37982e44c3a9e614b64bf484294c13756 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= <jorgen.lind@nokia.com> Date: Wed, 16 Mar 2011 15:11:40 +0100 Subject: Lighthouse: Make sure we don't use xkbcommon when we don't have it --- configure | 18 ++++++++++++++---- mkspecs/common/linux.conf | 3 ++- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/configure b/configure index bf9d0b4..a71dd31 100755 --- a/configure +++ b/configure @@ -6181,10 +6181,18 @@ if [ "$PLATFORM_QPA" = "yes" ]; then fi - if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists wayland-client xkbcommon 2>/dev/null; then - QMAKE_CFLAGS_WAYLAND=`$PKG_CONFIG --cflags wayland-client xkbcommon 2>/dev/null` - QMAKE_LIBS_WAYLAND=`$PKG_CONFIG --libs wayland-client xkbcommon 2>/dev/null` - QMAKE_INCDIR_WAYLAND=`$PKG_CONFIG --variable=includedir wayland-client xkbcommon 2>/dev/null` + if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists wayland-client 2>/dev/null; then + QMAKE_CFLAGS_WAYLAND=`$PKG_CONFIG --cflags wayland-client 2>/dev/null` + QMAKE_LIBS_WAYLAND=`$PKG_CONFIG --libs wayland-client 2>/dev/null` + QMAKE_INCDIR_WAYLAND=`$PKG_CONFIG --variable=includedir wayland-client 2>/dev/null` + QMAKE_LIBDIR_WAYLAND=`$PKG_CONFIG --variable=libdir wayland-client 2>/dev/null` + + if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists xkbcommon 2>/dev/null; then + QMAKE_CFLAGS_WAYLAND=$QMAKE_CFLAGS_WAYLAND `$PKG_CONFIG --cflags xkbcommon 2>/dev/null` + QMAKE_LIBS_WAYLAND=$QMAKE_LIBS_WAYLAND `$PKG_CONFIG --libs xkbcommon 2>/dev/null` + else + QMAKE_DEFINES_WAYLAND=QT_NO_WAYLAND_XKB + fi fi # QMake variables set here override those in the mkspec. Therefore we only set the variables here if they are not zero. @@ -6192,6 +6200,8 @@ if [ "$PLATFORM_QPA" = "yes" ]; then QMakeVar set QMAKE_CFLAGS_WAYLAND "$QMAKE_CFLAGS_WAYLAND" QMakeVar set QMAKE_INCDIR_WAYLAND "$QMAKE_INCDIR_WAYLAND" QMakeVar set QMAKE_LIBS_WAYLAND "$QMAKE_LIBS_WAYLAND" + QMakeVar set QMAKE_LIBDIR_WAYLAND "$QMAKE_LIBDIR_WAYLAND" + QMakeVar set QMAKE_DEFINES_WAYLAND " $QMAKE_DEFINES_WAYLAND" fi if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/qpa/wayland "Wayland" $L_FLAGS $I_FLAGS $l_FLAGS $QMAKE_CFLAGS_WAYLAND -I$QMAKE_INCDIR_WAYLAND $QMAKE_LIBS_WAYLAND; then diff --git a/mkspecs/common/linux.conf b/mkspecs/common/linux.conf index 283cf83..d60533e 100644 --- a/mkspecs/common/linux.conf +++ b/mkspecs/common/linux.conf @@ -37,7 +37,8 @@ QMAKE_LIBS_THREAD = -lpthread QMAKE_CFLAGS_WAYLAND = QMAKE_INCDIR_WAYLAND = -QMAKE_LIBS_WAYLAND = -lwayland-client -lxkbcommon +QMAKE_LIBS_WAYLAND = +QMAKE_LIBDIR_WAYLAND = QMAKE_DEFINES_WAYLAND = QMAKE_MOC = $$[QT_INSTALL_BINS]/moc -- cgit v0.12 From f3ec9966ab23d1c4e56e17e593b99165364612ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= <jorgen.lind@nokia.com> Date: Wed, 16 Mar 2011 15:52:07 +0100 Subject: Lighthouse: Xcb, compile fix for the glx path --- src/plugins/platforms/xcb/qxcbconnection.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index da60311..5a6bef7 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -443,10 +443,12 @@ void QXcbConnection::initializeAllAtoms() { m_allAtoms[i] = xcb_intern_atom_reply(xcb_connection(), cookies[i], 0)->atom; } +#if defined(XCB_USE_EGL) bool QXcbConnection::hasEgl() const { return m_has_egl; } +#endif // defined(XCB_USE_EGL) #ifdef XCB_USE_DRI2 void QXcbConnection::initializeDri2() -- cgit v0.12 From 50c0c6a032ef2c0af8c93f52f5c2f86ca145e852 Mon Sep 17 00:00:00 2001 From: Yann Bodson <yann.bodson@nokia.com> Date: Thu, 17 Mar 2011 14:41:40 +1000 Subject: Re-enable lineHeight tests. These tests were disabled by 24d8e96624af91ab01a20c10625858300f16099b Change-Id: I5bf3e11dfb3c975415c3039b39a39c22984d2900 --- tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp index 2d52642..581b58c 100644 --- a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp +++ b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp @@ -1206,13 +1206,13 @@ void tst_qdeclarativetext::lineHeight() myText->setLineHeightMode(QDeclarativeText::ProportionalHeight); myText->setLineHeight(1.0); - //qreal h2 = myText->height(); + qreal h2 = myText->height(); myText->setLineHeight(2.0); - //QVERIFY(myText->height() == h2 * 2.0); + QVERIFY(myText->height() == h2 * 2.0); myText->setLineHeightMode(QDeclarativeText::FixedHeight); myText->setLineHeight(10); - //QCOMPARE(myText->height(), myText->lineCount() * 10.0); + QCOMPARE(myText->height(), myText->lineCount() * 10.0); delete canvas; } -- cgit v0.12 From 82a53835a71a8e1902774c67e792bf6d7d6385de Mon Sep 17 00:00:00 2001 From: Martin Jones <martin.jones@nokia.com> Date: Thu, 17 Mar 2011 14:24:50 +1000 Subject: QDeclarativeView flickers when composited on MeeGo Set Qt::WA_OpaquePaintEvent and Qt::WA_NoSystemBackground for QDeclarativeView on meego. Change-Id: I301d2381ae831485d205ff42b0c15b3fa7a73424 Task-number: QTBUG-17173 Reviewed-by: Michael Brasser --- doc/src/declarative/qdeclarativeperformance.qdoc | 11 +++++++++++ src/declarative/declarative.pro | 2 ++ src/declarative/util/qdeclarativeview.cpp | 7 +++++++ 3 files changed, 20 insertions(+) diff --git a/doc/src/declarative/qdeclarativeperformance.qdoc b/doc/src/declarative/qdeclarativeperformance.qdoc index 36b4878..6760869 100644 --- a/doc/src/declarative/qdeclarativeperformance.qdoc +++ b/doc/src/declarative/qdeclarativeperformance.qdoc @@ -136,4 +136,15 @@ The QML Viewer uses the raster graphics system by default for X11 and OS X. It a includes a \c -opengl command line option which sets a QGLWidget as the viewport of the view. On OS X, a QGLWidget is always used. +You can also prevent QDeclarativeView from painting its window background if +you will provide the background of your application using QML, e.g. + +\code +QDeclarativeView window; +window.setAttribute(Qt::WA_OpaquePaintEvent); +window.setAttribute(Qt::WA_NoSystemBackground); +window.viewport()->setAttribute(Qt::WA_OpaquePaintEvent); +window.viewport()->setAttribute(Qt::WA_NoSystemBackground); +\endcode + */ diff --git a/src/declarative/declarative.pro b/src/declarative/declarative.pro index 1ad888b..f3a7db9 100644 --- a/src/declarative/declarative.pro +++ b/src/declarative/declarative.pro @@ -29,6 +29,8 @@ symbian: { LIBS += -lefsrv } +linux-g++-maemo:DEFINES += QDECLARATIVEVIEW_NOBACKGROUND + DEFINES += QT_NO_OPENTYPE INCLUDEPATH += ../3rdparty/harfbuzz/src diff --git a/src/declarative/util/qdeclarativeview.cpp b/src/declarative/util/qdeclarativeview.cpp index c2e5efe..13880c2 100644 --- a/src/declarative/util/qdeclarativeview.cpp +++ b/src/declarative/util/qdeclarativeview.cpp @@ -293,6 +293,13 @@ void QDeclarativeViewPrivate::init() q->setFocusPolicy(Qt::StrongFocus); q->scene()->setStickyFocus(true); //### needed for correct focus handling + +#ifdef QDECLARATIVEVIEW_NOBACKGROUND + q->setAttribute(Qt::WA_OpaquePaintEvent); + q->setAttribute(Qt::WA_NoSystemBackground); + q->viewport()->setAttribute(Qt::WA_OpaquePaintEvent); + q->viewport()->setAttribute(Qt::WA_NoSystemBackground); +#endif } /*! -- cgit v0.12 From cb0b93e3ef107b8a47445c926753b6bcf07b796d Mon Sep 17 00:00:00 2001 From: Yann Bodson <yann.bodson@nokia.com> Date: Thu, 17 Mar 2011 16:12:29 +1000 Subject: Doc improvement for Image.fillMode. Change-Id: I2aec2c9fae07a8551001b2c7d5f5ab8da0fbb7df Task-number: QTBUG-14899 --- src/declarative/graphicsitems/qdeclarativeimage.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativeimage.cpp b/src/declarative/graphicsitems/qdeclarativeimage.cpp index 2c9bde5..ec20200 100644 --- a/src/declarative/graphicsitems/qdeclarativeimage.cpp +++ b/src/declarative/graphicsitems/qdeclarativeimage.cpp @@ -147,8 +147,8 @@ void QDeclarativeImagePrivate::setPixmap(const QPixmap &pixmap) /*! \qmlproperty enumeration Image::fillMode - Set this property to define what happens when the image set for the item is smaller - than the size of the item. + Set this property to define what happens when the source image has a different size + than the item. \list \o Image.Stretch - the image is scaled to fit @@ -234,6 +234,9 @@ void QDeclarativeImagePrivate::setPixmap(const QPixmap &pixmap) \endtable + Note that \c clip is \c false by default which means that the element might + paint outside its bounding rectangle even if the fillMode is set to \c PreserveAspectCrop. + \sa {declarative/imageelements/image}{Image example} */ QDeclarativeImage::FillMode QDeclarativeImage::fillMode() const -- cgit v0.12 From 695a39410c8ce186a2ce78cef51093c55fc32643 Mon Sep 17 00:00:00 2001 From: Martin Jones <martin.jones@nokia.com> Date: Thu, 17 Mar 2011 17:10:56 +1000 Subject: Image.PreserveAspectFit has unexpected effect on Image's sourceSize The sourceSize should always be the size of the image, unless set otherwise. When calculating the size of an image with Image.PreserveAspectFit set the natural image size should be used for the calculation if no size has been set explicitly. Change-Id: I104b7d1c3c16aa5b4fc98b1f9078ed8ae997cf69 Task-number: QTBUG-16389 Reviewed-by: Joona Petrell --- .../graphicsitems/qdeclarativeimage.cpp | 10 +++++--- .../graphicsitems/qdeclarativeimagebase.cpp | 2 +- .../qdeclarativeimage/data/qtbug_16389.qml | 30 ++++++++++++++++++++++ .../qdeclarativeimage/tst_qdeclarativeimage.cpp | 24 +++++++++++++++++ 4 files changed, 61 insertions(+), 5 deletions(-) create mode 100644 tests/auto/declarative/qdeclarativeimage/data/qtbug_16389.qml diff --git a/src/declarative/graphicsitems/qdeclarativeimage.cpp b/src/declarative/graphicsitems/qdeclarativeimage.cpp index ec20200..ed5d5fc 100644 --- a/src/declarative/graphicsitems/qdeclarativeimage.cpp +++ b/src/declarative/graphicsitems/qdeclarativeimage.cpp @@ -389,14 +389,16 @@ void QDeclarativeImage::updatePaintedGeometry() if (d->fillMode == PreserveAspectFit) { if (!d->pix.width() || !d->pix.height()) return; - qreal widthScale = width() / qreal(d->pix.width()); - qreal heightScale = height() / qreal(d->pix.height()); + qreal w = widthValid() ? width() : d->pix.width(); + qreal widthScale = w / qreal(d->pix.width()); + qreal h = heightValid() ? height() : d->pix.height(); + qreal heightScale = h / qreal(d->pix.height()); if (widthScale <= heightScale) { - d->paintedWidth = width(); + d->paintedWidth = w; d->paintedHeight = widthScale * qreal(d->pix.height()); } else if(heightScale < widthScale) { d->paintedWidth = heightScale * qreal(d->pix.width()); - d->paintedHeight = height(); + d->paintedHeight = h; } if (widthValid() && !heightValid()) { setImplicitHeight(d->paintedHeight); diff --git a/src/declarative/graphicsitems/qdeclarativeimagebase.cpp b/src/declarative/graphicsitems/qdeclarativeimagebase.cpp index 471c87f..2de3ba0 100644 --- a/src/declarative/graphicsitems/qdeclarativeimagebase.cpp +++ b/src/declarative/graphicsitems/qdeclarativeimagebase.cpp @@ -130,7 +130,7 @@ QSize QDeclarativeImageBase::sourceSize() const int width = d->sourcesize.width(); int height = d->sourcesize.height(); - return QSize(width != -1 ? width : implicitWidth(), height != -1 ? height : implicitHeight()); + return QSize(width != -1 ? width : d->pix.width(), height != -1 ? height : d->pix.height()); } bool QDeclarativeImageBase::cache() const diff --git a/tests/auto/declarative/qdeclarativeimage/data/qtbug_16389.qml b/tests/auto/declarative/qdeclarativeimage/data/qtbug_16389.qml new file mode 100644 index 0000000..29fba40 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeimage/data/qtbug_16389.qml @@ -0,0 +1,30 @@ +import QtQuick 1.0 +Rectangle { + width: 400 + height: 400 + + Item { + anchors.top: parent.top + anchors.left: parent.left + anchors.bottom: blueHandle.top + anchors.right: blueHandle.left + + Image { + id: iconImage + objectName: "iconImage" + anchors.top: parent.top + anchors.bottom: parent.bottom + source: "heart200.png" + fillMode: Image.PreserveAspectFit + smooth: true + } + } + + Rectangle { + id: blueHandle + objectName: "blueHandle" + color: "blue" + width: 25 + height: 25 + } +} diff --git a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp index f1fe2bd..9e090d2 100644 --- a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp +++ b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp @@ -89,6 +89,7 @@ private slots: void noLoading(); void paintedWidthHeight(); void sourceSize_QTBUG_14303(); + void sourceSize_QTBUG_16389(); void nullPixmapPaint(); void testQtQuick11Attributes(); void testQtQuick11Attributes_data(); @@ -640,6 +641,29 @@ void tst_qdeclarativeimage::sourceSize_QTBUG_14303() QTRY_COMPARE(sourceSizeSpy.count(), 2); } +void tst_qdeclarativeimage::sourceSize_QTBUG_16389() +{ + QDeclarativeView *canvas = new QDeclarativeView(0); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/qtbug_16389.qml")); + canvas->show(); + qApp->processEvents(); + + QDeclarativeImage *image = findItem<QDeclarativeImage>(canvas->rootObject(), "iconImage"); + QDeclarativeItem *handle = findItem<QDeclarativeItem>(canvas->rootObject(), "blueHandle"); + + QCOMPARE(image->sourceSize().width(), 200); + QCOMPARE(image->sourceSize().height(), 200); + QCOMPARE(image->paintedWidth(), 0.0); + QCOMPARE(image->paintedHeight(), 0.0); + + handle->setY(20); + + QCOMPARE(image->sourceSize().width(), 200); + QCOMPARE(image->sourceSize().height(), 200); + QCOMPARE(image->paintedWidth(), 20.0); + QCOMPARE(image->paintedHeight(), 20.0); +} + static int numberOfWarnings = 0; static void checkWarnings(QtMsgType, const char *) { -- cgit v0.12 From ac704e9f682378a5ec56e3f5c195dcf2f2dfa1ac Mon Sep 17 00:00:00 2001 From: Martin Jones <martin.jones@nokia.com> Date: Thu, 17 Mar 2011 18:01:50 +1000 Subject: PathView doesn't update if preferred highlight range changes. Simply call refill() when they change. Change-Id: I45ab56cbcaf5c726ce4c4f23f66ee687a6d89dad Task-number: QTBUG-15356 Reviewed-by: Kevin Wu Won --- .../graphicsitems/qdeclarativepathview.cpp | 2 ++ .../qdeclarativepathview/data/dragpath.qml | 2 +- .../tst_qdeclarativepathview.cpp | 40 ++++++++++++++++++++++ 3 files changed, 43 insertions(+), 1 deletion(-) diff --git a/src/declarative/graphicsitems/qdeclarativepathview.cpp b/src/declarative/graphicsitems/qdeclarativepathview.cpp index 4e401e9..778b8b9 100644 --- a/src/declarative/graphicsitems/qdeclarativepathview.cpp +++ b/src/declarative/graphicsitems/qdeclarativepathview.cpp @@ -796,6 +796,7 @@ void QDeclarativePathView::setPreferredHighlightBegin(qreal start) return; d->highlightRangeStart = start; d->haveHighlightRange = d->highlightRangeMode != NoHighlightRange && d->highlightRangeStart <= d->highlightRangeEnd; + refill(); emit preferredHighlightBeginChanged(); } @@ -812,6 +813,7 @@ void QDeclarativePathView::setPreferredHighlightEnd(qreal end) return; d->highlightRangeEnd = end; d->haveHighlightRange = d->highlightRangeMode != NoHighlightRange && d->highlightRangeStart <= d->highlightRangeEnd; + refill(); emit preferredHighlightEndChanged(); } diff --git a/tests/auto/declarative/qdeclarativepathview/data/dragpath.qml b/tests/auto/declarative/qdeclarativepathview/data/dragpath.qml index a361bdc..0f94840 100644 --- a/tests/auto/declarative/qdeclarativepathview/data/dragpath.qml +++ b/tests/auto/declarative/qdeclarativepathview/data/dragpath.qml @@ -9,7 +9,7 @@ PathView { startX: 0; startY: 100 PathLine { x: 400; y: 100 } } - delegate: Rectangle { height: 100; width: 1; color: PathView.isCurrentItem?"red" : "black" } + delegate: Rectangle { objectName: "wrapper"; height: 100; width: 2; color: PathView.isCurrentItem?"red" : "black" } dragMargin: 100 preferredHighlightBegin: 0.5 preferredHighlightEnd: 0.5 diff --git a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp index ebb5f98..8000137 100644 --- a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp +++ b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp @@ -111,6 +111,7 @@ private slots: void undefinedPath(); void mouseDrag(); void treeModel(); + void changePreferredHighlight(); private: QDeclarativeView *createView(); @@ -948,6 +949,45 @@ void tst_QDeclarativePathView::treeModel() delete canvas; } +void tst_QDeclarativePathView::changePreferredHighlight() +{ + QDeclarativeView *canvas = createView(); + canvas->setFixedSize(400,200); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/dragpath.qml")); + canvas->show(); + QApplication::setActiveWindow(canvas); + QTest::qWaitForWindowShown(canvas); + QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(canvas)); + + QDeclarativePathView *pathview = qobject_cast<QDeclarativePathView*>(canvas->rootObject()); + QVERIFY(pathview != 0); + + int current = pathview->currentIndex(); + QCOMPARE(current, 0); + + QDeclarativeRectangle *firstItem = findItem<QDeclarativeRectangle>(pathview, "wrapper", 0); + QVERIFY(firstItem); + QDeclarativePath *path = qobject_cast<QDeclarativePath*>(pathview->path()); + QVERIFY(path); + QPointF start = path->pointAt(0.5); + start.setX(qRound(start.x())); + start.setY(qRound(start.y())); + QPointF offset;//Center of item is at point, but pos is from corner + offset.setX(firstItem->width()/2); + offset.setY(firstItem->height()/2); + QTRY_COMPARE(firstItem->pos() + offset, start); + + pathview->setPreferredHighlightBegin(0.8); + pathview->setPreferredHighlightEnd(0.8); + start = path->pointAt(0.8); + start.setX(qRound(start.x())); + start.setY(qRound(start.y())); + QTRY_COMPARE(firstItem->pos() + offset, start); + QCOMPARE(pathview->currentIndex(), 0); + + delete canvas; +} + QDeclarativeView *tst_QDeclarativePathView::createView() { QDeclarativeView *canvas = new QDeclarativeView(0); -- cgit v0.12 From 58548add6d3ff7c09db0573abdba4d006a10bad1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= <samuel.rodal@nokia.com> Date: Wed, 16 Mar 2011 10:45:16 +0100 Subject: Don't skip remaining events on unhandled events in xcb backend. --- src/plugins/platforms/xcb/qxcbconnection.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index 5a6bef7..de3f926 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -216,6 +216,7 @@ void printXcbEvent(const char *message, xcb_generic_event_t *event) void QXcbConnection::eventDispatcher() { while (xcb_generic_event_t *event = xcb_poll_for_event(xcb_connection())) { + bool handled = true; switch (event->response_type & ~0x80) { case XCB_EXPOSE: HANDLE_PLATFORM_WINDOW_EVENT(xcb_expose_event_t, window, handleExposeEvent); @@ -245,10 +246,13 @@ void QXcbConnection::eventDispatcher() m_keyboard->handleMappingNotifyEvent((xcb_mapping_notify_event_t *)event); break; default: - printXcbEvent("Unhandled XCB event", event); + handled = false; return; } - printXcbEvent("Handled XCB event", event); + if (handled) + printXcbEvent("Handled XCB event", event); + else + printXcbEvent("Unhandled XCB event", event); } } -- cgit v0.12 From 64f06b90f58a3f88482e116fa36f2b26acd82b0b Mon Sep 17 00:00:00 2001 From: Morten Sorvig <msorvig@trolltech.com> Date: Thu, 17 Mar 2011 12:22:26 +0100 Subject: Mac: add autorelease pools to create_sys Fixes a couple of on-startup leaks. --- src/gui/kernel/qwidget_mac.mm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index 14a90ef..34918e4 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -2476,6 +2476,8 @@ void QWidgetPrivate::createWindow_sys() void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyOldWindow) { Q_Q(QWidget); + QMacCocoaAutoReleasePool pool; + OSViewRef destroyid = 0; #ifndef QT_MAC_USE_COCOA window_event = 0; @@ -4423,6 +4425,8 @@ void QWidgetPrivate::adjustWithinMaxAndMinSize(int &w, int &h) void QWidgetPrivate::applyMaxAndMinSizeOnWindow() { Q_Q(QWidget); + QMacCocoaAutoReleasePool pool; + const float max_f(20000); #ifndef QT_MAC_USE_COCOA #define SF(x) ((x > max_f) ? max_f : x) -- cgit v0.12 From 2ba58fc0a36a30d19e46f9c012598958f98c2e33 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint <Friedemann.Kleint@nokia.com> Date: Thu, 17 Mar 2011 12:23:51 +0100 Subject: Clipboard/Windows: Fix a hang when sending to non-responsive clients. Check if clipboard viewer is responsive before sending the contents. This prevents Qt Creator from hanging when copying text while a debugging session with a crashed/stopped debuggee is in progress. Reviewed-by: Prasanth Ullattil <prasanth.ullattil@nokia.com> Task-number: QTBUG-17465 --- src/gui/kernel/qclipboard_win.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/qclipboard_win.cpp b/src/gui/kernel/qclipboard_win.cpp index 52b9663..ea41165 100644 --- a/src/gui/kernel/qclipboard_win.cpp +++ b/src/gui/kernel/qclipboard_win.cpp @@ -52,6 +52,7 @@ #include "qt_windows.h" #include "qdnd_p.h" #include <private/qwidget_p.h> +#include <private/qsystemlibrary_p.h> QT_BEGIN_NAMESPACE @@ -70,6 +71,9 @@ void QtCeFlushClipboard(); #endif +typedef BOOL (WINAPI *PtrIsHungAppWindow)(HWND); + +static PtrIsHungAppWindow ptrIsHungAppWindow = 0; class QClipboardWatcher : public QInternalMimeData { public: @@ -327,9 +331,16 @@ bool QClipboard::event(QEvent *e) d->releaseIData(); propagate = true; } - if (propagate && d->nextClipboardViewer) { - SendMessage(d->nextClipboardViewer, m->message, m->wParam, m->lParam); + if (ptrIsHungAppWindow == 0) { + QSystemLibrary library(QLatin1String("User32")); + ptrIsHungAppWindow = (PtrIsHungAppWindow)library.resolve("IsHungAppWindow"); + } + if (ptrIsHungAppWindow && ptrIsHungAppWindow(d->nextClipboardViewer)) { + qWarning("%s: Cowardly refusing to send clipboard message to hung application...", Q_FUNC_INFO); + } else { + SendMessage(d->nextClipboardViewer, m->message, m->wParam, m->lParam); + } } return true; -- cgit v0.12 From 1cd2752dab75ed88a4b41e352dc695060935594a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= <jorgen.lind@nokia.com> Date: Thu, 17 Mar 2011 12:32:41 +0100 Subject: Fixup license headers in Lighthouse plugins --- src/plugins/platforms/cocoa/main.mm | 2 +- .../platforms/cocoa/qcocoaautoreleasepool.h | 2 +- .../platforms/cocoa/qcocoaautoreleasepool.mm | 2 +- .../platforms/cocoa/qcocoaeventloopintegration.h | 2 +- .../platforms/cocoa/qcocoaeventloopintegration.mm | 2 +- src/plugins/platforms/cocoa/qcocoaintegration.h | 2 +- src/plugins/platforms/cocoa/qcocoaintegration.mm | 2 +- src/plugins/platforms/cocoa/qcocoawindow.h | 4 +-- src/plugins/platforms/cocoa/qcocoawindow.mm | 4 +-- src/plugins/platforms/cocoa/qcocoawindowsurface.h | 4 +-- src/plugins/platforms/cocoa/qcocoawindowsurface.mm | 4 +-- src/plugins/platforms/cocoa/qnsview.h | 2 +- src/plugins/platforms/cocoa/qnsview.mm | 2 +- src/plugins/platforms/cocoa/qnswindowdelegate.h | 2 +- src/plugins/platforms/cocoa/qnswindowdelegate.mm | 2 +- src/plugins/platforms/directfb/main.cpp | 2 +- .../eglconvenience/qxlibeglintegration.cpp | 4 +-- .../platforms/eglconvenience/qxlibeglintegration.h | 2 +- src/plugins/platforms/linuxfb/main.cpp | 2 +- .../platforms/linuxfb/qlinuxfbintegration.cpp | 2 +- .../platforms/linuxfb/qlinuxfbintegration.h | 2 +- src/plugins/platforms/openvglite/main.cpp | 2 +- .../openvglite/qgraphicssystem_vglite.cpp | 2 +- .../platforms/openvglite/qgraphicssystem_vglite.h | 2 +- .../platforms/openvglite/qwindowsurface_vglite.cpp | 4 +-- .../platforms/openvglite/qwindowsurface_vglite.h | 2 +- src/plugins/platforms/qvfb/main.cpp | 2 +- src/plugins/platforms/qvfb/qvfbintegration.cpp | 2 +- src/plugins/platforms/qvfb/qvfbintegration.h | 2 +- src/plugins/platforms/qvfb/qvfbwindowsurface.cpp | 4 +-- src/plugins/platforms/qvfb/qvfbwindowsurface.h | 4 +-- .../qmlapplicationviewer/qmlapplicationviewer.cpp | 41 ++++++++++++++++++++++ .../qmlapplicationviewer/qmlapplicationviewer.h | 41 ++++++++++++++++++++++ src/plugins/platforms/uikit/main.mm | 2 +- src/plugins/platforms/uikit/quikiteventloop.h | 2 +- src/plugins/platforms/uikit/quikiteventloop.mm | 2 +- src/plugins/platforms/uikit/quikitintegration.h | 2 +- src/plugins/platforms/uikit/quikitintegration.mm | 2 +- src/plugins/platforms/uikit/quikitscreen.h | 2 +- src/plugins/platforms/uikit/quikitscreen.mm | 2 +- src/plugins/platforms/uikit/quikitwindow.h | 2 +- src/plugins/platforms/uikit/quikitwindow.mm | 2 +- src/plugins/platforms/uikit/quikitwindowsurface.h | 2 +- src/plugins/platforms/uikit/quikitwindowsurface.mm | 2 +- src/plugins/platforms/vnc/main.cpp | 2 +- src/plugins/platforms/vnc/qvnccursor.cpp | 4 +-- src/plugins/platforms/vnc/qvnccursor.h | 4 +-- src/plugins/platforms/vnc/qvncintegration.cpp | 2 +- src/plugins/platforms/vnc/qvncintegration.h | 2 +- src/plugins/platforms/vnc/qvncserver.cpp | 2 +- src/plugins/platforms/vnc/qvncserver.h | 2 +- src/plugins/platforms/wayland/main.cpp | 2 +- src/plugins/platforms/wayland/qwaylandcursor.cpp | 2 +- src/plugins/platforms/wayland/qwaylandcursor.h | 2 +- .../platforms/wayland/qwaylanddrmsurface.cpp | 4 +-- .../platforms/wayland/qwaylandintegration.h | 2 +- .../platforms/wayland/qwaylandshmsurface.cpp | 4 +-- src/plugins/platforms/wayland/qwaylandshmsurface.h | 4 +-- src/plugins/platforms/xcb/main.cpp | 2 +- src/plugins/platforms/xcb/qdri2context.cpp | 41 ++++++++++++++++++++++ src/plugins/platforms/xcb/qdri2context.h | 41 ++++++++++++++++++++++ src/plugins/platforms/xcb/qglxintegration.cpp | 2 +- src/plugins/platforms/xcb/qglxintegration.h | 2 +- src/plugins/platforms/xcb/qxcbconnection.cpp | 2 +- src/plugins/platforms/xcb/qxcbconnection.h | 2 +- src/plugins/platforms/xcb/qxcbintegration.cpp | 2 +- src/plugins/platforms/xcb/qxcbintegration.h | 2 +- src/plugins/platforms/xcb/qxcbkeyboard.cpp | 2 +- src/plugins/platforms/xcb/qxcbkeyboard.h | 2 +- src/plugins/platforms/xcb/qxcbnativeinterface.cpp | 41 ++++++++++++++++++++++ src/plugins/platforms/xcb/qxcbnativeinterface.h | 41 ++++++++++++++++++++++ src/plugins/platforms/xcb/qxcbobject.h | 2 +- src/plugins/platforms/xcb/qxcbscreen.cpp | 2 +- src/plugins/platforms/xcb/qxcbscreen.h | 2 +- src/plugins/platforms/xcb/qxcbwindow.cpp | 2 +- src/plugins/platforms/xcb/qxcbwindow.h | 2 +- src/plugins/platforms/xcb/qxcbwindowsurface.cpp | 2 +- src/plugins/platforms/xcb/qxcbwindowsurface.h | 2 +- src/plugins/platforms/xlib/main.cpp | 2 +- src/plugins/platforms/xlib/qglxintegration.cpp | 2 +- src/plugins/platforms/xlib/qglxintegration.h | 2 +- src/plugins/platforms/xlib/qxlibclipboard.cpp | 4 +-- src/plugins/platforms/xlib/qxlibclipboard.h | 4 +-- src/plugins/platforms/xlib/qxlibcursor.cpp | 2 +- src/plugins/platforms/xlib/qxlibcursor.h | 4 +-- src/plugins/platforms/xlib/qxlibdisplay.cpp | 41 ++++++++++++++++++++++ src/plugins/platforms/xlib/qxlibdisplay.h | 41 ++++++++++++++++++++++ src/plugins/platforms/xlib/qxlibintegration.cpp | 2 +- src/plugins/platforms/xlib/qxlibintegration.h | 2 +- src/plugins/platforms/xlib/qxlibkeyboard.cpp | 2 +- src/plugins/platforms/xlib/qxlibkeyboard.h | 2 +- src/plugins/platforms/xlib/qxlibmime.cpp | 2 +- src/plugins/platforms/xlib/qxlibmime.h | 2 +- src/plugins/platforms/xlib/qxlibscreen.cpp | 2 +- src/plugins/platforms/xlib/qxlibscreen.h | 2 +- src/plugins/platforms/xlib/qxlibstatic.cpp | 2 +- src/plugins/platforms/xlib/qxlibstatic.h | 2 +- src/plugins/platforms/xlib/qxlibwindow.cpp | 4 +-- src/plugins/platforms/xlib/qxlibwindow.h | 4 +-- src/plugins/platforms/xlib/qxlibwindowsurface.cpp | 4 +-- src/plugins/platforms/xlib/qxlibwindowsurface.h | 4 +-- 101 files changed, 441 insertions(+), 113 deletions(-) diff --git a/src/plugins/platforms/cocoa/main.mm b/src/plugins/platforms/cocoa/main.mm index 8be8883..da7af3f 100644 --- a/src/plugins/platforms/cocoa/main.mm +++ b/src/plugins/platforms/cocoa/main.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/cocoa/qcocoaautoreleasepool.h b/src/plugins/platforms/cocoa/qcocoaautoreleasepool.h index 47b94d1..6e41e9a 100644 --- a/src/plugins/platforms/cocoa/qcocoaautoreleasepool.h +++ b/src/plugins/platforms/cocoa/qcocoaautoreleasepool.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/cocoa/qcocoaautoreleasepool.mm b/src/plugins/platforms/cocoa/qcocoaautoreleasepool.mm index 9a18fe2..35750cd 100644 --- a/src/plugins/platforms/cocoa/qcocoaautoreleasepool.mm +++ b/src/plugins/platforms/cocoa/qcocoaautoreleasepool.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/cocoa/qcocoaeventloopintegration.h b/src/plugins/platforms/cocoa/qcocoaeventloopintegration.h index 87998e3..81e272e 100644 --- a/src/plugins/platforms/cocoa/qcocoaeventloopintegration.h +++ b/src/plugins/platforms/cocoa/qcocoaeventloopintegration.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/cocoa/qcocoaeventloopintegration.mm b/src/plugins/platforms/cocoa/qcocoaeventloopintegration.mm index 844751c..885916e 100644 --- a/src/plugins/platforms/cocoa/qcocoaeventloopintegration.mm +++ b/src/plugins/platforms/cocoa/qcocoaeventloopintegration.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.h b/src/plugins/platforms/cocoa/qcocoaintegration.h index b94bcb9..2a04e8c 100644 --- a/src/plugins/platforms/cocoa/qcocoaintegration.h +++ b/src/plugins/platforms/cocoa/qcocoaintegration.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm index a75b88c..7c4319c 100644 --- a/src/plugins/platforms/cocoa/qcocoaintegration.mm +++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/cocoa/qcocoawindow.h b/src/plugins/platforms/cocoa/qcocoawindow.h index 660e9f8..b71879d 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.h +++ b/src/plugins/platforms/cocoa/qcocoawindow.h @@ -1,10 +1,10 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtOpenVG module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index 4e233ee..aa54fe9 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -1,10 +1,10 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtOpenVG module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/cocoa/qcocoawindowsurface.h b/src/plugins/platforms/cocoa/qcocoawindowsurface.h index 35f4064..5ae7be1 100644 --- a/src/plugins/platforms/cocoa/qcocoawindowsurface.h +++ b/src/plugins/platforms/cocoa/qcocoawindowsurface.h @@ -1,10 +1,10 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtOpenVG module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/cocoa/qcocoawindowsurface.mm b/src/plugins/platforms/cocoa/qcocoawindowsurface.mm index 443a486..ecf6879 100644 --- a/src/plugins/platforms/cocoa/qcocoawindowsurface.mm +++ b/src/plugins/platforms/cocoa/qcocoawindowsurface.mm @@ -1,10 +1,10 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtOpenVG module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/cocoa/qnsview.h b/src/plugins/platforms/cocoa/qnsview.h index 0523725..fc946e2 100644 --- a/src/plugins/platforms/cocoa/qnsview.h +++ b/src/plugins/platforms/cocoa/qnsview.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 60de6ba..6fda27b 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/cocoa/qnswindowdelegate.h b/src/plugins/platforms/cocoa/qnswindowdelegate.h index 9fc1d63..f4dcec7 100644 --- a/src/plugins/platforms/cocoa/qnswindowdelegate.h +++ b/src/plugins/platforms/cocoa/qnswindowdelegate.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/cocoa/qnswindowdelegate.mm b/src/plugins/platforms/cocoa/qnswindowdelegate.mm index c04602b..58dffb7 100644 --- a/src/plugins/platforms/cocoa/qnswindowdelegate.mm +++ b/src/plugins/platforms/cocoa/qnswindowdelegate.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/directfb/main.cpp b/src/plugins/platforms/directfb/main.cpp index f4ece32..d9caa70 100644 --- a/src/plugins/platforms/directfb/main.cpp +++ b/src/plugins/platforms/directfb/main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/eglconvenience/qxlibeglintegration.cpp b/src/plugins/platforms/eglconvenience/qxlibeglintegration.cpp index 1135d2f..7f296c5 100644 --- a/src/plugins/platforms/eglconvenience/qxlibeglintegration.cpp +++ b/src/plugins/platforms/eglconvenience/qxlibeglintegration.cpp @@ -1,10 +1,10 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtOpenVG module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/eglconvenience/qxlibeglintegration.h b/src/plugins/platforms/eglconvenience/qxlibeglintegration.h index f62dce4..51996da 100644 --- a/src/plugins/platforms/eglconvenience/qxlibeglintegration.h +++ b/src/plugins/platforms/eglconvenience/qxlibeglintegration.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtOpenVG module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/linuxfb/main.cpp b/src/plugins/platforms/linuxfb/main.cpp index c5f7fe0..fb14ef4 100644 --- a/src/plugins/platforms/linuxfb/main.cpp +++ b/src/plugins/platforms/linuxfb/main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp b/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp index af5a337..a088a31 100644 --- a/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp +++ b/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/linuxfb/qlinuxfbintegration.h b/src/plugins/platforms/linuxfb/qlinuxfbintegration.h index ddf8873..f361843 100644 --- a/src/plugins/platforms/linuxfb/qlinuxfbintegration.h +++ b/src/plugins/platforms/linuxfb/qlinuxfbintegration.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/openvglite/main.cpp b/src/plugins/platforms/openvglite/main.cpp index dc0b4a8..97321fa 100644 --- a/src/plugins/platforms/openvglite/main.cpp +++ b/src/plugins/platforms/openvglite/main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/openvglite/qgraphicssystem_vglite.cpp b/src/plugins/platforms/openvglite/qgraphicssystem_vglite.cpp index 41b2303..5f7106e 100644 --- a/src/plugins/platforms/openvglite/qgraphicssystem_vglite.cpp +++ b/src/plugins/platforms/openvglite/qgraphicssystem_vglite.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/openvglite/qgraphicssystem_vglite.h b/src/plugins/platforms/openvglite/qgraphicssystem_vglite.h index 512793d..9d45bf9 100644 --- a/src/plugins/platforms/openvglite/qgraphicssystem_vglite.h +++ b/src/plugins/platforms/openvglite/qgraphicssystem_vglite.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/openvglite/qwindowsurface_vglite.cpp b/src/plugins/platforms/openvglite/qwindowsurface_vglite.cpp index c73e35a..8432ad6 100644 --- a/src/plugins/platforms/openvglite/qwindowsurface_vglite.cpp +++ b/src/plugins/platforms/openvglite/qwindowsurface_vglite.cpp @@ -1,10 +1,10 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtOpenVG module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/openvglite/qwindowsurface_vglite.h b/src/plugins/platforms/openvglite/qwindowsurface_vglite.h index b7d0a92..6d66c42 100644 --- a/src/plugins/platforms/openvglite/qwindowsurface_vglite.h +++ b/src/plugins/platforms/openvglite/qwindowsurface_vglite.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtOpenVG module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/qvfb/main.cpp b/src/plugins/platforms/qvfb/main.cpp index 997e544..5c3b72b 100644 --- a/src/plugins/platforms/qvfb/main.cpp +++ b/src/plugins/platforms/qvfb/main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/qvfb/qvfbintegration.cpp b/src/plugins/platforms/qvfb/qvfbintegration.cpp index 0cc3938..ddde800 100644 --- a/src/plugins/platforms/qvfb/qvfbintegration.cpp +++ b/src/plugins/platforms/qvfb/qvfbintegration.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/qvfb/qvfbintegration.h b/src/plugins/platforms/qvfb/qvfbintegration.h index 198a45c..33e31a5 100644 --- a/src/plugins/platforms/qvfb/qvfbintegration.h +++ b/src/plugins/platforms/qvfb/qvfbintegration.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/qvfb/qvfbwindowsurface.cpp b/src/plugins/platforms/qvfb/qvfbwindowsurface.cpp index 6699072..85918eb 100644 --- a/src/plugins/platforms/qvfb/qvfbwindowsurface.cpp +++ b/src/plugins/platforms/qvfb/qvfbwindowsurface.cpp @@ -1,10 +1,10 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtOpenVG module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/qvfb/qvfbwindowsurface.h b/src/plugins/platforms/qvfb/qvfbwindowsurface.h index 9228189..9f828d3 100644 --- a/src/plugins/platforms/qvfb/qvfbwindowsurface.h +++ b/src/plugins/platforms/qvfb/qvfbwindowsurface.h @@ -1,10 +1,10 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtOpenVG module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/uikit/examples/qmltest/qmlapplicationviewer/qmlapplicationviewer.cpp b/src/plugins/platforms/uikit/examples/qmltest/qmlapplicationviewer/qmlapplicationviewer.cpp index 7844e46..72f8c52 100644 --- a/src/plugins/platforms/uikit/examples/qmltest/qmlapplicationviewer/qmlapplicationviewer.cpp +++ b/src/plugins/platforms/uikit/examples/qmltest/qmlapplicationviewer/qmlapplicationviewer.cpp @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + // checksum 0x17fa version 0x3000a /* This file was generated by the Qt Quick Application wizard of Qt Creator. diff --git a/src/plugins/platforms/uikit/examples/qmltest/qmlapplicationviewer/qmlapplicationviewer.h b/src/plugins/platforms/uikit/examples/qmltest/qmlapplicationviewer/qmlapplicationviewer.h index 0e4de04..01b2af0 100644 --- a/src/plugins/platforms/uikit/examples/qmltest/qmlapplicationviewer/qmlapplicationviewer.h +++ b/src/plugins/platforms/uikit/examples/qmltest/qmlapplicationviewer/qmlapplicationviewer.h @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + // checksum 0x5a59 version 0x3000a /* This file was generated by the Qt Quick Application wizard of Qt Creator. diff --git a/src/plugins/platforms/uikit/main.mm b/src/plugins/platforms/uikit/main.mm index 05e0d02..1ef69fa 100644 --- a/src/plugins/platforms/uikit/main.mm +++ b/src/plugins/platforms/uikit/main.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/uikit/quikiteventloop.h b/src/plugins/platforms/uikit/quikiteventloop.h index 5c18999..cf5c682 100644 --- a/src/plugins/platforms/uikit/quikiteventloop.h +++ b/src/plugins/platforms/uikit/quikiteventloop.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/uikit/quikiteventloop.mm b/src/plugins/platforms/uikit/quikiteventloop.mm index 78f046e..70757b1 100644 --- a/src/plugins/platforms/uikit/quikiteventloop.mm +++ b/src/plugins/platforms/uikit/quikiteventloop.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/uikit/quikitintegration.h b/src/plugins/platforms/uikit/quikitintegration.h index e448881..a986e92 100644 --- a/src/plugins/platforms/uikit/quikitintegration.h +++ b/src/plugins/platforms/uikit/quikitintegration.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/uikit/quikitintegration.mm b/src/plugins/platforms/uikit/quikitintegration.mm index f1fc402..d4b4192 100644 --- a/src/plugins/platforms/uikit/quikitintegration.mm +++ b/src/plugins/platforms/uikit/quikitintegration.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/uikit/quikitscreen.h b/src/plugins/platforms/uikit/quikitscreen.h index 0253795..15c7d69 100644 --- a/src/plugins/platforms/uikit/quikitscreen.h +++ b/src/plugins/platforms/uikit/quikitscreen.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/uikit/quikitscreen.mm b/src/plugins/platforms/uikit/quikitscreen.mm index 718ba54..ec94e3a 100644 --- a/src/plugins/platforms/uikit/quikitscreen.mm +++ b/src/plugins/platforms/uikit/quikitscreen.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/uikit/quikitwindow.h b/src/plugins/platforms/uikit/quikitwindow.h index 8e8c51b..d5a6690 100644 --- a/src/plugins/platforms/uikit/quikitwindow.h +++ b/src/plugins/platforms/uikit/quikitwindow.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/uikit/quikitwindow.mm b/src/plugins/platforms/uikit/quikitwindow.mm index 457598b..ebdee06 100644 --- a/src/plugins/platforms/uikit/quikitwindow.mm +++ b/src/plugins/platforms/uikit/quikitwindow.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/uikit/quikitwindowsurface.h b/src/plugins/platforms/uikit/quikitwindowsurface.h index 2c22d7f..50d02b4 100644 --- a/src/plugins/platforms/uikit/quikitwindowsurface.h +++ b/src/plugins/platforms/uikit/quikitwindowsurface.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/uikit/quikitwindowsurface.mm b/src/plugins/platforms/uikit/quikitwindowsurface.mm index f21bb77..1274fca 100644 --- a/src/plugins/platforms/uikit/quikitwindowsurface.mm +++ b/src/plugins/platforms/uikit/quikitwindowsurface.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/vnc/main.cpp b/src/plugins/platforms/vnc/main.cpp index e051e2d..890b8f8 100644 --- a/src/plugins/platforms/vnc/main.cpp +++ b/src/plugins/platforms/vnc/main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/vnc/qvnccursor.cpp b/src/plugins/platforms/vnc/qvnccursor.cpp index e83696d..dbcdef3 100644 --- a/src/plugins/platforms/vnc/qvnccursor.cpp +++ b/src/plugins/platforms/vnc/qvnccursor.cpp @@ -1,10 +1,10 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtOpenVG module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/vnc/qvnccursor.h b/src/plugins/platforms/vnc/qvnccursor.h index eeb3686..8eb26e0 100644 --- a/src/plugins/platforms/vnc/qvnccursor.h +++ b/src/plugins/platforms/vnc/qvnccursor.h @@ -1,10 +1,10 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtOpenVG module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/vnc/qvncintegration.cpp b/src/plugins/platforms/vnc/qvncintegration.cpp index 56cbe4b..b99ff3f 100644 --- a/src/plugins/platforms/vnc/qvncintegration.cpp +++ b/src/plugins/platforms/vnc/qvncintegration.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/vnc/qvncintegration.h b/src/plugins/platforms/vnc/qvncintegration.h index 80338a1..ef16dfa 100644 --- a/src/plugins/platforms/vnc/qvncintegration.h +++ b/src/plugins/platforms/vnc/qvncintegration.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/vnc/qvncserver.cpp b/src/plugins/platforms/vnc/qvncserver.cpp index 288d1bc..be2de7c 100644 --- a/src/plugins/platforms/vnc/qvncserver.cpp +++ b/src/plugins/platforms/vnc/qvncserver.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/vnc/qvncserver.h b/src/plugins/platforms/vnc/qvncserver.h index 7244bdf..3b514a5 100644 --- a/src/plugins/platforms/vnc/qvncserver.h +++ b/src/plugins/platforms/vnc/qvncserver.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/wayland/main.cpp b/src/plugins/platforms/wayland/main.cpp index 1bca661..6dc1c2b 100644 --- a/src/plugins/platforms/wayland/main.cpp +++ b/src/plugins/platforms/wayland/main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/wayland/qwaylandcursor.cpp b/src/plugins/platforms/wayland/qwaylandcursor.cpp index 0ad0702..614686f 100644 --- a/src/plugins/platforms/wayland/qwaylandcursor.cpp +++ b/src/plugins/platforms/wayland/qwaylandcursor.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtOpenVG module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/wayland/qwaylandcursor.h b/src/plugins/platforms/wayland/qwaylandcursor.h index 19e6047..254cb94 100644 --- a/src/plugins/platforms/wayland/qwaylandcursor.h +++ b/src/plugins/platforms/wayland/qwaylandcursor.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtOpenVG module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/wayland/qwaylanddrmsurface.cpp b/src/plugins/platforms/wayland/qwaylanddrmsurface.cpp index 38bbc59..a8bc352 100644 --- a/src/plugins/platforms/wayland/qwaylanddrmsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylanddrmsurface.cpp @@ -1,10 +1,10 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtOpenVG module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/wayland/qwaylandintegration.h b/src/plugins/platforms/wayland/qwaylandintegration.h index c3919ab..067b6e4 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.h +++ b/src/plugins/platforms/wayland/qwaylandintegration.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/wayland/qwaylandshmsurface.cpp b/src/plugins/platforms/wayland/qwaylandshmsurface.cpp index 6872bac..54da9a1 100644 --- a/src/plugins/platforms/wayland/qwaylandshmsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmsurface.cpp @@ -1,10 +1,10 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtOpenVG module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/wayland/qwaylandshmsurface.h b/src/plugins/platforms/wayland/qwaylandshmsurface.h index 615d944..02b324a 100644 --- a/src/plugins/platforms/wayland/qwaylandshmsurface.h +++ b/src/plugins/platforms/wayland/qwaylandshmsurface.h @@ -1,10 +1,10 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtOpenVG module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/xcb/main.cpp b/src/plugins/platforms/xcb/main.cpp index 1966003..89bc66e 100644 --- a/src/plugins/platforms/xcb/main.cpp +++ b/src/plugins/platforms/xcb/main.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/xcb/qdri2context.cpp b/src/plugins/platforms/xcb/qdri2context.cpp index 10c9417..0079f91 100644 --- a/src/plugins/platforms/xcb/qdri2context.cpp +++ b/src/plugins/platforms/xcb/qdri2context.cpp @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + #include "qdri2context.h" #include "qxcbwindow.h" diff --git a/src/plugins/platforms/xcb/qdri2context.h b/src/plugins/platforms/xcb/qdri2context.h index 8e4ac89..42dd6bd 100644 --- a/src/plugins/platforms/xcb/qdri2context.h +++ b/src/plugins/platforms/xcb/qdri2context.h @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + #ifndef QDRI2CONTEXT_H #define QDRI2CONTEXT_H diff --git a/src/plugins/platforms/xcb/qglxintegration.cpp b/src/plugins/platforms/xcb/qglxintegration.cpp index 0cb6b1d..e94b6a6 100644 --- a/src/plugins/platforms/xcb/qglxintegration.cpp +++ b/src/plugins/platforms/xcb/qglxintegration.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/xcb/qglxintegration.h b/src/plugins/platforms/xcb/qglxintegration.h index 0006363..f2e20c4 100644 --- a/src/plugins/platforms/xcb/qglxintegration.h +++ b/src/plugins/platforms/xcb/qglxintegration.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index de3f926..191699b 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index a7fa7fd..e00fbb1 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp index 0981655..63c26a1 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.cpp +++ b/src/plugins/platforms/xcb/qxcbintegration.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/xcb/qxcbintegration.h b/src/plugins/platforms/xcb/qxcbintegration.h index eab6949..6c9634e 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.h +++ b/src/plugins/platforms/xcb/qxcbintegration.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.cpp b/src/plugins/platforms/xcb/qxcbkeyboard.cpp index f594232..ec9a009 100644 --- a/src/plugins/platforms/xcb/qxcbkeyboard.cpp +++ b/src/plugins/platforms/xcb/qxcbkeyboard.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.h b/src/plugins/platforms/xcb/qxcbkeyboard.h index 2a17e48..ddade79 100644 --- a/src/plugins/platforms/xcb/qxcbkeyboard.h +++ b/src/plugins/platforms/xcb/qxcbkeyboard.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp index 8b6678b..b2ca1be 100644 --- a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp +++ b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + #include "qxcbnativeinterface.h" #include "qxcbscreen.h" diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.h b/src/plugins/platforms/xcb/qxcbnativeinterface.h index 72c27d5..f60905c 100644 --- a/src/plugins/platforms/xcb/qxcbnativeinterface.h +++ b/src/plugins/platforms/xcb/qxcbnativeinterface.h @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + #ifndef QXCBNATIVEINTERFACE_H #define QXCBNATIVEINTERFACE_H diff --git a/src/plugins/platforms/xcb/qxcbobject.h b/src/plugins/platforms/xcb/qxcbobject.h index cabfd7c..69494b0 100644 --- a/src/plugins/platforms/xcb/qxcbobject.h +++ b/src/plugins/platforms/xcb/qxcbobject.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp index f868db8..53b0563 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.cpp +++ b/src/plugins/platforms/xcb/qxcbscreen.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/xcb/qxcbscreen.h b/src/plugins/platforms/xcb/qxcbscreen.h index 77ee46f..6f69fc7 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.h +++ b/src/plugins/platforms/xcb/qxcbscreen.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 9478b5b..cbf50f7 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/xcb/qxcbwindow.h b/src/plugins/platforms/xcb/qxcbwindow.h index 2e8238b..1e9930d 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.h +++ b/src/plugins/platforms/xcb/qxcbwindow.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/xcb/qxcbwindowsurface.cpp b/src/plugins/platforms/xcb/qxcbwindowsurface.cpp index 513de08..7fed230 100644 --- a/src/plugins/platforms/xcb/qxcbwindowsurface.cpp +++ b/src/plugins/platforms/xcb/qxcbwindowsurface.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/xcb/qxcbwindowsurface.h b/src/plugins/platforms/xcb/qxcbwindowsurface.h index ee63190..61689b1 100644 --- a/src/plugins/platforms/xcb/qxcbwindowsurface.h +++ b/src/plugins/platforms/xcb/qxcbwindowsurface.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/xlib/main.cpp b/src/plugins/platforms/xlib/main.cpp index 3e2a6b9..f0bf6ff 100644 --- a/src/plugins/platforms/xlib/main.cpp +++ b/src/plugins/platforms/xlib/main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/xlib/qglxintegration.cpp b/src/plugins/platforms/xlib/qglxintegration.cpp index 89cd768..80011d9 100644 --- a/src/plugins/platforms/xlib/qglxintegration.cpp +++ b/src/plugins/platforms/xlib/qglxintegration.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/xlib/qglxintegration.h b/src/plugins/platforms/xlib/qglxintegration.h index 81b48c9..dbb5c2e 100644 --- a/src/plugins/platforms/xlib/qglxintegration.h +++ b/src/plugins/platforms/xlib/qglxintegration.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/xlib/qxlibclipboard.cpp b/src/plugins/platforms/xlib/qxlibclipboard.cpp index 49b2dc7..dfaf552 100644 --- a/src/plugins/platforms/xlib/qxlibclipboard.cpp +++ b/src/plugins/platforms/xlib/qxlibclipboard.cpp @@ -1,10 +1,10 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtOpenVG module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/xlib/qxlibclipboard.h b/src/plugins/platforms/xlib/qxlibclipboard.h index ec1d728..15901b0 100644 --- a/src/plugins/platforms/xlib/qxlibclipboard.h +++ b/src/plugins/platforms/xlib/qxlibclipboard.h @@ -1,10 +1,10 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtOpenVG module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/xlib/qxlibcursor.cpp b/src/plugins/platforms/xlib/qxlibcursor.cpp index 074d2f7..042cbc9 100644 --- a/src/plugins/platforms/xlib/qxlibcursor.cpp +++ b/src/plugins/platforms/xlib/qxlibcursor.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtOpenVG module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/xlib/qxlibcursor.h b/src/plugins/platforms/xlib/qxlibcursor.h index 77c66bf..62b13eb 100644 --- a/src/plugins/platforms/xlib/qxlibcursor.h +++ b/src/plugins/platforms/xlib/qxlibcursor.h @@ -1,10 +1,10 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtOpenVG module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/xlib/qxlibdisplay.cpp b/src/plugins/platforms/xlib/qxlibdisplay.cpp index 3b60af2..d8aa230 100644 --- a/src/plugins/platforms/xlib/qxlibdisplay.cpp +++ b/src/plugins/platforms/xlib/qxlibdisplay.cpp @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + #include "qxlibdisplay.h" QXlibDisplay::QXlibDisplay(Display *display) diff --git a/src/plugins/platforms/xlib/qxlibdisplay.h b/src/plugins/platforms/xlib/qxlibdisplay.h index f2cca9e..557ab52 100644 --- a/src/plugins/platforms/xlib/qxlibdisplay.h +++ b/src/plugins/platforms/xlib/qxlibdisplay.h @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + #ifndef QXLIBDISPLAY_H #define QXLIBDISPLAY_H diff --git a/src/plugins/platforms/xlib/qxlibintegration.cpp b/src/plugins/platforms/xlib/qxlibintegration.cpp index c207eb2..6733ed1 100644 --- a/src/plugins/platforms/xlib/qxlibintegration.cpp +++ b/src/plugins/platforms/xlib/qxlibintegration.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/xlib/qxlibintegration.h b/src/plugins/platforms/xlib/qxlibintegration.h index dd8cdec..3bbf897 100644 --- a/src/plugins/platforms/xlib/qxlibintegration.h +++ b/src/plugins/platforms/xlib/qxlibintegration.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/xlib/qxlibkeyboard.cpp b/src/plugins/platforms/xlib/qxlibkeyboard.cpp index 690d273..8d94157 100644 --- a/src/plugins/platforms/xlib/qxlibkeyboard.cpp +++ b/src/plugins/platforms/xlib/qxlibkeyboard.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtOpenVG module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/xlib/qxlibkeyboard.h b/src/plugins/platforms/xlib/qxlibkeyboard.h index 02fc290..5e0135a 100644 --- a/src/plugins/platforms/xlib/qxlibkeyboard.h +++ b/src/plugins/platforms/xlib/qxlibkeyboard.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtOpenVG module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/xlib/qxlibmime.cpp b/src/plugins/platforms/xlib/qxlibmime.cpp index 61a0735..e98983d 100644 --- a/src/plugins/platforms/xlib/qxlibmime.cpp +++ b/src/plugins/platforms/xlib/qxlibmime.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtOpenVG module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/xlib/qxlibmime.h b/src/plugins/platforms/xlib/qxlibmime.h index 316d423..a9bc265 100644 --- a/src/plugins/platforms/xlib/qxlibmime.h +++ b/src/plugins/platforms/xlib/qxlibmime.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtOpenVG module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/xlib/qxlibscreen.cpp b/src/plugins/platforms/xlib/qxlibscreen.cpp index 5a9aca9..23a2d07 100644 --- a/src/plugins/platforms/xlib/qxlibscreen.cpp +++ b/src/plugins/platforms/xlib/qxlibscreen.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/xlib/qxlibscreen.h b/src/plugins/platforms/xlib/qxlibscreen.h index 8dac41d..35c0141 100644 --- a/src/plugins/platforms/xlib/qxlibscreen.h +++ b/src/plugins/platforms/xlib/qxlibscreen.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/xlib/qxlibstatic.cpp b/src/plugins/platforms/xlib/qxlibstatic.cpp index f67fbdc..6117781 100644 --- a/src/plugins/platforms/xlib/qxlibstatic.cpp +++ b/src/plugins/platforms/xlib/qxlibstatic.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtOpenVG module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/xlib/qxlibstatic.h b/src/plugins/platforms/xlib/qxlibstatic.h index 8473ee9..72cfaec 100644 --- a/src/plugins/platforms/xlib/qxlibstatic.h +++ b/src/plugins/platforms/xlib/qxlibstatic.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtOpenVG module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/xlib/qxlibwindow.cpp b/src/plugins/platforms/xlib/qxlibwindow.cpp index b0d32d9..a7bc53c 100644 --- a/src/plugins/platforms/xlib/qxlibwindow.cpp +++ b/src/plugins/platforms/xlib/qxlibwindow.cpp @@ -1,10 +1,10 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtOpenVG module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/xlib/qxlibwindow.h b/src/plugins/platforms/xlib/qxlibwindow.h index be98032..08694a5 100644 --- a/src/plugins/platforms/xlib/qxlibwindow.h +++ b/src/plugins/platforms/xlib/qxlibwindow.h @@ -1,10 +1,10 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtOpenVG module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/xlib/qxlibwindowsurface.cpp b/src/plugins/platforms/xlib/qxlibwindowsurface.cpp index fa1e197..513f10d 100644 --- a/src/plugins/platforms/xlib/qxlibwindowsurface.cpp +++ b/src/plugins/platforms/xlib/qxlibwindowsurface.cpp @@ -1,10 +1,10 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtOpenVG module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/xlib/qxlibwindowsurface.h b/src/plugins/platforms/xlib/qxlibwindowsurface.h index 12b4c60..d46b7b4 100644 --- a/src/plugins/platforms/xlib/qxlibwindowsurface.h +++ b/src/plugins/platforms/xlib/qxlibwindowsurface.h @@ -1,10 +1,10 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtOpenVG module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage -- cgit v0.12 From 483a069415f2648a0d4c1f86d69f372607750ae6 Mon Sep 17 00:00:00 2001 From: Simon Hausmann <simon.hausmann@nokia.com> Date: Thu, 17 Mar 2011 14:51:10 +0100 Subject: Fix disk cache interaction for range retrieval HTTP requests. The disk cache API does not currently support retrieving partial content, it can only serve entire files. Therefore we disable the use of the cache for these kinds of requests, as indicated by the presence of the Range header field. Done-with: Jocelyn Turcotte Reviewed-by: Markus Goetz Reviewed-by: Peter Hartmann --- src/network/access/qnetworkaccesshttpbackend.cpp | 5 ++ tests/auto/qnetworkreply/tst_qnetworkreply.cpp | 74 +++++++++++++++++------- 2 files changed, 58 insertions(+), 21 deletions(-) diff --git a/src/network/access/qnetworkaccesshttpbackend.cpp b/src/network/access/qnetworkaccesshttpbackend.cpp index 4189743..108ac68 100644 --- a/src/network/access/qnetworkaccesshttpbackend.cpp +++ b/src/network/access/qnetworkaccesshttpbackend.cpp @@ -360,6 +360,11 @@ void QNetworkAccessHttpBackend::validateCache(QHttpNetworkRequest &httpRequest, return; } + // The disk cache API does not currently support partial content retrieval. + // That is why we don't use the disk cache for any such requests. + if (request().hasRawHeader("Range")) + return; + QAbstractNetworkCache *nc = networkCache(); if (!nc) return; // no local cache diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp index 39bb0fc..4338e74 100644 --- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp @@ -2663,6 +2663,7 @@ void tst_QNetworkReply::ioGetFromHttpWithCache_data() QTest::addColumn<QString>("body"); QTest::addColumn<MyMemoryCache::CachedContent>("cachedReply"); QTest::addColumn<int>("cacheMode"); + QTest::addColumn<QStringList>("extraHttpHeaders"); QTest::addColumn<bool>("loadedFromCache"); QTest::addColumn<bool>("networkUsed"); @@ -2680,11 +2681,11 @@ void tst_QNetworkReply::ioGetFromHttpWithCache_data() "\r\n"; QTest::newRow("not-cached,always-network") - << reply200 << "Reloaded" << MyMemoryCache::CachedContent() << int(QNetworkRequest::AlwaysNetwork) << false << true; + << reply200 << "Reloaded" << MyMemoryCache::CachedContent() << int(QNetworkRequest::AlwaysNetwork) << QStringList() << false << true; QTest::newRow("not-cached,prefer-network") - << reply200 << "Reloaded" << MyMemoryCache::CachedContent() << int(QNetworkRequest::PreferNetwork) << false << true; + << reply200 << "Reloaded" << MyMemoryCache::CachedContent() << int(QNetworkRequest::PreferNetwork) << QStringList() << false << true; QTest::newRow("not-cached,prefer-cache") - << reply200 << "Reloaded" << MyMemoryCache::CachedContent() << int(QNetworkRequest::PreferCache) << false << true; + << reply200 << "Reloaded" << MyMemoryCache::CachedContent() << int(QNetworkRequest::PreferCache) << QStringList() << false << true; QDateTime present = QDateTime::currentDateTime().toUTC(); QDateTime past = present.addSecs(-3600); @@ -2706,14 +2707,14 @@ void tst_QNetworkReply::ioGetFromHttpWithCache_data() content.first.setLastModified(past); QTest::newRow("expired,200,prefer-network") - << reply200 << "Reloaded" << content << int(QNetworkRequest::PreferNetwork) << false << true; + << reply200 << "Reloaded" << content << int(QNetworkRequest::PreferNetwork) << QStringList() << false << true; QTest::newRow("expired,200,prefer-cache") - << reply200 << "Reloaded" << content << int(QNetworkRequest::PreferCache) << false << true; + << reply200 << "Reloaded" << content << int(QNetworkRequest::PreferCache) << QStringList() << false << true; QTest::newRow("expired,304,prefer-network") - << reply304 << "Not-reloaded" << content << int(QNetworkRequest::PreferNetwork) << true << true; + << reply304 << "Not-reloaded" << content << int(QNetworkRequest::PreferNetwork) << QStringList() << true << true; QTest::newRow("expired,304,prefer-cache") - << reply304 << "Not-reloaded" << content << int(QNetworkRequest::PreferCache) << true << true; + << reply304 << "Not-reloaded" << content << int(QNetworkRequest::PreferCache) << QStringList() << true << true; // // Set to not-expired @@ -2725,20 +2726,20 @@ void tst_QNetworkReply::ioGetFromHttpWithCache_data() content.first.setExpirationDate(future); QTest::newRow("not-expired,200,always-network") - << reply200 << "Reloaded" << content << int(QNetworkRequest::AlwaysNetwork) << false << true; + << reply200 << "Reloaded" << content << int(QNetworkRequest::AlwaysNetwork) << QStringList() << false << true; QTest::newRow("not-expired,200,prefer-network") - << reply200 << "Not-reloaded" << content << int(QNetworkRequest::PreferNetwork) << true << false; + << reply200 << "Not-reloaded" << content << int(QNetworkRequest::PreferNetwork) << QStringList() << true << false; QTest::newRow("not-expired,200,prefer-cache") - << reply200 << "Not-reloaded" << content << int(QNetworkRequest::PreferCache) << true << false; + << reply200 << "Not-reloaded" << content << int(QNetworkRequest::PreferCache) << QStringList() << true << false; QTest::newRow("not-expired,200,always-cache") - << reply200 << "Not-reloaded" << content << int(QNetworkRequest::AlwaysCache) << true << false; + << reply200 << "Not-reloaded" << content << int(QNetworkRequest::AlwaysCache) << QStringList() << true << false; QTest::newRow("not-expired,304,prefer-network") - << reply304 << "Not-reloaded" << content << int(QNetworkRequest::PreferNetwork) << true << false; + << reply304 << "Not-reloaded" << content << int(QNetworkRequest::PreferNetwork) << QStringList() << true << false; QTest::newRow("not-expired,304,prefer-cache") - << reply304 << "Not-reloaded" << content << int(QNetworkRequest::PreferCache) << true << false; + << reply304 << "Not-reloaded" << content << int(QNetworkRequest::PreferCache) << QStringList() << true << false; QTest::newRow("not-expired,304,always-cache") - << reply304 << "Not-reloaded" << content << int(QNetworkRequest::AlwaysCache) << true << false; + << reply304 << "Not-reloaded" << content << int(QNetworkRequest::AlwaysCache) << QStringList() << true << false; // // Set must-revalidate now @@ -2749,20 +2750,42 @@ void tst_QNetworkReply::ioGetFromHttpWithCache_data() content.first.setRawHeaders(rawHeaders); QTest::newRow("must-revalidate,200,always-network") - << reply200 << "Reloaded" << content << int(QNetworkRequest::AlwaysNetwork) << false << true; + << reply200 << "Reloaded" << content << int(QNetworkRequest::AlwaysNetwork) << QStringList() << false << true; QTest::newRow("must-revalidate,200,prefer-network") - << reply200 << "Reloaded" << content << int(QNetworkRequest::PreferNetwork) << false << true; + << reply200 << "Reloaded" << content << int(QNetworkRequest::PreferNetwork) << QStringList() << false << true; QTest::newRow("must-revalidate,200,prefer-cache") - << reply200 << "Not-reloaded" << content << int(QNetworkRequest::PreferCache) << true << false; + << reply200 << "Not-reloaded" << content << int(QNetworkRequest::PreferCache) << QStringList() << true << false; QTest::newRow("must-revalidate,200,always-cache") - << reply200 << "Not-reloaded" << content << int(QNetworkRequest::AlwaysCache) << true << false; + << reply200 << "Not-reloaded" << content << int(QNetworkRequest::AlwaysCache) << QStringList() << true << false; QTest::newRow("must-revalidate,304,prefer-network") - << reply304 << "Not-reloaded" << content << int(QNetworkRequest::PreferNetwork) << true << true; + << reply304 << "Not-reloaded" << content << int(QNetworkRequest::PreferNetwork) << QStringList() << true << true; QTest::newRow("must-revalidate,304,prefer-cache") - << reply304 << "Not-reloaded" << content << int(QNetworkRequest::PreferCache) << true << false; + << reply304 << "Not-reloaded" << content << int(QNetworkRequest::PreferCache) << QStringList() << true << false; QTest::newRow("must-revalidate,304,always-cache") - << reply304 << "Not-reloaded" << content << int(QNetworkRequest::AlwaysCache) << true << false; + << reply304 << "Not-reloaded" << content << int(QNetworkRequest::AlwaysCache) << QStringList() << true << false; + + // + // Partial content + // + rawHeaders.clear(); + rawHeaders << QNetworkCacheMetaData::RawHeader("Date", QLocale::c().toString(past, dateFormat).toLatin1()) + << QNetworkCacheMetaData::RawHeader("Cache-control", "max-age=7200"); // isn't used in cache loading + content.first.setRawHeaders(rawHeaders); + content.first.setExpirationDate(future); + + QByteArray reply206 = + "HTTP/1.0 206\r\n" + "Connection: keep-alive\r\n" + "Content-Type: text/plain\r\n" + "Cache-control: no-cache\r\n" + "Content-Range: bytes 2-6/8\r\n" + "Content-length: 4\r\n" + "\r\n" + "load"; + + QTest::newRow("partial,dontuse-cache") + << reply206 << "load" << content << int(QNetworkRequest::PreferCache) << (QStringList() << "Range" << "bytes=2-6") << false << true; } void tst_QNetworkReply::ioGetFromHttpWithCache() @@ -2784,6 +2807,15 @@ void tst_QNetworkReply::ioGetFromHttpWithCache() QNetworkRequest request(url); request.setAttribute(QNetworkRequest::CacheLoadControlAttribute, cacheMode); request.setAttribute(QNetworkRequest::CacheSaveControlAttribute, false); + + QFETCH(QStringList, extraHttpHeaders); + QStringListIterator it(extraHttpHeaders); + while (it.hasNext()) { + QString header = it.next(); + QString value = it.next(); + request.setRawHeader(header.toLatin1(), value.toLatin1()); // To latin1? Deal with it! + } + QNetworkReplyPtr reply = manager.get(request); connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop())); -- cgit v0.12 From 268394b854766855c7ce5697bbc079a6974ad866 Mon Sep 17 00:00:00 2001 From: Simon Hausmann <simon.hausmann@nokia.com> Date: Thu, 17 Mar 2011 15:19:25 +0100 Subject: Fix accidental population of the disk cache with partial content Since the disk cache does not support partial content, we should not try to store it in the cache altogether. Done-with: Jocelyn Turcotte Reviewed-by: Markus Goetz Reviewed-by: Peter Hartmann --- src/network/access/qnetworkreplyimpl.cpp | 7 ++ tests/auto/qnetworkreply/tst_qnetworkreply.cpp | 93 ++++++++++++++++++++++++++ 2 files changed, 100 insertions(+) diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp index 343f344..894df79 100644 --- a/src/network/access/qnetworkreplyimpl.cpp +++ b/src/network/access/qnetworkreplyimpl.cpp @@ -505,6 +505,13 @@ void QNetworkReplyImplPrivate::initCacheSaveDevice() { Q_Q(QNetworkReplyImpl); + // The disk cache does not support partial content, so don't even try to + // save any such content into the cache. + if (q->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt() == 206) { + cacheEnabled = false; + return; + } + // save the meta data QNetworkCacheMetaData metaData; metaData.setUrl(url); diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp index 4338e74..81278b6 100644 --- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp @@ -333,6 +333,8 @@ private Q_SLOTS: void synchronousRequest(); void synchronousRequestSslFailure(); + void dontInsertPartialContentIntoTheCache(); + // NOTE: This test must be last! void parentingRepliesToTheApp(); }; @@ -573,6 +575,63 @@ public: Q_DECLARE_METATYPE(MyMemoryCache::CachedContent) Q_DECLARE_METATYPE(MyMemoryCache::CacheData) +class MySpyMemoryCache: public QAbstractNetworkCache +{ +public: + MySpyMemoryCache(QObject *parent) : QAbstractNetworkCache(parent) {} + ~MySpyMemoryCache() + { + qDeleteAll(m_buffers); + m_buffers.clear(); + } + + QHash<QUrl, QIODevice*> m_buffers; + QList<QUrl> m_insertedUrls; + + QNetworkCacheMetaData metaData(const QUrl &) + { + return QNetworkCacheMetaData(); + } + + void updateMetaData(const QNetworkCacheMetaData &) + { + } + + QIODevice *data(const QUrl &) + { + return 0; + } + + bool remove(const QUrl &url) + { + delete m_buffers.take(url); + return m_insertedUrls.removeAll(url) > 0; + } + + qint64 cacheSize() const + { + return 0; + } + + QIODevice *prepare(const QNetworkCacheMetaData &metaData) + { + QBuffer* buffer = new QBuffer; + buffer->open(QIODevice::ReadWrite); + buffer->setProperty("url", metaData.url()); + m_buffers.insert(metaData.url(), buffer); + return buffer; + } + + void insert(QIODevice *buffer) + { + QUrl url = buffer->property("url").toUrl(); + m_insertedUrls << url; + delete m_buffers.take(url); + } + + void clear() { m_insertedUrls.clear(); } +}; + class DataReader: public QObject { Q_OBJECT @@ -5275,6 +5334,39 @@ void tst_QNetworkReply::synchronousRequestSslFailure() QCOMPARE(sslErrorsSpy.count(), 0); } +void tst_QNetworkReply::dontInsertPartialContentIntoTheCache() +{ + QByteArray reply206 = + "HTTP/1.0 206\r\n" + "Connection: keep-alive\r\n" + "Content-Type: text/plain\r\n" + "Cache-control: no-cache\r\n" + "Content-Range: bytes 2-6/8\r\n" + "Content-length: 4\r\n" + "\r\n" + "load"; + + MiniHttpServer server(reply206); + server.doClose = false; + + MySpyMemoryCache *memoryCache = new MySpyMemoryCache(&manager); + manager.setCache(memoryCache); + + QUrl url = "http://localhost:" + QString::number(server.serverPort()); + QNetworkRequest request(url); + request.setRawHeader("Range", "bytes=2-6"); + + QNetworkReplyPtr reply = manager.get(request); + + connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop())); + QTestEventLoop::instance().enterLoop(10); + QVERIFY(!QTestEventLoop::instance().timeout()); + + QVERIFY(server.totalConnections > 0); + QCOMPARE(reply->readAll().constData(), "load"); + QCOMPARE(memoryCache->m_insertedUrls.count(), 0); +} + // NOTE: This test must be last testcase in tst_qnetworkreply! void tst_QNetworkReply::parentingRepliesToTheApp() { @@ -5284,4 +5376,5 @@ void tst_QNetworkReply::parentingRepliesToTheApp() } QTEST_MAIN(tst_QNetworkReply) + #include "tst_qnetworkreply.moc" -- cgit v0.12 From ce33fe15dde2151905839196da9927f4c19b18be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= <jorgen.lind@nokia.com> Date: Thu, 17 Mar 2011 17:12:38 +0100 Subject: Fixes detected by the static-check This included added a license header on a moc file. Its nasty, but has to stay like that until we have a better sollution for generating moc files on uikit --- src/gui/kernel/qplatformintegration_qpa.h | 2 +- .../platforms/uikit/examples/qmltest/main.mm | 45 +++++++++++++++++++++- .../moc_qmlapplicationviewer.cpp | 41 ++++++++++++++++++++ src/plugins/platforms/xcb/qxcbscreen.cpp | 2 +- 4 files changed, 86 insertions(+), 4 deletions(-) diff --git a/src/gui/kernel/qplatformintegration_qpa.h b/src/gui/kernel/qplatformintegration_qpa.h index e76d077..0aacefa 100644 --- a/src/gui/kernel/qplatformintegration_qpa.h +++ b/src/gui/kernel/qplatformintegration_qpa.h @@ -98,7 +98,7 @@ public: //jl:XXX should it be hasGLContext and do we need it at all? virtual bool hasOpenGL() const; -// Access native handles. The window handle is allready available from Wid; +// Access native handles. The window handle is already available from Wid; virtual QPlatformNativeInterface *nativeInterface() const; }; diff --git a/src/plugins/platforms/uikit/examples/qmltest/main.mm b/src/plugins/platforms/uikit/examples/qmltest/main.mm index d90be56..6fd5629 100644 --- a/src/plugins/platforms/uikit/examples/qmltest/main.mm +++ b/src/plugins/platforms/uikit/examples/qmltest/main.mm @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + // // main.m // qmltest @@ -16,9 +57,9 @@ Q_IMPORT_PLUGIN(UIKit) int main(int argc, char *argv[]) { - + NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; - + setenv("QT_QPA_PLATFORM","uikit",1); QApplication app(argc, argv); diff --git a/src/plugins/platforms/uikit/examples/qmltest/qmlapplicationviewer/moc_qmlapplicationviewer.cpp b/src/plugins/platforms/uikit/examples/qmltest/qmlapplicationviewer/moc_qmlapplicationviewer.cpp index 7733ce2..a2b40ec 100644 --- a/src/plugins/platforms/uikit/examples/qmltest/qmlapplicationviewer/moc_qmlapplicationviewer.cpp +++ b/src/plugins/platforms/uikit/examples/qmltest/qmlapplicationviewer/moc_qmlapplicationviewer.cpp @@ -1,4 +1,45 @@ /**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/**************************************************************************** ** Meta object code from reading C++ file 'qmlapplicationviewer.h' ** ** Created: Fri Feb 18 17:53:42 2011 diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp index 53b0563..fffeb2e 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.cpp +++ b/src/plugins/platforms/xcb/qxcbscreen.cpp @@ -49,7 +49,7 @@ QXcbScreen::QXcbScreen(QXcbConnection *connection, xcb_screen_t *screen, int num , m_number(number) { printf ("\n"); - printf ("Informations of screen %d:\n", screen->root); + printf ("Information of screen %d:\n", screen->root); printf (" width.........: %d\n", screen->width_in_pixels); printf (" height........: %d\n", screen->height_in_pixels); printf (" depth.........: %d\n", screen->root_depth); -- cgit v0.12 From 5e2f4be486140d694c0acccbfc7a55fc7c104c61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= <samuel.rodal@nokia.com> Date: Thu, 17 Mar 2011 12:03:06 +0100 Subject: Switch to raster also when last window is destroyed (on MeeGo). This will save GPU resources for applications that are in the background for most of the time and only show a window now and then. Reviewed-by: Armin Berres --- .../graphicssystems/meego/qmeegographicssystem.cpp | 39 +++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp b/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp index 18a0944..cb66695 100644 --- a/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp +++ b/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp @@ -59,6 +59,8 @@ #include "qmeegographicssystem.h" #include "qmeegoextensions.h" +#include <QTimer> + bool QMeeGoGraphicsSystem::surfaceWasCreated = false; QHash <Qt::HANDLE, QPixmap*> QMeeGoGraphicsSystem::liveTexturePixmaps; @@ -85,8 +87,12 @@ public: void addWidget(QWidget *widget); bool eventFilter(QObject *, QEvent *); + void handleMapNotify(); + private slots: void removeWidget(QObject *object); + void switchToRaster(); + void switchToMeeGo(); private: int visibleWidgets() const; @@ -95,22 +101,46 @@ private: QList<QWidget *> m_widgets; }; +typedef bool(*QX11FilterFunction)(XEvent *event); +Q_GUI_EXPORT void qt_installX11EventFilter(QX11FilterFunction func); + +static bool x11EventFilter(XEvent *event); + QMeeGoGraphicsSystemSwitchHandler::QMeeGoGraphicsSystemSwitchHandler() { + qt_installX11EventFilter(x11EventFilter); } void QMeeGoGraphicsSystemSwitchHandler::addWidget(QWidget *widget) { - if (!m_widgets.contains(widget)) { + if (widget != qt_gl_share_widget() && !m_widgets.contains(widget)) { widget->installEventFilter(this); connect(widget, SIGNAL(destroyed(QObject *)), this, SLOT(removeWidget(QObject *))); m_widgets << widget; } } +void QMeeGoGraphicsSystemSwitchHandler::handleMapNotify() +{ + if (m_widgets.isEmpty()) + QTimer::singleShot(0, this, SLOT(switchToMeeGo())); +} + void QMeeGoGraphicsSystemSwitchHandler::removeWidget(QObject *object) { m_widgets.removeOne(static_cast<QWidget *>(object)); + if (m_widgets.isEmpty()) + QTimer::singleShot(0, this, SLOT(switchToRaster())); +} + +void QMeeGoGraphicsSystemSwitchHandler::switchToRaster() +{ + QMeeGoGraphicsSystem::switchToRaster(); +} + +void QMeeGoGraphicsSystemSwitchHandler::switchToMeeGo() +{ + QMeeGoGraphicsSystem::switchToMeeGo(); } int QMeeGoGraphicsSystemSwitchHandler::visibleWidgets() const @@ -148,6 +178,13 @@ bool QMeeGoGraphicsSystemSwitchHandler::eventFilter(QObject *object, QEvent *eve Q_GLOBAL_STATIC(QMeeGoGraphicsSystemSwitchHandler, switch_handler) +bool x11EventFilter(XEvent *event) +{ + if (event->type == MapNotify) + switch_handler()->handleMapNotify(); + return false; +} + QWindowSurface* QMeeGoGraphicsSystem::createWindowSurface(QWidget *widget) const { QGLWidget *shareWidget = qt_gl_share_widget(); -- cgit v0.12 From 3fb5fce61b6f64534ad292a78250e4256a6514b6 Mon Sep 17 00:00:00 2001 From: Robin Burchell <robin.burchell@collabora.co.uk> Date: Thu, 17 Mar 2011 18:32:58 +0100 Subject: Changes to driver workarounds. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Force enable brokenFBOReadBack on non-Nokia v1.4 SGX drivers (as this is apparantly not fixed, except on the Nokia drivers) - Add debug when workarounds are enabled to ease debugging This fixes the following MeeGo bug: https://bugs.meego.com/show_bug.cgi?id=5616 Merge-request: 1144 Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com> --- src/opengl/qgl_egl.cpp | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/src/opengl/qgl_egl.cpp b/src/opengl/qgl_egl.cpp index 674d80d..d6b2d3b 100644 --- a/src/opengl/qgl_egl.cpp +++ b/src/opengl/qgl_egl.cpp @@ -39,6 +39,7 @@ ** ****************************************************************************/ +#include <QtCore/qdebug.h> #include <QtOpenGL/qgl.h> #include <QtOpenGL/qglpixelbuffer.h> #include "qgl_p.h" @@ -195,6 +196,7 @@ void QGLContext::makeCurrent() // PowerVR MBX/SGX chips needs to clear all buffers when starting to render // a new frame, otherwise there will be a performance penalty to pay for // each frame. + qDebug() << "Found SGX/MBX driver, enabling FullClearOnEveryFrame"; d->workaround_needsFullClearOnEveryFrame = true; // Older PowerVR SGX drivers (like the one in the N900) have a @@ -202,10 +204,31 @@ void QGLContext::makeCurrent() // or GL_ALPHA texture bound to an FBO. The only way to // identify that driver is to check the EGL version number for it. const char *egl_version = eglQueryString(d->eglContext->display(), EGL_VERSION); - if (egl_version && strstr(egl_version, "1.3")) + + if (egl_version && strstr(egl_version, "1.3")) { + qDebug() << "Found v1.3 driver, enabling brokenFBOReadBack"; d->workaround_brokenFBOReadBack = true; - else if (egl_version && strstr(egl_version, "1.4")) + } else if (egl_version && strstr(egl_version, "1.4")) { + qDebug() << "Found v1.4 driver, enabling brokenTexSubImage"; d->workaround_brokenTexSubImage = true; + + // this is a bit complicated; 1.4 version SGX drivers from + // Nokia have fixed the brokenFBOReadBack problem, but + // official drivers from TI haven't, meaning that things + // like the beagleboard are broken unless we hack around it + // - but at the same time, we want to not reduce performance + // by not enabling this elsewhere. + // + // so, let's check for a Nokia-specific addon, and only + // enable if it isn't present. + // (see MeeGo bug #5616) + if (!QEgl::hasExtension("EGL_NOK_image_shared")) { + // no Nokia extension, this is probably a standard SGX + // driver, so enable the workaround + qDebug() << "Found non-Nokia v1.4 driver, enabling brokenFBOReadBack"; + d->workaround_brokenFBOReadBack = true; + } + } } } } -- cgit v0.12 From af760349e083c0d9719733abe5f39f35ff02f81c Mon Sep 17 00:00:00 2001 From: Joerg Bornemann <joerg.bornemann@nokia.com> Date: Fri, 18 Mar 2011 19:21:11 +0100 Subject: qmake vcproj generator: do not insert $(INHERIT) This will remove the warnings about undefined environment variables when building with IncrediBuild. The $(INHERIT) feature does not work in the "Create PCH through file" property of Visual Studio. It expands to an empty string but doesn't yield a warning in a standard VS build. Also, the value of "Create PCH through file" is supposed to be exactly the string as in the include statement of the cpp file. Done-with: Marius Storm-Olsen --- qmake/generators/win32/msvc_objectmodel.cpp | 8 ++++---- qmake/generators/win32/msvc_objectmodel.h | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/qmake/generators/win32/msvc_objectmodel.cpp b/qmake/generators/win32/msvc_objectmodel.cpp index 020c3d8..815a476 100644 --- a/qmake/generators/win32/msvc_objectmodel.cpp +++ b/qmake/generators/win32/msvc_objectmodel.cpp @@ -355,7 +355,7 @@ VCCLCompilerTool::VCCLCompilerTool() TreatWChar_tAsBuiltInType(unset), TurnOffAssemblyGeneration(unset), UndefineAllPreprocessorDefinitions(unset), - UsePrecompiledHeader(pchNone), + UsePrecompiledHeader(pchUnset), UseUnicodeForAssemblerListing(unset), WarnAsError(unset), WarningLevel(warningLevel_0), @@ -389,7 +389,7 @@ inline XmlOutput::xml_output xformUsePrecompiledHeaderForNET2005(pchOption whatP if (whatPch == pchGenerateAuto) whatPch = (pchOption)0; if (whatPch == pchUseUsingSpecific) whatPch = (pchOption)2; } - return attrE(_UsePrecompiledHeader, whatPch); + return attrE(_UsePrecompiledHeader, whatPch, /*ifNot*/ pchUnset); } inline XmlOutput::xml_output xformExceptionHandlingNET2005(exceptionHandling eh, DotNET compilerVersion) @@ -2146,7 +2146,7 @@ void VCFilter::modifyPCHstage(QString str) useCompilerTool = true; // Setup PCH options CompilerTool.UsePrecompiledHeader = (isCFile ? pchNone : pchCreateUsingSpecific); - CompilerTool.PrecompiledHeaderThrough = (isCPPFile ? QString("$(INHERIT)") : QString("$(NOINHERIT)")); + CompilerTool.PrecompiledHeaderThrough = (isCPPFile ? Project->precompHFilename : QString("$(NOINHERIT)")); CompilerTool.ForcedIncludeFiles = QStringList("$(NOINHERIT)"); } @@ -2514,7 +2514,7 @@ void VCProjectWriter::write(XmlOutput &xml, const VCCLCompilerTool &tool) << attrT(_TurnOffAssemblyGeneration, tool.TurnOffAssemblyGeneration) << attrT(_UndefineAllPreprocessorDefinitions, tool.UndefineAllPreprocessorDefinitions) << attrX(_UndefinePreprocessorDefinitions, tool.UndefinePreprocessorDefinitions) - << (!tool.PrecompiledHeaderFile.isEmpty() || !tool.PrecompiledHeaderThrough.isEmpty() ? xformUsePrecompiledHeaderForNET2005(tool.UsePrecompiledHeader, tool.config->CompilerVersion) : noxml()) + << xformUsePrecompiledHeaderForNET2005(tool.UsePrecompiledHeader, tool.config->CompilerVersion) << attrT(_WarnAsError, tool.WarnAsError) << attrE(_WarningLevel, tool.WarningLevel, /*ifNot*/ warningLevelUnknown) << attrT(_WholeProgramOptimization, tool.WholeProgramOptimization) diff --git a/qmake/generators/win32/msvc_objectmodel.h b/qmake/generators/win32/msvc_objectmodel.h index 5431ce0..3e62fb4 100644 --- a/qmake/generators/win32/msvc_objectmodel.h +++ b/qmake/generators/win32/msvc_objectmodel.h @@ -366,6 +366,7 @@ enum optLinkTimeCodeGenType { optLTCGUpdate }; enum pchOption { + pchUnset = -1, pchNone, pchCreateUsingSpecific, pchGenerateAuto, -- cgit v0.12