xserver: Branch 'master'

Jeremy Huddleston jeremyhu at kemper.freedesktop.org
Mon Jul 20 22:04:24 PDT 2009


 configure.ac                        |   11 +++++++++--
 hw/xquartz/X11Application.h         |    2 ++
 hw/xquartz/X11Application.m         |   36 +++++++++++++++++++++++++++++++++++-
 hw/xquartz/bundle/Info.plist.cpp    |    8 ++++++++
 hw/xquartz/bundle/Makefile.am       |    4 ++++
 hw/xquartz/mach-startup/Makefile.am |    5 +++++
 include/dix-config.h.in             |    3 +++
 7 files changed, 66 insertions(+), 3 deletions(-)

New commits:
commit be4dd35ffecbf49aff13aa9f604a44c9b665ae92
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Sat Jul 18 15:51:29 2009 -0700

    XQuartz: Initial support for automatic updates through Sparkle
    (cherry picked from commit c45f1be36426bceeef9af67c26351114f14f5277)

diff --git a/configure.ac b/configure.ac
index bf709da..84613cc 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 80aee59..c02073e 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 b31634d..736d4e6 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -50,6 +50,10 @@
 #include <unistd.h>
 #include <AvailabilityMacros.h>
 
+#ifdef XQUARTZ_SPARKLE
+#include <Sparkle/SUUpdater.h>
+#endif
+
 #include <Xplugin.h>
 
 // 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 9062816..6d951ad 100644
--- a/hw/xquartz/bundle/Info.plist.cpp
+++ b/hw/xquartz/bundle/Info.plist.cpp
@@ -26,6 +26,14 @@
 		<string>x11a</string>
 	<key>CSResourcesFileMapped</key>
 		<true/>
+#ifdef XQUARTZ_SPARKLE
+	<key>SUEnableAutomaticChecks</key>
+		<true/>
+	<key>SUPublicDSAKeyFile</key>
+		<string>sparkle.pem</string>
+        <key>SUFeedURL</key>
+                <string>http://xquartz.macosforge.org/downloads/sparkle/release.xml</string>
+#endif
 	<key>NSHumanReadableCopyright</key>
 		<string>© 2003-2009 Apple Inc.
 © 2003 XFree86 Project, Inc.
diff --git a/hw/xquartz/bundle/Makefile.am b/hw/xquartz/bundle/Makefile.am
index 963327b..ea02cd6 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 0c609e3..2901b65 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 26ac223..fcb582f 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
 


More information about the xorg-commit mailing list