After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 690241 - Animate window destruction
Animate window destruction
Status: RESOLVED WONTFIX
Product: gnome-shell
Classification: Core
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
Depends on:
Blocks:
 
 
Reported: 2012-12-15 02:38 UTC by Giovanni Campagna
Modified: 2012-12-16 21:41 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
WindowManager: clean up effects code (6.13 KB, patch)
2012-12-15 02:39 UTC, Giovanni Campagna
reviewed Details | Review
WindowManager: scale windows to primary monitors corner on minimize (1.35 KB, patch)
2012-12-15 02:39 UTC, Giovanni Campagna
needs-work Details | Review
WindowManager: tween out the opacity when a window is destroyed (1.47 KB, patch)
2012-12-15 02:39 UTC, Giovanni Campagna
rejected Details | Review
WindowManager: clean up scale_y when overwrite the map animation (1.01 KB, patch)
2012-12-16 19:05 UTC, Giovanni Campagna
committed Details | Review
WindowManager: clean up effects code (5.91 KB, patch)
2012-12-16 19:06 UTC, Giovanni Campagna
committed Details | Review
LayoutManager: fix findMonitorForWindow to take a metaWindow (3.37 KB, patch)
2012-12-16 20:00 UTC, Giovanni Campagna
committed Details | Review
WindowManager: scale windows to their monitor's corner on minimize (1.58 KB, patch)
2012-12-16 20:00 UTC, Giovanni Campagna
committed Details | Review

Description Giovanni Campagna 2012-12-15 02:38:13 UTC
Two late night WindowManager patches, and something that needs designer review but I like: when a window is unmapped, we animate the opacity to 0 before destroying the actor.

Or that was the intention. Testing at slower speed, I found out the window texture goes away immediately, so what's really animated is the background shadow. Still, at normal speed it looks better to me than just killing the window altogether.

(While bugzilla forced me to choose a component, I noticed that, despite being a shell and a window manager, we have no component for window management or application search/launch. Funny! )
Comment 1 Giovanni Campagna 2012-12-15 02:39:16 UTC
Created attachment 231608 [details] [review]
WindowManager: clean up effects code

Use consistently shouldAnimateActor(), and try to have a uniform code flow
between the modal dialog and the normal case.
Comment 2 Giovanni Campagna 2012-12-15 02:39:31 UTC
Created attachment 231609 [details] [review]
WindowManager: scale windows to primary monitors corner on minimize

We previously scaled windows to (primary.x, 0), which is wrong if
the primary monitor is not at y == 0.
Comment 3 Giovanni Campagna 2012-12-15 02:39:48 UTC
Created attachment 231610 [details] [review]
WindowManager: tween out the opacity when a window is destroyed

It looks nicer, and is symmetric with the mapping effect.
Comment 4 Jasper St. Pierre (not reading bugmail) 2012-12-16 00:03:30 UTC
This has been discussed before. Indeed, window contents may get destroyed before we have any say in the matter. The TFP spec says that if we don't re-bind the texture and there's a DAMAGE event, that the current state of the pixmap is "undefined", so we'd have to copy the window pixmap ourselves, which is expensive.
Comment 5 Jasper St. Pierre (not reading bugmail) 2012-12-16 00:04:37 UTC
Review of attachment 231608 [details] [review]:

Nice cleanup in general.

