Bug#863791: unblock: caja/1.16.6-1

Mike Gabriel mike.gabriel at das-netzwerkteam.de
Wed May 31 09:20:25 UTC 2017


Package: release.debian.org
Severity: normal
User: release.debian.org at packages.debian.org
Usertags: unblock

Please consider unblocking not-yet-uploaded package caja

Currently, it is not possible to modify the background image in MATE
desktop sessions running on Debian stretch. Also, there are various issues
open for caja on Debian BTS, that this version of caja could resolve.

This upload also contains various issues fixed by upstream that never
made it to Debian BTS, but are still in issue for users.

As MATE upstream esp. maintains a fix-up branch for Debian (1.16 series,
MATE upstream is at 1.18 and beyond already), cherry-picking patches from
upstream makes no sense. The patches already have been cherry-picked by
upstream esp. for targetting caja in Debian 9.

Here is a list of issues that this upload will solve:

  * New upstream release. (Closes: #862155).

#862155 is a tracking bug for the background changing issue mentioned
above. Merged with various other reports addressing the same issue.

  * Issues solved between 1.16.2 and 1.16.5:
    - Caja's background and emblems dialog works again. (Closes: #828158).
    - Add ability to get feedback from Orca when additional icons are
      selected/deselected. (Closes: #757851).
    - In icon and compact view, fix scrolling and renaming in large folders
      (Closes: #836352, #826261).
  * Issues solved between 1.16.5 and 1.16.6:
    - Show correct right-click menu after making file/folder selection
    - Make custom icons (like folder-color extension) work in list view
    - Open With dialog: force icon size to avoid huge icons with GTK+3
    - Load different CSS for desktop with GTK+ 3.14 (fixes black text
      under desktop icons with some themes like Adwaita)

Unfortunately, this version of caja also requires an update of the
mate-desktop src:package to 1.16.2. I will file a separate unblock
request for that.

unblock caja/1.16.6-1

-- System Information:
Debian Release: 9.0
  APT prefers testing
  APT policy: (990, 'testing')
Architecture: amd64
 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.9.0-2-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
-------------- next part --------------
diff -Nru caja-1.16.2/configure.ac caja-1.16.6/configure.ac
--- caja-1.16.2/configure.ac	2017-01-22 13:36:35.000000000 +0100
+++ caja-1.16.6/configure.ac	2017-05-08 12:34:20.000000000 +0200
@@ -4,7 +4,7 @@
 
 m4_define(glib_minver,                 2.36.0)
 m4_define(gio_minver,                  2.26.0)
-m4_define(mate_desktop_minver,         1.15.1)
+m4_define(mate_desktop_minver,         1.16.2)
 m4_define(pango_minver,                1.1.2)
 m4_define(gtk_minver,                  2.24.0)
 m4_define(xml_minver,                  2.4.7)
@@ -19,7 +19,7 @@
 m4_define(caja_extension_current,  5)
 m4_define(caja_extension_revision, 0)
 
-AC_INIT([caja], [1.16.2], [http://www.mate-desktop.org])
+AC_INIT([caja], [1.16.6], [http://www.mate-desktop.org])
 
 dnl ---------------------------------------------------------------------------
 dnl GTK library version
diff -Nru caja-1.16.2/data/caja-desktop-3.14.css caja-1.16.6/data/caja-desktop-3.14.css
--- caja-1.16.2/data/caja-desktop-3.14.css	1970-01-01 01:00:00.000000000 +0100
+++ caja-1.16.6/data/caja-desktop-3.14.css	2017-05-08 12:34:20.000000000 +0200
@@ -0,0 +1,29 @@
+/* Everything that themes must not override goes in this file */
+/* This is loaded with GTK_STYLE_PROVIDER_PRIORITY_APPLICATION and overrides themes */
+
+/* desktop mode */
+.caja-desktop.caja-canvas-item {
+    color: #ffffff;
+    text-shadow: 1px 1px alpha (#000000, 0.8);
+}
+
+.caja-desktop.caja-canvas-item:selected,
+.caja-desktop.caja-canvas-item:active,
+.caja-desktop.caja-canvas-item:hover {
+    text-shadow: none;
+}
+
+/* remove possible theme settings for borders on scrolledwindow with gtk+-3.20 */
+.caja-desktop-window > grid.vertical > box.vertical > box.vertical > box.vertical > scrolledwindow,
+.caja-desktop-window > grid.vertical > box.vertical > box.vertical > box.vertical > scrolledwindow.frame,
+.caja-desktop-window > grid.vertical > box.vertical > box.vertical > box.vertical > scrolledwindow > widget.view.caja-desktop {
+   border-width: 0px;
+   border-style: none;
+   border-radius: 0px;
+}
+
+/* This is not on the desktop but will cause errors if themes can override */
+/* Padding in slider buttons causes GTK errors in GTK 3.20 or later */
+.caja-navigation-window .slider-button {
+	padding: 0px;
+}
diff -Nru caja-1.16.2/data/Makefile.am caja-1.16.6/data/Makefile.am
--- caja-1.16.2/data/Makefile.am	2017-01-22 13:36:35.000000000 +0100
+++ caja-1.16.6/data/Makefile.am	2017-05-08 12:34:20.000000000 +0200
@@ -35,6 +35,7 @@
 	caja-suggested.placeholder \
 	caja.css \
     caja-desktop.css \
+    caja-desktop-3.14.css \
 	$(NULL)
 
 # app data file
diff -Nru caja-1.16.2/debian/changelog caja-1.16.6/debian/changelog
--- caja-1.16.2/debian/changelog	2017-01-24 20:15:21.000000000 +0100
+++ caja-1.16.6/debian/changelog	2017-04-28 22:41:10.000000000 +0200
@@ -1,3 +1,23 @@
+caja (1.16.6-1) unstable; urgency=medium
+
+  * New upstream release. (Closes: #862155).
+  * Issues solved between 1.16.2 and 1.16.5:
+    - Caja's background and emblems dialog works again. (Closes: #828158).
+    - Add ability to get feedback from Orca when additional icons are
+      selected/deselected. (Closes: #757851).
+    - In icon and compact view, fix scrolling and renaming in large folders
+      (Closes: #836352, #826261).
+  * Issues solved between 1.16.5 and 1.16.6:
+    - Show correct right-click menu after making file/folder selection
+    - Make custom icons (like folder-color extension) work in list view
+    - Open With dialog: force icon size to avoid huge icons with GTK+3
+    - Load different CSS for desktop with GTK+ 3.14 (fixes black text
+      under desktop icons with some themes like Adwaita)
+  * debian/control:
+    + Versioned B-D bump of libmate-desktop-dev (to >= 1.16.2)
+
+ -- Mike Gabriel <sunweaver at debian.org>  Fri, 28 Apr 2017 22:41:10 +0200
+
 caja (1.16.2-2) unstable; urgency=medium
 
   [ Martin Wimpress ]
diff -Nru caja-1.16.2/debian/control caja-1.16.6/debian/control
--- caja-1.16.2/debian/control	2016-10-01 16:27:22.000000000 +0200
+++ caja-1.16.6/debian/control	2017-04-28 22:41:10.000000000 +0200
@@ -17,7 +17,7 @@
                libgirepository1.0-dev,
                libglib2.0-dev,
                libgtk-3-dev,
-               libmate-desktop-dev (>= 1.16),
+               libmate-desktop-dev (>= 1.16.2),
                libpango1.0-dev,
                libselinux1-dev [linux-any],
                libstartup-notification0-dev,
diff -Nru caja-1.16.2/eel/eel-background-box.c caja-1.16.6/eel/eel-background-box.c
--- caja-1.16.2/eel/eel-background-box.c	2017-01-22 13:36:35.000000000 +0100
+++ caja-1.16.6/eel/eel-background-box.c	2017-05-08 12:34:20.000000000 +0200
@@ -30,23 +30,30 @@
 G_DEFINE_TYPE (EelBackgroundBox, eel_background_box, GTK_TYPE_EVENT_BOX)
 
 static gboolean
-eel_background_box_draw (GtkWidget *widget,
 #if GTK_CHECK_VERSION (3, 0, 0)
+eel_background_box_draw (GtkWidget *widget,
                          cairo_t *cr)
 #else
-                         GdkEventExpose *event)
+eel_background_box_expose_event (GtkWidget *widget,
+                                 GdkEventExpose *event)
 #endif
 {
-#if GTK_CHECK_VERSION (3, 0, 0)
+#if !GTK_CHECK_VERSION (3, 0, 0)
+    cairo_t *cr = gdk_cairo_create (event->window);
+
+    gdk_cairo_rectangle (cr, &event->area);
+    cairo_clip (cr);
+#endif
     eel_background_draw (widget, cr);
+#if GTK_CHECK_VERSION (3, 0, 0)
     gtk_container_propagate_draw (GTK_CONTAINER (widget),
                                   gtk_bin_get_child (GTK_BIN (widget)),
                                   cr);
 #else
-    eel_background_draw (widget, event);
     gtk_container_propagate_expose (GTK_CONTAINER (widget),
                                     gtk_bin_get_child (GTK_BIN (widget)),
                                     event);
+    cairo_destroy (cr);
 #endif
     return TRUE;
 }
@@ -60,12 +67,12 @@
 eel_background_box_class_init (EelBackgroundBoxClass *klass)
 {
     GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
-
 #if GTK_CHECK_VERSION (3, 0, 0)
     widget_class->draw = eel_background_box_draw;
 #else
-    widget_class->expose_event = eel_background_box_draw;
+    widget_class->expose_event = eel_background_box_expose_event;
 #endif
+
 }
 
 GtkWidget*
diff -Nru caja-1.16.2/eel/eel-background.c caja-1.16.6/eel/eel-background.c
--- caja-1.16.2/eel/eel-background.c	2017-01-22 13:36:35.000000000 +0100
+++ caja-1.16.6/eel/eel-background.c	2017-05-08 12:34:20.000000000 +0200
@@ -68,6 +68,7 @@
 struct EelBackgroundDetails
 {
     GtkWidget *widget;
+    GtkWidget *front_widget;
     MateBG *bg;
     char *color;
 
@@ -99,6 +100,10 @@
     gboolean is_active;
 };
 
+#if GTK_CHECK_VERSION (3, 22, 0)
+static GList *desktop_bg_objects = NULL;
+#endif
+
 static void
 free_fade (EelBackground *self)
 {
@@ -144,9 +149,16 @@
     }
 
     free_background_surface (self);
-
     free_fade (self);
 
+#if GTK_CHECK_VERSION (3, 22, 0)
+    if (self->details->is_desktop)
+    {
+        desktop_bg_objects = g_list_remove (desktop_bg_objects,
+                                            G_OBJECT (self));
+    }
+
+#endif
     G_OBJECT_CLASS (eel_background_parent_class)->finalize (object);
 }
 
@@ -157,12 +169,24 @@
 
     self->details->bg_entire_width = 0;
     self->details->bg_entire_height = 0;
+#if GTK_CHECK_VERSION (3, 0, 0)
+    self->details->default_color.red = 1.0;
+    self->details->default_color.green = 1.0;
+    self->details->default_color.blue = 1.0;
+    self->details->default_color.alpha = 1.0;
+#else
     self->details->default_color.red = 0xffff;
     self->details->default_color.green = 0xffff;
     self->details->default_color.blue = 0xffff;
+#endif
 }
 
+#if GTK_CHECK_VERSION (3, 0, 0)
+#define CLAMP_COLOR(v) (CLAMP ((v), 0, 1))
+#else
 #define CLAMP_COLOR(v) (t = (v), CLAMP (t, 0, G_MAXUSHORT))
+#endif
+
 #define SATURATE(v) ((1.0 - saturation) * intensity + saturation * (v))
 
 static void
@@ -174,7 +198,9 @@
 #endif
 {
     double intensity, saturation;
+#if !GTK_CHECK_VERSION (3, 0, 0)
     gushort t;
+#endif
 
     if (!self->details->is_active) {
         saturation = 0.7;
@@ -183,7 +209,11 @@
         color->green = SATURATE (color->green);
         color->blue = SATURATE (color->blue);
 
+#if GTK_CHECK_VERSION (3, 0, 0)
+        if (intensity > 0.5)
+#else
         if (intensity > G_MAXUSHORT / 2)
+#endif
         {
            color->red *= 0.9;
            color->green *= 0.9;
@@ -450,46 +480,21 @@
 
 void
 eel_background_draw (GtkWidget *widget,
-#  if GTK_CHECK_VERSION (3, 0, 0)
                      cairo_t   *cr)
 {
-    int width, height;
-    GdkWindow *window = gtk_widget_get_window (widget);
-    GdkRGBA color;
-
     EelBackground *self = eel_get_widget_background (widget);
-
-    drawable_get_adjusted_size (self, &width, &height);
-
-    eel_background_ensure_realized (self);
-    color = self->details->default_color;
-    make_color_inactive (self, &color);
-
-    cairo_save (cr);
-
-    if (self->details->bg_surface != NULL) {
-        cairo_set_source_surface (cr, self->details->bg_surface, 0, 0);
-        cairo_pattern_set_extend (cairo_get_source (cr), CAIRO_EXTEND_REPEAT);
-    } else {
-        gdk_cairo_set_source_rgba (cr, &color);
-    }
-
-    cairo_rectangle (cr, 0, 0, width, height);
-    cairo_fill (cr);
-
-    cairo_restore (cr);
-}
-#  else
-                     GdkEventExpose *event)
-{
-    int width, height;
-    GdkWindow *window = gtk_widget_get_window (widget);
+#if GTK_CHECK_VERSION (3, 0, 0)
+    GdkRGBA color;
+#else
     GdkColor color;
+#endif
+    int width, height;
 
-    if (event->window != window)
+    if (self->details->fade != NULL &&
+        mate_bg_crossfade_is_started (self->details->fade))
+    {
         return;
-
-    EelBackground *self = eel_get_widget_background (widget);
+    }
 
     drawable_get_adjusted_size (self, &width, &height);
 
@@ -497,24 +502,25 @@
     color = self->details->default_color;
     make_color_inactive (self, &color);
 
-    cairo_t *cr = gdk_cairo_create (window);
+    cairo_save (cr);
 
-    if (self->details->bg_surface != NULL) {
+    if (self->details->bg_surface != NULL)
+    {
         cairo_set_source_surface (cr, self->details->bg_surface, 0, 0);
         cairo_pattern_set_extend (cairo_get_source (cr), CAIRO_EXTEND_REPEAT);
     } else {
+#if GTK_CHECK_VERSION (3, 0, 0)
+        gdk_cairo_set_source_rgba (cr, &color);
+#else
         gdk_cairo_set_source_color (cr, &color);
+#endif
     }
 
-    gdk_cairo_rectangle (cr, &event->area);
-    cairo_clip (cr);
-
     cairo_rectangle (cr, 0, 0, width, height);
     cairo_fill (cr);
 
-    cairo_destroy (cr);
+    cairo_restore (cr);
 }
-#  endif
 
 static void
 set_root_surface (EelBackground *self,
@@ -599,7 +605,7 @@
 
 static gboolean
 fade_to_surface (EelBackground   *self,
-                 GdkWindow       *window,
+                 GtkWidget       *widget,
                  cairo_surface_t *surface)
 {
     if (self->details->fade == NULL ||
@@ -610,7 +616,22 @@
 
     if (!mate_bg_crossfade_is_started (self->details->fade))
     {
+#if GTK_CHECK_VERSION (3, 22, 0)
+        mate_bg_crossfade_start_widget (self->details->fade, widget);
+#else
+        GdkWindow *window;
+
+        if (EEL_IS_CANVAS (widget))
+        {
+            window = gtk_layout_get_bin_window (GTK_LAYOUT (widget));
+        }
+        else
+        {
+            window = gtk_widget_get_window (widget);
+        }
+
         mate_bg_crossfade_start (self->details->fade, window);
+#endif
         if (self->details->is_desktop)
         {
             g_signal_connect (self->details->fade,
@@ -625,63 +646,70 @@
 static void
 eel_background_set_up_widget (EelBackground *self)
 {
-    GdkWindow *window;
     GtkWidget *widget = self->details->widget;
-#  if GTK_CHECK_VERSION (3, 0, 0)
-    GdkRGBA color;
-#else
-    GdkColor color;
-#endif
     gboolean in_fade = FALSE;
 
     if (!gtk_widget_get_realized (widget))
         return;
 
     eel_background_ensure_realized (self);
-    color = self->details->default_color;
-    make_color_inactive (self, &color);
 
     if (self->details->bg_surface == NULL)
         return;
 
-    if (EEL_IS_CANVAS (widget)) {
-        window = gtk_layout_get_bin_window (GTK_LAYOUT (widget));
-    } else {
-        window = gtk_widget_get_window (widget);
-    }
+    gtk_widget_queue_draw (widget);
 
     if (self->details->fade != NULL)
-        in_fade = fade_to_surface (self, window, self->details->bg_surface);
+        in_fade = fade_to_surface (self, widget, self->details->bg_surface);
 
     if (!in_fade)
     {
-#  if GTK_CHECK_VERSION (3, 0, 0)
-        cairo_pattern_t *pattern;
-        pattern = cairo_pattern_create_for_surface (self->details->bg_surface);
-        gdk_window_set_background_pattern (window, pattern);
-        cairo_pattern_destroy (pattern);
-#  endif
+        GdkWindow *window;
 
-        if (self->details->is_desktop)
+        if (EEL_IS_CANVAS (widget))
         {
-#  if !GTK_CHECK_VERSION (3, 0, 0)
-            gdk_window_set_back_pixmap (window, self->details->bg_surface, FALSE);
-#  endif
-            set_root_surface (self, window, gtk_widget_get_screen (widget));
+            window = gtk_layout_get_bin_window (GTK_LAYOUT (widget));
         }
         else
         {
-#if GTK_CHECK_VERSION (3, 0, 0)
-            gdk_window_set_background_rgba (window, &color);
-#else
-            gdk_window_set_background (window, &color);
-#endif
-#  if !GTK_CHECK_VERSION (3, 0, 0)
-            gdk_window_set_back_pixmap (window, self->details->bg_surface, FALSE);
-#  endif
+            window = gtk_widget_get_window (widget);
         }
 
+#if !GTK_CHECK_VERSION (3, 0, 0)
+        if (self->details->bg_surface != NULL)
+        {
+            gdk_window_set_back_pixmap (window,
+                                        self->details->bg_surface, FALSE);
+        }
+        else
+        {
+            GdkColor color = self->details->default_color;
+            make_color_inactive (self, &color);
+            gdk_window_set_background (window, &color);
+        }
         gdk_window_invalidate_rect (window, NULL, TRUE);
+
+#endif
+        if (self->details->is_desktop)
+        {
+#if GTK_CHECK_VERSION (3, 0, 0) && !GTK_CHECK_VERSION (3, 22, 0)
+            if (self->details->bg_surface != NULL)
+            {
+                cairo_pattern_t *pattern =
+                  cairo_pattern_create_for_surface (self->details->bg_surface);
+                gdk_window_set_background_pattern (window, pattern);
+                cairo_pattern_destroy (pattern);
+            }
+            else
+            {
+                GdkRGBA color = self->details->default_color;
+                make_color_inactive (self, &color);
+                gdk_window_set_background_rgba (window, &color);
+            }
+            gdk_window_invalidate_rect (window, NULL, TRUE);
+#endif
+            set_root_surface (self, window, gtk_widget_get_screen (widget));
+        }
     }
 }
 
@@ -696,8 +724,6 @@
     eel_background_unrealize (self);
     eel_background_set_up_widget (self);
 
-    gtk_widget_queue_draw (self->details->widget);
-
     return FALSE;
 }
 
@@ -720,6 +746,13 @@
  * EelBackgroundStyle so that it will match the chosen GTK+ theme.
  */
 static void
+#if GTK_CHECK_VERSION (3, 0, 0)
+widget_style_updated_cb (GtkWidget *widget,
+                         gpointer   user_data)
+{
+    widget_queue_background_change (widget, user_data);
+}
+#else
 widget_style_set_cb (GtkWidget *widget,
                      GtkStyle  *previous_style,
                      gpointer   user_data)
@@ -727,6 +760,7 @@
     if (previous_style != NULL)
         widget_queue_background_change (widget, user_data);
 }
+#endif
 
 static void
 eel_background_changed (MateBG *bg,
@@ -835,7 +869,9 @@
     }
 
     free_fade (self);
+
     self->details->widget = NULL;
+    self->details->front_widget = NULL;
 }
 
 /* Gets the background attached to a widget.
@@ -844,9 +880,9 @@
    this will create one. To change the widget's background, you can
    just call eel_background methods on the widget.
 
-   If the widget is a canvas, nothing more needs to be done.  For
-   normal widgets, you need to call eel_background_draw() from your
-   draw/expose handler to draw the background.
+   If the widget is a desktop window, nothing more needs to be done, otherwise
+   you need to call eel_background_draw() from your draw/expose event handler
+   to draw the background.
 
    Later, we might want a call to find out if we already have a background,
    or a way to share the same background among multiple widgets; both would
@@ -855,22 +891,41 @@
 EelBackground *
 eel_get_widget_background (GtkWidget *widget)
 {
+    EelBackground *self;
+    gpointer data;
+#if GTK_CHECK_VERSION (3, 22, 0)
+    GList *l;
+#endif
 
     g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
 
     /* Check for an existing background. */
-    gpointer data = g_object_get_data (G_OBJECT (widget), "eel_background");
+    data = g_object_get_data (G_OBJECT (widget), "eel_background");
     if (data != NULL)
     {
         g_assert (EEL_IS_BACKGROUND (data));
         return data;
     }
+#if GTK_CHECK_VERSION (3, 22, 0)
+    /* Check for an existing desktop window background. */
+    for (l = desktop_bg_objects; l != NULL; l = l->next)
+    {
+        g_assert (EEL_IS_BACKGROUND (l->data));
+        self = EEL_BACKGROUND (l->data);
+        if (widget == self->details->widget)
+        {
+            return self;
+        }
+    }
+#endif
+
+    self = eel_background_new ();
+    self->details->widget = widget;
+    self->details->front_widget = widget;
 
     /* Store the background in the widget's data. */
-    EelBackground *self = eel_background_new ();
     g_object_set_data_full (G_OBJECT (widget), "eel_background",
                             self, g_object_unref);
-    self->details->widget = widget;
 
     g_signal_connect_object (widget, "destroy",
                              G_CALLBACK (on_widget_destroyed), self, 0);
@@ -879,8 +934,13 @@
     g_signal_connect_object (widget, "unrealize",
                              G_CALLBACK (widget_unrealize_cb), self, 0);
 
+#if GTK_CHECK_VERSION (3, 0, 0)
+    g_signal_connect_object (widget, "style-updated",
+                             G_CALLBACK (widget_style_updated_cb), self, 0);
+#else
     g_signal_connect_object (widget, "style_set",
                              G_CALLBACK (widget_style_set_cb), self, 0);
+#endif
 
     /* Arrange to get the signal whenever the background changes. */
     g_signal_connect_object (self, "appearance_changed",
@@ -928,9 +988,16 @@
         			       EelBackgroundDetails);
 
     self->details->bg = mate_bg_new ();
+#if GTK_CHECK_VERSION (3, 0, 0)
+    self->details->default_color.red = 1.0;
+    self->details->default_color.green = 1.0;
+    self->details->default_color.blue = 1.0;
+    self->details->default_color.alpha = 1.0;
+#else
     self->details->default_color.red = 0xffff;
     self->details->default_color.green = 0xffff;
     self->details->default_color.blue = 0xffff;
+#endif
     self->details->is_active = TRUE;
 
     g_signal_connect (self->details->bg, "changed",
@@ -970,14 +1037,32 @@
 
 void
 eel_background_set_desktop (EelBackground *self,
-                            GtkWidget     *widget,
                             gboolean       is_desktop)
 {
     self->details->is_desktop = is_desktop;
 
-    if (gtk_widget_get_realized (widget) && is_desktop)
+    if (is_desktop)
+    {
+#if GTK_CHECK_VERSION (3, 22, 0)
+        self->details->widget =
+          gtk_widget_get_toplevel (self->details->front_widget);
+
+        desktop_bg_objects = g_list_prepend (desktop_bg_objects,
+                                             G_OBJECT (self));
+
+#endif
+        if (gtk_widget_get_realized (self->details->widget))
+        {
+            widget_realized_setup (self->details->widget, self);
+        }
+    }
+    else
     {
-        widget_realized_setup (widget, self);
+#if GTK_CHECK_VERSION (3, 22, 0)
+        desktop_bg_objects = g_list_remove (desktop_bg_objects,
+                                            G_OBJECT (self));
+        self->details->widget = self->details->front_widget;
+#endif
     }
 }
 
@@ -995,6 +1080,7 @@
     {
         self->details->is_active = is_active;
         set_image_properties (self);
+        gtk_widget_queue_draw (self->details->widget);
     }
 }
 
diff -Nru caja-1.16.2/eel/eel-background.h caja-1.16.6/eel/eel-background.h
--- caja-1.16.2/eel/eel-background.h	2017-01-22 13:36:35.000000000 +0100
+++ caja-1.16.6/eel/eel-background.h	2017-05-08 12:34:20.000000000 +0200
@@ -83,7 +83,6 @@
 /* Should be TRUE for desktop background */
 gboolean		    eel_background_is_desktop 		 (EelBackground   *self);
 void			    eel_background_set_desktop 		 (EelBackground   *self,
-        							  GtkWidget       *widget,
         							  gboolean         is_desktop);
 
 /* Calls to interrogate the current state of a background. */
@@ -95,11 +94,7 @@
 
 /* Helper function for widgets using EelBackground */
 void                        eel_background_draw                  (GtkWidget       *widget,
-#if GTK_CHECK_VERSION (3, 0, 0)
         							  cairo_t         *cr);
-#else
-        							  GdkEventExpose  *event);
-#endif
 
 /* Handles a dragged color being dropped on a widget to change the background color. */
 void                        eel_background_set_dropped_color     (EelBackground   *self,
diff -Nru caja-1.16.2/eel/eel-canvas.c caja-1.16.6/eel/eel-canvas.c
--- caja-1.16.2/eel/eel-canvas.c	2017-01-22 13:36:35.000000000 +0100
+++ caja-1.16.6/eel/eel-canvas.c	2017-05-08 12:34:20.000000000 +0200
@@ -578,6 +578,15 @@
 
 }
 
+#if GTK_CHECK_VERSION (3, 0, 0)
+static void
+eel_canvas_queue_resize (EelCanvas *canvas)
+{
+    if (gtk_widget_is_drawable (GTK_WIDGET (canvas)))
+            gtk_widget_queue_resize (GTK_WIDGET (canvas));
+}
+#endif
+
 /* Convenience function to reorder items in a group's child list.  This puts the
  * specified link after the "before" link. Returns TRUE if the list was changed.
  */
@@ -851,6 +860,9 @@
         }
 
         redraw_and_repick_if_mapped (item);
+#if GTK_CHECK_VERSION (3, 0, 0)
+        eel_canvas_queue_resize (item->canvas);
+#endif
     }
 }
 
@@ -876,6 +888,10 @@
         if (item->flags & EEL_CANVAS_ITEM_MAPPED)
             (* EEL_CANVAS_ITEM_GET_CLASS (item)->unmap) (item);
 
+#if GTK_CHECK_VERSION (3, 0, 0)
+        eel_canvas_queue_resize (item->canvas);
+#endif
+
         /* No need to unrealize when we just want to hide */
     }
 }
@@ -1909,6 +1925,11 @@
         if (!(item->flags & EEL_CANVAS_ITEM_MAPPED))
             (* EEL_CANVAS_ITEM_GET_CLASS (item)->map) (item);
     }
+
+#if GTK_CHECK_VERSION (3, 0, 0)
+    if (item->flags & EEL_CANVAS_ITEM_VISIBLE)
+            eel_canvas_queue_resize (EEL_CANVAS_ITEM (group)->canvas);
+#endif
 }
 
 /* Removes an item from a group */
@@ -1929,6 +1950,11 @@
             if (item->flags & EEL_CANVAS_ITEM_REALIZED)
                 (* EEL_CANVAS_ITEM_GET_CLASS (item)->unrealize) (item);
 
+#if GTK_CHECK_VERSION (3, 0, 0)
+            if (item->flags & EEL_CANVAS_ITEM_VISIBLE)
+                    eel_canvas_queue_resize (item->canvas);
+#endif
+
             /* Unparent the child */
 
             item->parent = NULL;
@@ -3045,6 +3071,7 @@
 
     if ((canvas->new_current_item != canvas->current_item) && button_down)
     {
+        canvas->current_item = canvas->new_current_item;
         canvas->left_grabbed_item = TRUE;
         return retval;
     }
diff -Nru caja-1.16.2/eel/eel-gdk-extensions.c caja-1.16.6/eel/eel-gdk-extensions.c
--- caja-1.16.2/eel/eel-gdk-extensions.c	2017-01-22 13:36:35.000000000 +0100
+++ caja-1.16.6/eel/eel-gdk-extensions.c	2017-05-08 12:34:20.000000000 +0200
@@ -343,6 +343,7 @@
         color->red = 1.0;
         color->green = 1.0;
         color->blue = 1.0;
+        color->alpha = 1.0;
     }
 }
 #else
@@ -494,9 +495,9 @@
 {
     int intensity;
 
-    intensity = ((((int) (color->red) >> 8) * 77)
-                 + (((int) (color->green) >> 8) * 150)
-                 + (((int) (color->blue) >> 8) * 28)) >> 8;
+    intensity = (((guint) (color->red * 0xff) * 77)
+                 + ((guint) (color->green * 0xff) * 150)
+                 + ((guint) (color->blue * 0xff) * 28)) >> 8;
 #else
 /**
  * eel_gdk_color_is_dark:
diff -Nru caja-1.16.2/libcaja-private/caja-directory-background.c caja-1.16.6/libcaja-private/caja-directory-background.c
--- caja-1.16.2/libcaja-private/caja-directory-background.c	2017-01-22 13:36:35.000000000 +0100
+++ caja-1.16.6/libcaja-private/caja-directory-background.c	2017-05-08 12:34:20.000000000 +0200
@@ -382,8 +382,7 @@
 
     background = eel_get_widget_background (GTK_WIDGET (icon_container));
 
-    eel_background_set_desktop (background,
-                                GTK_WIDGET (icon_container), TRUE);
+    eel_background_set_desktop (background, TRUE);
 
     g_signal_connect_object (background, "settings_changed",
                              G_CALLBACK (desktop_background_changed_cb), NULL, 0);
diff -Nru caja-1.16.2/libcaja-private/caja-file.c caja-1.16.6/libcaja-private/caja-file.c
--- caja-1.16.2/libcaja-private/caja-file.c	2017-01-22 13:36:35.000000000 +0100
+++ caja-1.16.6/libcaja-private/caja-file.c	2017-05-08 12:34:20.000000000 +0200
@@ -4132,6 +4132,11 @@
 		return NULL;
 	}
 
+	icon = get_custom_icon (file);
+	if (icon != NULL) {
+		return icon;
+	}
+
 	if (file->details->icon) {
 		icon = NULL;
 
diff -Nru caja-1.16.2/libcaja-private/caja-icon-canvas-item.c caja-1.16.6/libcaja-private/caja-icon-canvas-item.c
--- caja-1.16.2/libcaja-private/caja-icon-canvas-item.c	2017-01-22 13:36:35.000000000 +0100
+++ caja-1.16.6/libcaja-private/caja-icon-canvas-item.c	2017-05-08 12:34:20.000000000 +0200
@@ -377,9 +377,11 @@
 {
     CajaIconCanvasItem *item;
     CajaIconCanvasItemDetails *details;
+    AtkObject *accessible;
 
     item = CAJA_ICON_CANVAS_ITEM (object);
     details = item->details;
+    accessible = atk_gobject_accessible_for_object (G_OBJECT (item));
 
     switch (property_id)
     {
@@ -395,11 +397,8 @@
         details->editable_text = g_strdup (g_value_get_string (value));
         if (details->text_util)
         {
-            AtkObject *accessible;
-
             gail_text_util_text_setup (details->text_util,
                                        details->editable_text);
-            accessible = atk_gobject_accessible_for_object (G_OBJECT (item));
             g_object_notify (G_OBJECT(accessible), "accessible-name");
         }
 
@@ -436,6 +435,9 @@
         }
         details->is_highlighted_for_selection = g_value_get_boolean (value);
         caja_icon_canvas_item_invalidate_label_size (item);
+
+        atk_object_notify_state_change (accessible, ATK_STATE_SELECTED,
+                                        details->is_highlighted_for_selection);
         break;
 
     case PROP_HIGHLIGHTED_AS_KEYBOARD_FOCUS:
@@ -444,12 +446,8 @@
             return;
         }
         details->is_highlighted_as_keyboard_focus = g_value_get_boolean (value);
-
-        if (details->is_highlighted_as_keyboard_focus)
-        {
-            AtkObject *atk_object = atk_gobject_accessible_for_object (object);
-            atk_focus_tracker_notify (atk_object);
-        }
+        atk_object_notify_state_change (accessible, ATK_STATE_FOCUSED,
+                                        details->is_highlighted_as_keyboard_focus);
         break;
 
     case PROP_HIGHLIGHTED_FOR_DROP:
@@ -1222,7 +1220,6 @@
         pango_layout_set_height (layout, -1);
     }
     else if (needs_highlight ||
-             details->is_prelit ||
              details->is_highlighted_as_keyboard_focus ||
              details->entire_text ||
              container->details->label_position == CAJA_ICON_LABEL_POSITION_BESIDE)
diff -Nru caja-1.16.2/libcaja-private/caja-icon-container.c caja-1.16.6/libcaja-private/caja-icon-container.c
--- caja-1.16.2/libcaja-private/caja-icon-container.c	2017-01-22 13:36:35.000000000 +0100
+++ caja-1.16.6/libcaja-private/caja-icon-container.c	2017-05-08 12:34:20.000000000 +0200
@@ -220,8 +220,10 @@
         gboolean               commit);
 static CajaIcon *get_icon_being_renamed                         (CajaIconContainer *container);
 static void          finish_adding_new_icons                        (CajaIconContainer *container);
+#if !GTK_CHECK_VERSION(3,0,0)
 static void          update_label_color                             (EelBackground         *background,
         CajaIconContainer *icon_container);
+#endif
 static inline void   icon_get_bounding_box                          (CajaIcon          *icon,
         int                   *x1_return,
         int                   *y1_return,
@@ -914,10 +916,10 @@
 }
 
 static void inline
-emit_atk_focus_tracker_notify (CajaIcon *icon)
+emit_atk_focus_state_change (CajaIcon *icon, gboolean focused)
 {
     AtkObject *atk_object = atk_gobject_accessible_for_object (G_OBJECT (icon->item));
-    atk_focus_tracker_notify (atk_object);
+    atk_object_notify_state_change (atk_object, ATK_STATE_FOCUSED, focused);
 }
 
 /* Set @icon as the icon currently selected for keyboard operations. */
@@ -940,7 +942,7 @@
                          "highlighted_as_keyboard_focus", 1,
                          NULL);
 
-    emit_atk_focus_tracker_notify (icon);
+    emit_atk_focus_state_change (icon, TRUE);
 }
 
 static void
@@ -2621,7 +2623,7 @@
 
     if (selection_changed && icon2 != NULL)
     {
-        emit_atk_focus_tracker_notify (icon2);
+        emit_atk_focus_state_change (icon2, TRUE);
     }
     return selection_changed;
 }
@@ -2647,7 +2649,7 @@
 
     if (selection_changed && icon_to_select != NULL)
     {
-        emit_atk_focus_tracker_notify (icon_to_select);
+        emit_atk_focus_state_change (icon_to_select, TRUE);
         reveal_icon (container, icon_to_select);
     }
     return selection_changed;
@@ -4698,6 +4700,81 @@
     }
 }
 
+#if GTK_CHECK_VERSION (3, 0, 0)
+static GtkSizeRequestMode
+get_request_mode (GtkWidget *widget)
+{
+    /* Don't trade size at all, since we get whatever we get anyway. */
+    return GTK_SIZE_REQUEST_CONSTANT_SIZE;
+}
+
+    /* We need to implement these since the GtkScrolledWindow uses them
+    to guess whether to show scrollbars or not, and if we don't report
+    anything it'll tend to get it wrong causing double calls
+    to size_allocate (at different sizes) during its size allocation. */
+static void
+get_prefered_width (GtkWidget *widget,
+                    gint      *minimum_size,
+                    gint      *natural_size)
+{
+    EelCanvasGroup *root;
+    double x1, x2;
+    int cx1, cx2;
+    int width;
+
+    root = eel_canvas_root (EEL_CANVAS (widget));
+    eel_canvas_item_get_bounds (EEL_CANVAS_ITEM (root),
+                    &x1, NULL, &x2, NULL);
+    eel_canvas_w2c (EEL_CANVAS (widget), x1, 0, &cx1, NULL);
+    eel_canvas_w2c (EEL_CANVAS (widget), x2, 0, &cx2, NULL);
+
+    width = cx2 - cx1;
+    if (natural_size) {
+        *natural_size = width;
+    }
+    if (minimum_size) {
+        *minimum_size = width;
+    }
+}
+
+static void
+get_prefered_height (GtkWidget *widget,
+                     gint      *minimum_size,
+                     gint      *natural_size)
+{
+    EelCanvasGroup *root;
+    double y1, y2;
+    int cy1, cy2;
+    int height;
+
+    root = eel_canvas_root (EEL_CANVAS (widget));
+    eel_canvas_item_get_bounds (EEL_CANVAS_ITEM (root),
+                    NULL, &y1, NULL, &y2);
+    eel_canvas_w2c (EEL_CANVAS (widget), 0, y1, NULL, &cy1);
+    eel_canvas_w2c (EEL_CANVAS (widget), 0, y2, NULL, &cy2);
+
+    height = cy2 - cy1;
+    if (natural_size) {
+        *natural_size = height;
+    }
+    if (minimum_size) {
+        *minimum_size = height;
+    }
+}
+
+static gboolean
+draw (GtkWidget *widget, cairo_t *cr)
+{
+    if (!CAJA_ICON_CONTAINER (widget)->details->is_desktop)
+    {
+        eel_background_draw (widget, cr);
+    }
+
+    return GTK_WIDGET_CLASS (caja_icon_container_parent_class)->draw (widget,
+                                                                      cr);
+}
+#endif
+
 static void
 realize (GtkWidget *widget)
 {
@@ -4707,8 +4784,7 @@
     GTK_WIDGET_CLASS (caja_icon_container_parent_class)->realize (widget);
 
     container = CAJA_ICON_CONTAINER (widget);
-     /* Unless GTK 3.21 or later is in use and the desktop must be transparent*/
-#if !GTK_CHECK_VERSION(3, 21, 0)
+#if !GTK_CHECK_VERSION (3, 22, 0)
     /* Ensure that the desktop window is native so the background
        set on it is drawn by X. */
     if (container->details->is_desktop)
@@ -6285,7 +6361,6 @@
     return TRUE;
 }
 
-#if !GTK_CHECK_VERSION(3, 21, 0)
 static void
 draw_canvas_background (EelCanvas *canvas,
 #if GTK_CHECK_VERSION(3,0,0)
@@ -6296,23 +6371,8 @@
 {
     /* Don't chain up to the parent to avoid clearing and redrawing */
 }
-#endif
 
 
-#if !GTK_CHECK_VERSION(3,0,0)
-static gboolean
-expose_event (GtkWidget      *widget,
-              GdkEventExpose *event)
-{
-    /*	g_warning ("Expose Icon Container %p '%d,%d: %d,%d'",
-    		   widget,
-    		   event->area.x, event->area.y,
-    		   event->area.width, event->area.height); */
-
-    return GTK_WIDGET_CLASS (caja_icon_container_parent_class)->expose_event (widget, event);
-}
-#endif
-
 #if !GTK_CHECK_VERSION(3, 0, 0)
 static AtkObject *
 get_accessible (GtkWidget *widget)
@@ -6766,6 +6826,12 @@
 
     widget_class = GTK_WIDGET_CLASS (class);
     widget_class->size_allocate = size_allocate;
+#if GTK_CHECK_VERSION (3, 0, 0)
+    widget_class->get_request_mode = get_request_mode;
+    widget_class->get_preferred_width = get_prefered_width;
+    widget_class->get_preferred_height = get_prefered_height;
+    widget_class->draw = draw;
+#endif
     widget_class->realize = realize;
     widget_class->unrealize = unrealize;
     widget_class->button_press_event = button_press_event;
@@ -6782,14 +6848,11 @@
     widget_class->style_updated = style_updated;
 #else
     widget_class->style_set = style_set;
-    widget_class->expose_event = expose_event;
 #endif
     widget_class->grab_notify = grab_notify_cb;
 
     canvas_class = EEL_CANVAS_CLASS (class);
-#if !GTK_CHECK_VERSION(3, 21, 0)
     canvas_class->draw_background = draw_canvas_background;
-#endif
     class->start_interactive_search = caja_icon_container_start_interactive_search;
 
 #if GTK_CHECK_VERSION(3,0,0)
diff -Nru caja-1.16.2/libcaja-private/caja-open-with-dialog.c caja-1.16.6/libcaja-private/caja-open-with-dialog.c
--- caja-1.16.2/libcaja-private/caja-open-with-dialog.c	2017-01-22 13:36:35.000000000 +0100
+++ caja-1.16.6/libcaja-private/caja-open-with-dialog.c	2017-05-08 12:34:20.000000000 +0200
@@ -531,7 +531,7 @@
                 *p = 0;
             }
             pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (),
-                                               icon_no_extension, 24, 0, NULL);
+                                               icon_no_extension, 24, GTK_ICON_LOOKUP_FORCE_SIZE, NULL);
             g_free (icon_no_extension);
         }
     }
