Merge lp:~fboucault/unity-2d/windowimageprovider_remove_timestamp_hack into lp:unity-2d

Proposed by Florian Boucault
Status: Merged
Approved by: Gerry Boland
Approved revision: 810
Merged at revision: 823
Proposed branch: lp:~fboucault/unity-2d/windowimageprovider_remove_timestamp_hack
Merge into: lp:unity-2d
Diff against target: 121 lines (+9/-44)
5 files modified
libunity-2d-private/src/screeninfo.cpp (+0/-8)
libunity-2d-private/src/screeninfo.h (+0/-5)
libunity-2d-private/src/windowimageprovider.cpp (+4/-9)
places/dash.qml (+2/-11)
spread/Window.qml (+3/-11)
To merge this branch: bzr merge lp:~fboucault/unity-2d/windowimageprovider_remove_timestamp_hack
Reviewer Review Type Date Requested Status
Gerry Boland (community) Approve
Lohith D Shivamurthy (community) code Needs Fixing
Review via email: mp+84662@code.launchpad.net

Description of the change

[dash & spread] Do not use a timestamp to make sure the window screenshots are
refreshed but instead make use of the 'cache' property of the Image QML element
recently introduced in Qt Quick 1.1

Removed unused ScreenInfo::currentTime()

To post a comment you must log in.
Revision history for this message
Lohith D Shivamurthy (dyams) wrote :

Two issues I noticed

1) Is it not a good time to remove this too?
<code >QString ScreenInfo::currentTime() { ... } </code>

2) The comment needs to be fixed. windowimageprovider.cpp line#104
Current : /* After doing this, split the rest of the id on the character "|". The first
            part is the window ID of the decorations, the latter of the actual content. */
Updated : /* Split the id on the character "|". The first part is the window ID of the decorations and the latter is the actual content. */

Would it be possible to address these two issues? Please let me know.

review: Needs Fixing (code)
808. By Florian Boucault

Removed now unused ScreenInfo::currentTime()

809. By Florian Boucault

Fixed comment wording in WindowImageProvider.

Revision history for this message
Florian Boucault (fboucault) wrote :

Thanks a lot for this review Lohith. I believed I have now addressed the 2 issues.

Revision history for this message
Gerry Boland (gerboland) wrote :

Just a minor thing:

QString windowIds = id;

there no need for the copy now. Otherwise is good.

Revision history for this message
Gerry Boland (gerboland) wrote :

This is breaking the spread for me. Launch spread (works ok), exit it, then launch it again. It fails to work, errors like:

unity-2d-spread: [WARNING] file:///home/gerry/dev/windowimageprovider_remove_timestamp_hack//spread/Window.qml:64:5: QML Image: Failed to get image from provider: image://window/17184478|23068809

review: Needs Fixing
Revision history for this message
Florian Boucault (fboucault) wrote :

> Just a minor thing:
>
> QString windowIds = id;
>
> there no need for the copy now. Otherwise is good.

Yeah, I kept it in order to minimize the diff.

Revision history for this message
Florian Boucault (fboucault) wrote :

> This is breaking the spread for me. Launch spread (works ok), exit it, then
> launch it again. It fails to work, errors like:
>
> unity-2d-spread: [WARNING] file:///home/gerry/dev/windowimageprovider_remove_t
> imestamp_hack//spread/Window.qml:64:5: QML Image: Failed to get image from
> provider: image://window/17184478|23068809

It sounds like it is unrelated to that patch. I will do more stress testing.

810. By Florian Boucault

Merged lp:unity-2d

Revision history for this message
Florian Boucault (fboucault) wrote :

Gerry, I do not experience this issue unless:
- metacity's compositing is disabled
- a window is on another workspace and metacity's capture before unmap is disabled
- a window is minimized and metacity's capture before unmap is disabled

Whether or not the patch in this MR is applied you should experience this.

Revision history for this message
Gerry Boland (gerboland) wrote :

