New emoji menu w/windows 7 fixed fallback.

This commit is contained in:
2026-07-16 03:28:04 -06:00
parent 2db3076c92
commit f87f1bfc4b
37 changed files with 39968 additions and 66 deletions

View File

@@ -45,6 +45,7 @@
#include "theme/theme-manager.h"
#include "theme/theme-css.h"
#include "banlist.h"
#include "emoji-picker.h"
#include "gtkutil.h"
#include "icon-resolver.h"
#include "joind.h"
@@ -3514,8 +3515,12 @@ mg_apply_session_font_prefs (session_gui *gui)
mg_topicbar_update_height (gui->topic_entry);
}
if (gui->input_box && prefs.hex_gui_input_style)
theme_manager_apply_entry_palette (gui->input_box, font);
if (gui->input_box)
{
if (prefs.hex_gui_input_style)
theme_manager_apply_entry_palette (gui->input_box, font);
mg_apply_emoji_fallback_widget (gui->input_box);
}
if (gui->chanview)
chanview_apply_theme (gui->chanview);
@@ -4362,13 +4367,31 @@ mg_inputbox_rightclick (GtkEntry *entry, GtkWidget *menu)
* font size/style/weight, and without breaking user-configured fonts.
* ------------------------------------------------------------------------- */
static const char *mg_emoji_family_fallback =
static const char *
mg_emoji_family_fallback (void)
{
#ifdef G_OS_WIN32
"Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji, Apple Color Emoji, Twemoji Mozilla, EmojiOne Color";
#else
"Noto Color Emoji, Segoe UI Emoji, Apple Color Emoji, Twemoji Mozilla, EmojiOne Color";
#endif
static char family_list[sizeof prefs.hex_text_font_alternative + 32];
if (!win32_is_windows_8_or_newer ())
{
if (prefs.hex_text_font_alternative[0])
{
g_snprintf (family_list, sizeof family_list, "%s, Segoe UI Symbol", prefs.hex_text_font_alternative);
return family_list;
}
return "Segoe UI Symbol";
}
return "Noto Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Apple Color Emoji, Twemoji Mozilla, EmojiOne Color";
#else
return "Noto Color Emoji, Segoe UI Emoji, Apple Color Emoji, Twemoji Mozilla, EmojiOne Color";
#endif
}
#ifdef G_OS_WIN32
/* Only used by the Windows 7 fallback to GTK's built-in emoji chooser */
static const char *
mg_find_available_icon_name (const char *const *icon_names)
{
@@ -4400,6 +4423,7 @@ mg_find_available_icon_name (const char *const *icon_names)
return NULL;
}
#endif
static gboolean
mg_family_already_has_emoji (const gchar *family)
@@ -4434,14 +4458,14 @@ mg_fontdesc_with_fallback (const PangoFontDescription *base_desc, gboolean emoji
if (emoji_first)
{
family_list = g_strdup_printf ("%s, %s",
mg_emoji_family_fallback,
mg_emoji_family_fallback (),
(base_family && *base_family) ? base_family : "Sans");
}
else
{
family_list = g_strdup_printf ("%s, %s",
(base_family && *base_family) ? base_family : "Sans",
mg_emoji_family_fallback);
mg_emoji_family_fallback ());
}
pango_font_description_set_family (desc, family_list);
@@ -4727,15 +4751,6 @@ mg_create_entry (session *sess, GtkWidget *box)
{
GtkWidget *hbox, *but, *entry;
session_gui *gui = sess->gui;
const char *emoji_fallback_icon_names[] = {
"face-smile-symbolic",
"face-smile",
"insert-emoticon-symbolic",
"insert-emoticon",
"zc-menu-emoji",
NULL
};
const char *emoji_fallback_icon_name;
gui->reply_box = mg_box_new (GTK_ORIENTATION_HORIZONTAL, FALSE, 6);
gtk_widget_set_name (gui->reply_box, "zoitechat-replybar");
@@ -4788,16 +4803,44 @@ mg_create_entry (session *sess, GtkWidget *box)
if (prefs.hex_gui_input_style)
mg_apply_entry_style (entry);
mg_apply_emoji_fallback_widget (entry);
mg_apply_entry_scroll_artifact_fix (entry);
g_object_set (G_OBJECT (entry), "show-emoji-icon", TRUE, NULL);
if (gtk_entry_get_icon_storage_type (GTK_ENTRY (entry), GTK_ENTRY_ICON_SECONDARY) == GTK_IMAGE_EMPTY)
#ifdef G_OS_WIN32
/* Windows 7 cannot render the color emoji font that ZoiteChat's own
* picker is designed around, so it keeps the GTK built-in emoji
* chooser that was used before the picker existed (the HexChat-era
* behavior, which works on Windows 7). */
if (!win32_is_windows_8_or_newer ())
{
emoji_fallback_icon_name = mg_find_available_icon_name (emoji_fallback_icon_names);
if (emoji_fallback_icon_name)
gtk_entry_set_icon_from_icon_name (GTK_ENTRY (entry), GTK_ENTRY_ICON_SECONDARY, emoji_fallback_icon_name);
const char *emoji_fallback_icon_names[] = {
"face-smile-symbolic",
"face-smile",
"insert-emoticon-symbolic",
"insert-emoticon",
"zc-menu-emoji",
NULL
};
g_object_set (G_OBJECT (entry), "show-emoji-icon", TRUE, NULL);
if (gtk_entry_get_icon_storage_type (GTK_ENTRY (entry), GTK_ENTRY_ICON_SECONDARY) == GTK_IMAGE_EMPTY)
{
const char *icon_name = mg_find_available_icon_name (emoji_fallback_icon_names);
if (icon_name)
gtk_entry_set_icon_from_icon_name (GTK_ENTRY (entry), GTK_ENTRY_ICON_SECONDARY, icon_name);
}
return;
}
#endif
/* ZoiteChat's own emoji picker; deliberately not GTK's
* "show-emoji-icon" machinery, so the catalog is the same on every
* GTK runtime and the button always has a working callback */
but = emoji_picker_button_new (entry);
gtk_box_pack_start (GTK_BOX (hbox), but, FALSE, FALSE, 0);
}
static void