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
1=== modified file 'libunity-2d-private/src/screeninfo.cpp'
2--- libunity-2d-private/src/screeninfo.cpp 2011-11-29 17:36:45 +0000
3+++ libunity-2d-private/src/screeninfo.cpp 2011-12-12 10:03:27 +0000
4@@ -62,14 +62,6 @@
5 }
6 }
7
8-/* FIXME: This should be removed when we find a cleaner way to bypass the
9- QML Image cache. See SpreadWindow.qml and WindowImageProvider::requestImage
10- for details. */
11-QString ScreenInfo::currentTime()
12-{
13- return QString::number(time(NULL));
14-}
15-
16 QRect ScreenInfo::availableGeometry() const
17 {
18 int screen = QX11Info::appScreen();
19
20=== modified file 'libunity-2d-private/src/screeninfo.h'
21--- libunity-2d-private/src/screeninfo.h 2011-11-29 17:36:45 +0000
22+++ libunity-2d-private/src/screeninfo.h 2011-12-12 10:03:27 +0000
23@@ -28,11 +28,6 @@
24 public:
25 static ScreenInfo* instance();
26
27- /* The following method doesn't strictly belong to a "screen" class
28- logically. It would be perhaps more appropriate to make an
29- "utility" class for it, but this will do for now. */
30- Q_INVOKABLE QString currentTime();
31-
32 /* Getters */
33 WorkspacesInfo *workspaces() { return &m_workspacesInfo; }
34 unsigned int activeWindow() const { return m_activeWindow; }
35
36=== modified file 'libunity-2d-private/src/windowimageprovider.cpp'
37--- libunity-2d-private/src/windowimageprovider.cpp 2011-08-09 14:32:13 +0000
38+++ libunity-2d-private/src/windowimageprovider.cpp 2011-12-12 10:03:27 +0000
39@@ -99,16 +99,11 @@
40 QSize *size,
41 const QSize &requestedSize)
42 {
43- /* Throw away the part of the id after the @ (if any) since it's just a timestamp
44- added to force the QML image cache to request to this image provider
45- a new image instead of re-using the old. See SpreadWindow.qml for more
46- details on the problem. */
47- int atPos = id.indexOf('@');
48- QString windowIds = (atPos == -1) ? id : id.left(atPos);
49+ QString windowIds = id;
50
51- /* After doing this, split the rest of the id on the character "|". The first
52- part is the window ID of the decorations, the latter of the actual content. */
53- atPos = windowIds.indexOf('|');
54+ /* Split the id on the character "|". The first part is the window ID of
55+ the decorations, the latter of the actual content. */
56+ int atPos = windowIds.indexOf('|');
57 Window frameId = ((atPos == -1) ? windowIds : windowIds.left(atPos)).toULong();
58 Window contentId = ((atPos == -1) ? windowIds : windowIds.mid(atPos + 1)).toULong();
59
60
61=== modified file 'places/dash.qml'
62--- places/dash.qml 2011-11-29 12:13:27 +0000
63+++ places/dash.qml 2011-12-12 10:03:27 +0000
64@@ -179,22 +179,13 @@
65 is when declarativeView.active becomes true, so that a
66 screenshot of the windows behind the dash is taken at that
67 point.
68- 'source' also needs to change so that the screenshot is
69- re-taken as opposed to pulled from QML's image cache.
70- This workarounds the fact that the image cache cannot be
71- disabled. A new API to deal with this was introduced in Qt Quick 1.1.
72-
73 See http://doc.qt.nokia.com/4.7-snapshot/qml-image.html#cache-prop
74 */
75- property variant timeAtActivation
76- Connections {
77- target: declarativeView
78- onActiveChanged: blurredBackground.timeAtActivation = screen.currentTime()
79- }
80
81 /* Use an image of the root window which essentially is a
82 capture of the entire screen */
83- source: declarativeView.active ? "image://window/root@" + blurredBackground.timeAtActivation : ""
84+ source: declarativeView.active ? "image://window/root" : ""
85+ cache: false
86
87 fillMode: Image.PreserveAspectCrop
88 x: -declarativeView.globalPosition.x
89
90=== modified file 'spread/Window.qml'
91--- spread/Window.qml 2011-06-23 17:08:53 +0000
92+++ spread/Window.qml 2011-12-12 10:03:27 +0000
93@@ -16,7 +16,7 @@
94 * along with this program. If not, see <http://www.gnu.org/licenses/>.
95 */
96
97-import QtQuick 1.0
98+import QtQuick 1.1
99 import "utils.js" as Utils
100
101 /*
102@@ -67,17 +67,9 @@
103 anchors.fill: parent
104 fillMode: Image.Stretch
105
106- /* HACK: QML uses an internal cache for Image objects that seems to use as
107- key the source property of the image.
108- This is great for normal images but in this case we really want the
109- screenshot to reload everytime.
110- Since I could not find any way to disable this cache, I am using this
111- hack which essentially appends the current time to the source URL of the
112- Image, tricking the cache into doing a request to the image provider.
113- */
114 source: "image://window/" + windowInfo.decoratedXid + "|"
115- + windowInfo.contentXid + "@"
116- + screen.currentTime()
117+ + windowInfo.contentXid
118+ cache: false
119
120 /* Disabled during animations for performance reasons */
121 smooth: !animating

Subscribers

People subscribed via source and target branches