rebuild macos build

This commit is contained in:
deepend committed 2026-10-17 13:08:32 -06:00
1 parent 74d9e35b37
commit a2c0eb646f
24 files changed
+1798 -44

No files matched your search

+19 -1
View File
@@ -21,6 +21,9 @@
#include <stdlib.h>
#include "fe-gtk.h"
#ifdef __APPLE__
#include "../common/macos.h"
#endif
#ifdef GDK_WINDOWING_WIN32
#include <gdk/gdkwin32.h>
@@ -372,7 +375,13 @@ fe_args (int argc, char *argv[])
g_free (locale_path);
g_free (base_path);
#else
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
bindtextdomain (GETTEXT_PACKAGE,
#ifdef __APPLE__
zoitechat_macos_locale_dir ()
#else
LOCALEDIR
#endif
);
#endif
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
@@ -493,6 +502,15 @@ fe_args (int argc, char *argv[])
#endif
gtk_init (&argc, &argv);
#ifdef __APPLE__
if (g_getenv ("ZOITECHAT_MACOS_SHARE"))
{
char *icons = g_build_filename (g_getenv ("ZOITECHAT_MACOS_SHARE"), "icons", NULL);
gtk_icon_theme_prepend_search_path (gtk_icon_theme_get_default (), icons);
g_free (icons);
}
#endif
#ifdef WIN32
win32_configure_icon_theme ();
#endif
+16
View File
@@ -53,6 +53,15 @@ zoitechat_gtk_deps = [
gtk_dep = dependency('gtk+-3.0', version: '>= 3.22')
# Standalone GTK tests also include the common application's headers.
gtk_dep = declare_dependency(dependencies: [gtk_dep] + zoitechat_common_header_deps)
# fe-gtk.h exposes GtkosxApplication to every GTK consumer when enabled.
# Theme libraries and standalone UI tests need the same headers as the app.
if host_machine.system() == 'darwin' and gtk_mac_dep.found()
gtk_dep = declare_dependency(dependencies: [gtk_dep, gtk_mac_dep])
endif
zoitechat_theme_deps = [gtk_dep, zoitechat_common_dep]
if host_machine.system() != 'windows'
@@ -91,12 +100,18 @@ if host_machine.system() != 'windows'
endif
zoitechat_gtk_ldflags = []
zoitechat_gtk_objcflags = []
if host_machine.system() == 'windows'
zoitechat_gtk_sources += 'notifications/notification-windows.c'
zoitechat_gtk_deps += cc.find_library('dwmapi', required: true)
zoitechat_theme_deps += cc.find_library('dwmapi', required: true)
elif host_machine.system() == 'darwin'
add_languages('objc', required: true)
zoitechat_gtk_sources += 'notifications/notification-osx.m'
zoitechat_gtk_deps += dependency('appleframeworks', modules: ['Cocoa', 'UserNotifications'])
zoitechat_gtk_objcflags += '-fobjc-arc'
else
zoitechat_gtk_sources += 'notifications/notification-freedesktop.c'
endif
@@ -137,6 +152,7 @@ executable('zoitechat',
dependencies: zoitechat_gtk_deps,
link_with: zoitechat_theme_lib,
c_args: zoitechat_gtk_cflags,
objc_args: zoitechat_gtk_objcflags,
link_args: zoitechat_gtk_ldflags,
pie: true,
install: true,
+51 -38
View File
@@ -1,54 +1,67 @@
/* ZoiteChat
* Copyright (C) 2015 Patrick Griffis.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
/* Native macOS notifications; GPL-2.0-or-later, see COPYING. */
#import <Cocoa/Cocoa.h>
#include <gtkosxapplication.h>
#import <UserNotifications/UserNotifications.h>
void
notification_backend_show (const char *title, const char *text)
@interface ZoiteChatNotificationDelegate : NSObject <UNUserNotificationCenterDelegate>
@end
@implementation ZoiteChatNotificationDelegate
- (void)userNotificationCenter:(UNUserNotificationCenter *)center
willPresentNotification:(UNNotification *)notification
withCompletionHandler:(void (^)(UNNotificationPresentationOptions))completionHandler
{
NSString *str_title = [[NSString alloc] initWithUTF8String:title];
NSString *str_text = [[NSString alloc] initWithUTF8String:text];
completionHandler(UNNotificationPresentationOptionBanner | UNNotificationPresentationOptionSound);
}
@end
NSUserNotification *userNotification = [NSUserNotification new];
userNotification.title = str_title;
userNotification.informativeText = str_text;
static ZoiteChatNotificationDelegate *notification_delegate;
NSUserNotificationCenter *center = [NSUserNotificationCenter defaultUserNotificationCenter];
[center scheduleNotification:userNotification];
[str_title release];
[str_text release];
int
notification_backend_supported (void)
{
return [[NSBundle mainBundle] bundleIdentifier] != nil;
}
int
notification_backend_init (const char **error)
{
return 1;
if (!notification_backend_supported ())
{
*error = "macOS notifications require an application bundle";
return 0;
}
notification_delegate = [ZoiteChatNotificationDelegate new];
[UNUserNotificationCenter currentNotificationCenter].delegate = notification_delegate;
return 1;
}
void
notification_backend_show (const char *title, const char *text)
{
UNMutableNotificationContent *content = [UNMutableNotificationContent new];
content.title = [NSString stringWithUTF8String:title] ?: @"ZoiteChat";
content.body = [NSString stringWithUTF8String:text] ?: @"";
UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
/* Ask only when the user first needs a notification, without blocking GTK. */
[center requestAuthorizationWithOptions:UNAuthorizationOptionAlert | UNAuthorizationOptionSound
completionHandler:^(BOOL granted, NSError *error) {
if (granted)
{
UNNotificationRequest *request = [UNNotificationRequest
requestWithIdentifier:[[NSUUID UUID] UUIDString] content:content trigger:nil];
[center addNotificationRequest:request withCompletionHandler:^(NSError *deliveryError) {
if (deliveryError)
NSLog(@"ZoiteChat notification failed: %@", deliveryError);
}];
}
else if (error)
NSLog(@"ZoiteChat notification authorization failed: %@", error);
}];
}
void
notification_backend_deinit (void)
{
}
int
notification_backend_supported (void)
{
return gtkosx_application_get_bundle_id () != NULL;
if (notification_delegate)
[UNUserNotificationCenter currentNotificationCenter].delegate = nil;
notification_delegate = nil;
}
+16 -1
View File
@@ -215,7 +215,22 @@ initialize_enchant (void)
#endif
};
for (i = 0; i < G_N_ELEMENTS(libnames); ++i)
#ifdef __APPLE__
const char *bundled_enchant = g_getenv ("ZOITECHAT_ENCHANT_LIBRARY");
if (bundled_enchant && *bundled_enchant)
{
enchant = g_module_open (bundled_enchant, 0);
if (enchant)
{
void (*set_prefix) (const char *) = NULL;
const char *prefix = g_getenv ("ZOITECHAT_ENCHANT_PREFIX");
if (prefix && g_module_symbol (enchant, "enchant_set_prefix_dir", (gpointer *) &set_prefix))
set_prefix (prefix);
have_enchant = TRUE;
}
}
#endif
for (i = 0; !have_enchant && i < G_N_ELEMENTS(libnames); ++i)
{
enchant = g_module_open(libnames[i], 0);
if (enchant)
@@ -21,6 +21,7 @@
#include "../../fe-gtk.h"
#include "../theme-application.h"
#include "../theme-css.h"
#include "../theme-policy.h"
#include "../../maingui.h"
#include "../../../common/zoitechat.h"
@@ -45,6 +46,13 @@ fe_message (char *msg, int flags)
message_calls++;
}
/* This test isolates input styling from the application's toplevel CSS. */
char *
theme_css_build_toplevel_classes (void)
{
return g_strdup ("");
}
void
theme_css_reload_input_style (gboolean enabled, const PangoFontDescription *font_desc)
{