This commit is contained in:
Jaroslav Reznik 2011-12-15 14:46:57 +01:00
parent d23802217a
commit ff98402c2b
5 changed files with 15 additions and 240 deletions

3
.gitignore vendored
View File

@ -7,5 +7,4 @@
/hi32-phonon-gstreamer.png
/hi48-phonon-gstreamer.png
/hi64-phonon-gstreamer.png
/qt-everywhere-opensource-src-4.7.4.tar.gz
/qt-everywhere-opensource-src-4.8.0-rc1.tar.gz
/qt-everywhere-opensource-src-4.8.0.tar.gz

View File

@ -1,146 +0,0 @@
From b56dbaf5b3247bd8e87e4e856ad845593755c10c Mon Sep 17 00:00:00 2001
From: =?utf-8?q?Samuel=20R=C3=B8dal?= <samuel.rodal@nokia.com>
Date: Wed, 28 Sep 2011 15:22:56 +0200
Subject: [PATCH] Fixed broken window surface flush when depth is 24 and bpp is not 32.
Some X servers use a compact representation of 24 depth visuals. In that
case we can't use the shared memory or XPutImage paths, as Qt's RGB32
does not match the internal memory layout.
Also fixed QPixmap::fromImage() to work in this case to prevent the red
and blue channels from being swapped.
Task-number: QTBUG-21754
Reviewed-by: Alberto Mardegan
---
src/gui/image/qnativeimage.cpp | 12 ++++++------
src/gui/image/qpixmap_x11.cpp | 18 +++++++++++++-----
src/gui/kernel/qapplication_x11.cpp | 6 ++++++
src/gui/kernel/qt_x11_p.h | 2 ++
src/gui/painting/qwindowsurface_raster.cpp | 5 +++--
5 files changed, 30 insertions(+), 13 deletions(-)
diff --git a/src/gui/image/qnativeimage.cpp b/src/gui/image/qnativeimage.cpp
index aebcbaf..e1382dd 100644
--- a/src/gui/image/qnativeimage.cpp
+++ b/src/gui/image/qnativeimage.cpp
@@ -153,7 +153,12 @@ QImage::Format QNativeImage::systemFormat()
QNativeImage::QNativeImage(int width, int height, QImage::Format format,bool /* isTextBuffer */, QWidget *widget)
: xshmimg(0), xshmpm(0)
{
- if (!X11->use_mitshm) {
+ QX11Info info = widget->x11Info();
+
+ int dd = info.depth();
+ Visual *vis = (Visual*) info.visual();
+
+ if (!X11->use_mitshm || format != QImage::Format_RGB16 && X11->bppForDepth.value(dd) != 32) {
image = QImage(width, height, format);
// follow good coding practice and set xshminfo attributes, though values not used in this case
xshminfo.readOnly = true;
@@ -163,11 +168,6 @@ QNativeImage::QNativeImage(int width, int height, QImage::Format format,bool /*
return;
}
- QX11Info info = widget->x11Info();
-
- int dd = info.depth();
- Visual *vis = (Visual*) info.visual();
-
xshmimg = XShmCreateImage(X11->display, vis, dd, ZPixmap, 0, &xshminfo, width, height);
if (!xshmimg) {
qWarning("QNativeImage: Unable to create shared XImage.");
diff --git a/src/gui/image/qpixmap_x11.cpp b/src/gui/image/qpixmap_x11.cpp
index 77c2a2a..0e1401c 100644
--- a/src/gui/image/qpixmap_x11.cpp
+++ b/src/gui/image/qpixmap_x11.cpp
@@ -897,12 +897,20 @@ void QX11PixmapData::fromImage(const QImage &img,
}
)
break;
- case BPP24_888: // 24 bit MSB
+ case BPP24_888:
CYCLE(
- for (int x=0; x<w; x++) {
- *dst++ = qRed (*p);
- *dst++ = qGreen(*p);
- *dst++ = qBlue (*p++);
+ if (QSysInfo::ByteOrder == QSysInfo::BigEndian) {
+ for (int x=0; x<w; x++) {
+ *dst++ = qRed (*p);
+ *dst++ = qGreen(*p);
+ *dst++ = qBlue (*p++);
+ }
+ } else {
+ for (int x=0; x<w; x++) {
+ *dst++ = qBlue (*p);
+ *dst++ = qGreen(*p);
+ *dst++ = qRed (*p++);
+ }
}
)
break;
diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp
index ef8e2b8..408e9ac 100644
--- a/src/gui/kernel/qapplication_x11.cpp
+++ b/src/gui/kernel/qapplication_x11.cpp
@@ -1896,6 +1896,12 @@ void qt_init(QApplicationPrivate *priv, int,
X11->defaultScreen = DefaultScreen(X11->display);
X11->screenCount = ScreenCount(X11->display);
+ int formatCount = 0;
+ XPixmapFormatValues *values = XListPixmapFormats(X11->display, &formatCount);
+ for (int i = 0; i < formatCount; ++i)
+ X11->bppForDepth[values[i].depth] = values[i].bits_per_pixel;
+ XFree(values);
+
X11->screens = new QX11InfoData[X11->screenCount];
X11->argbVisuals = new Visual *[X11->screenCount];
X11->argbColormaps = new Colormap[X11->screenCount];
diff --git a/src/gui/kernel/qt_x11_p.h b/src/gui/kernel/qt_x11_p.h
index 72acaf3..fe4a631 100644
--- a/src/gui/kernel/qt_x11_p.h
+++ b/src/gui/kernel/qt_x11_p.h
@@ -54,6 +54,7 @@
//
#include "QtGui/qwindowdefs.h"
+#include "QtCore/qhash.h"
#include "QtCore/qlist.h"
#include "QtCore/qvariant.h"
@@ -467,6 +468,7 @@ struct QX11Data
Colormap *argbColormaps;
int screenCount;
int defaultScreen;
+ QHash<int, int> bppForDepth;
Time time;
Time userTime;
diff --git a/src/gui/painting/qwindowsurface_raster.cpp b/src/gui/painting/qwindowsurface_raster.cpp
index 15ff044..2a25bff 100644
--- a/src/gui/painting/qwindowsurface_raster.cpp
+++ b/src/gui/painting/qwindowsurface_raster.cpp
@@ -254,8 +254,9 @@ void QRasterWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoi
} else
#endif
{
+ int depth = widget->x11Info().depth();
const QImage &src = d->image->image;
- if (src.format() != QImage::Format_RGB32 || widget->x11Info().depth() < 24) {
+ if (src.format() != QImage::Format_RGB32 || depth < 24 || X11->bppForDepth.value(depth) != 32) {
Q_ASSERT(src.depth() >= 16);
const QImage sub_src(src.scanLine(br.y()) + br.x() * (uint(src.depth()) / 8),
br.width(), br.height(), src.bytesPerLine(), src.format());
@@ -267,7 +268,7 @@ void QRasterWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoi
} else {
// qpaintengine_x11.cpp
extern void qt_x11_drawImage(const QRect &rect, const QPoint &pos, const QImage &image, Drawable hd, GC gc, Display *dpy, Visual *visual, int depth);
- qt_x11_drawImage(br, wpos, src, widget->handle(), d_ptr->gc, X11->display, (Visual *)widget->x11Info().visual(), widget->x11Info().depth());
+ qt_x11_drawImage(br, wpos, src, widget->handle(), d_ptr->gc, X11->display, (Visual *)widget->x11Info().visual(), depth);
}
}
--
1.6.1

View File

@ -1,65 +0,0 @@
From fba5fce6723a739aec73ef5184ccb6cc425402fe Mon Sep 17 00:00:00 2001
From: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Date: Mon, 14 Nov 2011 16:26:15 +0100
Subject: [PATCH] Revert "Improved performance of mapFromGlobal/mapToGlobal on
X11"
The change introduces problems with Unity's global menu bar.
Task-number: QTBUG-22420
Reviewed-by: denis <denis.dzyubenko@nokia.com>
This reverts commit cdd776a91e65bf5c30cea1bab9823134a3f797d0.
---
src/gui/kernel/qwidget_x11.cpp | 28 ----------------------------
1 files changed, 0 insertions(+), 28 deletions(-)
diff --git a/src/gui/kernel/qwidget_x11.cpp b/src/gui/kernel/qwidget_x11.cpp
index f99cc2c..52e3046 100644
--- a/src/gui/kernel/qwidget_x11.cpp
+++ b/src/gui/kernel/qwidget_x11.cpp
@@ -1336,40 +1336,12 @@ QPoint QWidgetPrivate::mapFromGlobal(const QPoint &pos) const
QPoint QWidget::mapToGlobal(const QPoint &pos) const
{
Q_D(const QWidget);
- QPoint offset = data->crect.topLeft();
- const QWidget *w = this;
- const QWidget *p = w->parentWidget();
- while (!w->isWindow() && p) {
- w = p;
- p = p->parentWidget();
- offset += w->data->crect.topLeft();
- }
-
- const QWidgetPrivate *wd = w->d_func();
- QTLWExtra *tlw = wd->topData();
- if (!tlw->embedded)
- return pos + offset;
-
return d->mapToGlobal(pos);
}
QPoint QWidget::mapFromGlobal(const QPoint &pos) const
{
Q_D(const QWidget);
- QPoint offset = data->crect.topLeft();
- const QWidget *w = this;
- const QWidget *p = w->parentWidget();
- while (!w->isWindow() && p) {
- w = p;
- p = p->parentWidget();
- offset += w->data->crect.topLeft();
- }
-
- const QWidgetPrivate *wd = w->d_func();
- QTLWExtra *tlw = wd->topData();
- if (!tlw->embedded)
- return pos - offset;
-
return d->mapFromGlobal(pos);
}
--
1.7.6

32
qt.spec
View File

@ -11,19 +11,13 @@ Summary: Qt toolkit
Name: qt
Epoch: 1
Version: 4.8.0
Release: 0.29.rc1%{?dist}
Release: 1%{?dist}
# See LGPL_EXCEPTIONS.txt, LICENSE.GPL3, respectively, for exception details
License: (LGPLv2 with exceptions or GPLv3 with exceptions) and ASL 2.0 and BSD and FTL and MIT
Group: System Environment/Libraries
Url: http://qt.nokia.com/
%if 0%{?snap:1}
# git clone git://gitorious.org/qt/qt.git ; cd qt
# git archive --prefix qt-everywhere-opensource-src-%{version}/ 4.8 | xz -9
Source0: qt-everywhere-opensource-src-4.8.0-20111002.tar.xz
%else
Source0: http://get.qt.nokia.com/qt/source/qt-everywhere-opensource-src-%{version}-rc1.tar.gz
%endif
Source0: http://get.qt.nokia.com/qt/source/qt-everywhere-opensource-src-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Obsoletes: qt4 < %{version}-%{release}
@ -101,12 +95,6 @@ Patch74: qt-everywhere-opensource-src-4.7.4-tds_no_strict_aliasing.patch
Patch75: qt-ppc64-crash.patch
# upstream patches
# Applications crash when using a visual with 24 bits per pixel
# https://bugreports.qt.nokia.com/browse/QTBUG-21754
Patch100: qt-everywhere-opensource-src-4.8.0-QTBUG-21754.patch
# Revert "Improved performance of mapFromGlobal/mapToGlobal on X11" (QTBUG-22420)
# Fixes the position of misplaced mouse input
Patch101: qt-everywhere-opensource-src-4.8.0-QTBUG-22420-revert-x11-map-global.patch
# security patches
@ -434,8 +422,6 @@ popd
%patch75 -p1 -b .ppc64-crash
# upstream patches
%patch100 -p1 -b .QTBUG-21754
%patch101 -p1 -b .QTBUG-22420-revert-x11-map-global
# security fixes
@ -547,11 +533,6 @@ make %{?_smp_mflags}
# recreate .qm files
LD_LIBRARY_PATH=`pwd`/lib bin/lrelease translations/*.ts
%if 0%{?snap:1}
# fixup/generate docs
LD_LIBRARY_PATH=`pwd`/lib QT_PLUGIN_PATH=`pwd`/plugins make docs
%endif
%install
rm -rf %{buildroot}
@ -818,11 +799,7 @@ fi
%files -f qt.lang
%defattr(-,root,root,-)
%if ! 0%{?snap}
%doc README
%doc LICENSE.GPL3
%endif
%doc LICENSE.LGPL LGPL_EXCEPTION.txt
%doc README LICENSE.GPL3 LICENSE.LGPL LGPL_EXCEPTION.txt
%if "%{_qt4_libdir}" != "%{_libdir}"
/etc/ld.so.conf.d/*
%dir %{_qt4_libdir}
@ -1069,6 +1046,9 @@ fi
%changelog
* Thu Dec 15 2011 Jaroslav Reznik <jreznik@redhat.com> 4.8.0-1
- 4.8.0
* Mon Dec 12 2011 Jaroslav Reznik <jreznik@redhat.com> 4.8.0-0.29.rc1
- Fixes the position of misplaced mouse input (QTBUG-22420)

View File

@ -1,3 +1,10 @@
e8a5fdbeba2927c948d9f477a6abe904 qt-everywhere-opensource-src-4.8.0.tar.gz
d9f511e4b51983b4e10eb58b320416d5 hi128-app-qt4-logo.png
60de9d7e1cddd019f09fd036f0e5413a hi128-phonon-gstreamer.png
7ca265e0cf75b3b4c81e1490d3dba3be hi16-phonon-gstreamer.png
0a9f69d901aded140d4fed969c22e14f hi22-phonon-gstreamer.png
12db12c009b722a6dc141f78feb7e330 hi32-phonon-gstreamer.png
6dcc0672ff9e60a6b83f95c5f42bec5b hi48-app-qt4-logo.png
3e003b671384df8d1cb77dd6cc804934 qt-everywhere-opensource-src-4.8.0-rc1.tar.gz
86c34a1b81d44980b1381f94ed6b7a23 hi48-phonon-gstreamer.png
153505c71ec021b0a3bd4b74f2492e93 hi64-phonon-gstreamer.png
8e3924f417fea67f72b2105faed2119c gstreamer-logo.svg