summaryrefslogtreecommitdiff
path: root/hw/xquartz/pbproxy/main.m
diff options
context:
space:
mode:
Diffstat (limited to 'hw/xquartz/pbproxy/main.m')
-rw-r--r--hw/xquartz/pbproxy/main.m66
1 files changed, 30 insertions, 36 deletions
diff --git a/hw/xquartz/pbproxy/main.m b/hw/xquartz/pbproxy/main.m
index 2d2f76108..92cde0437 100644
--- a/hw/xquartz/pbproxy/main.m
+++ b/hw/xquartz/pbproxy/main.m
@@ -78,55 +78,49 @@ x_error_handler(Display *dpy, XErrorEvent *errevent)
int
xpbproxy_run(void)
{
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
- size_t i;
+ @autoreleasepool {
+ size_t i;
- for (i = 0, xpbproxy_dpy = NULL; !xpbproxy_dpy && i < 5; i++) {
- xpbproxy_dpy = XOpenDisplay(NULL);
+ for (i = 0, xpbproxy_dpy = NULL; !xpbproxy_dpy && i < 5; i++) {
+ xpbproxy_dpy = XOpenDisplay(NULL);
- if (!xpbproxy_dpy && display) {
- char _display[32];
- snprintf(_display, sizeof(_display), ":%s", display);
- setenv("DISPLAY", _display, TRUE);
+ if (!xpbproxy_dpy && display) {
+ char _display[32];
+ snprintf(_display, sizeof(_display), ":%s", display);
+ setenv("DISPLAY", _display, TRUE);
- xpbproxy_dpy = XOpenDisplay(_display);
+ xpbproxy_dpy = XOpenDisplay(_display);
+ }
+ if (!xpbproxy_dpy)
+ sleep(1);
}
- if (!xpbproxy_dpy)
- sleep(1);
- }
- if (xpbproxy_dpy == NULL) {
- ErrorF("xpbproxy: can't open default display\n");
- [pool release];
- return EXIT_FAILURE;
- }
+ if (xpbproxy_dpy == NULL) {
+ ErrorF("xpbproxy: can't open default display\n");
+ return EXIT_FAILURE;
+ }
- XSetIOErrorHandler(x_io_error_handler);
- XSetErrorHandler(x_error_handler);
+ XSetIOErrorHandler(x_io_error_handler);
+ XSetErrorHandler(x_error_handler);
- if (!XAppleWMQueryExtension(xpbproxy_dpy, &xpbproxy_apple_wm_event_base,
- &xpbproxy_apple_wm_error_base)) {
- ErrorF("xpbproxy: can't open AppleWM server extension\n");
- [pool release];
- return EXIT_FAILURE;
- }
+ if (!XAppleWMQueryExtension(xpbproxy_dpy, &xpbproxy_apple_wm_event_base,
+ &xpbproxy_apple_wm_error_base)) {
+ ErrorF("xpbproxy: can't open AppleWM server extension\n");
+ return EXIT_FAILURE;
+ }
- xpbproxy_have_xfixes =
- XFixesQueryExtension(xpbproxy_dpy, &xpbproxy_xfixes_event_base,
- &xpbproxy_xfixes_error_base);
+ xpbproxy_have_xfixes = XFixesQueryExtension(xpbproxy_dpy, &xpbproxy_xfixes_event_base,
+ &xpbproxy_xfixes_error_base);
- XAppleWMSelectInput(xpbproxy_dpy, AppleWMActivationNotifyMask |
- AppleWMPasteboardNotifyMask);
+ XAppleWMSelectInput(xpbproxy_dpy, AppleWMActivationNotifyMask | AppleWMPasteboardNotifyMask);
- _selection_object = [[x_selection alloc] init];
+ _selection_object = [x_selection new];
- if (!xpbproxy_input_register()) {
- [pool release];
- return EXIT_FAILURE;
+ if (!xpbproxy_input_register()) {
+ return EXIT_FAILURE;
+ }
}
- [pool release];
-
CFRunLoopRun();
return EXIT_SUCCESS;