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 656433 - The background of non-primary monitors in the Overview isn't darkened
The background of non-primary monitors in the Overview isn't darkened
Status: RESOLVED FIXED
Product: gnome-shell
Classification: Core
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
Depends on:
Blocks:
 
 
Reported: 2011-08-13 01:37 UTC by Rui Matos
Modified: 2011-08-29 18:20 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
overview: make this._group fill the screen instead of only the primary (1.29 KB, patch)
2011-08-13 01:37 UTC, Rui Matos
rejected Details | Review
overview: make the background of non-primary monitors darkened (3.70 KB, patch)
2011-08-17 19:48 UTC, Rui Matos
needs-work Details | Review
MetaBackgroundActor: add a dim-factor property (4.75 KB, patch)
2011-08-26 18:03 UTC, Rui Matos
none Details | Review
Overview: use the background_actor dim-factor property to dim (1.74 KB, patch)
2011-08-26 18:05 UTC, Rui Matos
none Details | Review
WorkspaceThumbnail: set the background dim-factor temporarily while painting (1.27 KB, patch)
2011-08-26 18:33 UTC, Rui Matos
none Details | Review
MetaBackgroundActor: add a dim-factor property (4.70 KB, patch)
2011-08-26 19:10 UTC, Rui Matos
none Details | Review
MetaBackgroundActor: allow creating multiple instances (17.85 KB, patch)
2011-08-28 18:14 UTC, Owen Taylor
committed Details | Review
MetaBackgroundActor: add a dim-factor property (4.73 KB, patch)
2011-08-29 01:51 UTC, Rui Matos
reviewed Details | Review
MetaBackgroundActor: make this a public class (16.57 KB, patch)
2011-08-29 01:52 UTC, Rui Matos
committed Details | Review
Use Meta.BackgroundActor instances instead of cloning global.background_actor (2.13 KB, patch)
2011-08-29 01:53 UTC, Rui Matos
committed Details | Review
Overview: dim the background with the dim-factor property (1.90 KB, patch)
2011-08-29 01:53 UTC, Rui Matos
committed Details | Review
MetaBackgroundActor: add a dim-factor property (4.83 KB, patch)
2011-08-29 14:48 UTC, Rui Matos
committed Details | Review

Description Rui Matos 2011-08-13 01:37:30 UTC
This allows the overview's darkened background to be applied to secondary monitors
making the overall overview appearance consistent across all monitors.

