mirror of
https://github.com/ZoiteChat/zoitechat.git
synced 2026-07-17 17:09:25 +00:00
Compare commits
11 Commits
251272c708
...
fix-issue-
| Author | SHA1 | Date | |
|---|---|---|---|
| c752b06374 | |||
| e0b159c069 | |||
|
|
cfb19820fa | ||
|
|
e05ca13608 | ||
|
|
15cf96c01f | ||
| 2caec91a0f | |||
| 9465a1e0a8 | |||
| d0034cd112 | |||
| ae6d5ebeef | |||
|
|
8466e70424 | ||
| b85229f1a1 |
79
.github/workflows/manjaro-package-build.yml
vendored
79
.github/workflows/manjaro-package-build.yml
vendored
@@ -1,79 +0,0 @@
|
|||||||
name: Manjaro Package Build
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [master, main]
|
|
||||||
pull_request:
|
|
||||||
branches: [master, main]
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
manjaro-package:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
container:
|
|
||||||
image: manjarolinux/base:latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Install packaging toolchain
|
|
||||||
run: |
|
|
||||||
set -euxo pipefail
|
|
||||||
pacman -Syu --noconfirm
|
|
||||||
pacman -S --noconfirm --needed \
|
|
||||||
base-devel \
|
|
||||||
git \
|
|
||||||
namcap \
|
|
||||||
meson \
|
|
||||||
ninja \
|
|
||||||
pkgconf \
|
|
||||||
glib2 \
|
|
||||||
glib2-devel \
|
|
||||||
gtk3 \
|
|
||||||
openssl \
|
|
||||||
libcanberra \
|
|
||||||
libayatana-appindicator \
|
|
||||||
iso-codes \
|
|
||||||
lua \
|
|
||||||
perl \
|
|
||||||
python \
|
|
||||||
python-cffi \
|
|
||||||
pciutils
|
|
||||||
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v5
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
submodules: true
|
|
||||||
|
|
||||||
- name: Build package and generate .SRCINFO (non-root)
|
|
||||||
run: |
|
|
||||||
set -euxo pipefail
|
|
||||||
id -u builder >/dev/null 2>&1 || useradd -m builder
|
|
||||||
chown -R builder:builder "$GITHUB_WORKSPACE"
|
|
||||||
su builder -c "cd '$GITHUB_WORKSPACE/packaging/manjaro' && makepkg --noconfirm --syncdeps --cleanbuild"
|
|
||||||
su builder -c "cd '$GITHUB_WORKSPACE/packaging/manjaro' && makepkg --printsrcinfo > .SRCINFO"
|
|
||||||
|
|
||||||
- name: Lint PKGBUILD and package with namcap
|
|
||||||
run: |
|
|
||||||
set -euxo pipefail
|
|
||||||
cd "$GITHUB_WORKSPACE/packaging/manjaro"
|
|
||||||
namcap PKGBUILD
|
|
||||||
pkg_file="$(find . -maxdepth 1 -type f -name '*.pkg.tar.*' | head -n1)"
|
|
||||||
namcap "$pkg_file"
|
|
||||||
|
|
||||||
- name: Collect artifacts
|
|
||||||
run: |
|
|
||||||
set -euxo pipefail
|
|
||||||
mkdir -p artifacts
|
|
||||||
cp -v "$GITHUB_WORKSPACE"/packaging/manjaro/*.pkg.tar.* artifacts/
|
|
||||||
cp -v "$GITHUB_WORKSPACE"/packaging/manjaro/PKGBUILD artifacts/
|
|
||||||
cp -v "$GITHUB_WORKSPACE"/packaging/manjaro/.SRCINFO artifacts/
|
|
||||||
|
|
||||||
- name: Upload package artifacts
|
|
||||||
uses: actions/upload-artifact@v6
|
|
||||||
with:
|
|
||||||
name: zoitechat-manjaro-package
|
|
||||||
path: artifacts/*
|
|
||||||
if-no-files-found: error
|
|
||||||
@@ -1,69 +0,0 @@
|
|||||||
# Maintainer: ZoiteChat Maintainers <zoitechat@users.noreply.github.com>
|
|
||||||
|
|
||||||
pkgname=zoitechat-git
|
|
||||||
pkgver=0
|
|
||||||
pkgrel=1
|
|
||||||
pkgdesc='IRC client for GNOME (ZoiteChat development snapshot)'
|
|
||||||
arch=('x86_64')
|
|
||||||
url='https://github.com/zoitechat/zoitechat'
|
|
||||||
license=('GPL-2.0-or-later')
|
|
||||||
depends=(
|
|
||||||
'glib2'
|
|
||||||
'gtk3'
|
|
||||||
'iso-codes'
|
|
||||||
'libayatana-appindicator'
|
|
||||||
'libcanberra'
|
|
||||||
'lua'
|
|
||||||
'openssl'
|
|
||||||
'perl'
|
|
||||||
'python-cffi'
|
|
||||||
)
|
|
||||||
makedepends=(
|
|
||||||
'git'
|
|
||||||
'meson'
|
|
||||||
'ninja'
|
|
||||||
'pkgconf'
|
|
||||||
'python'
|
|
||||||
)
|
|
||||||
optdepends=(
|
|
||||||
'pciutils: sysinfo plugin hardware detection details'
|
|
||||||
)
|
|
||||||
provides=('zoitechat')
|
|
||||||
conflicts=('zoitechat')
|
|
||||||
|
|
||||||
_repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
|
||||||
source=("zoitechat::git+file://${_repo_root}")
|
|
||||||
sha256sums=('SKIP')
|
|
||||||
|
|
||||||
pkgver() {
|
|
||||||
cd "$srcdir/zoitechat"
|
|
||||||
|
|
||||||
if git describe --long --tags --abbrev=7 >/dev/null 2>&1; then
|
|
||||||
git describe --long --tags --abbrev=7 \
|
|
||||||
| sed 's/^v//' \
|
|
||||||
| sed -E 's/([^-]+)-([0-9]+)-g/\1.r\2.g/' \
|
|
||||||
| sed 's/-/./g'
|
|
||||||
else
|
|
||||||
printf '0.r%s.%s\n' \
|
|
||||||
"$(git rev-list --count HEAD)" \
|
|
||||||
"$(git rev-parse --short=7 HEAD)"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
build() {
|
|
||||||
arch-meson zoitechat build \
|
|
||||||
-Dtext-frontend=false \
|
|
||||||
-Dwith-checksum=true \
|
|
||||||
-Dwith-fishlim=true \
|
|
||||||
-Dwith-lua=lua \
|
|
||||||
-Dwith-perl=perl \
|
|
||||||
-Dwith-python=python3 \
|
|
||||||
-Dwith-sysinfo=true \
|
|
||||||
-Dinstall-plugin-metainfo=true
|
|
||||||
|
|
||||||
meson compile -C build
|
|
||||||
}
|
|
||||||
|
|
||||||
package() {
|
|
||||||
meson install -C build --destdir "$pkgdir"
|
|
||||||
}
|
|
||||||
@@ -1695,6 +1695,97 @@ pevent_load (char *filename)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
text_event_uses_color (const char *text, int color)
|
||||||
|
{
|
||||||
|
const char *p;
|
||||||
|
|
||||||
|
if (!text || color < 0 || color > 31)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
for (p = text; *p; p++)
|
||||||
|
{
|
||||||
|
int value;
|
||||||
|
int digits;
|
||||||
|
|
||||||
|
if ((unsigned char) *p == 3)
|
||||||
|
p++;
|
||||||
|
else if (*p == '%' && p[1] == 'C')
|
||||||
|
p += 2;
|
||||||
|
else
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!g_ascii_isdigit (*p))
|
||||||
|
{
|
||||||
|
p--;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
value = *p - '0';
|
||||||
|
digits = 1;
|
||||||
|
if (g_ascii_isdigit (p[1]))
|
||||||
|
{
|
||||||
|
value = value * 10 + p[1] - '0';
|
||||||
|
digits = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (value == color)
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
p += digits - 1;
|
||||||
|
if (*p == ',' && g_ascii_isdigit (p[1]))
|
||||||
|
{
|
||||||
|
p++;
|
||||||
|
value = *p - '0';
|
||||||
|
if (g_ascii_isdigit (p[1]))
|
||||||
|
{
|
||||||
|
value = value * 10 + p[1] - '0';
|
||||||
|
p++;
|
||||||
|
}
|
||||||
|
if (value == color)
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
char **
|
||||||
|
text_color_event_names (int color, int *count)
|
||||||
|
{
|
||||||
|
GPtrArray *names;
|
||||||
|
int found = 0;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if (count)
|
||||||
|
*count = 0;
|
||||||
|
|
||||||
|
names = g_ptr_array_new ();
|
||||||
|
|
||||||
|
for (i = 0; i < NUM_XP; i++)
|
||||||
|
{
|
||||||
|
const char *text = pntevts_text[i] ? pntevts_text[i] : te[i].def;
|
||||||
|
|
||||||
|
if (!text_event_uses_color (text, color))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
g_ptr_array_add (names, g_strdup (_(te[i].name)));
|
||||||
|
found++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!found)
|
||||||
|
{
|
||||||
|
g_ptr_array_free (names, TRUE);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_ptr_array_add (names, NULL);
|
||||||
|
if (count)
|
||||||
|
*count = found;
|
||||||
|
return (char **) g_ptr_array_free (names, FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
pevent_check_all_loaded (void)
|
pevent_check_all_loaded (void)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ int pevt_build_string (const char *input, char **output, int *max_arg);
|
|||||||
int pevent_load (char *filename);
|
int pevent_load (char *filename);
|
||||||
void pevent_make_pntevts (void);
|
void pevent_make_pntevts (void);
|
||||||
int text_color_of (char *name);
|
int text_color_of (char *name);
|
||||||
|
char **text_color_event_names (int color, int *count);
|
||||||
void text_emit (int index, session *sess, char *a, char *b, char *c, char *d,
|
void text_emit (int index, session *sess, char *a, char *b, char *c, char *d,
|
||||||
time_t timestamp);
|
time_t timestamp);
|
||||||
int text_emit_by_name (char *name, session *sess, time_t timestamp,
|
int text_emit_by_name (char *name, session *sess, time_t timestamp,
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -67,6 +67,34 @@
|
|||||||
#include <shellapi.h>
|
#include <shellapi.h>
|
||||||
#include <gdk/gdkwin32.h>
|
#include <gdk/gdkwin32.h>
|
||||||
|
|
||||||
|
/* The shell only minimizes a window from its taskbar button when the
|
||||||
|
* window style carries WS_MINIMIZEBOX; without it the click merely
|
||||||
|
* deactivates the window (issue #65). GTK3 older than 3.24.50 can drop
|
||||||
|
* the bit from top-level windows (https://gitlab.gnome.org/GNOME/gtk/-/issues/7494),
|
||||||
|
* so guarantee it ourselves for session windows. */
|
||||||
|
static void
|
||||||
|
mg_win32_ensure_minimizable (GdkWindow *gdk_window)
|
||||||
|
{
|
||||||
|
HWND hwnd;
|
||||||
|
LONG_PTR window_style;
|
||||||
|
|
||||||
|
if (!gdk_window)
|
||||||
|
return;
|
||||||
|
|
||||||
|
hwnd = gdk_win32_window_get_handle (gdk_window);
|
||||||
|
if (!hwnd)
|
||||||
|
return;
|
||||||
|
|
||||||
|
window_style = GetWindowLongPtr (hwnd, GWL_STYLE);
|
||||||
|
if (!window_style || (window_style & WS_MINIMIZEBOX))
|
||||||
|
return;
|
||||||
|
|
||||||
|
SetWindowLongPtr (hwnd, GWL_STYLE, window_style | WS_MINIMIZEBOX);
|
||||||
|
SetWindowPos (hwnd, NULL, 0, 0, 0, 0,
|
||||||
|
SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE |
|
||||||
|
SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOOWNERZORDER);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
mg_win32_allow_autohide_taskbar (GtkWindow *window, GdkEventWindowState *event)
|
mg_win32_allow_autohide_taskbar (GtkWindow *window, GdkEventWindowState *event)
|
||||||
{
|
{
|
||||||
@@ -3388,10 +3416,19 @@ mg_topicbar_update_height (GtkWidget *topic)
|
|||||||
|
|
||||||
if (parent && GTK_IS_SCROLLED_WINDOW (parent))
|
if (parent && GTK_IS_SCROLLED_WINDOW (parent))
|
||||||
{
|
{
|
||||||
gtk_scrolled_window_set_max_content_height (GTK_SCROLLED_WINDOW (parent), -1);
|
GtkScrolledWindow *scrolled = GTK_SCROLLED_WINDOW (parent);
|
||||||
gtk_scrolled_window_set_min_content_height (GTK_SCROLLED_WINDOW (parent), -1);
|
int max_height = gtk_scrolled_window_get_max_content_height (scrolled);
|
||||||
gtk_scrolled_window_set_max_content_height (GTK_SCROLLED_WINDOW (parent), target_height);
|
|
||||||
gtk_scrolled_window_set_min_content_height (GTK_SCROLLED_WINDOW (parent), target_height);
|
if (max_height != -1 && target_height > max_height)
|
||||||
|
{
|
||||||
|
gtk_scrolled_window_set_max_content_height (scrolled, target_height);
|
||||||
|
gtk_scrolled_window_set_min_content_height (scrolled, target_height);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gtk_scrolled_window_set_min_content_height (scrolled, target_height);
|
||||||
|
gtk_scrolled_window_set_max_content_height (scrolled, target_height);
|
||||||
|
}
|
||||||
gtk_widget_set_size_request (parent, -1, target_height);
|
gtk_widget_set_size_request (parent, -1, target_height);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4976,6 +5013,7 @@ mg_create_topwindow (session *sess)
|
|||||||
#ifdef G_OS_WIN32
|
#ifdef G_OS_WIN32
|
||||||
parent_win = gtk_widget_get_window (win);
|
parent_win = gtk_widget_get_window (win);
|
||||||
gdk_window_add_filter (parent_win, mg_win32_filter, NULL);
|
gdk_window_add_filter (parent_win, mg_win32_filter, NULL);
|
||||||
|
mg_win32_ensure_minimizable (parent_win);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5012,6 +5050,18 @@ mg_win32_filter (GdkXEvent *xevent, GdkEvent *event, gpointer data)
|
|||||||
if (!msg)
|
if (!msg)
|
||||||
return GDK_FILTER_CONTINUE;
|
return GDK_FILTER_CONTINUE;
|
||||||
|
|
||||||
|
if (msg->message == WM_STYLECHANGING && msg->wParam == (WPARAM)GWL_STYLE)
|
||||||
|
{
|
||||||
|
STYLESTRUCT *style = (STYLESTRUCT *)msg->lParam;
|
||||||
|
|
||||||
|
/* Keep the window minimizable from its taskbar button; see
|
||||||
|
* mg_win32_ensure_minimizable (). */
|
||||||
|
if (style)
|
||||||
|
style->styleNew |= WS_MINIMIZEBOX;
|
||||||
|
|
||||||
|
return GDK_FILTER_CONTINUE;
|
||||||
|
}
|
||||||
|
|
||||||
if (msg->message == WM_TIMECHANGE)
|
if (msg->message == WM_TIMECHANGE)
|
||||||
{
|
{
|
||||||
_tzset();
|
_tzset();
|
||||||
@@ -5161,6 +5211,7 @@ mg_create_tabwindow (session *sess)
|
|||||||
#ifdef G_OS_WIN32
|
#ifdef G_OS_WIN32
|
||||||
parent_win = gtk_widget_get_window (win);
|
parent_win = gtk_widget_get_window (win);
|
||||||
gdk_window_add_filter (parent_win, mg_win32_filter, NULL);
|
gdk_window_add_filter (parent_win, mg_win32_filter, NULL);
|
||||||
|
mg_win32_ensure_minimizable (parent_win);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ zoitechat_gtk_deps = [
|
|||||||
|
|
||||||
gtk_dep = dependency('gtk+-3.0', version: '>= 3.22')
|
gtk_dep = dependency('gtk+-3.0', version: '>= 3.22')
|
||||||
|
|
||||||
zoitechat_theme_deps = [gtk_dep]
|
zoitechat_theme_deps = [gtk_dep, zoitechat_common_dep]
|
||||||
|
|
||||||
if host_machine.system() != 'windows'
|
if host_machine.system() != 'windows'
|
||||||
appindicator_opt = get_option('appindicator')
|
appindicator_opt = get_option('appindicator')
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ typedef enum
|
|||||||
WS_HIDDEN
|
WS_HIDDEN
|
||||||
} WinStatus;
|
} WinStatus;
|
||||||
|
|
||||||
#if !defined(WIN32) && (defined(HAVE_AYATANA_APPINDICATOR) || defined(HAVE_APPINDICATOR))
|
#if !defined(WIN32) && (defined(HAVE_AYATANA_APPINDICATOR) || defined(HAVE_APPINDICATOR)) && !defined(GDK_WINDOWING_X11)
|
||||||
#define HAVE_APPINDICATOR_BACKEND 1
|
#define HAVE_APPINDICATOR_BACKEND 1
|
||||||
#else
|
#else
|
||||||
#define HAVE_APPINDICATOR_BACKEND 0
|
#define HAVE_APPINDICATOR_BACKEND 0
|
||||||
|
|||||||
@@ -70,6 +70,15 @@ load_text_events (void)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char **
|
||||||
|
text_color_event_names (int color, int *count)
|
||||||
|
{
|
||||||
|
(void)color;
|
||||||
|
if (count)
|
||||||
|
*count = 0;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
theme_get_color (ThemeSemanticToken token, GdkRGBA *color)
|
theme_get_color (ThemeSemanticToken token, GdkRGBA *color)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -52,14 +52,13 @@ static const guint8 theme_default_99_mirc_colors[THEME_XTEXT_MIRC_COLS][3] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
theme_access_apply_default_99_palette (XTextColor *palette, size_t palette_len, gboolean apply_base)
|
theme_access_apply_default_99_palette (XTextColor *palette, size_t palette_len)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
size_t start = apply_base ? 0 : 32;
|
|
||||||
|
|
||||||
if (palette_len == 0)
|
if (palette_len == 0)
|
||||||
return;
|
return;
|
||||||
for (i = start; i < THEME_XTEXT_MIRC_COLS && i < palette_len; i++)
|
for (i = 32; i < THEME_XTEXT_MIRC_COLS && i < palette_len; i++)
|
||||||
{
|
{
|
||||||
palette[i].red = theme_default_99_mirc_colors[i][0] / 255.0;
|
palette[i].red = theme_default_99_mirc_colors[i][0] / 255.0;
|
||||||
palette[i].green = theme_default_99_mirc_colors[i][1] / 255.0;
|
palette[i].green = theme_default_99_mirc_colors[i][1] / 255.0;
|
||||||
@@ -148,11 +147,10 @@ gboolean
|
|||||||
theme_get_mirc_color (unsigned int mirc_index, GdkRGBA *out_rgba)
|
theme_get_mirc_color (unsigned int mirc_index, GdkRGBA *out_rgba)
|
||||||
{
|
{
|
||||||
ThemeSemanticToken token = (ThemeSemanticToken) (THEME_TOKEN_MIRC_0 + (int) mirc_index);
|
ThemeSemanticToken token = (ThemeSemanticToken) (THEME_TOKEN_MIRC_0 + (int) mirc_index);
|
||||||
gboolean has_user_colors = theme_runtime_mode_has_user_colors (theme_runtime_is_dark_active ());
|
|
||||||
|
|
||||||
if (mirc_index >= THEME_XTEXT_MIRC_COLS)
|
if (mirc_index >= THEME_XTEXT_MIRC_COLS)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (!has_user_colors || mirc_index >= 32)
|
if (mirc_index >= 32)
|
||||||
{
|
{
|
||||||
out_rgba->red = theme_default_99_mirc_colors[mirc_index][0] / 255.0;
|
out_rgba->red = theme_default_99_mirc_colors[mirc_index][0] / 255.0;
|
||||||
out_rgba->green = theme_default_99_mirc_colors[mirc_index][1] / 255.0;
|
out_rgba->green = theme_default_99_mirc_colors[mirc_index][1] / 255.0;
|
||||||
@@ -173,11 +171,10 @@ gboolean
|
|||||||
theme_get_mirc_color_rgb16 (unsigned int mirc_index, guint16 *red, guint16 *green, guint16 *blue)
|
theme_get_mirc_color_rgb16 (unsigned int mirc_index, guint16 *red, guint16 *green, guint16 *blue)
|
||||||
{
|
{
|
||||||
ThemeSemanticToken token = (ThemeSemanticToken) (THEME_TOKEN_MIRC_0 + (int) mirc_index);
|
ThemeSemanticToken token = (ThemeSemanticToken) (THEME_TOKEN_MIRC_0 + (int) mirc_index);
|
||||||
gboolean has_user_colors = theme_runtime_mode_has_user_colors (theme_runtime_is_dark_active ());
|
|
||||||
|
|
||||||
if (mirc_index >= THEME_XTEXT_MIRC_COLS)
|
if (mirc_index >= THEME_XTEXT_MIRC_COLS)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (!has_user_colors || mirc_index >= 32)
|
if (mirc_index >= 32)
|
||||||
{
|
{
|
||||||
*red = (guint16) (theme_default_99_mirc_colors[mirc_index][0] * 257);
|
*red = (guint16) (theme_default_99_mirc_colors[mirc_index][0] * 257);
|
||||||
*green = (guint16) (theme_default_99_mirc_colors[mirc_index][1] * 257);
|
*green = (guint16) (theme_default_99_mirc_colors[mirc_index][1] * 257);
|
||||||
@@ -227,7 +224,6 @@ void
|
|||||||
theme_get_xtext_colors_for_widget (GtkWidget *widget, XTextColor *palette, size_t palette_len)
|
theme_get_xtext_colors_for_widget (GtkWidget *widget, XTextColor *palette, size_t palette_len)
|
||||||
{
|
{
|
||||||
ThemeWidgetStyleValues style_values;
|
ThemeWidgetStyleValues style_values;
|
||||||
gboolean has_user_colors;
|
|
||||||
GdkRGBA marker_color;
|
GdkRGBA marker_color;
|
||||||
|
|
||||||
if (!palette)
|
if (!palette)
|
||||||
@@ -235,9 +231,8 @@ theme_get_xtext_colors_for_widget (GtkWidget *widget, XTextColor *palette, size_
|
|||||||
|
|
||||||
theme_get_widget_style_values_for_widget (widget, &style_values);
|
theme_get_widget_style_values_for_widget (widget, &style_values);
|
||||||
theme_runtime_get_xtext_colors (palette, palette_len);
|
theme_runtime_get_xtext_colors (palette, palette_len);
|
||||||
has_user_colors = theme_runtime_mode_has_user_colors (theme_runtime_is_dark_active ());
|
|
||||||
if (palette_len >= THEME_XTEXT_MIRC_COLS)
|
if (palette_len >= THEME_XTEXT_MIRC_COLS)
|
||||||
theme_access_apply_default_99_palette (palette, palette_len, !has_user_colors);
|
theme_access_apply_default_99_palette (palette, palette_len);
|
||||||
if (palette_len > THEME_XTEXT_MARK_FG_INDEX)
|
if (palette_len > THEME_XTEXT_MARK_FG_INDEX)
|
||||||
{
|
{
|
||||||
palette[THEME_XTEXT_MARK_FG_INDEX].red = style_values.selection_foreground.red;
|
palette[THEME_XTEXT_MARK_FG_INDEX].red = style_values.selection_foreground.red;
|
||||||
|
|||||||
@@ -38,6 +38,7 @@
|
|||||||
#include "theme-runtime.h"
|
#include "theme-runtime.h"
|
||||||
|
|
||||||
extern void load_text_events (void);
|
extern void load_text_events (void);
|
||||||
|
extern char **text_color_event_names (int color, int *count);
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
@@ -243,6 +244,9 @@ theme_preferences_stage_discard (void)
|
|||||||
static void
|
static void
|
||||||
theme_preferences_show_import_error (GtkWidget *button, const char *message);
|
theme_preferences_show_import_error (GtkWidget *button, const char *message);
|
||||||
|
|
||||||
|
static void
|
||||||
|
theme_preferences_color_set_tooltip (GtkWidget *widget, ThemeSemanticToken token);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
theme_preferences_manager_row_free (gpointer data)
|
theme_preferences_manager_row_free (gpointer data)
|
||||||
{
|
{
|
||||||
@@ -481,6 +485,7 @@ theme_preferences_color_response_cb (GtkDialog *dialog, gint response_id, gpoint
|
|||||||
data->color_change_flag,
|
data->color_change_flag,
|
||||||
TRUE);
|
TRUE);
|
||||||
theme_preferences_color_button_apply (data->button, &rgba);
|
theme_preferences_color_button_apply (data->button, &rgba);
|
||||||
|
theme_preferences_color_set_tooltip (data->button, data->token);
|
||||||
theme_preferences_manager_update_preview ((theme_color_manager_ui *) data->manager_ui);
|
theme_preferences_manager_update_preview ((theme_color_manager_ui *) data->manager_ui);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -559,6 +564,113 @@ theme_preferences_token_display_name (ThemeSemanticToken token)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static char *
|
||||||
|
theme_preferences_color_tooltip_markup (ThemeSemanticToken token)
|
||||||
|
{
|
||||||
|
GString *tip;
|
||||||
|
GdkRGBA rgba;
|
||||||
|
char *display;
|
||||||
|
char *hex;
|
||||||
|
char *escaped;
|
||||||
|
char **names;
|
||||||
|
int count = 0;
|
||||||
|
|
||||||
|
if (token < THEME_TOKEN_MIRC_0 || token > THEME_TOKEN_MIRC_31)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
if (!theme_preferences_staged_get_color (token, &rgba))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
tip = g_string_new (NULL);
|
||||||
|
|
||||||
|
display = theme_preferences_token_display_name (token);
|
||||||
|
hex = theme_preferences_format_hex (&rgba);
|
||||||
|
escaped = g_markup_escape_text (display, -1);
|
||||||
|
g_string_append_printf (tip,
|
||||||
|
"<span background='%s'>\xe2\x80\x83\xe2\x80\x83</span> <b>%s</b> <tt><small>%s</small></tt>",
|
||||||
|
hex, escaped, hex);
|
||||||
|
g_free (escaped);
|
||||||
|
g_free (display);
|
||||||
|
|
||||||
|
names = text_color_event_names (token - THEME_TOKEN_MIRC_0, &count);
|
||||||
|
if (names)
|
||||||
|
{
|
||||||
|
int line_target;
|
||||||
|
int line_len = 0;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
display = g_strdup_printf (ngettext ("Used by %d text event",
|
||||||
|
"Used by %d text events", count), count);
|
||||||
|
escaped = g_markup_escape_text (display, -1);
|
||||||
|
g_string_append_printf (tip,
|
||||||
|
"\n<small><span alpha='60%%'>%s</span></small>\n\n<small>",
|
||||||
|
escaped);
|
||||||
|
g_free (escaped);
|
||||||
|
g_free (display);
|
||||||
|
|
||||||
|
/* Explicit line breaks keep the tooltip geometry stable;
|
||||||
|
* heavily-used colors get wider lines so the full list
|
||||||
|
* stays on screen. */
|
||||||
|
if (count <= 12)
|
||||||
|
line_target = 44;
|
||||||
|
else if (count <= 40)
|
||||||
|
line_target = 60;
|
||||||
|
else
|
||||||
|
line_target = 76;
|
||||||
|
|
||||||
|
for (i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
int name_len = (int) g_utf8_strlen (names[i], -1);
|
||||||
|
|
||||||
|
if (i)
|
||||||
|
{
|
||||||
|
if (line_len + name_len + 5 > line_target)
|
||||||
|
{
|
||||||
|
g_string_append_c (tip, '\n');
|
||||||
|
line_len = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_string_append (tip, " \xc2\xb7 ");
|
||||||
|
line_len += 5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
escaped = g_markup_escape_text (names[i], -1);
|
||||||
|
g_string_append (tip, escaped);
|
||||||
|
line_len += name_len;
|
||||||
|
g_free (escaped);
|
||||||
|
}
|
||||||
|
g_string_append (tip, "</small>");
|
||||||
|
g_strfreev (names);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
escaped = g_markup_escape_text (_("Not used by any text events"), -1);
|
||||||
|
g_string_append_printf (tip,
|
||||||
|
"\n<small><span alpha='60%%'><i>%s</i></span></small>",
|
||||||
|
escaped);
|
||||||
|
g_free (escaped);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_free (hex);
|
||||||
|
return g_string_free (tip, FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Static markup tooltips only: building tooltip widgets from a
|
||||||
|
* query-tooltip handler makes GtkTooltip flicker on some setups, so the
|
||||||
|
* markup is set once and refreshed whenever the color changes. */
|
||||||
|
static void
|
||||||
|
theme_preferences_color_set_tooltip (GtkWidget *widget, ThemeSemanticToken token)
|
||||||
|
{
|
||||||
|
char *markup = theme_preferences_color_tooltip_markup (token);
|
||||||
|
|
||||||
|
if (!markup)
|
||||||
|
return;
|
||||||
|
|
||||||
|
gtk_widget_set_tooltip_markup (widget, markup);
|
||||||
|
g_free (markup);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
theme_preferences_manager_row_apply (theme_color_manager_row *row, const GdkRGBA *rgba)
|
theme_preferences_manager_row_apply (theme_color_manager_row *row, const GdkRGBA *rgba)
|
||||||
{
|
{
|
||||||
@@ -569,6 +681,7 @@ theme_preferences_manager_row_apply (theme_color_manager_row *row, const GdkRGBA
|
|||||||
hex = theme_preferences_format_hex (rgba);
|
hex = theme_preferences_format_hex (rgba);
|
||||||
gtk_entry_set_text (GTK_ENTRY (row->entry), hex);
|
gtk_entry_set_text (GTK_ENTRY (row->entry), hex);
|
||||||
g_free (hex);
|
g_free (hex);
|
||||||
|
theme_preferences_color_set_tooltip (row->row, row->token);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -884,6 +997,8 @@ theme_preferences_create_color_manager_dialog (GtkWindow *parent, gboolean *colo
|
|||||||
if (theme_preferences_staged_get_color (token, &rgba))
|
if (theme_preferences_staged_get_color (token, &rgba))
|
||||||
theme_preferences_manager_row_apply (row, &rgba);
|
theme_preferences_manager_row_apply (row, &rgba);
|
||||||
|
|
||||||
|
theme_preferences_color_set_tooltip (list_row, token);
|
||||||
|
|
||||||
g_signal_connect (G_OBJECT (button), "clicked",
|
g_signal_connect (G_OBJECT (button), "clicked",
|
||||||
G_CALLBACK (theme_preferences_manager_pick_cb), row);
|
G_CALLBACK (theme_preferences_manager_pick_cb), row);
|
||||||
g_object_set_data (G_OBJECT (button), "zoitechat-theme-color-manager-ui", ui);
|
g_object_set_data (G_OBJECT (button), "zoitechat-theme-color-manager-ui", ui);
|
||||||
@@ -1198,6 +1313,7 @@ theme_preferences_create_color_button (GtkWidget *table,
|
|||||||
g_object_set_data (G_OBJECT (but), "zoitechat-color-box", box);
|
g_object_set_data (G_OBJECT (but), "zoitechat-color-box", box);
|
||||||
g_object_set_data (G_OBJECT (but), "zoitechat-theme-token", GINT_TO_POINTER (token));
|
g_object_set_data (G_OBJECT (but), "zoitechat-theme-token", GINT_TO_POINTER (token));
|
||||||
g_object_set_data (G_OBJECT (but), "zoitechat-theme-color-change", color_change_flag);
|
g_object_set_data (G_OBJECT (but), "zoitechat-theme-color-change", color_change_flag);
|
||||||
|
theme_preferences_color_set_tooltip (but, token);
|
||||||
gtk_grid_attach (GTK_GRID (table), but, col, row, 1, 1);
|
gtk_grid_attach (GTK_GRID (table), but, col, row, 1, 1);
|
||||||
g_signal_connect (G_OBJECT (but), "clicked", G_CALLBACK (theme_preferences_color_cb), parent);
|
g_signal_connect (G_OBJECT (but), "clicked", G_CALLBACK (theme_preferences_color_cb), parent);
|
||||||
if (theme_preferences_staged_get_color (token, &color))
|
if (theme_preferences_staged_get_color (token, &color))
|
||||||
|
|||||||
Reference in New Issue
Block a user