diff -Nru caja-1.16.2/NEWS caja-1.16.6/NEWS
--- caja-1.16.2/NEWS	2017-01-22 13:36:35.000000000 +0100
+++ caja-1.16.6/NEWS	2017-05-08 12:34:20.000000000 +0200
@@ -1,3 +1,29 @@
+Major changes in 1.16.6 are:
+* Show correct right-click menu after making file/folder selection
+* Make custom icons (like folder-color extension) work in list view
+* Open With dialog: force icon size to avoid huge icons with GTK+3
+* Load different CSS for desktop with GTK+ 3.14 (fixes black text
+  under desktop icons with some themes like Adwaita)
+
+Major changes in 1.16.5 are:
+* icon and compact view: fix scrolling and renaming in large folders 
+* IconCanvasItem: fix overlapping filenames on hover
+
+Major changes in 1.16.4 are:
+* Fix broken directory background in GTK+2 build (regression in 1.16.3)
+
+Major changes in 1.16.3 are:
+* Build: require libmate-desktop >= 1.16.2
+* Add ability to get feedback from Orca when additional icons are
+  selected/deselected
+* Restore "Open with other application" menu entry for directories
+  (regression in 1.16.2)
+* Fix crossfade issues with recent GTK+3 versions
+* Fix more graphics issues to allow Caja to use background for
+  directory windows in GTK+3 build
+* GTK+3: fix broken rename in list view after keyboard navigation
+* GTK+3: property-browser: add style class frame to scrolledwindows
+
 Major changes in 1.16.2 are:
 * List view: show/hide columns instead of appending/removing them
   (fixes crash when moving between trash and other folder with GTK+3)
