From 6fc1ada88a92e70cb9f7f9154928a720200c17c8 Mon Sep 17 00:00:00 2001 From: Alf Gaida Date: Sat, 14 Jan 2017 03:55:07 +0100 Subject: [PATCH] Cherry-picking upstream release 0.11.3. --- AUTHORS | 2 +- CHANGELOG | 12 +++++++++- CMakeLists.txt | 2 +- debian/changelog | 6 +++++ pcmanfm/desktopwindow.cpp | 47 ++++++++++++++++++++++++--------------- pcmanfm/desktopwindow.h | 1 + 6 files changed, 49 insertions(+), 21 deletions(-) diff --git a/AUTHORS b/AUTHORS index 83cd2cd..40631a6 100644 --- a/AUTHORS +++ b/AUTHORS @@ -3,4 +3,4 @@ Upstream Authors: Hong Jen Yee (PCMan) Copyright: - Copyright (c) 2013-2016 LXQt team + Copyright (c) 2013-2017 LXQt team diff --git a/CHANGELOG b/CHANGELOG index ada4807..9cb2111 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,7 +1,17 @@ -pcmanfm-qt-0.11.2 / 2016-12-21 +pcmanfm-qt-0.11.3 / 2017-01-14 ============================== + * remove 0.11.3 changelog entries + * Bump patch version + * Release 0.11.3: Update changelog + * Add a workaround for the Qt5 bug which causes broken wallpaper background. + * Update AUTHORS + +0.11.2 / 2016-12-21 +=================== + + * Release 0.11.2: Update changelog * Use static_cast instead of the C style cast * Fix sign-compare warnings * Prevent wrong clearing of filter-bar with path buttons (#432) diff --git a/CMakeLists.txt b/CMakeLists.txt index f0c33ba..f29d0fe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,7 @@ endif (POLICY CMP0063) set(PCMANFM_QT_VERSION_MAJOR 0) set(PCMANFM_QT_VERSION_MINOR 11) -set(PCMANFM_QT_VERSION_PATCH 2) +set(PCMANFM_QT_VERSION_PATCH 3) set(PCMANFM_QT_VERSION ${PCMANFM_QT_VERSION_MAJOR}.${PCMANFM_QT_VERSION_MINOR}.${PCMANFM_QT_VERSION_PATCH}) set(LXQTBT_MINIMUM_VERSION "0.1.0") diff --git a/debian/changelog b/debian/changelog index 2ba6fb1..2c92ca1 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +pcmanfm-qt (0.11.3-1) unstable; urgency=medium + + * Cherry-picking upstream release 0.11.3. + + -- Alf Gaida Sat, 14 Jan 2017 03:54:54 +0100 + pcmanfm-qt (0.11.2-1) unstable; urgency=medium * Cherry-picking upstream release 0.11.2. diff --git a/pcmanfm/desktopwindow.cpp b/pcmanfm/desktopwindow.cpp index 2bbf880..46bc95f 100644 --- a/pcmanfm/desktopwindow.cpp +++ b/pcmanfm/desktopwindow.cpp @@ -26,7 +26,7 @@ #include #include #include -#include + #include #include #include @@ -36,6 +36,7 @@ #include #include #include +#include #include "./application.h" #include "mainwindow.h" @@ -81,6 +82,13 @@ DesktopWindow::DesktopWindow(int screenNum): listView_->setResizeMode(QListView::Adjust); listView_->setFlow(QListView::TopToBottom); + // This is to workaround Qt bug 54384 which affects Qt >= 5.6 + // https://bugreports.qt.io/browse/QTBUG-54384 + // Setting a QPixmap larger then the screen resolution to the background of a list view won't work. + // So we did a hack here: Disable the automatic background painting. + // Then paint the background of the list view ourselves by hook into its paint event handling method with a event filter. + listView_->viewport()->setAutoFillBackground(false); + // NOTE: When XRnadR is in use, the all screens are actually combined to form a // large virtual desktop and only one DesktopWindow needs to be created and screenNum is -1. // In some older multihead setups, such as xinerama, every physical screen @@ -121,6 +129,7 @@ DesktopWindow::DesktopWindow(int screenNum): connect(this, &DesktopWindow::openDirRequested, this, &DesktopWindow::onOpenDirRequested); listView_->installEventFilter(this); + listView_->viewport()->installEventFilter(this); // setup shortcuts QShortcut* shortcut; @@ -150,6 +159,7 @@ DesktopWindow::DesktopWindow(int screenNum): } DesktopWindow::~DesktopWindow() { + listView_->viewport()->removeEventFilter(this); listView_->removeEventFilter(this); if(relayoutTimer_) @@ -285,14 +295,7 @@ QImage DesktopWindow::loadWallpaperFile(QSize requiredSize) { // really generate the background pixmap according to current settings and apply it. void DesktopWindow::updateWallpaper() { - // reset the brush - // QPalette palette(listView_->palette()); - QPalette palette(Fm::FolderView::palette()); - - if(wallpaperMode_ == WallpaperNone) { // use background color only - palette.setBrush(QPalette::Base, bgColor_); - } - else { // use wallpaper + if(wallpaperMode_ != WallpaperNone) { // use wallpaper QPixmap pixmap; QImage image; if(wallpaperMode_ == WallpaperTile) { // use the original size @@ -327,16 +330,7 @@ void DesktopWindow::updateWallpaper() { } } wallpaperPixmap_ = pixmap; - if(!pixmap.isNull()) { - QBrush brush(pixmap); - palette.setBrush(QPalette::Base, brush); - } - else // if the image is not loaded, fallback to use background color only - palette.setBrush(QPalette::Base, bgColor_); } - - //FIXME: we should set the pixmap to X11 root window? - setPalette(palette); } void DesktopWindow::updateFromSettings(Settings& settings) { @@ -531,6 +525,19 @@ void DesktopWindow::removeBottomGap() { setShadow(settings.desktopShadowColor()); } +void DesktopWindow::paintBackground(QPaintEvent *event) { + // This is to workaround Qt bug 54384 which affects Qt >= 5.6 + // https://bugreports.qt.io/browse/QTBUG-54384 + // Since Qt does not paint the background of the QListView using the QPixmap we set properly, we do it ourselves. + QPainter painter(listView_->viewport()); // the painter paints on the viewport widget, not the QListView. + if(wallpaperMode_ == WallpaperNone || wallpaperPixmap_.isNull()) { + painter.fillRect(event->rect(), QBrush(bgColor_)); + } + else { + painter.drawPixmap(event->rect(), wallpaperPixmap_, event->rect()); + } +} + // QListView does item layout in a very inflexible way, so let's do our custom layout again. // FIXME: this is very inefficient, but due to the design flaw of QListView, this is currently the only workaround. void DesktopWindow::relayoutItems() { @@ -876,6 +883,10 @@ bool DesktopWindow::eventFilter(QObject * watched, QEvent * event) { } else if(watched == listView_->viewport()) { switch(event->type()) { + case QEvent::Paint: { + paintBackground(static_cast(event)); + break; + } case QEvent::MouseButtonPress: case QEvent::MouseButtonRelease: if(showWmMenu_) { diff --git a/pcmanfm/desktopwindow.h b/pcmanfm/desktopwindow.h index 1576245..cfa29d5 100644 --- a/pcmanfm/desktopwindow.h +++ b/pcmanfm/desktopwindow.h @@ -119,6 +119,7 @@ protected Q_SLOTS: private: void removeBottomGap(); + void paintBackground(QPaintEvent* event); private: Fm::ProxyFolderModel* proxyModel_;