mirror of
https://github.com/ZoiteChat/zoitechat.git
synced 2026-03-28 08:10:19 +00:00
Compare commits
4 Commits
build-icon
...
topic-spac
| Author | SHA1 | Date | |
|---|---|---|---|
| 8d97c906f2 | |||
| 23558f1963 | |||
| 40b99450ea | |||
| 6a7f44a1fb |
@@ -792,18 +792,21 @@ fe_set_topic (session *sess, char *topic, char *stripped_topic)
|
||||
{
|
||||
if (!sess->gui->is_tab || sess == current_tab)
|
||||
{
|
||||
GtkTextBuffer *topic_buffer;
|
||||
GtkTextIter start;
|
||||
GtkTextIter end;
|
||||
|
||||
topic_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (sess->gui->topic_entry));
|
||||
if (prefs.hex_text_stripcolor_topic)
|
||||
{
|
||||
gtk_text_buffer_set_text (
|
||||
gtk_text_view_get_buffer (GTK_TEXT_VIEW (sess->gui->topic_entry)),
|
||||
stripped_topic, -1);
|
||||
gtk_text_buffer_set_text (topic_buffer, stripped_topic, -1);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_text_buffer_set_text (
|
||||
gtk_text_view_get_buffer (GTK_TEXT_VIEW (sess->gui->topic_entry)),
|
||||
topic, -1);
|
||||
gtk_text_buffer_set_text (topic_buffer, topic, -1);
|
||||
}
|
||||
gtk_text_buffer_get_bounds (topic_buffer, &start, &end);
|
||||
gtk_text_buffer_apply_tag_by_name (topic_buffer, "zoitechat-topic-left", &start, &end);
|
||||
mg_set_topic_tip (sess);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1410,16 +1410,26 @@ mg_populate (session *sess)
|
||||
{
|
||||
GtkTextBuffer *topic_buffer;
|
||||
|
||||
GtkTextIter start;
|
||||
GtkTextIter end;
|
||||
|
||||
topic_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (gui->topic_entry));
|
||||
gtk_text_buffer_set_text (topic_buffer, res->topic_text, -1);
|
||||
gtk_text_buffer_get_bounds (topic_buffer, &start, &end);
|
||||
gtk_text_buffer_apply_tag_by_name (topic_buffer, "zoitechat-topic-left", &start, &end);
|
||||
g_free (res->topic_text);
|
||||
res->topic_text = NULL;
|
||||
} else
|
||||
{
|
||||
GtkTextBuffer *topic_buffer;
|
||||
|
||||
GtkTextIter start;
|
||||
GtkTextIter end;
|
||||
|
||||
topic_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (gui->topic_entry));
|
||||
gtk_text_buffer_set_text (topic_buffer, "", -1);
|
||||
gtk_text_buffer_get_bounds (topic_buffer, &start, &end);
|
||||
gtk_text_buffer_apply_tag_by_name (topic_buffer, "zoitechat-topic-left", &start, &end);
|
||||
}
|
||||
mg_restore_speller (gui->input_box, &res->input_text);
|
||||
mg_restore_entry (gui->key_entry, &res->key_text);
|
||||
@@ -2988,10 +2998,13 @@ mg_create_topicbar (session *sess, GtkWidget *box)
|
||||
sess->res->tab = NULL;
|
||||
|
||||
gui->topic_entry = topic = gtk_text_view_new ();
|
||||
gtk_widget_set_name (topic, "zoitechat-inputbox");
|
||||
gtk_widget_set_name (topic, "zoitechat-topicbox");
|
||||
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (topic), GTK_WRAP_WORD_CHAR);
|
||||
gtk_text_view_set_justification (GTK_TEXT_VIEW (topic), GTK_JUSTIFY_LEFT);
|
||||
gtk_text_view_set_left_margin (GTK_TEXT_VIEW (topic), 4);
|
||||
gtk_text_view_set_right_margin (GTK_TEXT_VIEW (topic), 4);
|
||||
gtk_text_buffer_create_tag (gtk_text_view_get_buffer (GTK_TEXT_VIEW (topic)), "zoitechat-topic-left",
|
||||
"justification", GTK_JUSTIFY_LEFT, NULL);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), topic, TRUE, TRUE, 0);
|
||||
mg_apply_emoji_fallback_widget (topic);
|
||||
gtk_widget_add_events (topic, GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
|
||||
|
||||
@@ -28,6 +28,8 @@
|
||||
|
||||
static const char *theme_css_selector_input = "#zoitechat-inputbox";
|
||||
static const char *theme_css_selector_input_text = "#zoitechat-inputbox text";
|
||||
static const char *theme_css_selector_topic = "#zoitechat-topicbox";
|
||||
static const char *theme_css_selector_topic_text = "#zoitechat-topicbox text";
|
||||
static const char *theme_css_selector_palette_class = "zoitechat-palette";
|
||||
static const char *theme_css_selector_dark_class = "zoitechat-dark";
|
||||
static const char *theme_css_selector_light_class = "zoitechat-light";
|
||||
@@ -159,29 +161,37 @@ theme_css_build_input (const char *theme_name, guint16 fg_red, guint16 fg_green,
|
||||
|
||||
if (g_str_has_prefix (theme_name, "Adwaita") || g_str_has_prefix (theme_name, "Yaru"))
|
||||
{
|
||||
g_string_append_printf (css, "%s { background-image: none; }", theme_css_selector_input);
|
||||
g_string_append_printf (css, "%s, %s { background-image: none; }",
|
||||
theme_css_selector_input, theme_css_selector_topic);
|
||||
}
|
||||
|
||||
g_string_append_printf (css,
|
||||
"%s {"
|
||||
"%s, %s {"
|
||||
"background-color: #%02x%02x%02x;"
|
||||
"color: #%02x%02x%02x;"
|
||||
"caret-color: #%02x%02x%02x;"
|
||||
"word-spacing: normal;"
|
||||
"letter-spacing: normal;"
|
||||
"}"
|
||||
"%s {"
|
||||
"%s, %s {"
|
||||
"color: #%02x%02x%02x;"
|
||||
"caret-color: #%02x%02x%02x;"
|
||||
"word-spacing: normal;"
|
||||
"letter-spacing: normal;"
|
||||
"}"
|
||||
"%s selection, %s text selection, %s:focus selection, %s:focus text selection, %s *:selected, %s *:selected:focus,"
|
||||
"%s selection, %s text selection, %s:focus selection, %s:focus text selection, %s *:selected, %s *:selected:focus {"
|
||||
"background-color: #%02x%02x%02x;"
|
||||
"color: #%02x%02x%02x;"
|
||||
"text-shadow: none;"
|
||||
"}",
|
||||
theme_css_selector_input,
|
||||
theme_css_selector_topic,
|
||||
(bg_red >> 8), (bg_green >> 8), (bg_blue >> 8),
|
||||
(fg_red >> 8), (fg_green >> 8), (fg_blue >> 8),
|
||||
(fg_red >> 8), (fg_green >> 8), (fg_blue >> 8),
|
||||
theme_css_selector_input_text,
|
||||
theme_css_selector_topic_text,
|
||||
(fg_red >> 8), (fg_green >> 8), (fg_blue >> 8),
|
||||
(fg_red >> 8), (fg_green >> 8), (fg_blue >> 8),
|
||||
theme_css_selector_input,
|
||||
@@ -190,6 +200,12 @@ theme_css_build_input (const char *theme_name, guint16 fg_red, guint16 fg_green,
|
||||
theme_css_selector_input,
|
||||
theme_css_selector_input,
|
||||
theme_css_selector_input,
|
||||
theme_css_selector_topic,
|
||||
theme_css_selector_topic,
|
||||
theme_css_selector_topic,
|
||||
theme_css_selector_topic,
|
||||
theme_css_selector_topic,
|
||||
theme_css_selector_topic,
|
||||
(sel_bg_red >> 8), (sel_bg_green >> 8), (sel_bg_blue >> 8),
|
||||
(sel_fg_red >> 8), (sel_fg_green >> 8), (sel_fg_blue >> 8));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user