::: js/ui/windowManager.js
@@ +210,2 @@
     _shouldAnimateActor: function(actor) {
         if (!this._shouldAnimate())

You should be able to move shouldAnimate() inline here.

@@ +410,3 @@
             Tweener.removeTweens(actor);
             actor.opacity = 255;
+            actor.scale_y = 1;

Seems like an unrelated bugfix? Would like it in a separate patch.
Comment 6 Jasper St. Pierre (not reading bugmail) 2012-12-16 00:05:03 UTC
Review of attachment 231609 [details] [review]:

OK
Comment 7 Jasper St. Pierre (not reading bugmail) 2012-12-16 00:05:20 UTC
Review of attachment 231610 [details] [review]:

Not going to happen.
Comment 8 Giovanni Campagna 2012-12-16 18:27:52 UTC
(In reply to comment #4)
> This has been discussed before. Indeed, window contents may get destroyed
> before we have any say in the matter. The TFP spec says that if we don't
> re-bind the texture and there's a DAMAGE event, that the current state of the
> pixmap is "undefined", so we'd have to copy the window pixmap ourselves, which
> is expensive.

Uhm... Docs for XCompositeNameWindowPixmap say that the pixmap remains allocated until freed, even if the window is unmapped or destroyed, so can't we just keep processing damage for the old pixmap, update the TFP texture and paint?

Currently, mutter stops processing damage when an effect is in progress, with a big comment in meta_window_actor_process_damage() saying it's done to freeze the window, but as I understand this just corrupts the texture.
OTOH, the TFP spec says that if we don't re-bind the texture and any client renders on it (which is perfectly possible that happens between when we bind the texture and when we paint with it), the result will be undefined.

Now, I'm not saying that continuing damage processing is easy to do, given that we unregister the window when unmanaged...
Comment 9 Giovanni Campagna 2012-12-16 19:00:10 UTC
Uh oh. I think I found the problem: window contents are not undefined, they're correctly updated as the window is updated. And in particular, as the client window is destroyed, the frame window and pixmap are correctly repainted with the background.

So yes, this another bug that won't be solved until we have client side decorations.
Leaving open for the cleanups, once committed this becomes WONTFIX.
Comment 10 Giovanni Campagna 2012-12-16 19:05:09 UTC
Created attachment 231663 [details] [review]
WindowManager: clean up scale_y when overwrite the map animation

If we overwrite a map animation (for example because the actor is now destroyed),
we need to complete it first, otherwise it starts off from a random
middle point. This is the same treatment opacity gets for normal windows.
Comment 11 Giovanni Campagna 2012-12-16 19:06:54 UTC
Created attachment 231664 [details] [review]
WindowManager: clean up effects code

Use consistently shouldAnimateActor(), and try to have a uniform code flow
between the modal dialog and the normal case.

I can't inline shouldAnimate because that's used by switchWorkspace too.
Comment 12 Jasper St. Pierre (not reading bugmail) 2012-12-16 19:28:10 UTC
(In reply to comment #9)
> Uh oh. I think I found the problem: window contents are not undefined, they're
> correctly updated as the window is updated. And in particular, as the client
> window is destroyed, the frame window and pixmap are correctly repainted with
> the background.

It's undefined by the spec. That's the implementation some graphics drivers will give it, because it's efficient.

"""
    Rendering to the drawable while it is bound to a texture will leave the
    contents of the texture in an undefined state.  However, no
    synchronization between rendering and texturing is done by GLX.  It is
    the application's responsibility to implement any synchronization
    required.
"""

It's undefined because it might be slower in some implementations that would be require a copy.
Comment 13 Jasper St. Pierre (not reading bugmail) 2012-12-16 19:29:35 UTC
Review of attachment 231609 [details] [review]:

Actually, not yet. This should probably go to the position of the monitor the window is on, because there's a hot corner there, and that's closest to where it will appear in the overview.
Comment 14 Jasper St. Pierre (not reading bugmail) 2012-12-16 19:30:10 UTC
Review of attachment 231663 [details] [review]:

OK.
Comment 15 Jasper St. Pierre (not reading bugmail) 2012-12-16 19:36:46 UTC
Review of attachment 231664 [details] [review]:

OK.
Comment 16 Giovanni Campagna 2012-12-16 19:47:51 UTC
Attachment 231663 [details] pushed as 15063ef - WindowManager: clean up scale_y when overwrite the map animation
Attachment 231664 [details] pushed as 3b8a125 - WindowManager: clean up effects code
Comment 17 Giovanni Campagna 2012-12-16 20:00:19 UTC
Created attachment 231666 [details] [review]
LayoutManager: fix findMonitorForWindow to take a metaWindow

This makes the method usable in places where the associated window actor
might not have the right size (such as from window manager animations).
Also, make the method public from LayoutManager.
Comment 18 Giovanni Campagna 2012-12-16 20:00:43 UTC
Created attachment 231667 [details] [review]
WindowManager: scale windows to their monitor's corner on minimize

We previously scaled windows to (primary.x, 0), which is wrong if the
window is not on the primary monitor, or if the primary monitor is not
at y == 0.
Comment 19 Jasper St. Pierre (not reading bugmail) 2012-12-16 20:26:45 UTC
Review of attachment 231666 [details] [review]:

OK.
Comment 20 Jasper St. Pierre (not reading bugmail) 2012-12-16 20:27:19 UTC
Review of attachment 231667 [details] [review]:

Commit message is wrong, otherwise fine.
Comment 21 Giovanni Campagna 2012-12-16 20:31:45 UTC
(In reply to comment #20)
> Review of attachment 231667 [details] [review]:
> 
> Commit message is wrong, otherwise fine.

Wrong? In what way?
Comment 22 Jasper St. Pierre (not reading bugmail) 2012-12-16 20:38:31 UTC
I'd like some expansion about *why* we made this change. Feel free to copy the rationale I made above.
Comment 23 Jasper St. Pierre (not reading bugmail) 2012-12-16 21:10:54 UTC
(In reply to comment #9)
> So yes, this another bug that won't be solved until we have client side
> decorations.
> Leaving open for the cleanups, once committed this becomes WONTFIX.

Why does CSD make a difference?
Comment 24 Giovanni Campagna 2012-12-16 21:31:14 UTC
(In reply to comment #23)
> (In reply to comment #9)
> > So yes, this another bug that won't be solved until we have client side
> > decorations.
> > Leaving open for the cleanups, once committed this becomes WONTFIX.
> 
> Why does CSD make a difference?

Because the client stops rendering on the window, so the pixmap contents are effectively a frozen image of the window.
Without CSD, the client drops the window, so the frame window is repainted with just the background by X, the pixmap is updated and the actual window contents are lost.
Comment 25 Giovanni Campagna 2012-12-16 21:40:58 UTC
Attachment 231666 [details] pushed as b38ecaf - LayoutManager: fix findMonitorForWindow to take a metaWindow
Attachment 231667 [details] pushed as 1256af7 - WindowManager: scale windows to their monitor's corner on minimize