diff -Nru caja-1.16.2/src/caja-application.c caja-1.16.6/src/caja-application.c
--- caja-1.16.2/src/caja-application.c	2017-01-22 13:36:35.000000000 +0100
+++ caja-1.16.6/src/caja-application.c	2017-05-08 12:34:20.000000000 +0200
@@ -1038,8 +1038,12 @@
 
 /* add our desktop CSS provider,  ensures the desktop background does not get covered */
     provider = gtk_css_provider_new ();
-    gtk_css_provider_load_from_path (provider,
-				CAJA_DATADIR G_DIR_SEPARATOR_S "caja-desktop.css", &error);
+
+#if GTK_CHECK_VERSION (3, 16, 0)
+    gtk_css_provider_load_from_path (provider, CAJA_DATADIR G_DIR_SEPARATOR_S "caja-desktop.css", &error);
+#else
+    gtk_css_provider_load_from_path (provider, CAJA_DATADIR G_DIR_SEPARATOR_S "caja-desktop-3.14.css", &error);
+#endif
 
     if (error != NULL) {
         g_warning ("Can't parse Caja' CSS custom description: %s\n", error->message);
diff -Nru caja-1.16.2/src/caja-desktop-window.c caja-1.16.6/src/caja-desktop-window.c
--- caja-1.16.2/src/caja-desktop-window.c	2017-01-22 13:36:35.000000000 +0100
+++ caja-1.16.6/src/caja-desktop-window.c	2017-05-08 12:34:20.000000000 +0200
@@ -30,133 +30,23 @@
 #include <X11/Xatom.h>
 #include <gdk/gdkx.h>
 #include <gtk/gtk.h>
+#include <eel/eel-background.h>
 #include <eel/eel-vfs-extensions.h>
 #include <libcaja-private/caja-file-utilities.h>
 #include <libcaja-private/caja-icon-names.h>
 #include <gio/gio.h>
 #include <glib/gi18n.h>    
-#if GTK_CHECK_VERSION(3, 21, 0)
-#define MATE_DESKTOP_USE_UNSTABLE_API
-#include <libmate-desktop/mate-bg.h>
-#endif
 
 struct CajaDesktopWindowDetails
 {
     gulong size_changed_id;
 
     gboolean loaded;
-#if GTK_CHECK_VERSION(3, 21, 0)
-    gboolean composited;
-    cairo_surface_t *surface;
-#endif
 };
 
 G_DEFINE_TYPE (CajaDesktopWindow, caja_desktop_window,
                CAJA_TYPE_SPATIAL_WINDOW);
 
-#if GTK_CHECK_VERSION(3, 21, 0) 
-
-static void
-background_changed (CajaDesktopWindow *window)
-{
-    GdkScreen *screen = gdk_screen_get_default ();
-
-    if (window->details->surface) {
-        cairo_surface_destroy (window->details->surface);
-    }
-
-    window->details->surface = mate_bg_get_surface_from_root (screen);
-    gtk_widget_queue_draw (GTK_WIDGET (window));
-}
-
-static GdkFilterReturn
-filter_func (GdkXEvent             *xevent,
-             GdkEvent              *event,
-             CajaDesktopWindow *window)
-{
-    XEvent *xev = (XEvent *) xevent;
-    GdkAtom gdkatom;
-
-    if (xev->type != PropertyNotify) {
-        return GDK_FILTER_CONTINUE;
-    }
-
-    gdkatom = gdk_atom_intern_static_string ("_XROOTPMAP_ID");
-    if (xev->xproperty.atom != gdk_x11_atom_to_xatom (gdkatom)) {
-        return GDK_FILTER_CONTINUE;
-    }
-
-    background_changed (window);
-
-    return GDK_FILTER_CONTINUE;
-}
-
-static void
-caja_desktop_window_composited_changed (GtkWidget *widget)
-{
-    CajaDesktopWindow *window = CAJA_DESKTOP_WINDOW (widget);
-    GdkScreen *screen = gdk_screen_get_default ();
-    gboolean composited = gdk_screen_is_composited (screen);
-    GdkWindow *root;
-
-    if (window->details->composited == composited) {
-        return;
-    }
-
-    window->details->composited = composited;
-    root = gdk_screen_get_root_window (screen);
-
-    if (composited) {
-        gdk_window_remove_filter (root, (GdkFilterFunc) filter_func, window);
-
-        if (window->details->surface) {
-            cairo_surface_destroy (window->details->surface);
-            window->details->surface = NULL;
-        }
-    } else {
-        gint events = gdk_window_get_events (root);
-
-        gdk_window_set_events (root, events | GDK_PROPERTY_CHANGE_MASK);
-        gdk_window_add_filter (root, (GdkFilterFunc) filter_func, window);
-        background_changed (window);
-    }
-}
-
-static gboolean
-caja_desktop_window_draw (GtkWidget *widget,
-                              cairo_t   *cr)
-{
-    CajaDesktopWindow *window = CAJA_DESKTOP_WINDOW (widget);
-
-    if (window->details->surface) {
-        cairo_set_source_surface (cr, window->details->surface, 0, 0);
-        cairo_paint (cr);
-    }
-
-    return GTK_WIDGET_CLASS (caja_desktop_window_parent_class)->draw (widget, cr);
-}
-
-static void
-caja_desktop_window_finalize (GObject *obj)
-{
-    CajaDesktopWindow *window = CAJA_DESKTOP_WINDOW (obj);
-
-    if (window->details->composited == FALSE) {
-        GdkScreen *screen = gdk_screen_get_default ();
-        GdkWindow *root = gdk_screen_get_root_window (screen);
-
-        gdk_window_remove_filter (root, (GdkFilterFunc) filter_func, window);
-    }
-
-    if (window->details->surface) {
-        cairo_surface_destroy (window->details->surface);
-        window->details->surface = NULL;
-    }
-
-    G_OBJECT_CLASS (caja_desktop_window_parent_class)->finalize (obj);
-}
-#endif
-
 static void
 caja_desktop_window_init (CajaDesktopWindow *window)
 {
@@ -173,11 +63,6 @@
     gtk_style_context_add_class (context, "caja-desktop-window");
 #endif
 
-#if GTK_CHECK_VERSION(3, 21, 0) 
-    window->details->composited = TRUE;
-    caja_desktop_window_composited_changed (GTK_WIDGET (window));
-#endif
-
     gtk_window_move (GTK_WINDOW (window), 0, 0);
 
     /* shouldn't really be needed given our semantic type
@@ -283,13 +168,6 @@
     /* Chain up to realize our children */
     GTK_WIDGET_CLASS (caja_desktop_window_parent_class)->map (widget);
     gdk_window_lower (gtk_widget_get_window (widget));
-#if GTK_CHECK_VERSION(3, 21, 0)
-    GdkWindow *window;
-    GdkRGBA transparent = { 0, 0, 0, 0 };
-
-    window = gtk_widget_get_window (widget);
-    gdk_window_set_background_rgba (window, &transparent);
-#endif
 }
 
 static void
@@ -359,21 +237,12 @@
 {
     CajaDesktopWindow *window;
     CajaDesktopWindowDetails *details;
-#if GTK_CHECK_VERSION(3, 21, 0)
-    GdkVisual *visual;
-#endif
     window = CAJA_DESKTOP_WINDOW (widget);
     details = window->details;
 
     /* Make sure we get keyboard events */
     gtk_widget_set_events (widget, gtk_widget_get_events (widget)
                            | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK);
-#if GTK_CHECK_VERSION(3, 21, 0)
-    visual = gdk_screen_get_rgba_visual (gtk_widget_get_screen (widget));
-    if (visual) {
-        gtk_widget_set_visual (widget, visual);
-    }
-#endif
     /* Do the work of realizing. */
     GTK_WIDGET_CLASS (caja_desktop_window_parent_class)->realize (widget);
 
@@ -387,6 +256,17 @@
                           G_CALLBACK (caja_desktop_window_screen_size_changed), window);
 }
 
