From 6bcad424c6efaf2b37f1810f52ab9ffd24377cd8 Mon Sep 17 00:00:00 2001 From: lukefromdc Date: Fri, 14 Jul 2017 15:38:31 -0400 Subject: don't use GtkPlug/GtkSocket for in process applets 1. This will allow panel to exit/stop without crashing when using in process applets. It was crashing because of following assert: g_assert (widget->priv->verifying_invariants_count > 0); 2. In process applet will not have extra background. Transparency should now work as expected. This fixes redrawing of in-process applet backgrounds with GTK 3.22 based on https://github.com/GNOME/gnome-panel/commit/df4ec78272624660e1e01b7382dac3e1f83cfc4a --- .../panel-applet-container.c | 39 ++++++++++++++++++---- 1 file changed, 32 insertions(+), 7 deletions(-) (limited to 'mate-panel') diff --git a/mate-panel/libmate-panel-applet-private/panel-applet-container.c b/mate-panel/libmate-panel-applet-private/panel-applet-container.c index 4b4ffd2b..f1ed62f2 100644 --- a/mate-panel/libmate-panel-applet-private/panel-applet-container.c +++ b/mate-panel/libmate-panel-applet-private/panel-applet-container.c @@ -23,6 +23,7 @@ #include #include #include +#include #include "panel-applet-container.h" #include "panel-marshal.h" @@ -32,6 +33,7 @@ struct _MatePanelAppletContainerPrivate { guint name_watcher_id; gchar *bus_name; + gchar *iid; gboolean out_of_process; guint32 xid; guint32 uid; @@ -88,19 +90,34 @@ static void mate_panel_applet_container_init(MatePanelAppletContainer* container { container->priv = MATE_PANEL_APPLET_CONTAINER_GET_PRIVATE (container); - container->priv->socket = gtk_socket_new (); - g_signal_connect_swapped (container->priv->socket, "plug-removed", G_CALLBACK (mate_panel_applet_container_plug_removed), container); - container->priv->pending_ops = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, (GDestroyNotify) g_object_unref); - - gtk_container_add (GTK_CONTAINER (container), - container->priv->socket); - gtk_widget_show (container->priv->socket); } +static void +panel_applet_container_setup (MatePanelAppletContainer *container) +{ + if (container->priv->out_of_process) { + container->priv->socket = gtk_socket_new (); + + g_signal_connect_swapped (container->priv->socket, + "plug-removed", + G_CALLBACK (mate_panel_applet_container_plug_removed), + container); + + gtk_container_add (GTK_CONTAINER (container), container->priv->socket); + gtk_widget_show (container->priv->socket); + } else { + GtkWidget *applet; + + applet = mate_panel_applets_manager_get_applet_widget (container->priv->iid, container->priv->uid); + + gtk_container_add (GTK_CONTAINER (container), applet); + } + } + static void mate_panel_applet_container_cancel_pending_operations (MatePanelAppletContainer *container) { @@ -135,6 +152,11 @@ mate_panel_applet_container_dispose (GObject *object) container->priv->bus_name = NULL; } + if (container->priv->iid) { + g_free (container->priv->iid); + container->priv->iid = NULL; + } + if (container->priv->name_watcher_id > 0) { g_bus_unwatch_name (container->priv->name_watcher_id); container->priv->name_watcher_id = 0; @@ -349,6 +371,8 @@ on_proxy_appeared (GObject *source_object, g_simple_async_result_complete (result); g_object_unref (result); + panel_applet_container_setup (container); + if (container->priv->xid > 0) { gtk_socket_add_id (GTK_SOCKET (container->priv->socket), container->priv->xid); @@ -496,6 +520,7 @@ mate_panel_applet_container_get_applet (MatePanelAppletContainer *container, bus_name = g_strdup_printf (MATE_PANEL_APPLET_BUS_NAME, factory_id); + container->priv->iid = g_strdup (iid); container->priv->name_watcher_id = g_bus_watch_name (G_BUS_TYPE_SESSION, bus_name, -- cgit v1.2.1