There shouldn't be any other side-effects since the overview's remaining
actors don't rely on this._group's size.
Comment 1 Rui Matos 2011-08-13 01:37:33 UTC
Created attachment 193737 [details] [review]
overview: make this._group fill the screen instead of only the primary
Comment 2 Jasper St. Pierre (not reading bugmail) 2011-08-13 02:16:30 UTC
(In reply to comment #0)
> There shouldn't be any other side-effects since the overview's remaining
> actors don't rely on this._group's size.

But you change the position, which will cause side effects.

There's a few other solutions:

 * A new actor that stretches from (0, 0) to (screen_width, screen_height) with the fade, and putting this._group inside of that.

 * A separate actor in the overlay group that we'll fade, and we remove the background-color from #overview. See lightbox.js
Comment 3 Rui Matos 2011-08-15 00:36:24 UTC
(In reply to comment #2)
> (In reply to comment #0)
> > There shouldn't be any other side-effects since the overview's remaining
> > actors don't rely on this._group's size.
> 
> But you change the position, which will cause side effects.

Indeed. *facepalm*

> There's a few other solutions:
> 
>  * A new actor that stretches from (0, 0) to (screen_width, screen_height) with
> the fade, and putting this._group inside of that.
> 
>  * A separate actor in the overlay group that we'll fade, and we remove the
> background-color from #overview. See lightbox.js

Nod. Will submit something tomorrow when I'm with my 2nd display again.
Comment 4 Rui Matos 2011-08-17 19:48:18 UTC
Created attachment 194076 [details] [review]
overview: make the background of non-primary monitors darkened

This makes the overall overview appearance consistent across all monitors.
Comment 5 Owen Taylor 2011-08-26 13:07:04 UTC
Review of attachment 194076 [details] [review]:

This looks like it works, but there's an alternate way of approaching this that adds a huge amount of efficiency when going into the overview that I'd really rather do instead.

Right now, what we do is:
 
 Read background pixel from texture 4 bytes
 Write to frame buffer              4 bytes
 Read pixel from frame buffer       4 bytes
 Blend with black
 Write result to frame buffer        4 bytes

But note that what we are dimming to black is basically just the background actor (*), so what we should do is:

 Read background pixel from texture 4 bytes
 Blend with black
 Write result to frame buffer       4 bytes

Saving us (pixels in screen) * 8 bytes of memory bandwidth for every frame we draw going into the overview.

We can add a dim-fraction property to MetaBackgroundActor and just implement implement it by changing the material for MetaBackgroundActor to do the appropriate cogl blending.

(*) Not completely true - when desktop icons are enabled, during the animation we mix the desktop icons with the background and fade that, but there's no UI to turn them on, and so in that case, I think we can just accept the change from dim(interp(icons, plain background)) to interp(icons, dim(plain_background)) - it will mean that you get a more abrupt dim in the with-icons case than without, but performance in the default case is more important to me than that.
Comment 6 Rui Matos 2011-08-26 18:03:07 UTC
Created attachment 194870 [details] [review]
MetaBackgroundActor: add a dim-factor property
Comment 7 Rui Matos 2011-08-26 18:05:49 UTC
Created attachment 194871 [details] [review]
Overview: use the background_actor dim-factor property to dim
Comment 8 Rui Matos 2011-08-26 18:33:36 UTC
Created attachment 194874 [details] [review]
WorkspaceThumbnail: set the background dim-factor temporarily while painting
Comment 9 Rui Matos 2011-08-26 19:10:19 UTC
Created attachment 194877 [details] [review]
MetaBackgroundActor: add a dim-factor property

--
I removed the queue_relayout (which should have been a queue_redraw to begin
with) from the property setter and it seems to work still. I'm not really sure
why though :-)
Comment 10 Owen Taylor 2011-08-28 18:14:32 UTC
Hmmm, I'm basically not willing to do the hack where we have a dim-factor item that doesn't trigger a redraw ... that's a bad hack that spills over between GnomeShell and Mutter. I'm OK with bad hacks, but only when encapsulated :-)

(And queuing redraws out of ::paint is just bad news - I think the only reason you didn't go into an infinite loop was the short-circuit in set_dim_factor() that returns immediately when the value is the same as the old one.)

I'll attach a rework of MetaBackgroundActor that allows multiple copies while sharing the same CoglTexture. You'll need to, beyond what I'm attaching here:

 - Split meta-background-actor.h into a -private.h and a public .h that goes into the src/meta/ subdirectory.
 - Rebase your ::dim-factor property on top of this (should be easy)

Also, review of my patch and additional testing would definitely be appreciated!
Comment 11 Owen Taylor 2011-08-28 18:14:54 UTC
Created attachment 194979 [details] [review]
MetaBackgroundActor: allow creating multiple instances

Instead of requiring a singleton MetaBackgroundActor for the screen,
allow creating multiple copies that internally share a single
CoglTexture behind the scenes. This will be useful for allowing
multiple views of the screen background with different rendering
options.
Comment 12 Rui Matos 2011-08-29 01:51:32 UTC
Created attachment 195024 [details] [review]
MetaBackgroundActor: add a dim-factor property

--
- rebased on top of Owen's patch
Comment 13 Rui Matos 2011-08-29 01:52:05 UTC
Created attachment 195025 [details] [review]
MetaBackgroundActor: make this a public class
Comment 14 Rui Matos 2011-08-29 01:53:36 UTC
Created attachment 195026 [details] [review]
Use Meta.BackgroundActor instances instead of cloning global.background_actor

Instances of this class share a single CoglTexture behind the scenes which
allows us to show the background with different rendering options without
duplicating the texture data.
Comment 15 Rui Matos 2011-08-29 01:53:52 UTC
Created attachment 195027 [details] [review]
Overview: dim the background with the dim-factor property

This saves us (pixels in screen) * 8 bytes of memory bandwidth for every frame
we draw going into the overview.

It also allows us to dim the background on non-primary monitors.
Comment 16 Rui Matos 2011-08-29 01:58:08 UTC
Review of attachment 194979 [details] [review]:

This is really nice Owen, thanks.

I tested it alone and with each one of my patches on top. No problems.
Comment 17 Owen Taylor 2011-08-29 11:52:47 UTC
Comment on attachment 194979 [details] [review]
MetaBackgroundActor: allow creating multiple instances

Attachment 194979 [details] pushed as c630046 - MetaBackgroundActor: allow creating multiple instances
Comment 18 Owen Taylor 2011-08-29 13:00:02 UTC
Review of attachment 195024 [details] [review]:

Good to commit except for the following:

::: src/compositor/meta-background-actor.c
@@ +299,3 @@
   meta_screen_get_size (self->background->screen, &width, &height);
 
+  color_component = 255 * self->dim_factor;

1) you need to take opacity into account here too
2) although this sort of conversion is pretty commonly found, I dislike having a dim_factor of 0.99999 give you a color_component of 254
 
 color_component = (int)(0.5 + opacity * self->dim_factor);

