Hello community,

here is the log from the commit of package budgie-desktop for openSUSE:Factory 
checked in at 2020-09-06 21:37:20
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/budgie-desktop (Old)
 and      /work/SRC/openSUSE:Factory/.budgie-desktop.new.3399 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "budgie-desktop"

Sun Sep  6 21:37:20 2020 rev:7 rq:832518 version:10.5.1

Changes:
--------
--- /work/SRC/openSUSE:Factory/budgie-desktop/budgie-desktop.changes    
2020-09-01 20:10:13.224672446 +0200
+++ /work/SRC/openSUSE:Factory/.budgie-desktop.new.3399/budgie-desktop.changes  
2020-09-06 21:38:59.445735630 +0200
@@ -1,0 +2,11 @@
+Sat Sep  5 17:10:21 UTC 2020 - Callum Farmer <[email protected]>
+
+- Add patches to fix boo#1176016:
+  * replace-na-tray-with-carbontray.patch 
+    (gh#solus-project/budgie-desktop#1998)
+  * clean-up-carbontray.patch
+    (gh#solus-project/budgie-desktop#2002)
+  * fix-integration-issues-with-carbontray.patch
+    (gh#solus-project/budgie-desktop#2009)
+
+-------------------------------------------------------------------

New:
----
  clean-up-carbontray.patch
  fix-integration-issues-with-carbontray.patch
  replace-na-tray-with-carbontray.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ budgie-desktop.spec ++++++
--- /var/tmp/diff_new_pack.9ilLhr/_old  2020-09-06 21:39:00.045735926 +0200
+++ /var/tmp/diff_new_pack.9ilLhr/_new  2020-09-06 21:39:00.045735926 +0200
@@ -40,6 +40,12 @@
 Patch4:         desktop-override.patch
 # PATCH-FIX-OPENSUSE: Use nemo instead of nautilus for desktop icons
 Patch5:         nemo-instead-of-nautilus.patch
+# PATCH-FIX-UPSTREAM: gh#solus-project/budgie-desktop#1998 -- Fixes boo#1176016
+Patch6:         replace-na-tray-with-carbontray.patch
+# PATCH-FIX-UPSTREAM: gh#solus-project/budgie-desktop#2002 -- Fixes boo#1176016
+Patch7:         clean-up-carbontray.patch
+# PATCH-FIX-UPSTREAM: gh#solus-project/budgie-desktop#2009 -- Fixes boo#1176016
+Patch8:         fix-integration-issues-with-carbontray.patch
 BuildRequires:  intltool
 BuildRequires:  meson >= 0.41.2
 BuildRequires:  pkgconfig



++++++ clean-up-carbontray.patch ++++++
>From a0eeae723af06e8cbb02ed9a7356fae8f4f3842e Mon Sep 17 00:00:00 2001
From: Campbell Jones <[email protected]>
Date: Mon, 6 Jul 2020 13:22:21 -0400
Subject: [PATCH] Clean up carbontray code and add copyright headers

---
 src/applets/tray/TrayApplet.vala    |  5 +--
 src/applets/tray/carbontray/child.c | 56 ++++++++++++++++-------
 src/applets/tray/carbontray/child.h | 15 ++++++-
 src/applets/tray/carbontray/tray.c  | 70 ++++++++++++++++-------------
 src/applets/tray/carbontray/tray.h  | 19 ++++++--
 5 files changed, 111 insertions(+), 54 deletions(-)

diff --git a/src/applets/tray/TrayApplet.vala b/src/applets/tray/TrayApplet.vala
index 62a92fd7..22fd6c3d 100644
--- a/src/applets/tray/TrayApplet.vala
+++ b/src/applets/tray/TrayApplet.vala
@@ -1,7 +1,7 @@
 /*
  * This file is part of budgie-desktop
  *
- * Copyright © 2015-2019 Budgie Desktop Developers
+ * Copyright © 2015-2020 Budgie Desktop Developers
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -131,8 +131,7 @@ public class TrayApplet : Budgie.Applet {
 
 
 [ModuleInit]
-public void peas_register_types(TypeModule module)
-{
+public void peas_register_types(TypeModule module) {
     // boilerplate - all modules need this
     var objmodule = module as Peas.ObjectModule;
     objmodule.register_extension_type(typeof(Budgie.Plugin), 
typeof(TrayPlugin));
diff --git a/src/applets/tray/carbontray/child.c 
b/src/applets/tray/carbontray/child.c
index eb7fa832..ba46c810 100644
--- a/src/applets/tray/carbontray/child.c
+++ b/src/applets/tray/carbontray/child.c
@@ -1,3 +1,18 @@
+/*
+ * This file is part of budgie-desktop
+ *
+ * Copyright © 2015-2020 Budgie Desktop Developers
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This file's contents largely use xfce4-panel as a reference, which is 
licensed under the terms of the GNU GPL v2.
+ * Additional notes were taken from na-tray, the previous system tray for 
Budgie, which is part of MATE Desktop 
+ * and licensed under the terms of the GNU GPL v2.
+ */
+
 #include "child.h"
 #include "tray.h"
 
@@ -20,26 +35,39 @@ G_DEFINE_TYPE(CarbonChild, carbon_child, GTK_TYPE_SOCKET)
 // public method implementations
 
 CarbonChild* carbon_child_new(int size, GdkScreen *screen, Window iconWindow) {
-    CarbonChild *self = g_object_new(carbon_child_get_type(), NULL);
-    self->preferredWidth = size;
-       self->preferredHeight = size;
-
-       if (GDK_IS_SCREEN(screen) == FALSE)
+       if (GDK_IS_SCREEN(screen) == FALSE) {
+               g_warning("No screen to place tray icon onto");
                return NULL;
+       }
+       
+       if (iconWindow == None) {
+               g_warning("No icon window to add to tray");
+               return NULL;
+       }
 
        GdkDisplay *display = gdk_screen_get_display(screen);
        gdk_x11_display_error_trap_push(display);
        XWindowAttributes attributes;
        int result = XGetWindowAttributes(GDK_DISPLAY_XDISPLAY(display), 
iconWindow, &attributes);
+       int error = gdk_x11_display_error_trap_pop(display);
 
-       if (gdk_x11_display_error_trap_pop(display) != 0 || result == 0)
+       if (result == 0) {
+               g_warning("Failed to get icon window attributes");
                return NULL;
+       }
 
-       GdkVisual *visual = gdk_x11_screen_lookup_visual(screen, 
attributes.visual->visualid);
-       if (visual == NULL || GDK_IS_VISUAL(visual) == FALSE) {
+       if (error != 0) {
+               g_warning("Encountered X error %d when obtaining window 
attributes for tray icon", error);
                return NULL;
        }
 
+       GdkVisual *visual = gdk_x11_screen_lookup_visual(screen, 
attributes.visual->visualid);
+       if (visual == NULL || GDK_IS_VISUAL(visual) == FALSE)
+               return NULL;
+
+       CarbonChild *self = g_object_new(carbon_child_get_type(), NULL);
+    self->preferredWidth = size;
+       self->preferredHeight = size;
        self->iconWindow = iconWindow;
        self->isComposited = FALSE;
        gtk_widget_set_visual(GTK_WIDGET(self), visual);
@@ -112,9 +140,7 @@ static void carbon_child_realize(GtkWidget *widget) {
                gdk_window_set_background_rgba(window, &transparent);
                gdk_window_set_composited(window, TRUE);
        } else if (gtk_widget_get_visual(widget) == 
gdk_window_get_visual(gdk_window_get_parent(window))) {
-               G_GNUC_BEGIN_IGNORE_DEPRECATIONS
                gdk_window_set_background_pattern(window, NULL);
-               G_GNUC_END_IGNORE_DEPRECATIONS
        } else {
                self->parentRelativeBg = FALSE;
        }
@@ -125,7 +151,7 @@ static void carbon_child_realize(GtkWidget *widget) {
 }
 
 static void carbon_child_get_preferred_width(GtkWidget *base, int 
*minimum_width, int *natural_width) {
-       CarbonChild *self =(CarbonChild*) base;
+       CarbonChild *self = CARBON_CHILD(base);
     int scale = gtk_widget_get_scale_factor(base);
        
     *minimum_width = self->preferredWidth / scale;
@@ -133,7 +159,7 @@ static void carbon_child_get_preferred_width(GtkWidget 
*base, int *minimum_width
 }
 
 static void carbon_child_get_preferred_height(GtkWidget *base, int 
*minimum_height, int *natural_height) {
-       CarbonChild *self =(CarbonChild*) base;
+       CarbonChild *self = CARBON_CHILD(base);
     int scale = gtk_widget_get_scale_factor(base);
        
     *minimum_height = self->preferredHeight / scale;
@@ -143,9 +169,9 @@ static void carbon_child_get_preferred_height(GtkWidget 
*base, int *minimum_heig
 static void carbon_child_class_init(CarbonChildClass *klass) {
     GtkWidgetClass *gtkwidget_class = GTK_WIDGET_CLASS(klass);
 
-       gtkwidget_class->get_preferred_width =(void(*)(GtkWidget*, int*, int*)) 
carbon_child_get_preferred_width;
-       gtkwidget_class->get_preferred_height =(void(*)(GtkWidget*, int*, 
int*)) carbon_child_get_preferred_height;
-    gtkwidget_class->realize =(void(*)(GtkWidget*)) carbon_child_realize;
+       gtkwidget_class->get_preferred_width = (void(*)(GtkWidget*, int*, 
int*)) carbon_child_get_preferred_width;
+       gtkwidget_class->get_preferred_height = (void(*)(GtkWidget*, int*, 
int*)) carbon_child_get_preferred_height;
+    gtkwidget_class->realize = (void(*)(GtkWidget*)) carbon_child_realize;
 }
 
 static void set_wmclass(CarbonChild *self, Display *xdisplay) {
diff --git a/src/applets/tray/carbontray/child.h 
b/src/applets/tray/carbontray/child.h
index 7f52a830..7accf372 100644
--- a/src/applets/tray/carbontray/child.h
+++ b/src/applets/tray/carbontray/child.h
@@ -1,5 +1,16 @@
-#ifndef __CARBONTRAY_CHILD_H__
-#define __CARBONTRAY_CHILD_H__
+/*
+ * This file is part of budgie-desktop
+ *
+ * Copyright © 2015-2020 Budgie Desktop Developers
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#ifndef __CARBON_CHILD_H__
+#define __CARBON_CHILD_H__
 
 #include <gtk/gtk.h>
 #include <gtk/gtkx.h>
diff --git a/src/applets/tray/carbontray/tray.c 
b/src/applets/tray/carbontray/tray.c
index 732f8c2f..6904f8e9 100644
--- a/src/applets/tray/carbontray/tray.c
+++ b/src/applets/tray/carbontray/tray.c
@@ -1,14 +1,22 @@
+/*
+ * This file is part of budgie-desktop
+ *
+ * Copyright © 2015-2020 Budgie Desktop Developers
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This file's contents largely use xfce4-panel as a reference, which is 
licensed under the terms of the GNU GPL v2.
+ * Additional notes were taken from na-tray, the previous system tray for 
Budgie, which is part of MATE Desktop 
+ * and licensed under the terms of the GNU GPL v2.
+ */
+
 #include "tray.h"
 #include "child.h"
 #include "marshal.h"
 
-/*
-  this file's contents largely use xfce4-panel as a reference, which is 
licensed under the terms of the GNU GPL v2
-  
-  additional notes were taken from na-tray, the previous system tray for 
Budgie, which is part of MATE Desktop 
-  and licensed under the terms of the GNU GPL v2
-*/
-
 
 
 // global declarations
@@ -52,36 +60,35 @@ G_DEFINE_TYPE(CarbonTray, carbon_tray, G_TYPE_OBJECT)
 
 CarbonTray* carbon_tray_new(GtkOrientation orientation, int iconSize, int 
spacing) {
        CarbonTray *self = g_object_new(CARBON_TYPE_TRAY, NULL);
-       self->box = GTK_BOX(gtk_box_new(orientation, spacing));
-       GtkWidget *boxWidget = GTK_WIDGET(self->box);
-
        self->iconSize = iconSize;
 
+       self->box = gtk_box_new(orientation, spacing);
+
        if (orientation == GTK_ORIENTATION_HORIZONTAL) {
-               gtk_widget_set_halign(boxWidget, GTK_ALIGN_START);
-               gtk_widget_set_valign(boxWidget, GTK_ALIGN_FILL);
+               gtk_widget_set_halign(self->box, GTK_ALIGN_START);
+               gtk_widget_set_valign(self->box, GTK_ALIGN_FILL);
        } else {
-               gtk_widget_set_halign(boxWidget, GTK_ALIGN_FILL);
-               gtk_widget_set_valign(boxWidget, GTK_ALIGN_START);
+               gtk_widget_set_halign(self->box, GTK_ALIGN_FILL);
+               gtk_widget_set_valign(self->box, GTK_ALIGN_START);
        }
 
-       gtk_widget_set_hexpand(boxWidget, FALSE);
-       gtk_widget_set_vexpand(boxWidget, FALSE);
-       gtk_widget_set_size_request(boxWidget, -1, -1);
+       gtk_widget_set_hexpand(self->box, FALSE);
+       gtk_widget_set_vexpand(self->box, FALSE);
+       gtk_widget_set_size_request(self->box, -1, -1);
 
        return self;
 }
 
 void carbon_tray_add_to_container(CarbonTray *tray, GtkContainer *container) {
-       gtk_container_add(container, GTK_WIDGET(tray->box));
+       gtk_container_add(container, tray->box);
 }
 
 void carbon_tray_remove_from_container(CarbonTray *tray, GtkContainer 
*container) {
-       gtk_container_remove(container, GTK_WIDGET(tray->box));
+       gtk_container_remove(container, tray->box);
 }
 
 bool carbon_tray_register(CarbonTray *tray, GdkScreen *screen) {
-       g_signal_connect(tray->box, "draw", G_CALLBACK(carbon_tray_draw), NULL);
+       g_signal_connect(G_OBJECT(tray->box), "draw", 
G_CALLBACK(carbon_tray_draw), NULL);
 
        GtkWidget *invisible = gtk_invisible_new_for_screen(screen);
        gtk_widget_realize(invisible);
@@ -173,8 +180,8 @@ static void carbon_tray_class_init(CarbonTrayClass *klass) {
        GObjectClass *gobjectClass = G_OBJECT_CLASS(klass);
        gobjectClass->finalize = carbon_tray_finalize;
 
-       g_signal_new("message-sent", G_OBJECT_CLASS_TYPE (klass), 
G_SIGNAL_RUN_LAST,
-                 G_STRUCT_OFFSET (CarbonTrayClass, message_sent), NULL, NULL,
+       g_signal_new("message-sent", G_OBJECT_CLASS_TYPE(klass), 
G_SIGNAL_RUN_LAST,
+                 G_STRUCT_OFFSET(CarbonTrayClass, message_sent), NULL, NULL,
                  g_cclosure_user_marshal_VOID__OBJECT_STRING_LONG_LONG,
                  G_TYPE_NONE, 4,
                  GTK_TYPE_SOCKET,
@@ -240,7 +247,7 @@ static GdkFilterReturn window_filter(GdkXEvent *xev, 
GdkEvent *event, void *user
 }
 
 static void handle_dock_request(CarbonTray *tray, XClientMessageEvent *xevent) 
{
-       Window window =(unsigned long) xevent->data.l[2];
+       Window window = (unsigned long) xevent->data.l[2];
 
        /* check if we already have this window */
        if (g_hash_table_lookup(tray->socketTable, GUINT_TO_POINTER(window)) != 
NULL) {
@@ -248,11 +255,14 @@ static void handle_dock_request(CarbonTray *tray, 
XClientMessageEvent *xevent) {
        }
 
        /* create the socket */
-       GdkScreen *screen = gtk_widget_get_screen(tray->invisible);
-       CarbonChild *child = carbon_child_new(tray->iconSize, screen, window);
-       GtkWidget *socket = GTK_WIDGET(child);
-       if (socket == NULL)
+       CarbonChild *child = carbon_child_new(tray->iconSize, 
gtk_widget_get_screen(tray->invisible), window);
+
+       if (child == NULL) {
+               g_warning("Failed to resolve system tray icon.");
                return;
+       }
+
+       GtkWidget *socket = GTK_WIDGET(child);
 
        // networkmanager applet should be packed at the end
        if (strcmp(child->wmclass, "Nm-applet") == 0) {
@@ -261,15 +271,15 @@ static void handle_dock_request(CarbonTray *tray, 
XClientMessageEvent *xevent) {
                gtk_box_pack_start(GTK_BOX(tray->box), socket, FALSE, FALSE, 0);
                gtk_box_reorder_child(GTK_BOX(tray->box), socket, 0);
        }
-       
+
        if (GTK_IS_WINDOW(gtk_widget_get_toplevel(socket))) {
                g_signal_connect(G_OBJECT(socket), "plug-removed", 
G_CALLBACK(handle_undock_request), tray);
                gtk_socket_add_id(GTK_SOCKET(socket), window);
                g_hash_table_insert(tray->socketTable, 
GUINT_TO_POINTER(window), socket);
-               gtk_widget_show_all(GTK_WIDGET(socket));
+               gtk_widget_show_all(socket);
        } else {
                g_warning("No parent window set, destroying socket");
-               gtk_container_remove(GTK_CONTAINER(tray->box), 
GTK_WIDGET(socket));
+               gtk_container_remove(GTK_CONTAINER(tray->box), socket);
                gtk_widget_destroy(socket);
        }
 
diff --git a/src/applets/tray/carbontray/tray.h 
b/src/applets/tray/carbontray/tray.h
index 81776ddf..5ee6a2fd 100644
--- a/src/applets/tray/carbontray/tray.h
+++ b/src/applets/tray/carbontray/tray.h
@@ -1,5 +1,16 @@
-#ifndef __CARBONTRAY_TRAY_H__
-#define __CARBONTRAY_TRAY_H__
+/*
+ * This file is part of budgie-desktop
+ *
+ * Copyright © 2015-2020 Budgie Desktop Developers
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#ifndef __CARBON_TRAY_H__
+#define __CARBON_TRAY_H__
 
 #include <gtk/gtk.h>
 #include <gtk/gtkx.h>
@@ -10,7 +21,7 @@
 typedef struct {
        GObject parent_instance;
 
-       GtkBox *box;
+       GtkWidget *box;
        int iconSize;
 
        GHashTable *socketTable;
@@ -25,7 +36,7 @@ typedef struct {
 typedef struct {
        GObjectClass parent_class;
 
-       void (*message_sent)(CarbonTray *manager, CarbonChild *child, char 
*message, long id, long timeout);
+       void (*message_sent)(CarbonTray *tray, CarbonChild *child, char 
*message, long id, long timeout);
 } CarbonTrayClass;
 
 typedef struct {
++++++ fix-integration-issues-with-carbontray.patch ++++++
>From 9e119a0fec06554f9ef90a19f47e309372a33ad5 Mon Sep 17 00:00:00 2001
From: Campbell Jones <[email protected]>
Date: Mon, 13 Jul 2020 16:19:23 -0400
Subject: [PATCH 1/2] Fix integration issues with carbontray

---
 src/applets/tray/TrayApplet.vala    | 152 +++++++++++++++++++---------
 src/applets/tray/carbontray/child.c |   2 +-
 src/applets/tray/carbontray/tray.c  |  22 +++-
 3 files changed, 123 insertions(+), 53 deletions(-)

diff --git a/src/applets/tray/TrayApplet.vala b/src/applets/tray/TrayApplet.vala
index 22fd6c3d..410d9cea 100644
--- a/src/applets/tray/TrayApplet.vala
+++ b/src/applets/tray/TrayApplet.vala
@@ -28,12 +28,60 @@ public class TraySettings : Gtk.Grid {
     }
 }
 
+private class TrayErrorIcon {
+    public Budgie.PopoverManager manager;
+    public Budgie.Popover popover;
+    private Gtk.EventBox parent;
+
+    public TrayErrorIcon(Gtk.EventBox parent, string text) {
+        this.parent = parent;
+
+        parent.add(new Gtk.Image.from_icon_name("gtk-dialog-error", 
Gtk.IconSize.LARGE_TOOLBAR));
+
+        popover = new Budgie.Popover(parent);
+        popover.border_width = 8;
+
+        Gtk.Label label = new Gtk.Label(text);
+        label.show();
+        popover.add(label);
+        popover.hide();
+
+        parent.button_press_event.connect(on_button_press);
+    }
+
+    ~TrayErrorIcon() {
+        parent.button_press_event.disconnect(on_button_press);
+    }
+
+    public void register(Budgie.PopoverManager newManager) {
+        manager = newManager;
+        manager.register_popover(parent, popover);
+    }
+
+    private bool on_button_press(Gdk.EventButton event) {
+        if (event.button != 1) {
+            return Gdk.EVENT_PROPAGATE;
+        }
+        if (popover.get_visible()) {
+            popover.hide();
+        } else {
+            manager.show_popover(parent);
+        }
+        return Gdk.EVENT_STOP;
+    }
+}
+
 public class TrayApplet : Budgie.Applet {
     public string uuid { public set; public get; }
     private Carbon.Tray tray;
     private Gtk.EventBox box;
     private Settings? settings;
     private Gtk.Orientation orient;
+    private Gdk.X11.Screen screen;
+
+    // this property prevents the registration of more than one carbontray 
instance
+    private static string activeUuid = null;
+    private TrayErrorIcon errorIcon;
 
     public TrayApplet(string uuid) {
         Object(uuid: uuid);
@@ -41,66 +89,61 @@ public class TrayApplet : Budgie.Applet {
         box = new Gtk.EventBox();
         add(box);
 
-        hexpand = false;
-        vexpand = false;
-        box.vexpand = false;
-        box.hexpand = false;
-
         settings_schema = "com.solus-project.tray";
         settings_prefix = "/com/solus-project/budgie-panel/instance/tray";
 
         settings = get_applet_settings(uuid);
-        settings.changed.connect(on_settings_change);
-
-        maybe_integrate_tray();
-    }
-
-    public override bool supports_settings() {
-        return true;
-    }
-
-    public override Gtk.Widget? get_settings_ui() {
-        return new TraySettings(get_applet_settings(uuid));
+        settings.changed.connect((key) => {
+            if (key == "spacing" && tray != null) {
+                tray.set_spacing(settings.get_int(key));
+            }
+        });
+
+        if (activeUuid == null) {
+            activeUuid = uuid;
+            screen = (Gdk.X11.Screen) get_screen();
+
+            screen.monitors_changed.connect(reintegrate_tray);
+            parent_set.connect((old_parent) => {
+                reintegrate_tray();
+            });
+
+            maybe_integrate_tray();
+        } else {
+            // there's already an active tray, create an informative icon with 
a popover
+            errorIcon = new TrayErrorIcon(box, _("Only one instance of the 
System Tray can be active at a time."));
+            show_all();
+        }
     }
 
-    void on_settings_change(string key) {
-        if (key != "spacing") {
-            return;
-        }
-        tray.set_spacing(settings.get_int(key));
+    ~TrayApplet() {
+        if (activeUuid == uuid) activeUuid = null;
     }
 
-    public override void panel_position_changed(Budgie.PanelPosition position) 
{
-        if (position == Budgie.PanelPosition.LEFT || position == 
Budgie.PanelPosition.RIGHT) {
-            orient = Gtk.Orientation.VERTICAL;
-        } else {
-            orient = Gtk.Orientation.HORIZONTAL;
+    private void reintegrate_tray() {
+        if (tray != null) {
+            tray.remove_from_container(box);
+            tray.dispose();
+            tray = null;
         }
 
-        if (tray == null) {
-            return;
+        if (activeUuid == null || activeUuid == uuid) {
+            maybe_integrate_tray();
         }
-
-        tray.unregister();
-        tray.remove_from_container(box);
-        tray = null;
-        maybe_integrate_tray();
     }
 
-    protected void maybe_integrate_tray() {
-        if (tray != null) {
-            return;
-        }
-
+    private void maybe_integrate_tray() {
         tray = new Carbon.Tray(orient, 24, settings.get_int("spacing"));
 
         if (tray == null) {
-            var label = new Gtk.Label("Tray unavailable");
-            box.add(label);
-            label.show_all();
+            activeUuid = null;
+            errorIcon = new TrayErrorIcon(box, _("The System Tray failed to 
initialize."));
+            show_all();
             return;
         }
 
+        activeUuid = uuid;
+
         switch (orient) {
         case Gtk.Orientation.HORIZONTAL:
             halign = Gtk.Align.START;
@@ -118,14 +161,29 @@ public class TrayApplet : Budgie.Applet {
 
         tray.add_to_container(box);
         show_all();
-        tray.register((Gdk.X11.Screen) get_screen());
+        tray.register(screen);
+    }
 
-        var win = get_toplevel();
-        if (win == null) {
-            return;
+    public override void panel_position_changed(Budgie.PanelPosition position) 
{
+        if (position == Budgie.PanelPosition.LEFT || position == 
Budgie.PanelPosition.RIGHT) {
+            orient = Gtk.Orientation.VERTICAL;
+        } else {
+            orient = Gtk.Orientation.HORIZONTAL;
         }
-        win.queue_draw();
-        queue_resize();
+
+        reintegrate_tray();
+    }
+
+    public override void update_popovers(Budgie.PopoverManager? manager) {
+        if (errorIcon != null) errorIcon.register(manager);
+    }
+
+    public override bool supports_settings() {
+        return true;
+    }
+
+    public override Gtk.Widget? get_settings_ui() {
+        return new TraySettings(get_applet_settings(uuid));
     }
 }
 
diff --git a/src/applets/tray/carbontray/child.c 
b/src/applets/tray/carbontray/child.c
index ccd22699..f615d489 100644
--- a/src/applets/tray/carbontray/child.c
+++ b/src/applets/tray/carbontray/child.c
@@ -54,7 +54,7 @@ CarbonChild* carbon_child_new(int size, GdkScreen *screen, 
Window iconWindow) {
        int error = gdk_x11_display_error_trap_pop(display);
 
        if (result == 0) {
-               g_warning("Failed to get icon window attributes");
+               g_info("Failed to populate icon window attributes for tray 
icon");
                return NULL;
        }
 
diff --git a/src/applets/tray/carbontray/tray.c 
b/src/applets/tray/carbontray/tray.c
index 60092fa3..feabd9e5 100644
--- a/src/applets/tray/carbontray/tray.c
+++ b/src/applets/tray/carbontray/tray.c
@@ -33,6 +33,7 @@ static unsigned int message_sent_signal;
 
 static void carbon_tray_init(CarbonTray*);
 static void carbon_tray_class_init(CarbonTrayClass*);
+static void carbon_tray_dispose(GObject*);
 static void carbon_tray_finalize(GObject*);
 static int carbon_tray_draw(GtkWidget*, cairo_t*);
 
@@ -143,6 +144,10 @@ bool carbon_tray_register(CarbonTray *tray, GdkScreen 
*screen) {
 }
 
 void carbon_tray_unregister(CarbonTray *tray) {
+       if (GTK_IS_WIDGET(tray->invisible) == FALSE) {
+               return;
+       }
+
        GtkWidget *invisible = tray->invisible;
        GdkDisplay *display = gtk_widget_get_display(invisible);
        GdkWindow *owner = gdk_selection_owner_get_for_display(display, 
tray->selectionAtom);
@@ -178,6 +183,7 @@ static void carbon_tray_init(CarbonTray* self) {
 
 static void carbon_tray_class_init(CarbonTrayClass *klass) {
        GObjectClass *gobjectClass = G_OBJECT_CLASS(klass);
+       gobjectClass->dispose = carbon_tray_dispose;
        gobjectClass->finalize = carbon_tray_finalize;
 
        g_signal_new("message-sent", G_OBJECT_CLASS_TYPE(klass), 
G_SIGNAL_RUN_LAST,
@@ -190,6 +196,10 @@ static void carbon_tray_class_init(CarbonTrayClass *klass) 
{
                  G_TYPE_LONG);
 }
 
+static void carbon_tray_dispose(GObject *object) {
+       carbon_tray_unregister(CARBON_TRAY(object));
+}
+
 static void carbon_tray_finalize(GObject *object) {
        CarbonTray *tray = CARBON_TRAY(object);
 
@@ -217,11 +227,15 @@ static GdkFilterReturn window_filter(GdkXEvent *xev, 
GdkEvent *event, void *user
        // event goes unused
        (void) event;
 
-       XEvent *xevent =(XEvent*) xev;
-       CarbonTray *tray =(CarbonTray*) userData;
+       XEvent *xevent = (XEvent*) xev;
+       CarbonTray *tray = (CarbonTray*) userData;
+
+       if (GTK_IS_WIDGET(tray->invisible) == FALSE) {
+               return GDK_FILTER_CONTINUE;
+       }
 
        if (xevent->type == ClientMessage) {
-               XClientMessageEvent *xclient =(XClientMessageEvent*) xevent;
+               XClientMessageEvent *xclient = (XClientMessageEvent*) xevent;
 
                if (xclient->message_type == tray->opcodeAtom) {
                        switch(xclient->data.l[1]) {
@@ -256,9 +270,7 @@ static void handle_dock_request(CarbonTray *tray, 
XClientMessageEvent *xevent) {
 
        /* create the socket */
        CarbonChild *child = carbon_child_new(tray->iconSize, 
gtk_widget_get_screen(tray->invisible), window);
-
        if (child == NULL) {
-               g_warning("Failed to resolve system tray icon.");
                return;
        }
 

>From 8687912ad1ea9b6514b996255f5ce7a2dbfcac0e Mon Sep 17 00:00:00 2001
From: Campbell Jones <[email protected]>
Date: Tue, 14 Jul 2020 13:15:49 -0400
Subject: [PATCH 2/2] Improve conciseness, and add CSS classes to system tray

---
 src/applets/tray/TrayApplet.vala | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/applets/tray/TrayApplet.vala b/src/applets/tray/TrayApplet.vala
index 410d9cea..8b8a1f68 100644
--- a/src/applets/tray/TrayApplet.vala
+++ b/src/applets/tray/TrayApplet.vala
@@ -39,7 +39,7 @@ private class TrayErrorIcon {
         parent.add(new Gtk.Image.from_icon_name("gtk-dialog-error", 
Gtk.IconSize.LARGE_TOOLBAR));
 
         popover = new Budgie.Popover(parent);
-        popover.border_width = 8;
+        popover.get_style_context().add_class("system-tray-popover");
 
         Gtk.Label label = new Gtk.Label(text);
         label.show();
@@ -86,6 +86,8 @@ public class TrayApplet : Budgie.Applet {
     public TrayApplet(string uuid) {
         Object(uuid: uuid);
 
+        get_style_context().add_class("system-tray-applet");
+
         box = new Gtk.EventBox();
         add(box);
 
@@ -93,10 +95,8 @@ public class TrayApplet : Budgie.Applet {
         settings_prefix = "/com/solus-project/budgie-panel/instance/tray";
 
         settings = get_applet_settings(uuid);
-        settings.changed.connect((key) => {
-            if (key == "spacing" && tray != null) {
-                tray.set_spacing(settings.get_int(key));
-            }
+        settings.changed["spacing"].connect((key) => {
+            if (tray != null) tray.set_spacing(settings.get_int("spacing"));
         });
 
         if (activeUuid == null) {
++++++ replace-na-tray-with-carbontray.patch ++++++
++++ 4136 lines (skipped)


Reply via email to