+#if GTK_CHECK_VERSION (3, 22, 0)
+static gboolean
+draw (GtkWidget *widget,
+      cairo_t   *cr)
+{
+    eel_background_draw (widget, cr);
+
+    return GTK_WIDGET_CLASS (caja_desktop_window_parent_class)->draw (widget, cr);
+}
+#endif
+
 static char *
 real_get_title (CajaWindow *window)
 {
@@ -405,18 +285,12 @@
 {
     GtkWidgetClass *wclass = GTK_WIDGET_CLASS (klass);
     CajaWindowClass *nclass = CAJA_WINDOW_CLASS (klass);
-#if GTK_CHECK_VERSION(3, 21, 0)
-    GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
-    object_class->finalize = caja_desktop_window_finalize;
-#endif
 
     wclass->realize = realize;
     wclass->unrealize = unrealize;
     wclass->map = map;
-#if GTK_CHECK_VERSION(3, 21, 0)
-    wclass->composited_changed = caja_desktop_window_composited_changed;
-    wclass->draw = caja_desktop_window_draw;
+#if GTK_CHECK_VERSION (3, 22, 0)
+    wclass->draw = draw;
 #endif
     nclass->window_type = CAJA_WINDOW_DESKTOP;
     nclass->get_title = real_get_title;
diff -Nru caja-1.16.2/src/caja-property-browser.c caja-1.16.6/src/caja-property-browser.c
--- caja-1.16.2/src/caja-property-browser.c	2017-01-22 13:36:35.000000000 +0100
+++ caja-1.16.6/src/caja-property-browser.c	2017-05-08 12:34:20.000000000 +0200
@@ -2238,6 +2238,9 @@
     gboolean got_categories;
     char *name, *image, *type, *description, *display_name, *path, *mode;
     const char *text;
+#if GTK_CHECK_VERSION (3, 0, 0)
+    GtkStyleContext *context;
+#endif
 
     /* load the xml document corresponding to the path and selection */
     document = read_browser_xml (property_browser);
@@ -2255,6 +2258,8 @@
     /* allocate a new container, with a scrollwindow and viewport */
     property_browser->details->content_frame = gtk_scrolled_window_new (NULL, NULL);
 #if GTK_CHECK_VERSION (3, 0, 0)
+    context = gtk_widget_get_style_context (property_browser->details->content_frame);
+    gtk_style_context_add_class (context, "frame");
     gtk_widget_set_vexpand (property_browser->details->content_frame, TRUE);
 #endif
     viewport = gtk_viewport_new (NULL, NULL);
diff -Nru caja-1.16.2/src/file-manager/fm-desktop-icon-view.c caja-1.16.6/src/file-manager/fm-desktop-icon-view.c
--- caja-1.16.2/src/file-manager/fm-desktop-icon-view.c	2017-01-22 13:36:35.000000000 +0100
+++ caja-1.16.6/src/file-manager/fm-desktop-icon-view.c	2017-05-08 12:34:20.000000000 +0200
@@ -38,9 +38,7 @@
 #include <gdk/gdkx.h>
 #include <glib/gi18n.h>
 #include <libcaja-private/caja-desktop-icon-file.h>
-#if !GTK_CHECK_VERSION(3, 21, 0)
 #include <libcaja-private/caja-directory-background.h>
-#endif
 #include <libcaja-private/caja-directory-notify.h>
 #include <libcaja-private/caja-file-changes-queue.h>
 #include <libcaja-private/caja-file-operations.h>
diff -Nru caja-1.16.2/src/file-manager/fm-directory-view.c caja-1.16.6/src/file-manager/fm-directory-view.c
--- caja-1.16.2/src/file-manager/fm-directory-view.c	2017-01-22 13:36:35.000000000 +0100
+++ caja-1.16.6/src/file-manager/fm-directory-view.c	2017-05-08 12:34:20.000000000 +0200
@@ -61,9 +61,7 @@
 #include <libcaja-private/caja-desktop-directory.h>
 #include <libcaja-private/caja-extensions.h>
 #include <libcaja-private/caja-search-directory.h>
-#if !GTK_CHECK_VERSION(3, 21, 0)
 #include <libcaja-private/caja-directory-background.h>
-#endif
 #include <libcaja-private/caja-directory.h>
 #include <libcaja-private/caja-dnd.h>
 #include <libcaja-private/caja-file-attributes.h>
@@ -423,9 +421,7 @@
 EEL_IMPLEMENT_MUST_OVERRIDE_SIGNAL (fm_directory_view, can_zoom_out)
 EEL_IMPLEMENT_MUST_OVERRIDE_SIGNAL (fm_directory_view, clear)
 EEL_IMPLEMENT_MUST_OVERRIDE_SIGNAL (fm_directory_view, file_changed)
-#if !GTK_CHECK_VERSION(3, 21, 0)
 EEL_IMPLEMENT_MUST_OVERRIDE_SIGNAL (fm_directory_view, get_background_widget)
-#endif
 EEL_IMPLEMENT_MUST_OVERRIDE_SIGNAL (fm_directory_view, get_selection)
 EEL_IMPLEMENT_MUST_OVERRIDE_SIGNAL (fm_directory_view, get_selection_for_file_transfer)
 EEL_IMPLEMENT_MUST_OVERRIDE_SIGNAL (fm_directory_view, get_item_count)
@@ -3692,7 +3688,6 @@
 		 can_zoom_out, (view));
 }
 
