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 --- libmate-panel-applet/mate-panel-applet.c | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) (limited to 'libmate-panel-applet') diff --git a/libmate-panel-applet/mate-panel-applet.c b/libmate-panel-applet/mate-panel-applet.c index bf7a1f35..e881667e 100644 --- a/libmate-panel-applet/mate-panel-applet.c +++ b/libmate-panel-applet/mate-panel-applet.c @@ -908,13 +908,19 @@ mate_panel_applet_can_focus (GtkWidget *widget) /* Taken from libmatecomponentui/matecomponent/matecomponent-plug.c */ static gboolean -mate_panel_applet_button_event (GtkWidget *widget, +mate_panel_applet_button_event (MatePanelApplet *applet, GdkEventButton *event) { + GtkWidget *widget; GdkWindow *window; GdkWindow *socket_window; XEvent xevent; + if (!applet->priv->out_of_process) + return FALSE; + + widget = applet->priv->plug; + if (!gtk_widget_is_toplevel (widget)) return FALSE; @@ -998,7 +1004,7 @@ mate_panel_applet_button_press (GtkWidget *widget, return TRUE; } - return mate_panel_applet_button_event (applet->priv->plug, event); + return mate_panel_applet_button_event (applet, event); } static gboolean @@ -1007,7 +1013,7 @@ mate_panel_applet_button_release (GtkWidget *widget, { MatePanelApplet *applet = MATE_PANEL_APPLET (widget); - return mate_panel_applet_button_event (applet->priv->plug, event); + return mate_panel_applet_button_event (applet, event); } static gboolean @@ -1882,6 +1888,9 @@ mate_panel_applet_constructor (GType type, construct_properties); applet = MATE_PANEL_APPLET (object); + if (!applet->priv->out_of_process) + return object; + applet->priv->plug = gtk_plug_new (0); GdkScreen *screen = gtk_widget_get_screen(GTK_WIDGET(applet->priv->plug)); @@ -2443,6 +2452,9 @@ guint32 mate_panel_applet_get_xid (MatePanelApplet *applet, GdkScreen *screen) { + if (applet->priv->out_of_process == FALSE) + return 0; + gtk_window_set_screen (GTK_WINDOW (applet->priv->plug), screen); gtk_widget_show (applet->priv->plug); @@ -2459,5 +2471,14 @@ G_MODULE_EXPORT GtkWidget * mate_panel_applet_get_applet_widget (const gchar *factory_id, guint uid) { - return mate_panel_applet_factory_get_applet_widget (factory_id, uid); + GtkWidget *widget; + + widget = mate_panel_applet_factory_get_applet_widget (factory_id, uid); + if (!widget) { + return NULL; + } + + mate_panel_applet_setup (MATE_PANEL_APPLET (widget)); + + return widget; } -- cgit v1.2.1