static GList* completion_init_completion(GList* target, GList* source);
static GList* completion_update(GList* completion, GList* active, gboolean back);
static void completion_show(gboolean back);
-static void completion_set_color(Completion* completion, gchar* fg, gchar* bg);
+static void completion_set_color(Completion* completion, const GdkColor* fg, const GdkColor* bg);
static void completion_set_entry_text(Completion* completion);
static Completion* completion_get_new(const gchar* label);
}
}
- gchar* fg = "#77ff77";
- gchar* bg = "#333333";
- completion_set_color(old->data, fg, bg);
- completion_set_color(new->data, fg, bg);
+ completion_set_color(
+ old->data,
+ &vp.style.comp_fg[VP_COMP_NORMAL],
+ &vp.style.comp_bg[VP_COMP_NORMAL]
+ );
+ completion_set_color(
+ new->data,
+ &vp.style.comp_fg[VP_COMP_ACTIVE],
+ &vp.style.comp_bg[VP_COMP_ACTIVE]
+ );
active = new;
completion_set_entry_text(active->data);
}
}
if (vp.comps.active != NULL) {
- gchar* fg = "#77ff77";
- gchar* bg = "#333333";
- completion_set_color(vp.comps.active->data, fg, bg);
+ completion_set_color(
+ vp.comps.active->data,
+ &vp.style.comp_fg[VP_COMP_ACTIVE],
+ &vp.style.comp_bg[VP_COMP_ACTIVE]
+ );
completion_set_entry_text(vp.comps.active->data);
gtk_widget_show(vp.gui.compbox);
}
}
-static void completion_set_color(Completion* completion, gchar* fg, gchar* bg)
+static void completion_set_color(Completion* completion, const GdkColor* fg, const GdkColor* bg)
{
- GdkColor color;
- gdk_color_parse(fg, &color);
- gtk_widget_modify_fg(completion->label, GTK_STATE_NORMAL, &color);
- gdk_color_parse(bg, &color);
- gtk_widget_modify_bg(completion->label, GTK_STATE_NORMAL, &color);
+ gtk_widget_modify_fg(completion->event, GTK_STATE_NORMAL, fg);
+ gtk_widget_modify_bg(completion->event, GTK_STATE_NORMAL, bg);
}
static void completion_set_entry_text(Completion* completion)
gtk_label_set_ellipsize(GTK_LABEL(c->label), PANGO_ELLIPSIZE_MIDDLE);
gtk_misc_set_alignment(GTK_MISC(c->label), 0.0, 0.5);
- gchar* fg = "#77ff77";
- gchar* bg = "#333333";
- completion_set_color(c, fg, bg);
+ completion_set_color(
+ c,
+ &vp.style.comp_fg[VP_COMP_NORMAL],
+ &vp.style.comp_bg[VP_COMP_NORMAL]
+ );
GtkWidget *alignment = gtk_alignment_new(0.5, 0.5, 1, 1);
gtk_alignment_set_padding(GTK_ALIGNMENT(alignment), padding, padding, padding, padding);
static gboolean setting_status_color_bg(const Setting* s);
static gboolean setting_status_color_fg(const Setting* s);
static gboolean setting_status_font(const Setting* s);
-static gboolean setting_style(const Setting* s);
+static gboolean setting_input_style(const Setting* s);
+static gboolean setting_completion_style(const Setting* s);
static Setting default_settings[] = {
/* webkit settings */
{"status-color-bg", TYPE_CHAR, setting_status_color_bg, {.s = "#000"}},
{"status-color-fg", TYPE_CHAR, setting_status_color_fg, {.s = "#fff"}},
{"status-font", TYPE_CHAR, setting_status_font, {.s = "monospace bold 8"}},
- {"input-bg-normal", TYPE_CHAR, setting_style, {.s = "#fff"}},
- {"input-bg-error", TYPE_CHAR, setting_style, {.s = "#f00"}},
- {"input-fg-normal", TYPE_CHAR, setting_style, {.s = "#000"}},
- {"input-fg-error", TYPE_CHAR, setting_style, {.s = "#000"}},
- {"input-font-normal", TYPE_CHAR, setting_style, {.s = "monospace normal 8"}},
- {"input-font-error", TYPE_CHAR, setting_style, {.s = "monospace bold 8"}},
+ {"input-bg-normal", TYPE_CHAR, setting_input_style, {.s = "#fff"}},
+ {"input-bg-error", TYPE_CHAR, setting_input_style, {.s = "#f00"}},
+ {"input-fg-normal", TYPE_CHAR, setting_input_style, {.s = "#000"}},
+ {"input-fg-error", TYPE_CHAR, setting_input_style, {.s = "#000"}},
+ {"input-font-normal", TYPE_CHAR, setting_input_style, {.s = "monospace normal 8"}},
+ {"input-font-error", TYPE_CHAR, setting_input_style, {.s = "monospace bold 8"}},
+ {"completion-font-normal", TYPE_CHAR, setting_completion_style, {.s = "monospace bold 8"}},
+ {"completion-font-active", TYPE_CHAR, setting_completion_style, {.s = "monospace bold 8"}},
+ {"completion-fg-normal", TYPE_CHAR, setting_completion_style, {.s = "#f6f3e8"}},
+ {"completion-fg-active", TYPE_CHAR, setting_completion_style, {.s = "#f6f3e8"}},
+ {"completion-bg-normal", TYPE_CHAR, setting_completion_style, {.s = "#656565"}},
+ {"completion-bg-active", TYPE_CHAR, setting_completion_style, {.s = "#777777"}},
};
static GHashTable* settings = NULL;
return TRUE;
}
-static gboolean setting_style(const Setting* s)
+static gboolean setting_input_style(const Setting* s)
{
Style* style = &vp.style;
-
- MessageType type = g_str_has_suffix(s->name, "error") ? VP_MSG_ERROR : VP_MSG_NORMAL;
+ MessageType type = g_str_has_suffix(s->name, "normal") ? VP_MSG_NORMAL : VP_MSG_ERROR;
if (g_str_has_prefix(s->name, "input-bg")) {
gdk_color_parse(s->arg.s, &style->input_bg[type]);
return TRUE;
}
+
+static gboolean setting_completion_style(const Setting* s)
+{
+ Style* style = &vp.style;
+ CompletionStyle type = g_str_has_suffix(s->name, "normal") ? VP_COMP_NORMAL : VP_COMP_ACTIVE;
+
+ if (g_str_has_prefix(s->name, "completion-bg")) {
+ gdk_color_parse(s->arg.s, &style->comp_bg[type]);
+ } else if (g_str_has_prefix(s->name, "completion-fg")) {
+ gdk_color_parse(s->name, &style->comp_fg[type]);
+ } else if (g_str_has_prefix(s->arg.s, "completion-font")) {
+ if (style->comp_font[type]) {
+ pango_font_description_free(style->comp_font[type]);
+ }
+ style->comp_font[type] = pango_font_description_from_string(s->arg.s);
+ }
+
+ return TRUE;
+}