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 769360 - draw background when screen is not composited
draw background when screen is not composited
Status: RESOLVED FIXED
Product: nautilus
Classification: Core
Component: Desktop
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Nautilus Maintainers
Nautilus Maintainers
Depends on:
Blocks:
 
 
Reported: 2016-07-31 15:46 UTC by Alberts Muktupāvels
Modified: 2016-08-22 13:55 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
nautilus-desktop: draw background when screen is not composited (5.19 KB, patch)
2016-07-31 15:47 UTC, Alberts Muktupāvels
none Details | Review
nautilus-desktop: draw background when screen is not composited (5.40 KB, patch)
2016-08-15 18:32 UTC, Alberts Muktupāvels
committed Details | Review
nautilus-desktop: initialize composited to TRUE (1.53 KB, patch)
2016-08-19 10:27 UTC, Alberts Muktupāvels
committed Details | Review

Description Alberts Muktupāvels 2016-07-31 15:46:28 UTC
At least GNOME Flashback session with Metacity still can be used without compositing manager. Since transparency is not available nautilus currently draw black background.
Comment 1 Alberts Muktupāvels 2016-07-31 15:47:08 UTC
Created attachment 332444 [details] [review]
nautilus-desktop: draw background when screen is not composited

At least GNOME Flashback session with Metacity still can be used
without compositing manager. Since transparency is not available
nautilus currently draw black background.

Fix it by checking if compositing manager is running and if it is
not then get background surface from root window and draw it on
nautilus desktop window.
Comment 2 Carlos Soriano 2016-08-01 12:28:34 UTC
Hey,

Took me some time to find out since the comment was in an unrelated bug report, but Cosimo already answered you in https://bugzilla.gnome.org/show_bug.cgi?id=765159#c22

I added the explanation in the first bug report requesting this. Let's mark this one as duplicate.

*** This bug has been marked as a duplicate of bug 444320 ***
Comment 3 Alberts Muktupāvels 2016-08-01 12:53:44 UTC
(In reply to Carlos Soriano from comment #2)
> Took me some time to find out since the comment was in an unrelated bug
> report, but Cosimo already answered you in
> https://bugzilla.gnome.org/show_bug.cgi?id=765159#c22

That was answer to question about restoring background drawing if --background command line option is passed. This patch is about only "drawing" background if compositing manager is not available...

(In reply to Cosimo Cecchi from comment #22)
> Longer answer: it's up to the GNOME desktop shell to render the background.
> If you are not running GNOME shell (e.g. the old fallback mode scenario), it
> would be the responsibility of gnome-settings-daemon's old background plugin
> to render it. If you also are not running gnome-settings-daemon, then you

gnome-settings-daemon does not draw background these days. But I think it does not matter if background is rendered from gnome-settings-daemon or gnome-flashback or any other app.

The problem is that when compositing manager is not available nautilus desktop window is no longer transparent - it is impossible to see rendered background unless desktop window is closed. You see icons on black window...

> most likely are also not using gnome-control-center to set the desktop
> background (e.g. you use another DE), so there's no point in having nautilus
> read those settings to draw the background.

We do use gnome-settings-daemon and gnome-control-center. :) And patch attached to this bug report does not touch any settings.

My patch adds code to check if composting manager is available. If it is not then it reads background from root window and renders it on nautilus desktop window.
Comment 4 Alberts Muktupāvels 2016-08-09 17:56:32 UTC
Carlos and/or Cosimo, can you please answer to my last comment?
Comment 5 Carlos Soriano 2016-08-10 07:17:50 UTC
Review of attachment 332444 [details] [review]:

Hey, sorry I forgot about this now that we are close to the UI freeze and work piles up :)

I'm fine with it since the code for the desktop is split, but I would like to hear from Cosimo.
Comment 6 Cosimo Cecchi 2016-08-14 15:52:09 UTC
Review of attachment 332444 [details] [review]:

Yeah, I'm not at all opposed to something like this, especially now that the desktop is a separate program.
Some minor comments on the patch, but looks good otherwise.

::: nautilus-desktop/nautilus-desktop-window.c
@@ -1,1 @@
-

Looks like a spurious change

@@ +61,3 @@
+	GdkScreen *screen = gdk_screen_get_default ();
+
+	if (window->details->surface) {

Use g_clear_pointer()

@@ +95,3 @@
+{
+	NautilusDesktopWindow *window = NAUTILUS_DESKTOP_WINDOW (widget);
+	GdkAtom gdkatom;

You can fetch the screen from the widget

@@ +165,3 @@
 
+	if (window->details->composited == FALSE) {
+		GdkScreen *screen = gdk_screen_get_default ();

You could fetch the GdkScreen from the widget instance directly.

@@ +166,3 @@
+	if (window->details->composited == FALSE) {
+		GdkScreen *screen = gdk_screen_get_default ();
+		GdkWindow *root = gdk_screen_get_root_window (screen);

Nautilus code style usually mandates variable declarations at the beginning of the functions instead of nested inside other blocks (multiple occurrences throughout the patch).

@@ +171,3 @@
+	}
+
+	if (window->details->surface) {

Use g_clear_pointer()

@@ +326,3 @@
 				     "nautilus-desktop-window");
 
+	window->details->composited = TRUE;

This should not be necessary. Or if it is, fetch the real value from the GdkScreen
Comment 7 Alberts Muktupāvels 2016-08-15 18:32:04 UTC
Created attachment 333375 [details] [review]
nautilus-desktop: draw background when screen is not  composited
Comment 8 Carlos Soriano 2016-08-19 09:53:53 UTC
Review of attachment 333375 [details] [review]:

LGTM!
Comment 9 Alberts Muktupāvels 2016-08-19 10:14:44 UTC
(In reply to Cosimo Cecchi from comment #6)
> Review of attachment 332444 [details] [review] [review]:
> @@ +326,3 @@
>  				     "nautilus-desktop-window");
>  
> +	window->details->composited = TRUE;
> 
> This should not be necessary. Or if it is, fetch the real value from the
> GdkScreen

Now I remember why it was set to TRUE...

The idea was:
- if compositor is available then we do nothing
- if compositor is not available then we setup background.

By using FALSE and/or value from GdkScreen background will not be setup, because of `if (window->details->composited == composited) return;`

Will prepare patch to change back it to TRUE.
Comment 10 Alberts Muktupāvels 2016-08-19 10:27:27 UTC
Created attachment 333618 [details] [review]
nautilus-desktop: initialize composited to TRUE
Comment 11 Cosimo Cecchi 2016-08-22 13:53:00 UTC
Review of attachment 333618 [details] [review]:

Makes sense, feel free to push!