diff --git a/configure.ac b/configure.ac index bf709da11..84613cc9e 100644 --- a/configure.ac +++ b/configure.ac @@ -527,6 +527,10 @@ AC_ARG_WITH(apple-application-id,AS_HELP_STRING([--with-apple-application-id=VAL [ APPLE_APPLICATION_ID="${withval}" ], [ APPLE_APPLICATION_ID="org.x.X11" ]) AC_SUBST([APPLE_APPLICATION_ID]) +AC_ARG_ENABLE(sparkle,AS_HELP_STRING([--enable-sparkle], [Enable updating of X11.app using the Sparkle Framework (default: disabled)]), + [ XQUARTZ_SPARKLE="${enableval}" ], + [ XQUARTZ_SPARKLE="no" ]) +AC_SUBST([XQUARTZ_SPARKLE]) AC_ARG_ENABLE(builddocs, AS_HELP_STRING([--enable-builddocs], [Build docs (default: disabled)]), [BUILDDOCS=$enableval], [BUILDDOCS=no]) @@ -1687,6 +1691,10 @@ if test "x$XQUARTZ" = xyes; then PKG_CHECK_MODULES(XPBPROXY, [applewmproto >= 1.3] [applewm >= 1.3] xfixes fixesproto x11) + if test "x$XQUARTZ_SPARKLE" = xyes ; then + AC_DEFINE(XQUARTZ_SPARKLE,1,[Support application updating through sparkle.]) + fi + if test "x$STANDALONE_XPBPROXY" = xyes ; then AC_DEFINE(STANDALONE_XPBPROXY,1,[Build a standalone xpbproxy]) fi @@ -1703,9 +1711,8 @@ AC_SUBST([OBJCLINK]) AC_SUBST([OBJCFLAGS]) # internal, undocumented automake func follows :( _AM_DEPENDENCIES([OBJC]) -AM_CONDITIONAL(HAVE_XPLUGIN, [test "x$ac_cv_lib_Xplugin_xp_init" = xyes]) -AM_CONDITIONAL(HAVE_AGL_FRAMEWORK, [test "x$xorg_cv_AGL_framework" = xyes]) AM_CONDITIONAL(XQUARTZ, [test "x$XQUARTZ" = xyes]) +AM_CONDITIONAL(XQUARTZ_SPARKLE, [test "x$XQUARTZ_SPARKLE" != "xno"]) AM_CONDITIONAL(STANDALONE_XPBPROXY, [test "x$STANDALONE_XPBPROXY" = xyes]) dnl DMX DDX diff --git a/hw/xquartz/X11Application.h b/hw/xquartz/X11Application.h index 80aee5932..c02073eb6 100644 --- a/hw/xquartz/X11Application.h +++ b/hw/xquartz/X11Application.h @@ -47,6 +47,7 @@ - (const char *) prefs_get_string:(NSString *)key default:(const char *)def; - (float) prefs_get_float:(NSString *)key default:(float)def; - (int) prefs_get_boolean:(NSString *)key default:(int)def; +- (NSURL *) prefs_copy_url:(NSString *)key default:(NSURL *)def; - (NSArray *) prefs_get_array:(NSString *)key; - (void) prefs_set_integer:(NSString *)key value:(int)value; - (void) prefs_set_float:(NSString *)key value:(float)value; @@ -95,6 +96,7 @@ extern int quartzHasRoot, quartzEnableRootless, quartzFullscreenMenu; #define PREFS_TEST_EXTENSIONS "enable_test_extensions" #define PREFS_XP_OPTIONS "xp_options" #define PREFS_LOGIN_SHELL "login_shell" +#define PREFS_UPDATE_FEED "update_feed" #define PREFS_CLICK_THROUGH "wm_click_through" #define PREFS_FFM "wm_ffm" #define PREFS_FOCUS_ON_NEW_WINDOW "wm_focus_on_new_window" diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m index b31634de0..736d4e61e 100644 --- a/hw/xquartz/X11Application.m +++ b/hw/xquartz/X11Application.m @@ -50,6 +50,10 @@ #include #include +#ifdef XQUARTZ_SPARKLE +#include +#endif + #include // pbproxy/pbproxy.h @@ -585,6 +589,23 @@ static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) { return ret != NULL ? ret : def; } +- (NSURL *) prefs_copy_url:(NSString *)key default:(NSURL *)def { + CFPropertyListRef value; + NSURL *ret = NULL; + + value = [self prefs_get:key]; + + if (value != NULL && CFGetTypeID (value) == CFStringGetTypeID ()) { + NSString *s = (NSString *) value; + + ret = [NSURL URLWithString:s]; + } + + if (value != NULL) CFRelease (value); + + return ret != NULL ? ret : def; +} + - (float) prefs_get_float:(NSString *)key default:(float)def { CFPropertyListRef value; float ret = def; @@ -746,6 +767,14 @@ static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) { noTestExtensions = ![self prefs_get_boolean:@PREFS_TEST_EXTENSIONS default:FALSE]; + +#if XQUARTZ_SPARKLE + NSURL *url = [self prefs_copy_url:@PREFS_UPDATE_FEED default:nil]; + if(url) { + [[SUUpdater sharedUpdater] setFeedURL:url]; + CFRelease(url); + } +#endif } /* This will end up at the end of the responder chain. */ @@ -935,7 +964,12 @@ void X11ApplicationMain (int argc, char **argv, char **envp) { if(!xpbproxy_init()) fprintf(stderr, "Error initializing xpbproxy\n"); - + +#if XQUARTZ_SPARKLE + [[SUUpdater sharedUpdater] resetUpdateCycle]; +// [[SUUpdater sharedUpdater] checkForUpdates:X11App]; +#endif + [NSApp run]; /* not reached */ } diff --git a/hw/xquartz/bundle/Info.plist.cpp b/hw/xquartz/bundle/Info.plist.cpp index 90628161d..6d951ada8 100644 --- a/hw/xquartz/bundle/Info.plist.cpp +++ b/hw/xquartz/bundle/Info.plist.cpp @@ -26,6 +26,14 @@ x11a CSResourcesFileMapped +#ifdef XQUARTZ_SPARKLE + SUEnableAutomaticChecks + + SUPublicDSAKeyFile + sparkle.pem + SUFeedURL + http://xquartz.macosforge.org/downloads/sparkle/release.xml +#endif NSHumanReadableCopyright © 2003-2009 Apple Inc. © 2003 XFree86 Project, Inc. diff --git a/hw/xquartz/bundle/Makefile.am b/hw/xquartz/bundle/Makefile.am index 963327bb9..ea02cd620 100644 --- a/hw/xquartz/bundle/Makefile.am +++ b/hw/xquartz/bundle/Makefile.am @@ -4,6 +4,10 @@ CPP_FILES_FLAGS = \ -DAPPLE_APPLICATION_ID="$(APPLE_APPLICATION_ID)" \ -DAPPLE_APPLICATION_NAME="$(APPLE_APPLICATION_NAME)" +if XQUARTZ_SPARKLE +CPP_FILES_FLAGS += -DXQUARTZ_SPARKLE +endif + install-data-hook: $(srcdir)/mk_bundke.sh $(srcdir) $(builddir) $(DESTDIR)$(APPLE_APPLICATIONS_DIR)/$(APPLE_APPLICATION_NAME).app install diff --git a/hw/xquartz/mach-startup/Makefile.am b/hw/xquartz/mach-startup/Makefile.am index 0c609e384..2901b6559 100644 --- a/hw/xquartz/mach-startup/Makefile.am +++ b/hw/xquartz/mach-startup/Makefile.am @@ -39,6 +39,11 @@ X11_bin_LDFLAGS += \ -Wl,-framework,OpenGL endif +if XQUARTZ_SPARKLE +X11_bin_LDFLAGS += \ + -Wl,-framework,Sparkle +endif + if RECORD X11_bin_LDADD += \ $(top_builddir)/record/librecord.la diff --git a/include/dix-config.h.in b/include/dix-config.h.in index 26ac22388..fcb582ff0 100644 --- a/include/dix-config.h.in +++ b/include/dix-config.h.in @@ -124,6 +124,9 @@ /* Have Quartz */ #undef XQUARTZ +/* Support application updating through sparkle. */ +#undef XQUARTZ_SPARKLE + /* Build a standalone xpbproxy */ #undef STANDALONE_XPBPROXY