-#if !GTK_CHECK_VERSION(3, 21, 0)
 GtkWidget *
 fm_directory_view_get_background_widget (FMDirectoryView *view)
 {
@@ -3718,7 +3713,7 @@
 	bg = fm_directory_view_get_background (view);
 	eel_background_set_active (bg, is_active);
 }
-#endif
+
 static void
 fm_directory_view_set_is_active (FMDirectoryView *view,
 				 gboolean is_active)
@@ -4783,13 +4778,6 @@
 	other_applications_visible = (selection != NULL);
 	filter_default = (selection != NULL);
 
-	for (node = selection; node != NULL; node = node->next) {
-
-		file = CAJA_FILE (node->data);
-
-		other_applications_visible &= (!caja_file_is_directory (file));
-	}
-
 	default_app = NULL;
 	if (filter_default) {
 		default_app = caja_mime_get_default_application_for_files (selection);
@@ -7752,11 +7740,9 @@
 
 	ui = caja_ui_string_get ("caja-directory-view-ui.xml");
 	view->details->dir_merge_id = gtk_ui_manager_add_ui_from_string (ui_manager, ui, -1, NULL);
-#if !GTK_CHECK_VERSION(3, 21, 0)
 	g_signal_connect_object (fm_directory_view_get_background (view), "settings_changed",
 				 G_CALLBACK (schedule_update_menus), G_OBJECT (view),
 				 G_CONNECT_SWAPPED);
-#endif
 	view->details->scripts_invalid = TRUE;
 	view->details->templates_invalid = TRUE;
 }
