XQuartz: Integrated xpbproxy into the server.
Added a configure option called --enable-standalone-xpbproxy which is useful for deveoping xpbproxy. The 'active' switch in preferences just disables the in-server xpbproxy (not this standalone). (cherry picked from commit 42944936326ef8732f622db9f75b79a92980550d)
This commit is contained in:
parent
24928b85dc
commit
e8112784e8
|
@ -546,7 +546,7 @@ AC_ARG_ENABLE(dmx, AS_HELP_STRING([--enable-dmx], [Build DMX server (d
|
||||||
AC_ARG_ENABLE(xvfb, AS_HELP_STRING([--enable-xvfb], [Build Xvfb server (default: yes)]), [XVFB=$enableval], [XVFB=yes])
|
AC_ARG_ENABLE(xvfb, AS_HELP_STRING([--enable-xvfb], [Build Xvfb server (default: yes)]), [XVFB=$enableval], [XVFB=yes])
|
||||||
AC_ARG_ENABLE(xnest, AS_HELP_STRING([--enable-xnest], [Build Xnest server (default: auto)]), [XNEST=$enableval], [XNEST=auto])
|
AC_ARG_ENABLE(xnest, AS_HELP_STRING([--enable-xnest], [Build Xnest server (default: auto)]), [XNEST=$enableval], [XNEST=auto])
|
||||||
AC_ARG_ENABLE(xquartz, AS_HELP_STRING([--enable-xquartz], [Build Xquartz server for OS-X (default: auto)]), [XQUARTZ=$enableval], [XQUARTZ=auto])
|
AC_ARG_ENABLE(xquartz, AS_HELP_STRING([--enable-xquartz], [Build Xquartz server for OS-X (default: auto)]), [XQUARTZ=$enableval], [XQUARTZ=auto])
|
||||||
AC_ARG_ENABLE(integrated-xpbproxy, AS_HELP_STRING([--enable-integrated-xpbproxy], [Build xpbproxy into Xquartz as a separate thread (default: no)]), [INTEGRATED_XPBPROXY=$enableval], [INTEGRATED_XPBPROXY=no])
|
AC_ARG_ENABLE(standalone-xpbproxy, AS_HELP_STRING([--enable-standalone-xpbproxy], [Build a standalone xpbproxy (in addigion to the one integrated into Xquartz as a separate thread) (default: no)]), [STANDALONE_XPBPROXY=$enableval], [STANDALONE_XPBPROXY=no])
|
||||||
AC_ARG_ENABLE(xwin, AS_HELP_STRING([--enable-xwin], [Build XWin server (default: auto)]), [XWIN=$enableval], [XWIN=auto])
|
AC_ARG_ENABLE(xwin, AS_HELP_STRING([--enable-xwin], [Build XWin server (default: auto)]), [XWIN=$enableval], [XWIN=auto])
|
||||||
dnl kdrive and its subsystems
|
dnl kdrive and its subsystems
|
||||||
AC_ARG_ENABLE(kdrive, AS_HELP_STRING([--enable-kdrive], [Build kdrive servers (default: no)]), [KDRIVE=$enableval], [KDRIVE=no])
|
AC_ARG_ENABLE(kdrive, AS_HELP_STRING([--enable-kdrive], [Build kdrive servers (default: no)]), [KDRIVE=$enableval], [KDRIVE=no])
|
||||||
|
@ -1532,8 +1532,8 @@ if test "x$XQUARTZ" = xyes; then
|
||||||
|
|
||||||
PKG_CHECK_MODULES(APPLEWM, [applewmproto >= 1.1.1])
|
PKG_CHECK_MODULES(APPLEWM, [applewmproto >= 1.1.1])
|
||||||
|
|
||||||
if test "x$INTEGRATED_XPBPROXY" = xyes ; then
|
if test "x$STANDALONE_XPBPROXY" = xyes ; then
|
||||||
AC_DEFINE(INTEGRATED_XPBPROXY,1,[Build xpbproxy into the server rather than as a standalone app])
|
AC_DEFINE(STANDALONE_XPBPROXY,1,[Build a standalone xpbproxy])
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -1551,7 +1551,7 @@ _AM_DEPENDENCIES([OBJC])
|
||||||
AM_CONDITIONAL(HAVE_XPLUGIN, [test "x$ac_cv_lib_Xplugin_xp_init" = xyes])
|
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(HAVE_AGL_FRAMEWORK, [test "x$xorg_cv_AGL_framework" = xyes])
|
||||||
AM_CONDITIONAL(XQUARTZ, [test "x$XQUARTZ" = xyes])
|
AM_CONDITIONAL(XQUARTZ, [test "x$XQUARTZ" = xyes])
|
||||||
AM_CONDITIONAL(INTEGRATED_XPBPROXY, [test "x$INTEGRATED_XPBPROXY" = xyes])
|
AM_CONDITIONAL(STANDALONE_XPBPROXY, [test "x$STANDALONE_XPBPROXY" = xyes])
|
||||||
|
|
||||||
dnl DMX DDX
|
dnl DMX DDX
|
||||||
|
|
||||||
|
|
|
@ -13,9 +13,9 @@ if GLX
|
||||||
GL_DIR = GL
|
GL_DIR = GL
|
||||||
endif
|
endif
|
||||||
|
|
||||||
SUBDIRS = bundle . GL xpr mach-startup doc pbproxy
|
SUBDIRS = bundle . GL xpr pbproxy mach-startup doc
|
||||||
|
|
||||||
DIST_SUBDIRS = bundle . $(GL_DIR) xpr mach-startup doc pbproxy
|
DIST_SUBDIRS = bundle . $(GL_DIR) xpr pbproxy mach-startup doc
|
||||||
|
|
||||||
libXquartz_la_SOURCES = \
|
libXquartz_la_SOURCES = \
|
||||||
$(top_srcdir)/fb/fbcmap_mi.c \
|
$(top_srcdir)/fb/fbcmap_mi.c \
|
||||||
|
|
|
@ -50,6 +50,9 @@
|
||||||
|
|
||||||
#include <Xplugin.h>
|
#include <Xplugin.h>
|
||||||
|
|
||||||
|
// pbproxy/pbproxy.h
|
||||||
|
extern BOOL xpbproxy_init (void);
|
||||||
|
|
||||||
#define DEFAULTS_FILE "/usr/X11/lib/X11/xserver/Xquartz.plist"
|
#define DEFAULTS_FILE "/usr/X11/lib/X11/xserver/Xquartz.plist"
|
||||||
|
|
||||||
#ifndef XSERVER_VERSION
|
#ifndef XSERVER_VERSION
|
||||||
|
@ -884,6 +887,9 @@ void X11ApplicationMain (int argc, char **argv, char **envp) {
|
||||||
* an mieqEnqueue() - <rdar://problem/6300249>
|
* an mieqEnqueue() - <rdar://problem/6300249>
|
||||||
*/
|
*/
|
||||||
check_xinitrc();
|
check_xinitrc();
|
||||||
|
|
||||||
|
if(!xpbproxy_init())
|
||||||
|
fprintf(stderr, "Error initializing xpbproxy\n");
|
||||||
|
|
||||||
[NSApp run];
|
[NSApp run];
|
||||||
/* not reached */
|
/* not reached */
|
||||||
|
|
|
@ -17,12 +17,9 @@ X11_LDADD = \
|
||||||
$(top_builddir)/hw/xquartz/xpr/libXquartzXpr.la \
|
$(top_builddir)/hw/xquartz/xpr/libXquartzXpr.la \
|
||||||
$(top_builddir)/dix/dixfonts.lo \
|
$(top_builddir)/dix/dixfonts.lo \
|
||||||
$(top_builddir)/miext/rootless/librootless.la \
|
$(top_builddir)/miext/rootless/librootless.la \
|
||||||
|
$(top_builddir)/hw/xquartz/pbproxy/libxpbproxy.la \
|
||||||
$(DARWIN_LIBS) $(XSERVER_LIBS) $(XSERVER_SYS_LIBS) -lXplugin -lX11
|
$(DARWIN_LIBS) $(XSERVER_LIBS) $(XSERVER_SYS_LIBS) -lXplugin -lX11
|
||||||
|
|
||||||
if INTEGRATED_XPBPROXY
|
|
||||||
X11_LDADD += $(top_builddir)/hw/xquartz/pbproxy/libxpbproxy.la
|
|
||||||
endif
|
|
||||||
|
|
||||||
X11_LDFLAGS = \
|
X11_LDFLAGS = \
|
||||||
-XCClinker -Objc \
|
-XCClinker -Objc \
|
||||||
-Wl,-u,_miDCInitialize \
|
-Wl,-u,_miDCInitialize \
|
||||||
|
|
|
@ -1,16 +1,14 @@
|
||||||
AM_CPPFLAGS=-F/System/Library/Frameworks/ApplicationServices.framework/Frameworks
|
AM_CPPFLAGS=-F/System/Library/Frameworks/ApplicationServices.framework/Frameworks
|
||||||
AM_LDFLAGS=-L/usr/X11/lib -lX11 -lXfixes -lAppleWM -framework AppKit -framework Foundation -framework ApplicationServices
|
AM_LDFLAGS=-L/usr/X11/lib -lX11 -lXfixes -lAppleWM -framework AppKit -framework Foundation -framework ApplicationServices
|
||||||
|
|
||||||
SOURCE_FILES = \
|
noinst_LTLIBRARIES = libxpbproxy.la
|
||||||
|
libxpbproxy_la_SOURCES = \
|
||||||
trick_autotools.c \
|
trick_autotools.c \
|
||||||
main.m \
|
main.m \
|
||||||
x-input.m \
|
x-input.m \
|
||||||
x-selection.m
|
x-selection.m
|
||||||
|
|
||||||
noinst_LTLIBRARIES = libxpbproxy.la
|
if STANDALONE_XPBPROXY
|
||||||
libxpbproxy_la_SOURCES = $(SOURCE_FILES)
|
|
||||||
|
|
||||||
if !INTEGRATED_XPBPROXY
|
|
||||||
|
|
||||||
bin_PROGRAMS = xpbproxy
|
bin_PROGRAMS = xpbproxy
|
||||||
xpbproxy_SOURCES = app-main.m
|
xpbproxy_SOURCES = app-main.m
|
||||||
|
|
|
@ -10,12 +10,10 @@
|
||||||
#include <unistd.h> /*for getpid*/
|
#include <unistd.h> /*for getpid*/
|
||||||
#include <Cocoa/Cocoa.h>
|
#include <Cocoa/Cocoa.h>
|
||||||
|
|
||||||
BOOL prefs_reload = NO;
|
|
||||||
|
|
||||||
static void signal_handler (int sig) {
|
static void signal_handler (int sig) {
|
||||||
switch(sig) {
|
switch(sig) {
|
||||||
case SIGHUP:
|
case SIGHUP:
|
||||||
prefs_reload = YES;
|
xpbproxy_prefs_reload = YES;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
_exit(EXIT_SUCCESS);
|
_exit(EXIT_SUCCESS);
|
||||||
|
@ -23,11 +21,13 @@ static void signal_handler (int sig) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int main (int argc, const char *argv[]) {
|
int main (int argc, const char *argv[]) {
|
||||||
#ifdef TEST
|
#ifdef DEBUG
|
||||||
printf("pid: %u\n", getpid());
|
printf("pid: %u\n", getpid());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(!x_init())
|
xpbproxy_is_standalone = YES;
|
||||||
|
|
||||||
|
if(!xpbproxy_init())
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
|
||||||
signal (SIGINT, signal_handler);
|
signal (SIGINT, signal_handler);
|
||||||
|
|
|
@ -9,10 +9,14 @@
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <X11/extensions/applewm.h>
|
#include <X11/extensions/applewm.h>
|
||||||
|
|
||||||
Display *x_dpy;
|
Display *xpbproxy_dpy;
|
||||||
int x_apple_wm_event_base, x_apple_wm_error_base;
|
int xpbproxy_apple_wm_event_base, xpbproxy_apple_wm_error_base;
|
||||||
int x_xfixes_event_base, x_xfixes_error_base;
|
int xpbproxy_xfixes_event_base, xpbproxy_xfixes_error_base;
|
||||||
BOOL have_xfixes;
|
BOOL xpbproxy_have_xfixes;
|
||||||
|
|
||||||
|
#ifdef STANDALONE_XPBPROXY
|
||||||
|
BOOL xpbproxy_is_standalone = NO;
|
||||||
|
#endif
|
||||||
|
|
||||||
x_selection *_selection_object;
|
x_selection *_selection_object;
|
||||||
|
|
||||||
|
@ -21,11 +25,15 @@ static int x_io_error_handler (Display *dpy) {
|
||||||
|
|
||||||
TRACE ();
|
TRACE ();
|
||||||
|
|
||||||
/* TODO: trigger the thread to restart? */
|
/* trigger the thread to restart?
|
||||||
#ifndef INTEGRATED_XPBPROXY
|
* NO - this would be to a "deeper" problem, and restarts would just
|
||||||
exit(1);
|
* make things worse...
|
||||||
|
*/
|
||||||
|
#ifdef STANDALONE_XPBPROXY
|
||||||
|
if(xpbproxy_is_standalone)
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,45 +41,50 @@ static int x_error_handler (Display *dpy, XErrorEvent *errevent) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL x_init (void) {
|
BOOL xpbproxy_init (void) {
|
||||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||||
|
|
||||||
x_dpy = XOpenDisplay (NULL);
|
xpbproxy_dpy = XOpenDisplay (NULL);
|
||||||
if (x_dpy == NULL) {
|
if (xpbproxy_dpy == NULL) {
|
||||||
fprintf (stderr, "can't open default display\n");
|
fprintf (stderr, "can't open default display\n");
|
||||||
|
[pool release];
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
XSetIOErrorHandler (x_io_error_handler);
|
XSetIOErrorHandler (x_io_error_handler);
|
||||||
XSetErrorHandler (x_error_handler);
|
XSetErrorHandler (x_error_handler);
|
||||||
|
|
||||||
if (!XAppleWMQueryExtension (x_dpy, &x_apple_wm_event_base,
|
if (!XAppleWMQueryExtension (xpbproxy_dpy, &xpbproxy_apple_wm_event_base,
|
||||||
&x_apple_wm_error_base)) {
|
&xpbproxy_apple_wm_error_base)) {
|
||||||
fprintf (stderr, "can't open AppleWM server extension\n");
|
fprintf (stderr, "can't open AppleWM server extension\n");
|
||||||
|
[pool release];
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
have_xfixes = XFixesQueryExtension(x_dpy, &x_xfixes_event_base, &x_xfixes_error_base);
|
xpbproxy_have_xfixes = XFixesQueryExtension(xpbproxy_dpy, &xpbproxy_xfixes_event_base, &xpbproxy_xfixes_error_base);
|
||||||
|
|
||||||
XAppleWMSelectInput (x_dpy, AppleWMActivationNotifyMask |
|
XAppleWMSelectInput (xpbproxy_dpy, AppleWMActivationNotifyMask |
|
||||||
AppleWMPasteboardNotifyMask);
|
AppleWMPasteboardNotifyMask);
|
||||||
|
|
||||||
_selection_object = [[x_selection alloc] init];
|
_selection_object = [[x_selection alloc] init];
|
||||||
|
|
||||||
if(!x_input_register())
|
if(!xpbproxy_input_register()) {
|
||||||
|
[pool release];
|
||||||
return FALSE;
|
return FALSE;
|
||||||
x_input_run();
|
}
|
||||||
|
|
||||||
|
xpbproxy_input_run();
|
||||||
|
|
||||||
[pool release];
|
[pool release];
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
id x_selection_object (void) {
|
id xpbproxy_selection_object (void) {
|
||||||
return _selection_object;
|
return _selection_object;
|
||||||
}
|
}
|
||||||
|
|
||||||
Time x_current_timestamp (void) {
|
Time xpbproxy_current_timestamp (void) {
|
||||||
/* FIXME: may want to fetch a timestamp from the server.. */
|
/* FIXME: may want to fetch a timestamp from the server.. */
|
||||||
return CurrentTime;
|
return CurrentTime;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,25 +12,34 @@
|
||||||
#include <X11/extensions/shape.h>
|
#include <X11/extensions/shape.h>
|
||||||
#undef Cursor
|
#undef Cursor
|
||||||
|
|
||||||
#ifndef INTEGRATED_XPBPROXY
|
#ifdef STANDALONE_XPBPROXY
|
||||||
extern BOOL prefs_reload;
|
/* Just used for the standalone to respond to SIGHUP to reload prefs */
|
||||||
|
extern BOOL xpbproxy_prefs_reload;
|
||||||
|
|
||||||
|
/* Setting this to YES (for the standalone app) causes us to ignore the
|
||||||
|
* 'sync_pasteboard' defaults preference since we assume it to be on... this is
|
||||||
|
* mainly useful for debugging/developing xpbproxy with XQuartz still running.
|
||||||
|
* Just disable the one in the server with X11's preference pane, then run
|
||||||
|
* the standalone app.
|
||||||
|
*/
|
||||||
|
extern BOOL xpbproxy_is_standalone;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* from main.m */
|
/* from main.m */
|
||||||
extern void x_set_is_active (BOOL state);
|
extern void xpbproxy_set_is_active (BOOL state);
|
||||||
extern BOOL x_get_is_active (void);
|
extern BOOL xpbproxy_get_is_active (void);
|
||||||
extern id x_selection_object (void);
|
extern id xpbproxy_selection_object (void);
|
||||||
extern Time x_current_timestamp (void);
|
extern Time xpbproxy_current_timestamp (void);
|
||||||
extern BOOL x_init (void);
|
extern BOOL xpbproxy_init (void);
|
||||||
|
|
||||||
extern Display *x_dpy;
|
extern Display *xpbproxy_dpy;
|
||||||
extern int x_apple_wm_event_base, x_apple_wm_error_base;
|
extern int xpbproxy_apple_wm_event_base, xpbproxy_apple_wm_error_base;
|
||||||
extern int x_xfixes_event_base, x_xfixes_error_base;
|
extern int xpbproxy_xfixes_event_base, xpbproxy_xfixes_error_base;
|
||||||
extern BOOL have_xfixes;
|
extern BOOL xpbproxy_have_xfixes;
|
||||||
|
|
||||||
/* from x-input.m */
|
/* from x-input.m */
|
||||||
extern BOOL x_input_register (void);
|
extern BOOL xpbproxy_input_register (void);
|
||||||
extern void x_input_run (void);
|
extern void xpbproxy_input_run (void);
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
/* BEWARE: this can cause a string memory leak, according to the leaks program. */
|
/* BEWARE: this can cause a string memory leak, according to the leaks program. */
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
/* app-main.m
|
||||||
|
$Id: main.m,v 1.29 2007-04-07 20:39:03 jharper Exp $
|
||||||
|
|
||||||
|
Copyright (c) 2002, 2008 Apple Computer, Inc. All rights reserved. */
|
||||||
|
|
||||||
|
#include "pbproxy.h"
|
||||||
|
#import "x-selection.h"
|
||||||
|
|
||||||
|
#include <pthread.h>
|
||||||
|
#include <unistd.h> /*for getpid*/
|
||||||
|
#include <Cocoa/Cocoa.h>
|
||||||
|
|
||||||
|
static void signal_handler (int sig) {
|
||||||
|
switch(sig) {
|
||||||
|
case SIGHUP:
|
||||||
|
xpbproxy_prefs_reload = YES;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
_exit(EXIT_SUCCESS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int main (int argc, const char *argv[]) {
|
||||||
|
#ifdef DEBUG
|
||||||
|
printf("pid: %u\n", getpid());
|
||||||
|
#endif
|
||||||
|
|
||||||
|
xpbproxy_is_standalone = YES;
|
||||||
|
|
||||||
|
if(!xpbproxy_init())
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
|
||||||
|
signal (SIGINT, signal_handler);
|
||||||
|
signal (SIGTERM, signal_handler);
|
||||||
|
signal (SIGHUP, signal_handler);
|
||||||
|
signal (SIGPIPE, SIG_IGN);
|
||||||
|
|
||||||
|
[NSApplication sharedApplication];
|
||||||
|
[NSApp run];
|
||||||
|
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
|
@ -15,21 +15,25 @@
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
static CFRunLoopSourceRef x_dpy_source;
|
static CFRunLoopSourceRef xpbproxy_dpy_source;
|
||||||
|
|
||||||
|
#ifdef STANDALONE_XPBPROXY
|
||||||
|
BOOL xpbproxy_prefs_reload = NO;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Timestamp when the X server last told us it's active */
|
/* Timestamp when the X server last told us it's active */
|
||||||
static Time last_activation_time;
|
static Time last_activation_time;
|
||||||
|
|
||||||
static void x_event_apple_wm_notify(XAppleWMNotifyEvent *e) {
|
static void x_event_apple_wm_notify(XAppleWMNotifyEvent *e) {
|
||||||
int type = e->type - x_apple_wm_event_base;
|
int type = e->type - xpbproxy_apple_wm_event_base;
|
||||||
int kind = e->kind;
|
int kind = e->kind;
|
||||||
|
|
||||||
/* We want to reload prefs even if we're not active */
|
/* We want to reload prefs even if we're not active */
|
||||||
if(type == AppleWMActivationNotify &&
|
if(type == AppleWMActivationNotify &&
|
||||||
kind == AppleWMReloadPreferences)
|
kind == AppleWMReloadPreferences)
|
||||||
[x_selection_object() reload_preferences];
|
[xpbproxy_selection_object() reload_preferences];
|
||||||
|
|
||||||
if(![x_selection_object() is_active])
|
if(![xpbproxy_selection_object() is_active])
|
||||||
return;
|
return;
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
@ -37,11 +41,11 @@ static void x_event_apple_wm_notify(XAppleWMNotifyEvent *e) {
|
||||||
switch (kind) {
|
switch (kind) {
|
||||||
case AppleWMIsActive:
|
case AppleWMIsActive:
|
||||||
last_activation_time = e->time;
|
last_activation_time = e->time;
|
||||||
[x_selection_object() x_active:e->time];
|
[xpbproxy_selection_object() x_active:e->time];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AppleWMIsInactive:
|
case AppleWMIsInactive:
|
||||||
[x_selection_object() x_inactive:e->time];
|
[xpbproxy_selection_object() x_inactive:e->time];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -49,13 +53,13 @@ static void x_event_apple_wm_notify(XAppleWMNotifyEvent *e) {
|
||||||
case AppleWMPasteboardNotify:
|
case AppleWMPasteboardNotify:
|
||||||
switch (kind) {
|
switch (kind) {
|
||||||
case AppleWMCopyToPasteboard:
|
case AppleWMCopyToPasteboard:
|
||||||
[x_selection_object() x_copy:e->time];
|
[xpbproxy_selection_object() x_copy:e->time];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void x_input_run (void) {
|
void xpbproxy_input_run (void) {
|
||||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||||
|
|
||||||
if (nil == pool)
|
if (nil == pool)
|
||||||
|
@ -64,39 +68,39 @@ void x_input_run (void) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (XPending (x_dpy) != 0) {
|
while (XPending (xpbproxy_dpy) != 0) {
|
||||||
XEvent e;
|
XEvent e;
|
||||||
XNextEvent (x_dpy, &e);
|
XNextEvent (xpbproxy_dpy, &e);
|
||||||
|
|
||||||
switch (e.type) {
|
switch (e.type) {
|
||||||
case SelectionClear:
|
case SelectionClear:
|
||||||
if([x_selection_object() is_active])
|
if([xpbproxy_selection_object() is_active])
|
||||||
[x_selection_object () clear_event:&e.xselectionclear];
|
[xpbproxy_selection_object () clear_event:&e.xselectionclear];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SelectionRequest:
|
case SelectionRequest:
|
||||||
[x_selection_object () request_event:&e.xselectionrequest];
|
[xpbproxy_selection_object () request_event:&e.xselectionrequest];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SelectionNotify:
|
case SelectionNotify:
|
||||||
[x_selection_object () notify_event:&e.xselection];
|
[xpbproxy_selection_object () notify_event:&e.xselection];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PropertyNotify:
|
case PropertyNotify:
|
||||||
[x_selection_object () property_event:&e.xproperty];
|
[xpbproxy_selection_object () property_event:&e.xproperty];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if(e.type >= x_apple_wm_event_base &&
|
if(e.type >= xpbproxy_apple_wm_event_base &&
|
||||||
e.type < x_apple_wm_event_base + AppleWMNumberEvents) {
|
e.type < xpbproxy_apple_wm_event_base + AppleWMNumberEvents) {
|
||||||
x_event_apple_wm_notify((XAppleWMNotifyEvent *) &e);
|
x_event_apple_wm_notify((XAppleWMNotifyEvent *) &e);
|
||||||
} else if(e.type == x_xfixes_event_base + XFixesSelectionNotify) {
|
} else if(e.type == xpbproxy_xfixes_event_base + XFixesSelectionNotify) {
|
||||||
[x_selection_object() xfixes_selection_notify:(XFixesSelectionNotifyEvent *)&e];
|
[xpbproxy_selection_object() xfixes_selection_notify:(XFixesSelectionNotifyEvent *)&e];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
XFlush(x_dpy);
|
XFlush(xpbproxy_dpy);
|
||||||
}
|
}
|
||||||
|
|
||||||
[pool release];
|
[pool release];
|
||||||
|
@ -129,17 +133,17 @@ static BOOL add_input_socket (int sock, CFOptionFlags callback_types,
|
||||||
static void x_input_callback (CFSocketRef sock, CFSocketCallBackType type,
|
static void x_input_callback (CFSocketRef sock, CFSocketCallBackType type,
|
||||||
CFDataRef address, const void *data, void *info) {
|
CFDataRef address, const void *data, void *info) {
|
||||||
|
|
||||||
#ifndef INTEGRATED_XPBPROXY
|
#ifdef STANDALONE_XPBPROXY
|
||||||
if(prefs_reload) {
|
if(xpbproxy_prefs_reload) {
|
||||||
[x_selection_object() reload_preferences];
|
[xpbproxy_selection_object() reload_preferences];
|
||||||
prefs_reload = NO;
|
xpbproxy_prefs_reload = NO;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
x_input_run();
|
xpbproxy_input_run();
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL x_input_register(void) {
|
BOOL xpbproxy_input_register(void) {
|
||||||
return add_input_socket(ConnectionNumber(x_dpy), kCFSocketReadCallBack,
|
return add_input_socket(ConnectionNumber(xpbproxy_dpy), kCFSocketReadCallBack,
|
||||||
x_input_callback, NULL, &x_dpy_source);
|
x_input_callback, NULL, &xpbproxy_dpy_source);
|
||||||
}
|
}
|
||||||
|
|
|
@ -155,7 +155,7 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
|
||||||
printf("bytesleft %lu\n", bytesleft);
|
printf("bytesleft %lu\n", bytesleft);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (Success != XGetWindowProperty (x_dpy, win, property,
|
if (Success != XGetWindowProperty (xpbproxy_dpy, win, property,
|
||||||
offset, length, delete,
|
offset, length, delete,
|
||||||
AnyPropertyType,
|
AnyPropertyType,
|
||||||
type, &format, &numitems,
|
type, &format, &numitems,
|
||||||
|
@ -171,7 +171,7 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
|
||||||
printf("format %d numitems %lu bytesleft %lu\n",
|
printf("format %d numitems %lu bytesleft %lu\n",
|
||||||
format, numitems, bytesleft);
|
format, numitems, bytesleft);
|
||||||
|
|
||||||
printf("type %s\n", XGetAtomName (x_dpy, *type));
|
printf("type %s\n", XGetAtomName (xpbproxy_dpy, *type));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Format is the number of bits. */
|
/* Format is the number of bits. */
|
||||||
|
@ -257,7 +257,7 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char *type = XGetAtomName(x_dpy, a);
|
char *type = XGetAtomName(xpbproxy_dpy, a);
|
||||||
if (type)
|
if (type)
|
||||||
{
|
{
|
||||||
DB("Unhandled X11 mime type: %s", type);
|
DB("Unhandled X11 mime type: %s", type);
|
||||||
|
@ -293,7 +293,7 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
|
||||||
|
|
||||||
TRACE ();
|
TRACE ();
|
||||||
|
|
||||||
if (Success != XGetWindowProperty (x_dpy, e->requestor, e->property,
|
if (Success != XGetWindowProperty (xpbproxy_dpy, e->requestor, e->property,
|
||||||
/*offset*/ 0L, /*length*/ 4UL,
|
/*offset*/ 0L, /*length*/ 4UL,
|
||||||
/*Delete*/ False,
|
/*Delete*/ False,
|
||||||
AnyPropertyType, &seltype, &format,
|
AnyPropertyType, &seltype, &format,
|
||||||
|
@ -378,7 +378,7 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
|
||||||
|
|
||||||
if (pbproxy_prefs.pasteboard_to_primary)
|
if (pbproxy_prefs.pasteboard_to_primary)
|
||||||
{
|
{
|
||||||
XSetSelectionOwner (x_dpy, atoms->primary, _selection_window, CurrentTime);
|
XSetSelectionOwner (xpbproxy_dpy, atoms->primary, _selection_window, CurrentTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pbproxy_prefs.pasteboard_to_clipboard) {
|
if (pbproxy_prefs.pasteboard_to_clipboard) {
|
||||||
|
@ -393,9 +393,9 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
|
||||||
/* Pasteboard has data we should proxy; I think it makes
|
/* Pasteboard has data we should proxy; I think it makes
|
||||||
sense to put it on both CLIPBOARD and PRIMARY */
|
sense to put it on both CLIPBOARD and PRIMARY */
|
||||||
|
|
||||||
XSetSelectionOwner (x_dpy, atoms->clipboard,
|
XSetSelectionOwner (xpbproxy_dpy, atoms->clipboard,
|
||||||
_selection_window, timestamp);
|
_selection_window, timestamp);
|
||||||
XSetSelectionOwner (x_dpy, atoms->primary,
|
XSetSelectionOwner (xpbproxy_dpy, atoms->primary,
|
||||||
_selection_window, timestamp);
|
_selection_window, timestamp);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -413,7 +413,7 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
|
||||||
TRACE ();
|
TRACE ();
|
||||||
|
|
||||||
request_atom = atoms->targets;
|
request_atom = atoms->targets;
|
||||||
XConvertSelection (x_dpy, atoms->primary, atoms->targets,
|
XConvertSelection (xpbproxy_dpy, atoms->primary, atoms->targets,
|
||||||
atoms->primary, _selection_window, CurrentTime);
|
atoms->primary, _selection_window, CurrentTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -425,7 +425,7 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
|
||||||
|
|
||||||
TRACE ();
|
TRACE ();
|
||||||
|
|
||||||
w = XGetSelectionOwner (x_dpy, atoms->primary);
|
w = XGetSelectionOwner (xpbproxy_dpy, atoms->primary);
|
||||||
|
|
||||||
if (None != w)
|
if (None != w)
|
||||||
{
|
{
|
||||||
|
@ -442,7 +442,7 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
XBell (x_dpy, 0);
|
XBell (xpbproxy_dpy, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -454,7 +454,7 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
|
||||||
{
|
{
|
||||||
TRACE ();
|
TRACE ();
|
||||||
|
|
||||||
Window owner = XGetSelectionOwner (x_dpy, atoms->clipboard_manager);
|
Window owner = XGetSelectionOwner (xpbproxy_dpy, atoms->clipboard_manager);
|
||||||
|
|
||||||
if(value) {
|
if(value) {
|
||||||
if(owner == _selection_window)
|
if(owner == _selection_window)
|
||||||
|
@ -467,14 +467,14 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
XSetSelectionOwner(x_dpy, atoms->clipboard_manager, _selection_window, CurrentTime);
|
XSetSelectionOwner(xpbproxy_dpy, atoms->clipboard_manager, _selection_window, CurrentTime);
|
||||||
return (_selection_window == XGetSelectionOwner(x_dpy, atoms->clipboard_manager));
|
return (_selection_window == XGetSelectionOwner(xpbproxy_dpy, atoms->clipboard_manager));
|
||||||
} else {
|
} else {
|
||||||
if(owner != _selection_window)
|
if(owner != _selection_window)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
XSetSelectionOwner(x_dpy, atoms->clipboard_manager, None, CurrentTime);
|
XSetSelectionOwner(xpbproxy_dpy, atoms->clipboard_manager, None, CurrentTime);
|
||||||
return(None == XGetSelectionOwner(x_dpy, atoms->clipboard_manager));
|
return(None == XGetSelectionOwner(xpbproxy_dpy, atoms->clipboard_manager));
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -490,7 +490,7 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
|
||||||
|
|
||||||
TRACE ();
|
TRACE ();
|
||||||
|
|
||||||
DB ("e->selection %s\n", XGetAtomName (x_dpy, e->selection));
|
DB ("e->selection %s\n", XGetAtomName (xpbproxy_dpy, e->selection));
|
||||||
|
|
||||||
if(e->selection == atoms->clipboard) {
|
if(e->selection == atoms->clipboard) {
|
||||||
/*
|
/*
|
||||||
|
@ -526,7 +526,7 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
|
||||||
if (!pbproxy_prefs.clipboard_to_pasteboard)
|
if (!pbproxy_prefs.clipboard_to_pasteboard)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
owner = XGetSelectionOwner (x_dpy, atoms->clipboard);
|
owner = XGetSelectionOwner (xpbproxy_dpy, atoms->clipboard);
|
||||||
if (None == owner) {
|
if (None == owner) {
|
||||||
/*
|
/*
|
||||||
* The owner probably died or we are just starting up pbproxy.
|
* The owner probably died or we are just starting up pbproxy.
|
||||||
|
@ -543,9 +543,9 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
|
||||||
DB ("requesting targets\n");
|
DB ("requesting targets\n");
|
||||||
|
|
||||||
request_atom = atoms->targets;
|
request_atom = atoms->targets;
|
||||||
XConvertSelection (x_dpy, atoms->clipboard, atoms->targets,
|
XConvertSelection (xpbproxy_dpy, atoms->clipboard, atoms->targets,
|
||||||
atoms->clipboard, _selection_window, CurrentTime);
|
atoms->clipboard, _selection_window, CurrentTime);
|
||||||
XFlush (x_dpy);
|
XFlush (xpbproxy_dpy);
|
||||||
/* Now we will get a SelectionNotify event in the future. */
|
/* Now we will get a SelectionNotify event in the future. */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -558,9 +558,9 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
|
||||||
/* We should perhaps have a boundary limit on the number of iterations... */
|
/* We should perhaps have a boundary limit on the number of iterations... */
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
XSetSelectionOwner (x_dpy, atoms->clipboard, _selection_window,
|
XSetSelectionOwner (xpbproxy_dpy, atoms->clipboard, _selection_window,
|
||||||
CurrentTime);
|
CurrentTime);
|
||||||
} while (_selection_window != XGetSelectionOwner (x_dpy,
|
} while (_selection_window != XGetSelectionOwner (xpbproxy_dpy,
|
||||||
atoms->clipboard));
|
atoms->clipboard));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -582,8 +582,8 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
|
||||||
*/
|
*/
|
||||||
DB ("reply->xselection.requestor 0x%lx\n", reply->xselection.requestor);
|
DB ("reply->xselection.requestor 0x%lx\n", reply->xselection.requestor);
|
||||||
|
|
||||||
XSendEvent (x_dpy, reply->xselection.requestor, False, 0, reply);
|
XSendEvent (xpbproxy_dpy, reply->xselection.requestor, False, 0, reply);
|
||||||
XFlush (x_dpy);
|
XFlush (xpbproxy_dpy);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -644,7 +644,7 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
|
||||||
if (count)
|
if (count)
|
||||||
{
|
{
|
||||||
/* We have a list of ATOMs to send. */
|
/* We have a list of ATOMs to send. */
|
||||||
XChangeProperty (x_dpy, e->requestor, e->property, atoms->atom, 32,
|
XChangeProperty (xpbproxy_dpy, e->requestor, e->property, atoms->atom, 32,
|
||||||
PropModeReplace, (unsigned char *) list, count);
|
PropModeReplace, (unsigned char *) list, count);
|
||||||
|
|
||||||
reply.xselection.property = e->property;
|
reply.xselection.property = e->property;
|
||||||
|
@ -707,9 +707,9 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
|
||||||
length = [data lengthOfBytesUsingEncoding:NSISOLatin1StringEncoding];
|
length = [data lengthOfBytesUsingEncoding:NSISOLatin1StringEncoding];
|
||||||
}
|
}
|
||||||
|
|
||||||
DB ("e->target %s\n", XGetAtomName (x_dpy, e->target));
|
DB ("e->target %s\n", XGetAtomName (xpbproxy_dpy, e->target));
|
||||||
|
|
||||||
XChangeProperty (x_dpy, e->requestor, e->property, e->target,
|
XChangeProperty (xpbproxy_dpy, e->requestor, e->property, e->target,
|
||||||
8, PropModeReplace, (unsigned char *) bytes, length);
|
8, PropModeReplace, (unsigned char *) bytes, length);
|
||||||
|
|
||||||
reply.xselection.property = e->property;
|
reply.xselection.property = e->property;
|
||||||
|
@ -743,7 +743,7 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
|
||||||
|
|
||||||
textprop.value = NULL;
|
textprop.value = NULL;
|
||||||
|
|
||||||
if (Success == Xutf8TextListToTextProperty (x_dpy, list, 1,
|
if (Success == Xutf8TextListToTextProperty (xpbproxy_dpy, list, 1,
|
||||||
XCompoundTextStyle,
|
XCompoundTextStyle,
|
||||||
&textprop))
|
&textprop))
|
||||||
{
|
{
|
||||||
|
@ -752,7 +752,7 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
|
||||||
DB ("textprop.format is unexpectedly not 8 - it's %d instead\n",
|
DB ("textprop.format is unexpectedly not 8 - it's %d instead\n",
|
||||||
textprop.format);
|
textprop.format);
|
||||||
|
|
||||||
XChangeProperty (x_dpy, e->requestor, e->property,
|
XChangeProperty (xpbproxy_dpy, e->requestor, e->property,
|
||||||
atoms->compound_text, textprop.format,
|
atoms->compound_text, textprop.format,
|
||||||
PropModeReplace, textprop.value,
|
PropModeReplace, textprop.value,
|
||||||
textprop.nitems);
|
textprop.nitems);
|
||||||
|
@ -857,7 +857,7 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
|
||||||
length = [encdata length];
|
length = [encdata length];
|
||||||
bytes = [encdata bytes];
|
bytes = [encdata bytes];
|
||||||
|
|
||||||
XChangeProperty (x_dpy, e->requestor, e->property, e->target,
|
XChangeProperty (xpbproxy_dpy, e->requestor, e->property, e->target,
|
||||||
8, PropModeReplace, bytes, length);
|
8, PropModeReplace, bytes, length);
|
||||||
reply.xselection.property = e->property;
|
reply.xselection.property = e->property;
|
||||||
|
|
||||||
|
@ -895,7 +895,7 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
|
||||||
length = [encdata length];
|
length = [encdata length];
|
||||||
bytes = [encdata bytes];
|
bytes = [encdata bytes];
|
||||||
|
|
||||||
XChangeProperty (x_dpy, e->requestor, e->property, e->target,
|
XChangeProperty (xpbproxy_dpy, e->requestor, e->property, e->target,
|
||||||
8, PropModeReplace, bytes, length);
|
8, PropModeReplace, bytes, length);
|
||||||
reply.xselection.property = e->property;
|
reply.xselection.property = e->property;
|
||||||
|
|
||||||
|
@ -981,7 +981,7 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
|
||||||
|
|
||||||
|
|
||||||
if (None != e->target)
|
if (None != e->target)
|
||||||
DB ("e->target %s\n", XGetAtomName (x_dpy, e->target));
|
DB ("e->target %s\n", XGetAtomName (xpbproxy_dpy, e->target));
|
||||||
|
|
||||||
if (e->target == atoms->targets)
|
if (e->target == atoms->targets)
|
||||||
{
|
{
|
||||||
|
@ -1040,8 +1040,8 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
printf ("e->selection %s\n", XGetAtomName (x_dpy, e->selection));
|
printf ("e->selection %s\n", XGetAtomName (xpbproxy_dpy, e->selection));
|
||||||
printf ("e->property %s\n", XGetAtomName (x_dpy, e->property));
|
printf ("e->property %s\n", XGetAtomName (xpbproxy_dpy, e->property));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ([self is_incr_type:e])
|
if ([self is_incr_type:e])
|
||||||
|
@ -1096,7 +1096,7 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
|
||||||
if (None != e->atom)
|
if (None != e->atom)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
char *name = XGetAtomName (x_dpy, e->atom);
|
char *name = XGetAtomName (xpbproxy_dpy, e->atom);
|
||||||
|
|
||||||
if (name)
|
if (name)
|
||||||
{
|
{
|
||||||
|
@ -1176,7 +1176,7 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
|
||||||
|
|
||||||
(void)name; /* Avoid a warning with non-debug compiles. */
|
(void)name; /* Avoid a warning with non-debug compiles. */
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
name = XGetAtomName (x_dpy, preferred);
|
name = XGetAtomName (xpbproxy_dpy, preferred);
|
||||||
|
|
||||||
if (name)
|
if (name)
|
||||||
{
|
{
|
||||||
|
@ -1184,7 +1184,7 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
request_atom = preferred;
|
request_atom = preferred;
|
||||||
XConvertSelection (x_dpy, selection, preferred, selection,
|
XConvertSelection (xpbproxy_dpy, selection, preferred, selection,
|
||||||
_selection_window, CurrentTime);
|
_selection_window, CurrentTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1375,7 +1375,7 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
|
||||||
|
|
||||||
(void)name; /* Avoid warning with non-debug compiles. */
|
(void)name; /* Avoid warning with non-debug compiles. */
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
name = XGetAtomName (x_dpy, selection);
|
name = XGetAtomName (xpbproxy_dpy, selection);
|
||||||
if (name)
|
if (name)
|
||||||
{
|
{
|
||||||
DB ("copy_completed: %s\n", name);
|
DB ("copy_completed: %s\n", name);
|
||||||
|
@ -1427,7 +1427,11 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
|
||||||
* The prefs_get_bool should fall back to defaults if the org.x.X11 plist doesn't exist or is invalid.
|
* 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(CFSTR(APP_PREFS));
|
||||||
|
#ifdef STANDALONE_XPBPROXY
|
||||||
|
if(xpbproxy_is_standalone)
|
||||||
|
pbproxy_prefs.active = YES;
|
||||||
|
else
|
||||||
|
#endif
|
||||||
pbproxy_prefs.active = prefs_get_bool(CFSTR("sync_pasteboard"), pbproxy_prefs.active);
|
pbproxy_prefs.active = prefs_get_bool(CFSTR("sync_pasteboard"), pbproxy_prefs.active);
|
||||||
pbproxy_prefs.primary_on_grab = prefs_get_bool(CFSTR("sync_primary_on_select"), pbproxy_prefs.primary_on_grab);
|
pbproxy_prefs.primary_on_grab = prefs_get_bool(CFSTR("sync_primary_on_select"), pbproxy_prefs.primary_on_grab);
|
||||||
pbproxy_prefs.clipboard_to_pasteboard = prefs_get_bool(CFSTR("sync_clipboard_to_pasteboard"), pbproxy_prefs.clipboard_to_pasteboard);
|
pbproxy_prefs.clipboard_to_pasteboard = prefs_get_bool(CFSTR("sync_clipboard_to_pasteboard"), pbproxy_prefs.clipboard_to_pasteboard);
|
||||||
|
@ -1437,7 +1441,7 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
|
||||||
/* This is used for debugging. */
|
/* This is used for debugging. */
|
||||||
//dump_prefs(stdout);
|
//dump_prefs(stdout);
|
||||||
|
|
||||||
if(pbproxy_prefs.active && pbproxy_prefs.primary_on_grab && !have_xfixes) {
|
if(pbproxy_prefs.active && pbproxy_prefs.primary_on_grab && !xpbproxy_have_xfixes) {
|
||||||
fprintf(stderr, "Disabling sync_primary_on_select functionality due to missing XFixes extension.\n");
|
fprintf(stderr, "Disabling sync_primary_on_select functionality due to missing XFixes extension.\n");
|
||||||
pbproxy_prefs.primary_on_grab = NO;
|
pbproxy_prefs.primary_on_grab = NO;
|
||||||
}
|
}
|
||||||
|
@ -1484,28 +1488,28 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
|
||||||
if (self == nil)
|
if (self == nil)
|
||||||
return nil;
|
return nil;
|
||||||
|
|
||||||
atoms->primary = XInternAtom (x_dpy, "PRIMARY", False);
|
atoms->primary = XInternAtom (xpbproxy_dpy, "PRIMARY", False);
|
||||||
atoms->clipboard = XInternAtom (x_dpy, "CLIPBOARD", False);
|
atoms->clipboard = XInternAtom (xpbproxy_dpy, "CLIPBOARD", False);
|
||||||
atoms->text = XInternAtom (x_dpy, "TEXT", False);
|
atoms->text = XInternAtom (xpbproxy_dpy, "TEXT", False);
|
||||||
atoms->utf8_string = XInternAtom (x_dpy, "UTF8_STRING", False);
|
atoms->utf8_string = XInternAtom (xpbproxy_dpy, "UTF8_STRING", False);
|
||||||
atoms->string = XInternAtom (x_dpy, "STRING", False);
|
atoms->string = XInternAtom (xpbproxy_dpy, "STRING", False);
|
||||||
atoms->targets = XInternAtom (x_dpy, "TARGETS", False);
|
atoms->targets = XInternAtom (xpbproxy_dpy, "TARGETS", False);
|
||||||
atoms->multiple = XInternAtom (x_dpy, "MULTIPLE", False);
|
atoms->multiple = XInternAtom (xpbproxy_dpy, "MULTIPLE", False);
|
||||||
atoms->cstring = XInternAtom (x_dpy, "CSTRING", False);
|
atoms->cstring = XInternAtom (xpbproxy_dpy, "CSTRING", False);
|
||||||
atoms->image_png = XInternAtom (x_dpy, "image/png", False);
|
atoms->image_png = XInternAtom (xpbproxy_dpy, "image/png", False);
|
||||||
atoms->image_jpeg = XInternAtom (x_dpy, "image/jpeg", False);
|
atoms->image_jpeg = XInternAtom (xpbproxy_dpy, "image/jpeg", False);
|
||||||
atoms->incr = XInternAtom (x_dpy, "INCR", False);
|
atoms->incr = XInternAtom (xpbproxy_dpy, "INCR", False);
|
||||||
atoms->atom = XInternAtom (x_dpy, "ATOM", False);
|
atoms->atom = XInternAtom (xpbproxy_dpy, "ATOM", False);
|
||||||
atoms->clipboard_manager = XInternAtom (x_dpy, "CLIPBOARD_MANAGER", False);
|
atoms->clipboard_manager = XInternAtom (xpbproxy_dpy, "CLIPBOARD_MANAGER", False);
|
||||||
atoms->compound_text = XInternAtom (x_dpy, "COMPOUND_TEXT", False);
|
atoms->compound_text = XInternAtom (xpbproxy_dpy, "COMPOUND_TEXT", False);
|
||||||
atoms->atom_pair = XInternAtom (x_dpy, "ATOM_PAIR", False);
|
atoms->atom_pair = XInternAtom (xpbproxy_dpy, "ATOM_PAIR", False);
|
||||||
|
|
||||||
pixel = BlackPixel (x_dpy, DefaultScreen (x_dpy));
|
pixel = BlackPixel (xpbproxy_dpy, DefaultScreen (xpbproxy_dpy));
|
||||||
_selection_window = XCreateSimpleWindow (x_dpy, DefaultRootWindow (x_dpy),
|
_selection_window = XCreateSimpleWindow (xpbproxy_dpy, DefaultRootWindow (xpbproxy_dpy),
|
||||||
0, 0, 1, 1, 0, pixel, pixel);
|
0, 0, 1, 1, 0, pixel, pixel);
|
||||||
|
|
||||||
/* This is used to get PropertyNotify events when doing INCR transfers. */
|
/* This is used to get PropertyNotify events when doing INCR transfers. */
|
||||||
XSelectInput (x_dpy, _selection_window, PropertyChangeMask);
|
XSelectInput (xpbproxy_dpy, _selection_window, PropertyChangeMask);
|
||||||
|
|
||||||
request_atom = None;
|
request_atom = None;
|
||||||
|
|
||||||
|
@ -1516,8 +1520,8 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
|
||||||
pending_copy = 0;
|
pending_copy = 0;
|
||||||
pending_clipboard = 0;
|
pending_clipboard = 0;
|
||||||
|
|
||||||
if(have_xfixes)
|
if(xpbproxy_have_xfixes)
|
||||||
XFixesSelectSelectionInput(x_dpy, _selection_window, atoms->primary,
|
XFixesSelectSelectionInput(xpbproxy_dpy, _selection_window, atoms->primary,
|
||||||
XFixesSetSelectionOwnerNotifyMask);
|
XFixesSetSelectionOwnerNotifyMask);
|
||||||
|
|
||||||
[self reload_preferences];
|
[self reload_preferences];
|
||||||
|
@ -1529,7 +1533,7 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
|
||||||
{
|
{
|
||||||
if (None != _selection_window)
|
if (None != _selection_window)
|
||||||
{
|
{
|
||||||
XDestroyWindow (x_dpy, _selection_window);
|
XDestroyWindow (xpbproxy_dpy, _selection_window);
|
||||||
_selection_window = None;
|
_selection_window = None;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -127,8 +127,8 @@
|
||||||
/* Have Quartz */
|
/* Have Quartz */
|
||||||
#undef XQUARTZ
|
#undef XQUARTZ
|
||||||
|
|
||||||
/* Build xpbproxy into Xquartz rather than a separate app */
|
/* Build a standalone xpbproxy */
|
||||||
#undef INTEGRATED_XPBPROXY
|
#undef STANDALONE_XPBPROXY
|
||||||
|
|
||||||
/* Define to 1 if you have the `m' library (-lm). */
|
/* Define to 1 if you have the `m' library (-lm). */
|
||||||
#undef HAVE_LIBM
|
#undef HAVE_LIBM
|
||||||
|
|
Loading…
Reference in New Issue