From 94a6ead9681bda3fec5689c03acc28b60111769d Mon Sep 17 00:00:00 2001 From: Juan RP Date: Sun, 8 Feb 2015 20:10:15 +0100 Subject: [PATCH] kwindowsystem: add patches for two bugfixes via Arch. --- .../kwindowsystem/patches/kdebug-337626.patch | 49 +++++++ .../kwindowsystem/patches/kdebug-340348.patch | 136 ++++++++++++++++++ srcpkgs/kwindowsystem/template | 2 +- 3 files changed, 186 insertions(+), 1 deletion(-) create mode 100644 srcpkgs/kwindowsystem/patches/kdebug-337626.patch create mode 100644 srcpkgs/kwindowsystem/patches/kdebug-340348.patch diff --git a/srcpkgs/kwindowsystem/patches/kdebug-337626.patch b/srcpkgs/kwindowsystem/patches/kdebug-337626.patch new file mode 100644 index 00000000000..c5fa6b0ba73 --- /dev/null +++ b/srcpkgs/kwindowsystem/patches/kdebug-337626.patch @@ -0,0 +1,49 @@ +commit 9dbb47b07d4b4ec1e3e46098f955d36a318794bb +Author: Thomas Lübking +Date: Mon Nov 17 20:06:20 2014 +0100 + + ensure to keep image data alive w/ the image + + raster QPixmaps re-use the image data (implicitly shared) + deleting them w/ scope will thus cause invalidated + memory in the returned pixmap + + BUG: 337626 + REVIEW: 121158 + +diff --git a/src/kxutils.cpp b/src/kxutils.cpp +index 44885e0..c75c08e 100644 +--- src/kxutils.cpp ++++ src/kxutils.cpp +@@ -107,19 +107,14 @@ template T fromNative(xcb_pixmap_t pixmap) + case 30: { + // Qt doesn't have a matching image format. We need to convert manually + uint32_t *pixels = reinterpret_cast(xcb_get_image_data(xImage.data())); +- for (int i = 0; i < xImage.data()->length; ++i) { ++ for (uint i = 0; i < xImage.data()->length; ++i) { + int r = (pixels[i] >> 22) & 0xff; + int g = (pixels[i] >> 12) & 0xff; + int b = (pixels[i] >> 2) & 0xff; + + pixels[i] = qRgba(r, g, b, 0xff); + } +- QImage image(reinterpret_cast(pixels), geo->width, geo->height, +- xcb_get_image_data_length(xImage.data()) / geo->height, QImage::Format_ARGB32_Premultiplied); +- if (image.isNull()) { +- return T(); +- } +- return T::fromImage(image); ++ // fall through, Qt format is still Format_ARGB32_Premultiplied + } + case 32: + format = QImage::Format_ARGB32_Premultiplied; +@@ -136,7 +131,8 @@ template T fromNative(xcb_pixmap_t pixmap) + } + } + QImage image(xcb_get_image_data(xImage.data()), geo->width, geo->height, +- xcb_get_image_data_length(xImage.data()) / geo->height, format); ++ xcb_get_image_data_length(xImage.data()) / geo->height, format, free, xImage.data()); ++ xImage.take(); + if (image.isNull()) { + return T(); + } diff --git a/srcpkgs/kwindowsystem/patches/kdebug-340348.patch b/srcpkgs/kwindowsystem/patches/kdebug-340348.patch new file mode 100644 index 00000000000..2222c6a26af --- /dev/null +++ b/srcpkgs/kwindowsystem/patches/kdebug-340348.patch @@ -0,0 +1,136 @@ +commit 34c49b24920274455f2784b2ae6ac9108b226856 +Author: Thomas Lübking +Date: Mon Nov 17 20:09:03 2014 +0100 + + simplify format selection, make 24bit rgb32 + + an image w/o alphachannel is certainly not + premultiplied + + the findFormat() made not much sense at all + it was only used if the image depth was + the default depth and then looked up supported + 16, 24 and 32 bit formats + + However 32 bit images were handled before + unconditionally so this was only relevant for + 16 bit images (where we supported either 5-6-5 + or nothing) or 24bit images, where a false value + (ARGB_premultiplied implies 32bit) was returned. + + IOW: for the majority of images (32bit) this was + not used, for 24bpp displays we got a falsely + colored images and for 16bpp either a correctly + colored (for 5-6-5 layouts) or no image at all + (for 5-5-5 or [4-]4-4-4 layouts) + + I don't know whether 16bpp w/ 5-5-5 or 4-4-4 itw., + but better show them miscolored images (and trigger + a bug) than none. + If there're funky 24bpp servers (other than 8-8-8) + somebody shall please report a bug to us. + + Possible TODO: + add a single call to test the server layout (channel + masks) and yell an error if there's something "strange" + + BUG: 340348 + +diff --git a/src/kxutils.cpp b/src/kxutils.cpp +index c75c08e..015749d 100644 +--- src/kxutils.cpp ++++ src/kxutils.cpp +@@ -30,57 +30,6 @@ + namespace KXUtils + { + +-static uint8_t defaultDepth() +-{ +- xcb_connection_t *c = QX11Info::connection(); +- int screen = QX11Info::appScreen(); +- +- xcb_screen_iterator_t it = xcb_setup_roots_iterator(xcb_get_setup(c)); +- for (; it.rem; --screen, xcb_screen_next(&it)) { +- if (screen == 0) { +- return it.data->root_depth; +- } +- } +- return 0; +-} +- +-static QImage::Format findFormat() +-{ +- xcb_connection_t *c = QX11Info::connection(); +- int screen = QX11Info::appScreen(); +- +- xcb_screen_iterator_t screenIt = xcb_setup_roots_iterator(xcb_get_setup(c)); +- for (; screenIt.rem; --screen, xcb_screen_next(&screenIt)) { +- if (screen != 0) { +- continue; +- } +- xcb_depth_iterator_t depthIt = xcb_screen_allowed_depths_iterator(screenIt.data); +- for (; depthIt.rem; xcb_depth_next(&depthIt)) { +- xcb_visualtype_iterator_t visualIt = xcb_depth_visuals_iterator(depthIt.data); +- for (; visualIt.rem; xcb_visualtype_next(&visualIt)) { +- if (screenIt.data->root_visual != visualIt.data->visual_id) { +- continue; +- } +- xcb_visualtype_t *visual = visualIt.data; +- if ((depthIt.data->depth == 24 || depthIt.data->depth == 32) && +- visual->red_mask == 0x00ff0000 && +- visual->green_mask == 0x0000ff00 && +- visual->blue_mask == 0x000000ff) { +- return QImage::Format_ARGB32_Premultiplied; +- } +- if (depthIt.data->depth == 16 && +- visual->red_mask == 0xf800 && +- visual->green_mask == 0x07e0 && +- visual->blue_mask == 0x001f) { +- return QImage::Format_RGB16; +- } +- break; +- } +- } +- } +- return QImage::Format_Invalid; +-} +- + template T fromNative(xcb_pixmap_t pixmap) + { + xcb_connection_t *c = QX11Info::connection(); +@@ -99,11 +48,17 @@ template T fromNative(xcb_pixmap_t pixmap) + // request for image data failed + return T(); + } +- QImage::Format format = QImage::Format_ARGB32_Premultiplied; ++ QImage::Format format = QImage::Format_Invalid; + switch (xImage->depth) { + case 1: + format = QImage::Format_MonoLSB; + break; ++ case 16: ++ format = QImage::Format_RGB16; ++ break; ++ case 24: ++ format = QImage::Format_RGB32; ++ break; + case 30: { + // Qt doesn't have a matching image format. We need to convert manually + uint32_t *pixels = reinterpret_cast(xcb_get_image_data(xImage.data())); +@@ -120,15 +75,7 @@ template T fromNative(xcb_pixmap_t pixmap) + format = QImage::Format_ARGB32_Premultiplied; + break; + default: +- if (xImage->depth == defaultDepth()) { +- format = findFormat(); +- if (format == QImage::Format_Invalid) { +- return T(); +- } +- } else { +- // we don't know +- return T(); +- } ++ return T(); // we don't know + } + QImage image(xcb_get_image_data(xImage.data()), geo->width, geo->height, + xcb_get_image_data_length(xImage.data()) / geo->height, format, free, xImage.data()); diff --git a/srcpkgs/kwindowsystem/template b/srcpkgs/kwindowsystem/template index c2b45cf4785..874f497249b 100644 --- a/srcpkgs/kwindowsystem/template +++ b/srcpkgs/kwindowsystem/template @@ -1,7 +1,7 @@ # Template file for 'kwindowsystem' pkgname=kwindowsystem version=5.6.0 -revision=1 +revision=2 build_style=cmake configure_args="-DKDE_INSTALL_USE_QT_SYS_PATHS=ON -DBUILD_TESTING=OFF" hostmakedepends="cmake qt5-qmake pkg-config extra-cmake-modules"