@@ -11112,12 +11098,10 @@
 	klass->supports_properties = real_supports_properties;
 	klass->supports_zooming = real_supports_zooming;
 	klass->using_manual_layout = real_using_manual_layout;
-        klass->merge_menus = real_merge_menus;
-        klass->unmerge_menus = real_unmerge_menus;
-        klass->update_menus = real_update_menus;
-#if !GTK_CHECK_VERSION(3, 21, 0)
-        klass->set_is_active = real_set_is_active;
-#endif
+	klass->merge_menus = real_merge_menus;
+	klass->unmerge_menus = real_unmerge_menus;
+	klass->update_menus = real_update_menus;
+	klass->set_is_active = real_set_is_active;
 	/* Function pointers that subclasses must override */
 	EEL_ASSIGN_MUST_OVERRIDE_SIGNAL (klass, fm_directory_view, add_file);
 	EEL_ASSIGN_MUST_OVERRIDE_SIGNAL (klass, fm_directory_view, bump_zoom_level);
@@ -11125,9 +11109,7 @@
 	EEL_ASSIGN_MUST_OVERRIDE_SIGNAL (klass, fm_directory_view, can_zoom_out);
 	EEL_ASSIGN_MUST_OVERRIDE_SIGNAL (klass, fm_directory_view, clear);
 	EEL_ASSIGN_MUST_OVERRIDE_SIGNAL (klass, fm_directory_view, file_changed);