@@ +363,3 @@
+  g_object_notify (G_OBJECT (self), "dim-factor");
+
+  clutter_actor_queue_redraw (CLUTTER_ACTOR (self));

Doesn't matter here , but as a matter of consistency, make the g_object_notify() the last line of the function, since notifcations should happen after everything else is done.
Comment 19 Owen Taylor 2011-08-29 13:00:54 UTC
Review of attachment 195024 [details] [review]:

Oh, can you make the commit message just a bit more descriptive as well - mention that the property darkens the background or something.
Comment 20 Owen Taylor 2011-08-29 13:04:30 UTC
Review of attachment 195025 [details] [review]:

Looks fine.

(It would also have been fine to simply not make the structures public and keep them private to the .c file.)
Comment 21 Owen Taylor 2011-08-29 13:05:56 UTC
Review of attachment 195026 [details] [review]:

Looks good
Comment 22 Owen Taylor 2011-08-29 13:07:42 UTC
Review of attachment 195027 [details] [review]:

Change "This" at the beginning of the commit message to:

 "Doing this rather than overdrawing a black rectangle "

Otherwise good to commit
Comment 23 Rui Matos 2011-08-29 14:48:06 UTC
Created attachment 195078 [details] [review]
MetaBackgroundActor: add a dim-factor property

This property darkens the background.

--
- Thanks for the review, comments addressed;

- Did a little optimization by keeping the property GParamSpec and use
  notify_by_pspec.
Comment 24 Owen Taylor 2011-08-29 14:55:56 UTC
Review of attachment 195078 [details] [review]:

Don't think it's a worthwhile complication^H^H^H^H^optimization except for the very most commonly notiifed properties, but sure.

(In this case, the notification isn't actually needed because it's done automatically at property set time, I didn't comment it before because it would be needed if the setter was ever made into a public function or otherwise called from somewhere else in the code.)
Comment 25 Rui Matos 2011-08-29 16:14:07 UTC
Comment on attachment 195078 [details] [review]
MetaBackgroundActor: add a dim-factor property

Attachment 195078 [details] pushed as 53e70b3 - MetaBackgroundActor: add a dim-factor property
Comment 26 Rui Matos 2011-08-29 16:26:25 UTC
Comment on attachment 195025 [details] [review]
MetaBackgroundActor: make this a public class

Attachment 195025 [details] pushed as b28c653 - MetaBackgroundActor: make it a public class

[ hand edit because I changed the patch summary slightly and git-bz doesn't cope with that ]
Comment 27 Rui Matos 2011-08-29 18:20:01 UTC
Attachment 195026 [details] pushed as 82ce8fe - Use Meta.BackgroundActor instances instead of cloning global.background_actor
Attachment 195027 [details] pushed as 155997b - Overview: dim the background with the dim-factor property