diff options
author | Jeremy Huddleston <jeremyhu@freedesktop.org> | 2008-11-25 00:15:53 -0800 |
---|---|---|
committer | Jeremy Huddleston <jeremyhu@freedesktop.org> | 2008-11-25 00:54:37 -0800 |
commit | b55cad4569e34e3c10e9a327e20b91ea87d9dd98 (patch) | |
tree | 09ca2c4644f19b16658a5bf5c2bdb6c80e207563 /hw/xquartz/pbproxy | |
parent | d508a3dcca2f160021aced872715e1ded23cef97 (diff) |
XQuartz: Don't hardcode values of org.x.X11 for the preferences domain
(cherry picked from commit 3a500d9247cf34686ec17b4a88c34d51ecd38ecd)
Diffstat (limited to 'hw/xquartz/pbproxy')
-rw-r--r-- | hw/xquartz/pbproxy/app-main.m | 24 | ||||
-rw-r--r-- | hw/xquartz/pbproxy/x-selection.m | 7 |
2 files changed, 28 insertions, 3 deletions
diff --git a/hw/xquartz/pbproxy/app-main.m b/hw/xquartz/pbproxy/app-main.m index b5748dace..e4a4652fc 100644 --- a/hw/xquartz/pbproxy/app-main.m +++ b/hw/xquartz/pbproxy/app-main.m @@ -34,6 +34,9 @@ #include <unistd.h> /*for getpid*/ #include <Cocoa/Cocoa.h> +static const char *app_prefs_domain = "org.x.X11"; +CFStringRef app_prefs_domain_cfstr; + static void signal_handler (int sig) { switch(sig) { case SIGHUP: @@ -50,6 +53,27 @@ int main (int argc, const char *argv[]) { #endif xpbproxy_is_standalone = YES; + + if((s = getenv("X11_PREFS_DOMAIN"))) + app_prefs_domain = s; + + for (i = 1; i < argc; i++) { + if(strcmp (argv[i], "--prefs-domain") == 0 && i+1 < argc) { + app_prefs_domain = argv[++i]; + } else if (strcmp (argv[i], "--help") == 0) { + printf("usage: xpbproxy OPTIONS\n" + "Pasteboard proxying for X11.\n\n" + "--prefs-domain <domain> Change the domain used for reading preferences\n" + " (default: org.x.X11)\n"); + return 0; + } else { + fprintf(stderr, "usage: xpbproxy OPTIONS...\n" + "Try 'xpbproxy --help' for more information.\n"); + return 1; + } + } + + app_prefs_domain_cfstr = CFStringCreateWithCString(NULL, app_prefs_domain, kCFStringEncodingUTF8); if(!xpbproxy_init()) return EXIT_FAILURE; diff --git a/hw/xquartz/pbproxy/x-selection.m b/hw/xquartz/pbproxy/x-selection.m index 960499557..cd540be98 100644 --- a/hw/xquartz/pbproxy/x-selection.m +++ b/hw/xquartz/pbproxy/x-selection.m @@ -97,12 +97,13 @@ dump_prefs (FILE *fp) { } #endif -#define APP_PREFS "org.x.X11" +extern CFStringRef app_prefs_domain_cfstr; + static BOOL prefs_get_bool (CFStringRef key, BOOL defaultValue) { Boolean value, ok; - value = CFPreferencesGetAppBooleanValue (key, CFSTR (APP_PREFS), &ok); + value = CFPreferencesGetAppBooleanValue (key, app_prefs_domain_cfstr, &ok); return ok ? (BOOL) value : defaultValue; } @@ -1425,7 +1426,7 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato * It's uncertain how we could handle the synchronization failing, so cast to void. * The prefs_get_bool should fall back to defaults if the org.x.X11 plist doesn't exist or is invalid. */ - (void)CFPreferencesAppSynchronize(CFSTR(APP_PREFS)); + (void)CFPreferencesAppSynchronize(app_prefs_domain_cfstr); #ifdef STANDALONE_XPBPROXY if(xpbproxy_is_standalone) pbproxy_prefs.active = YES; |