-#if !GTK_CHECK_VERSION(3, 21, 0)
-       EEL_ASSIGN_MUST_OVERRIDE_SIGNAL (klass, fm_directory_view, get_background_widget);
-#endif
+	EEL_ASSIGN_MUST_OVERRIDE_SIGNAL (klass, fm_directory_view, get_background_widget);
 	EEL_ASSIGN_MUST_OVERRIDE_SIGNAL (klass, fm_directory_view, get_selection);
 	EEL_ASSIGN_MUST_OVERRIDE_SIGNAL (klass, fm_directory_view, get_selection_for_file_transfer);
 	EEL_ASSIGN_MUST_OVERRIDE_SIGNAL (klass, fm_directory_view, get_item_count);
diff -Nru caja-1.16.2/src/file-manager/fm-icon-view.c caja-1.16.6/src/file-manager/fm-icon-view.c
--- caja-1.16.2/src/file-manager/fm-icon-view.c	2017-01-22 13:36:35.000000000 +0100
+++ caja-1.16.6/src/file-manager/fm-icon-view.c	2017-05-08 12:34:20.000000000 +0200
@@ -30,9 +30,7 @@
 #include "fm-desktop-icon-view.h"
 #include "fm-error-reporting.h"
 #include <stdlib.h>
-#if !GTK_CHECK_VERSION(3, 21, 0)
 #include <eel/eel-background.h>