Yes on further investigation I believe the issue I saw is unrelated to this patch. Hence I approve this. Thank you!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'libunity-2d-private/src/screeninfo.cpp'
--- libunity-2d-private/src/screeninfo.cpp 2011-11-29 17:36:45 +0000
+++ libunity-2d-private/src/screeninfo.cpp 2011-12-12 10:03:27 +0000
@@ -62,14 +62,6 @@
62 }62 }
63}63}
6464
65/* FIXME: This should be removed when we find a cleaner way to bypass the
66 QML Image cache. See SpreadWindow.qml and WindowImageProvider::requestImage
67 for details. */
68QString ScreenInfo::currentTime()
69{
70 return QString::number(time(NULL));
71}
72
73QRect ScreenInfo::availableGeometry() const65QRect ScreenInfo::availableGeometry() const
74{66{
75 int screen = QX11Info::appScreen();67 int screen = QX11Info::appScreen();
7668
=== modified file 'libunity-2d-private/src/screeninfo.h'
--- libunity-2d-private/src/screeninfo.h 2011-11-29 17:36:45 +0000
+++ libunity-2d-private/src/screeninfo.h 2011-12-12 10:03:27 +0000
@@ -28,11 +28,6 @@
28public:28public:
29 static ScreenInfo* instance();29 static ScreenInfo* instance();
3030
31 /* The following method doesn't strictly belong to a "screen" class
32 logically. It would be perhaps more appropriate to make an
33 "utility" class for it, but this will do for now. */
34 Q_INVOKABLE QString currentTime();
35
36 /* Getters */31 /* Getters */
37 WorkspacesInfo *workspaces() { return &m_workspacesInfo; }32 WorkspacesInfo *workspaces() { return &m_workspacesInfo; }
38 unsigned int activeWindow() const { return m_activeWindow; }33 unsigned int activeWindow() const { return m_activeWindow; }
3934
=== modified file 'libunity-2d-private/src/windowimageprovider.cpp'
--- libunity-2d-private/src/windowimageprovider.cpp 2011-08-09 14:32:13 +0000
+++ libunity-2d-private/src/windowimageprovider.cpp 2011-12-12 10:03:27 +0000
@@ -99,16 +99,11 @@
99 QSize *size,99 QSize *size,
100 const QSize &requestedSize)100 const QSize &requestedSize)
101{101{
102 /* Throw away the part of the id after the @ (if any) since it's just a timestamp102 QString windowIds = id;
103 added to force the QML image cache to request to this image provider
104 a new image instead of re-using the old. See SpreadWindow.qml for more
105 details on the problem. */
106 int atPos = id.indexOf('@');
107 QString windowIds = (atPos == -1) ? id : id.left(atPos);
108103
109 /* After doing this, split the rest of the id on the character "|". The first104 /* Split the id on the character "|". The first part is the window ID of
110 part is the window ID of the decorations, the latter of the actual content. */105 the decorations, the latter of the actual content. */
111 atPos = windowIds.indexOf('|');106 int atPos = windowIds.indexOf('|');
112 Window frameId = ((atPos == -1) ? windowIds : windowIds.left(atPos)).toULong();107 Window frameId = ((atPos == -1) ? windowIds : windowIds.left(atPos)).toULong();
113 Window contentId = ((atPos == -1) ? windowIds : windowIds.mid(atPos + 1)).toULong();108 Window contentId = ((atPos == -1) ? windowIds : windowIds.mid(atPos + 1)).toULong();
114109
115110
=== modified file 'places/dash.qml'
--- places/dash.qml 2011-11-29 12:13:27 +0000
+++ places/dash.qml 2011-12-12 10:03:27 +0000
@@ -179,22 +179,13 @@
179 is when declarativeView.active becomes true, so that a179 is when declarativeView.active becomes true, so that a
180 screenshot of the windows behind the dash is taken at that180 screenshot of the windows behind the dash is taken at that
181 point.181 point.
182 'source' also needs to change so that the screenshot is
183 re-taken as opposed to pulled from QML's image cache.
184 This workarounds the fact that the image cache cannot be
185 disabled. A new API to deal with this was introduced in Qt Quick 1.1.
186
187 See http://doc.qt.nokia.com/4.7-snapshot/qml-image.html#cache-prop182 See http://doc.qt.nokia.com/4.7-snapshot/qml-image.html#cache-prop
188 */183 */
189 property variant timeAtActivation
190 Connections {
191 target: declarativeView
192 onActiveChanged: blurredBackground.timeAtActivation = screen.currentTime()
193 }
194184
195 /* Use an image of the root window which essentially is a185 /* Use an image of the root window which essentially is a
196 capture of the entire screen */186 capture of the entire screen */
197 source: declarativeView.active ? "image://window/root@" + blurredBackground.timeAtActivation : ""187 source: declarativeView.active ? "image://window/root" : ""
188 cache: false
198189
199 fillMode: Image.PreserveAspectCrop190 fillMode: Image.PreserveAspectCrop
200 x: -declarativeView.globalPosition.x191 x: -declarativeView.globalPosition.x
201192
=== modified file 'spread/Window.qml'
--- spread/Window.qml 2011-06-23 17:08:53 +0000
+++ spread/Window.qml 2011-12-12 10:03:27 +0000
@@ -16,7 +16,7 @@
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */17 */
1818
19import QtQuick 1.019import QtQuick 1.1
20import "utils.js" as Utils20import "utils.js" as Utils
2121
22/*22/*
@@ -67,17 +67,9 @@
67 anchors.fill: parent67 anchors.fill: parent
68 fillMode: Image.Stretch68 fillMode: Image.Stretch
6969
70 /* HACK: QML uses an internal cache for Image objects that seems to use as
71 key the source property of the image.
72 This is great for normal images but in this case we really want the
73 screenshot to reload everytime.
74 Since I could not find any way to disable this cache, I am using this
75 hack which essentially appends the current time to the source URL of the
76 Image, tricking the cache into doing a request to the image provider.
77 */
78 source: "image://window/" + windowInfo.decoratedXid + "|"70 source: "image://window/" + windowInfo.decoratedXid + "|"
79 + windowInfo.contentXid + "@"71 + windowInfo.contentXid
80 + screen.currentTime()72 cache: false
8173
82 /* Disabled during animations for performance reasons */74 /* Disabled during animations for performance reasons */
83 smooth: !animating75 smooth: !animating

Subscribers

People subscribed via source and target branches