diff options
author | William Wold <[email protected]> | 2019-06-17 22:29:43 +0000 |
---|---|---|
committer | raveit65 <[email protected]> | 2019-06-23 10:12:24 +0200 |
commit | 08dba813b7e4289bf87ae4c12d87acd9e0399574 (patch) | |
tree | 37b7bf87d4c1cdd4eeec6c92e880cd1eb951b1ed | |
parent | 873c72216713553e7b94d061de9aafbf24cac2ae (diff) | |
download | mate-panel-08dba813b7e4289bf87ae4c12d87acd9e0399574.tar.bz2 mate-panel-08dba813b7e4289bf87ae4c12d87acd9e0399574.tar.xz |
Wayland support for mate-panel-applet.c
-rw-r--r-- | libmate-panel-applet/mate-panel-applet.c | 42 |
1 files changed, 23 insertions, 19 deletions
diff --git a/libmate-panel-applet/mate-panel-applet.c b/libmate-panel-applet/mate-panel-applet.c index 55bfad0c..7d6ab4ac 100644 --- a/libmate-panel-applet/mate-panel-applet.c +++ b/libmate-panel-applet/mate-panel-applet.c @@ -1740,10 +1740,12 @@ void _mate_panel_applet_apply_css(GtkWidget* widget, MatePanelAppletBackgroundTy } } +#ifdef HAVE_X11 static void _mate_panel_applet_prepare_css (GtkStyleContext *context) { GtkCssProvider *provider; + g_return_if_fail (GDK_IS_X11_DISPLAY (gdk_display_get_default ())); provider = gtk_css_provider_new (); gtk_css_provider_load_from_data (provider, "#PanelPlug {\n" @@ -1761,6 +1763,8 @@ static void _mate_panel_applet_prepare_css (GtkStyleContext *context) GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); g_object_unref (provider); } +#endif // HAVE_X11 + static void mate_panel_applet_init (MatePanelApplet *applet) { @@ -1810,30 +1814,30 @@ mate_panel_applet_constructor (GType type, #ifdef HAVE_X11 if (!GDK_IS_X11_DISPLAY (gdk_display_get_default ())) + { + applet->priv->plug = gtk_plug_new (0); + + GdkScreen *screen = gtk_widget_get_screen (GTK_WIDGET (applet->priv->plug)); + GdkVisual *visual = gdk_screen_get_rgba_visual (screen); + gtk_widget_set_visual (GTK_WIDGET (applet->priv->plug), visual); + GtkStyleContext *context; + context = gtk_widget_get_style_context (GTK_WIDGET(applet->priv->plug)); + gtk_style_context_add_class (context,"gnome-panel-menu-bar"); + gtk_style_context_add_class (context,"mate-panel-menu-bar"); + gtk_widget_set_name (GTK_WIDGET (applet->priv->plug), "PanelPlug"); + _mate_panel_applet_prepare_css (context); + + g_signal_connect_swapped (G_OBJECT (applet->priv->plug), "embedded", + G_CALLBACK (mate_panel_applet_setup), + applet); + + gtk_container_add (GTK_CONTAINER (applet->priv->plug), GTK_WIDGET (applet)); + } #endif { // not using X11 g_warning ("Requested construction of an out-of-process applet, which is only possible on X11"); - return object; } - applet->priv->plug = gtk_plug_new (0); - - GdkScreen *screen = gtk_widget_get_screen(GTK_WIDGET(applet->priv->plug)); - GdkVisual *visual = gdk_screen_get_rgba_visual(screen); - gtk_widget_set_visual(GTK_WIDGET(applet->priv->plug), visual); - GtkStyleContext *context; - context = gtk_widget_get_style_context (GTK_WIDGET(applet->priv->plug)); - gtk_style_context_add_class(context,"gnome-panel-menu-bar"); - gtk_style_context_add_class(context,"mate-panel-menu-bar"); - gtk_widget_set_name(GTK_WIDGET(applet->priv->plug), "PanelPlug"); - _mate_panel_applet_prepare_css(context); - - g_signal_connect_swapped (G_OBJECT (applet->priv->plug), "embedded", - G_CALLBACK (mate_panel_applet_setup), - applet); - - gtk_container_add (GTK_CONTAINER (applet->priv->plug), GTK_WIDGET (applet)); - return object; } |