-#endif
 #include <eel/eel-glib-extensions.h>
 #include <eel/eel-gtk-extensions.h>
 #include <eel/eel-gtk-macros.h>
@@ -45,9 +43,7 @@
 #include <glib/gi18n.h>
 #include <gio/gio.h>
 #include <libcaja-private/caja-clipboard-monitor.h>
-#if !GTK_CHECK_VERSION(3, 21, 0)
 #include <libcaja-private/caja-directory-background.h>
-#endif
 #include <libcaja-private/caja-directory.h>
 #include <libcaja-private/caja-dnd.h>
 #include <libcaja-private/caja-file-utilities.h>
@@ -1281,7 +1277,6 @@
 
     /* kill any sound preview process that is ongoing */
     preview_audio (icon_view, NULL, FALSE);
-#if !GTK_CHECK_VERSION(3, 21, 0)
     /* FIXME bugzilla.gnome.org 45060: Should use methods instead
      * of hardcoding desktop knowledge in here.
      */
@@ -1305,7 +1300,6 @@
         caja_connect_background_to_file_metadata (icon_container, file, default_action);
     }
 
-#endif
     /* Set up the zoom level from the metadata. */
     if (fm_directory_view_supports_zooming (FM_DIRECTORY_VIEW (icon_view)))
     {
@@ -1511,7 +1505,6 @@
            > CAJA_ZOOM_LEVEL_SMALLEST;
 }
 
-#if !GTK_CHECK_VERSION(3, 21, 0)
 static GtkWidget *
 fm_icon_view_get_background_widget (FMDirectoryView *view)
 {
@@ -1519,7 +1512,6 @@
 
     return GTK_WIDGET (get_icon_container (FM_ICON_VIEW (view)));
 }
-#endif
 
 static gboolean
 fm_icon_view_is_empty (FMDirectoryView *view)
@@ -3199,9 +3191,7 @@
     fm_directory_view_class->clear = fm_icon_view_clear;
     fm_directory_view_class->end_loading = fm_icon_view_end_loading;
     fm_directory_view_class->file_changed = fm_icon_view_file_changed;
-#if !GTK_CHECK_VERSION(3, 21, 0)
     fm_directory_view_class->get_background_widget = fm_icon_view_get_background_widget;
-#endif
     fm_directory_view_class->get_selected_icon_locations = fm_icon_view_get_selected_icon_locations;
     fm_directory_view_class->get_selection = fm_icon_view_get_selection;
     fm_directory_view_class->get_selection_for_file_transfer = fm_icon_view_get_selection;
diff -Nru caja-1.16.2/src/file-manager/fm-list-view.c caja-1.16.6/src/file-manager/fm-list-view.c
--- caja-1.16.2/src/file-manager/fm-list-view.c	2017-01-22 13:36:35.000000000 +0100
+++ caja-1.16.6/src/file-manager/fm-list-view.c	2017-05-08 12:34:20.000000000 +0200
@@ -47,9 +47,7 @@
 #include <libcaja-private/caja-column-chooser.h>
 #include <libcaja-private/caja-column-utilities.h>
 #include <libcaja-private/caja-debug-log.h>
-#if !GTK_CHECK_VERSION(3, 21, 0)
 #include <libcaja-private/caja-directory-background.h>
-#endif
 #include <libcaja-private/caja-dnd.h>
 #include <libcaja-private/caja-file-dnd.h>
 #include <libcaja-private/caja-file-utilities.h>
@@ -2121,13 +2119,11 @@
     }
 }
 
-#if !GTK_CHECK_VERSION(3, 21, 0)
 static GtkWidget *
 fm_list_view_get_background_widget (FMDirectoryView *view)
 {
     return GTK_WIDGET (view);
 }
-#endif
 
 static void
 fm_list_view_get_selection_foreach_func (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
@@ -2912,9 +2908,10 @@
                                   NULL,
                                   list_view->details->file_name_column,
                                   TRUE, 0.0, 0.0);
-    gtk_tree_view_set_cursor (list_view->details->tree_view,
+    gtk_tree_view_set_cursor_on_cell (list_view->details->tree_view,
                               path,
                               list_view->details->file_name_column,
+                              GTK_CELL_RENDERER (list_view->details->file_name_cell),
                               TRUE);
 
     /* set cursor also triggers editing-started, where we save the editable widget */
@@ -3329,9 +3326,7 @@
     fm_directory_view_class->click_policy_changed = fm_list_view_click_policy_changed;
     fm_directory_view_class->clear = fm_list_view_clear;
     fm_directory_view_class->file_changed = fm_list_view_file_changed;
-#if !GTK_CHECK_VERSION(3, 21, 0)
     fm_directory_view_class->get_background_widget = fm_list_view_get_background_widget;
-#endif
     fm_directory_view_class->get_selection = fm_list_view_get_selection;
     fm_directory_view_class->get_selection_for_file_transfer = fm_list_view_get_selection_for_file_transfer;
     fm_directory_view_class->get_item_count = fm_list_view_get_item_count;


More information about the pkg-mate-team mailing list