Skip to content

Commit

Permalink
gui/css: don't consume css string
Browse files Browse the repository at this point in the history
  • Loading branch information
LBCrion committed Feb 18, 2025
1 parent 93f1fdc commit d932334
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
7 changes: 5 additions & 2 deletions src/gui/bar.c
Original file line number Diff line number Diff line change
Expand Up @@ -808,6 +808,7 @@ GtkWidget *bar_new ( gchar *name )
{
GtkWidget *self;
BarPrivate *priv;
gchar *tmp;

self = GTK_WIDGET(g_object_new(bar_get_type(), NULL));
g_signal_connect(G_OBJECT(self), "delete-event",
Expand Down Expand Up @@ -843,8 +844,10 @@ GtkWidget *bar_new ( gchar *name )
gtk_widget_show(priv->ebox);
gtk_widget_show(GTK_WIDGET(priv->revealer));

css_widget_apply(self, g_strdup_printf(
"window#%s.sensor { background-color: rgba(0,0,0,0); }", name));
tmp = g_strdup_printf(
"window#%s.sensor { background-color: rgba(0,0,0,0); }", name);
css_widget_apply(self, tmp);
g_free(tmp);
bar_update_monitor(self);
bar_reveal(self);

Expand Down
4 changes: 2 additions & 2 deletions src/gui/basewidget.c
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ static void base_widget_mirror_impl ( GtkWidget *dest, GtkWidget *src )
base_widget_set_state(dest, spriv->user_state, TRUE);
base_widget_set_rect(dest, spriv->rect);
for(iter=spriv->css; iter; iter=g_list_next(iter))
css_widget_apply(base_widget_get_child(dest), g_strdup(iter->data));
css_widget_apply(base_widget_get_child(dest), iter->data);
}

static void base_widget_class_init ( BaseWidgetClass *kclass )
Expand Down Expand Up @@ -815,7 +815,7 @@ void base_widget_set_css ( GtkWidget *self, gchar *css )
if(!css || g_list_find_custom(priv->css, css, (GCompareFunc)g_strcmp0))
return;

css_widget_apply(base_widget_get_child(self), g_strdup(css));
css_widget_apply(base_widget_get_child(self), css);
for(iter=priv->mirror_children; iter; iter=g_list_next(iter))
css_widget_apply(base_widget_get_child(iter->data), css);

Expand Down
2 changes: 1 addition & 1 deletion src/gui/css.c
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ gchar *css_legacy_preprocess ( gchar *css_string )
gchar *tmp, *res;
gsize i;

res = css_string;
res = g_strdup(css_string);
for(i=0; old[i]; i++)
{
tmp = str_replace(res, old[i], new[i]);
Expand Down
4 changes: 2 additions & 2 deletions src/gui/taskbarpopup.c
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,8 @@ GtkWidget *taskbar_popup_new( const gchar *appid, GtkWidget *shell )
(void(*)(gpointer))taskbar_popup_timeout_set);
g_object_ref(G_OBJECT(priv->popover));
gtk_container_add(GTK_CONTAINER(priv->popover), priv->tgroup);
css_widget_apply(priv->tgroup, g_strdup(
g_object_get_data(G_OBJECT(shell), "g_css")));
css_widget_apply(priv->tgroup,
g_object_get_data(G_OBJECT(shell), "g_css"));
base_widget_set_style_static(priv->tgroup,g_strdup(
g_object_get_data(G_OBJECT(shell), "g_style")));
gtk_widget_show(priv->tgroup);
Expand Down

0 comments on commit d932334

Please sign in to comment.