mirror of
https://github.com/ZoiteChat/zoitechat.git
synced 2026-03-10 07:50:19 +00:00
Adjust for GTK3 github actions compile testing.
fixed gtk2 compiling.
This commit is contained in:
6
.github/workflows/appimage-build.yml
vendored
6
.github/workflows/appimage-build.yml
vendored
@@ -29,11 +29,13 @@ jobs:
|
||||
build-essential pkg-config meson ninja-build cmake \
|
||||
gettext \
|
||||
libcanberra-dev libdbus-glib-1-dev libglib2.0-dev \
|
||||
libgtk2.0-dev libgtk-3-dev \
|
||||
libgtk-3-dev \
|
||||
libgtk-3-bin libglib2.0-bin shared-mime-info gsettings-desktop-schemas \
|
||||
libluajit-5.1-dev libpci-dev libperl-dev libssl-dev \
|
||||
python3-dev python3-cffi mono-devel desktop-file-utils \
|
||||
patchelf file curl
|
||||
patchelf file curl \
|
||||
libwayland-client0 libwayland-cursor0 libwayland-egl1 \
|
||||
libxkbcommon0
|
||||
|
||||
- name: Configure
|
||||
run: |
|
||||
|
||||
6
.github/workflows/debian-build.yml
vendored
6
.github/workflows/debian-build.yml
vendored
@@ -22,9 +22,11 @@ jobs:
|
||||
git ca-certificates \
|
||||
build-essential pkg-config meson ninja-build cmake \
|
||||
gettext \
|
||||
libcanberra-dev libdbus-glib-1-dev libglib2.0-dev libgtk2.0-dev \
|
||||
libcanberra-dev libdbus-glib-1-dev libglib2.0-dev \
|
||||
libgtk-3-dev \
|
||||
libluajit-5.1-dev libpci-dev libperl-dev libssl-dev \
|
||||
python3-dev python3-cffi mono-devel desktop-file-utils
|
||||
python3-dev python3-cffi mono-devel desktop-file-utils \
|
||||
libx11-dev libxext-dev libxrender-dev libxrandr-dev libxi-dev
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
2
.github/workflows/msys-build.yml
vendored
2
.github/workflows/msys-build.yml
vendored
@@ -26,7 +26,7 @@ jobs:
|
||||
mingw-w64-x86_64-python-cffi
|
||||
mingw-w64-x86_64-meson
|
||||
mingw-w64-x86_64-ninja
|
||||
mingw-w64-x86_64-gtk2
|
||||
mingw-w64-x86_64-gtk3
|
||||
mingw-w64-x86_64-gtk-update-icon-cache
|
||||
mingw-w64-x86_64-luajit
|
||||
mingw-w64-x86_64-desktop-file-utils
|
||||
|
||||
45
.github/workflows/windows-build.yml
vendored
45
.github/workflows/windows-build.yml
vendored
@@ -39,7 +39,7 @@ jobs:
|
||||
|
||||
- name: Install Dependencies
|
||||
run: |
|
||||
New-Item -Name "deps" -ItemType "Directory"
|
||||
New-Item -Name "deps" -ItemType "Directory" -Force | Out-Null
|
||||
|
||||
Invoke-WebRequest http://files.jrsoftware.org/is/5/innosetup-5.5.9-unicode.exe -OutFile deps\innosetup-unicode.exe
|
||||
& deps\innosetup-unicode.exe /VERYSILENT | Out-Null
|
||||
@@ -47,9 +47,37 @@ jobs:
|
||||
Invoke-WebRequest https://github.com/zoitechat/gvsbuild/releases/download/zoitechat-2.17.0/idpsetup-1.5.1.exe -OutFile deps\idpsetup.exe
|
||||
& deps\idpsetup.exe /VERYSILENT
|
||||
|
||||
Invoke-WebRequest https://github.com/zoitechat/gvsbuild/releases/download/zoitechat-2.17.0/gtk-${{ matrix.platform }}-2018-08-29-openssl1.1.7z -OutFile deps\gtk-${{ matrix.arch }}.7z
|
||||
& 7z.exe x deps\gtk-${{ matrix.arch }}.7z -oC:\gtk-build\gtk
|
||||
# ----- GTK3 toolchain (gvsbuild) -----
|
||||
# We install GTK3 into C:\gtk-build\gtk so existing .vcxproj include/lib paths keep working.
|
||||
# (Yes, this is what Windows dev feels like: duct tape and hope.)
|
||||
|
||||
# Ensure base dirs exist
|
||||
New-Item -Path "C:\gtk-build" -ItemType Directory -Force | Out-Null
|
||||
New-Item -Path "C:\gtk-build\gtk" -ItemType Directory -Force | Out-Null
|
||||
|
||||
python -m pip install --upgrade pip
|
||||
python -m pip install cffi
|
||||
|
||||
# gvsbuild uses VS toolchain; pin a known-good gvsbuild
|
||||
python -m pip install "gvsbuild==2024.5.0"
|
||||
|
||||
# Build/install GTK3 stack. Target dir is architecture-specific.
|
||||
# Layout matches: C:\gtk-build\gtk\{x64|x86}
|
||||
$gtkArch = if ("${{ matrix.platform }}" -eq "x64") { "x64" } else { "x86" }
|
||||
|
||||
# Clean any prior install (CI sometimes reuses workspace paths)
|
||||
if (Test-Path "C:\gtk-build\gtk\$gtkArch") { Remove-Item "C:\gtk-build\gtk\$gtkArch" -Recurse -Force }
|
||||
|
||||
# Run gvsbuild. These packages cover typical HexChat/ZoiteChat deps.
|
||||
# Add/remove libs here as your solution requires.
|
||||
python -m gvsbuild build `
|
||||
--vsver 16 `
|
||||
--arch $gtkArch `
|
||||
--configuration release `
|
||||
--out-dir "C:\gtk-build\gtk" `
|
||||
gtk3 glib gobject-introspection pango atk cairo gdk-pixbuf libsoup libepoxy librsvg libxml2 gettext openssl
|
||||
|
||||
# ----- Other bundled deps you already used -----
|
||||
Invoke-WebRequest https://github.com/zoitechat/gvsbuild/releases/download/zoitechat-2.17.0/gendef-20111031.7z -OutFile deps\gendef.7z
|
||||
& 7z.exe x deps\gendef.7z -oC:\gtk-build
|
||||
|
||||
@@ -70,9 +98,7 @@ jobs:
|
||||
if (Test-Path $target) { Remove-Item $target -Recurse -Force }
|
||||
New-Item -Path $pyDir -Name "${{ matrix.platform }}" -ItemType Junction -Value $pyRoot | Out-Null
|
||||
}
|
||||
|
||||
python -m pip install --upgrade pip
|
||||
python -m pip install cffi
|
||||
shell: powershell
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
@@ -88,6 +114,13 @@ jobs:
|
||||
set "LIB=%PYTHON_DIR%\libs;%LIB%"
|
||||
set "INCLUDE=%PYTHON_DIR%\include;%INCLUDE%"
|
||||
|
||||
rem Make sure GTK3 runtime bin is on PATH for any post-build steps/tests.
|
||||
if "${{ matrix.platform }}"=="x64" (
|
||||
set "PATH=C:\gtk-build\gtk\x64\release\bin;%PATH%"
|
||||
) else (
|
||||
set "PATH=C:\gtk-build\gtk\x86\release\bin;%PATH%"
|
||||
)
|
||||
|
||||
msbuild win32\zoitechat.sln /m /verbosity:minimal /p:Configuration=Release /p:Platform=${{ matrix.platform }}
|
||||
shell: cmd
|
||||
|
||||
|
||||
@@ -7,7 +7,8 @@
|
||||
"command": "zoitechat",
|
||||
"finish-args": [
|
||||
"--share=ipc",
|
||||
"--socket=x11",
|
||||
"--socket=wayland",
|
||||
"--socket=fallback-x11",
|
||||
"--share=network",
|
||||
"--socket=pulseaudio",
|
||||
"--filesystem=xdg-download",
|
||||
@@ -28,8 +29,6 @@
|
||||
}
|
||||
},
|
||||
"modules": [
|
||||
"shared-modules/gtk2/gtk2.json",
|
||||
"shared-modules/gtk2/gtk2-common-themes.json",
|
||||
"shared-modules/dbus-glib/dbus-glib.json",
|
||||
"shared-modules/lua5.3/lua-5.3.5.json",
|
||||
"shared-modules/libcanberra/libcanberra.json",
|
||||
@@ -43,7 +42,7 @@
|
||||
"url": "https://github.com/pavouk/lgi.git",
|
||||
"commit": "95418635aa8151a516d43166227ea2b9d4c4403f"
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "zoitechat",
|
||||
|
||||
@@ -273,3 +273,25 @@ sysinfo_backend_get_network(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const char *sysinfo_detect_toolkit(void)
|
||||
{
|
||||
#if defined(HAVE_GTK3)
|
||||
return "GTK3";
|
||||
#elif defined(HAVE_GTK2)
|
||||
return "GTK2";
|
||||
#elif defined(HAVE_GTK)
|
||||
return "GTK";
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
char *sysinfo_backend_get_ui(void)
|
||||
{
|
||||
const char *toolkit = sysinfo_detect_toolkit();
|
||||
if (toolkit)
|
||||
return g_strdup_printf("%s / Quartz", toolkit);
|
||||
|
||||
return g_strdup("Quartz");
|
||||
}
|
||||
|
||||
@@ -30,4 +30,10 @@ char *sysinfo_backend_get_sound(void);
|
||||
char *sysinfo_backend_get_uptime(void);
|
||||
char *sysinfo_backend_get_network(void);
|
||||
|
||||
/*
|
||||
* Short description of the UI/toolkit + display backend.
|
||||
* Examples: "GTK3 / Wayland", "GTK2 / X11", "Windows / GTK3".
|
||||
*/
|
||||
char *sysinfo_backend_get_ui(void);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -41,7 +41,7 @@ static zoitechat_plugin *ph;
|
||||
static char name[] = "Sysinfo";
|
||||
static char desc[] = "Display info about your hardware and OS";
|
||||
static char version[] = "1.0";
|
||||
static char sysinfo_help[] = "SysInfo Usage:\n /SYSINFO [-e|-o] [CLIENT|OS|CPU|RAM|DISK|VGA|SOUND|ETHERNET|UPTIME], print various details about your system or print a summary without arguments\n /SYSINFO SET <variable>\n";
|
||||
static char sysinfo_help[] = "SysInfo Usage:\n /SYSINFO [-e|-o] [CLIENT|UI|OS|CPU|RAM|DISK|VGA|SOUND|ETHERNET|UPTIME], print various details about your system or print a summary without arguments\n /SYSINFO SET <variable>\n";
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@@ -54,11 +54,22 @@ typedef struct
|
||||
static char *
|
||||
get_client (void)
|
||||
{
|
||||
return g_strdup_printf ("ZoiteChat %s", zoitechat_get_info(ph, "version"));
|
||||
char *ui = sysinfo_backend_get_ui();
|
||||
const char *ver = zoitechat_get_info(ph, "version");
|
||||
char *out;
|
||||
|
||||
if (ui != NULL && *ui != '\0')
|
||||
out = g_strdup_printf ("ZoiteChat %s (%s)", ver, ui);
|
||||
else
|
||||
out = g_strdup_printf ("ZoiteChat %s", ver);
|
||||
|
||||
g_free (ui);
|
||||
return out;
|
||||
}
|
||||
|
||||
static hwinfo hwinfos[] = {
|
||||
{"client", "Client", get_client},
|
||||
{"ui", "UI", sysinfo_backend_get_ui},
|
||||
{"os", "OS", sysinfo_backend_get_os},
|
||||
{"cpu", "CPU", sysinfo_backend_get_cpu},
|
||||
{"memory", "Memory", sysinfo_backend_get_memory},
|
||||
@@ -235,7 +246,8 @@ zoitechat_plugin_init (zoitechat_plugin *plugin_handle, char **plugin_name, char
|
||||
|
||||
zoitechat_hook_command (ph, "SYSINFO", ZOITECHAT_PRI_NORM, sysinfo_cb, sysinfo_help, NULL);
|
||||
|
||||
zoitechat_command (ph, "MENU ADD \"Window/Send System Info\" \"SYSINFO\"");
|
||||
/* Match the classic label from HexChat so people can actually find it. */
|
||||
zoitechat_command (ph, "MENU ADD \"Window/Display System Info\" \"SYSINFO\"");
|
||||
zoitechat_printf (ph, _("%s plugin loaded\n"), name);
|
||||
return 1;
|
||||
}
|
||||
@@ -243,6 +255,8 @@ zoitechat_plugin_init (zoitechat_plugin *plugin_handle, char **plugin_name, char
|
||||
int
|
||||
zoitechat_plugin_deinit (void)
|
||||
{
|
||||
/* Keep both in case older builds used a different label. */
|
||||
zoitechat_command (ph, "MENU DEL \"Window/Send System Info\"");
|
||||
zoitechat_command (ph, "MENU DEL \"Window/Display System Info\"");
|
||||
zoitechat_printf (ph, _("%s plugin unloaded\n"), name);
|
||||
return 1;
|
||||
|
||||
@@ -18,6 +18,10 @@
|
||||
*/
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
#if defined(HAVE_GTK3) || defined(HAVE_GTK2) || defined(HAVE_GTK)
|
||||
#include <gdk/gdk.h>
|
||||
#endif
|
||||
#include "parse.h"
|
||||
#include "match.h"
|
||||
#include "sysinfo.h"
|
||||
@@ -168,3 +172,86 @@ char *sysinfo_backend_get_network(void)
|
||||
|
||||
return g_strdup (ethernet_card);
|
||||
}
|
||||
|
||||
static const char *sysinfo_detect_toolkit(void)
|
||||
{
|
||||
#if defined(HAVE_GTK3)
|
||||
return "GTK3";
|
||||
#elif defined(HAVE_GTK2)
|
||||
return "GTK2";
|
||||
#elif defined(HAVE_GTK)
|
||||
return "GTK";
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
static const char *sysinfo_detect_display_backend(void)
|
||||
{
|
||||
const char *backend = NULL;
|
||||
const char *gdk_backend = g_getenv("GDK_BACKEND");
|
||||
const char *session = g_getenv("XDG_SESSION_TYPE");
|
||||
const gboolean session_wayland = session && g_ascii_strcasecmp(session, "wayland") == 0;
|
||||
|
||||
/* Best-effort: ask GDK what it actually opened, if available. */
|
||||
#if defined(HAVE_GTK3) || defined(HAVE_GTK2) || defined(HAVE_GTK)
|
||||
{
|
||||
GdkDisplay *display = gdk_display_get_default();
|
||||
if (display)
|
||||
{
|
||||
const char *type_name = G_OBJECT_TYPE_NAME(display);
|
||||
if (type_name)
|
||||
{
|
||||
if (g_strrstr(type_name, "Wayland"))
|
||||
backend = "Wayland";
|
||||
else if (g_strrstr(type_name, "X11"))
|
||||
backend = "X11";
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Next best: honor explicit backend preference. */
|
||||
if (!backend && gdk_backend)
|
||||
{
|
||||
if (g_strrstr(gdk_backend, "wayland"))
|
||||
backend = "Wayland";
|
||||
else if (g_strrstr(gdk_backend, "x11"))
|
||||
backend = "X11";
|
||||
}
|
||||
|
||||
/* Last resort: infer from common env vars. */
|
||||
if (!backend)
|
||||
{
|
||||
const gboolean has_wayland = g_getenv("WAYLAND_DISPLAY") != NULL;
|
||||
const gboolean has_x11 = g_getenv("DISPLAY") != NULL;
|
||||
if (has_wayland && !has_x11)
|
||||
backend = "Wayland";
|
||||
else if (has_x11 && !has_wayland)
|
||||
backend = "X11";
|
||||
else if (session_wayland)
|
||||
backend = "Wayland";
|
||||
else
|
||||
backend = NULL;
|
||||
}
|
||||
|
||||
/* If we're using X11 inside a Wayland session, call it what it is. */
|
||||
if (backend && g_strcmp0(backend, "X11") == 0 && session_wayland)
|
||||
return "XWayland";
|
||||
|
||||
return backend;
|
||||
}
|
||||
|
||||
char *sysinfo_backend_get_ui(void)
|
||||
{
|
||||
const char *toolkit = sysinfo_detect_toolkit();
|
||||
const char *display = sysinfo_detect_display_backend();
|
||||
|
||||
if (toolkit && display)
|
||||
return g_strdup_printf("%s / %s", toolkit, display);
|
||||
if (toolkit)
|
||||
return g_strdup(toolkit);
|
||||
if (display)
|
||||
return g_strdup(display);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -103,3 +103,30 @@ static char *get_memory_info (void)
|
||||
|
||||
return sysinfo_format_memory (meminfo.ullTotalPhys, meminfo.ullAvailPhys);
|
||||
}
|
||||
|
||||
static const char *sysinfo_detect_toolkit(void)
|
||||
{
|
||||
#if defined(HAVE_GTK3)
|
||||
return "GTK3";
|
||||
#elif defined(HAVE_GTK2)
|
||||
return "GTK2";
|
||||
#elif defined(HAVE_GTK)
|
||||
return "GTK";
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
char *
|
||||
sysinfo_backend_get_ui (void)
|
||||
{
|
||||
const char *toolkit = sysinfo_detect_toolkit();
|
||||
|
||||
/* On Windows we don't have X11/Wayland. Keep it simple. */
|
||||
if (toolkit)
|
||||
{
|
||||
return g_strdup_printf ("Windows / %s", toolkit);
|
||||
}
|
||||
|
||||
return g_strdup ("Windows");
|
||||
}
|
||||
|
||||
@@ -1123,8 +1123,10 @@ gtkutil_tray_icon_supported (GtkWindow *window)
|
||||
#ifdef GDK_WINDOWING_X11
|
||||
GdkScreen *screen = gtk_window_get_screen (window);
|
||||
GdkDisplay *display = gdk_screen_get_display (screen);
|
||||
#ifdef HAVE_GTK3
|
||||
if (!GDK_IS_X11_DISPLAY (display))
|
||||
return FALSE;
|
||||
#endif
|
||||
int screen_number = gdk_screen_get_number (screen);
|
||||
Display *xdisplay = gdk_x11_display_get_xdisplay (display);
|
||||
char *selection_name = g_strdup_printf ("_NET_SYSTEM_TRAY_S%d", screen_number);
|
||||
|
||||
Reference in New Issue
Block a user