diff --git a/hw/darwin/apple/English.lproj/Localizable.strings b/hw/darwin/apple/English.lproj/Localizable.strings new file mode 100644 index 000000000..c83b08536 Binary files /dev/null and b/hw/darwin/apple/English.lproj/Localizable.strings differ diff --git a/hw/darwin/apple/Info.plist b/hw/darwin/apple/Info.plist index ae47e9590..66f1f6be1 100644 --- a/hw/darwin/apple/Info.plist +++ b/hw/darwin/apple/Info.plist @@ -4,42 +4,6 @@ CFBundleDevelopmentRegion English - CFBundleDocumentTypes - - - CFBundleTypeExtensions - - x11app - - CFBundleTypeIconFile - X11.icns - CFBundleTypeName - X11 Application - CFBundleTypeOSTypes - - **** - - CFBundleTypeRole - Viewer - LSIsAppleDefaultForType - - - - CFBundleTypeExtensions - - tool - * - - CFBundleTypeName - UNIX Application - CFBundleTypeOSTypes - - **** - - CFBundleTypeRole - Viewer - - CFBundleExecutable X11 CFBundleGetInfoString @@ -57,7 +21,7 @@ CFBundleShortVersionString 2.0 CFBundleSignature - ???? + x11a CSResourcesFileMapped NSHumanReadableCopyright diff --git a/hw/darwin/apple/X11.xcodeproj/project.pbxproj b/hw/darwin/apple/X11.xcodeproj/project.pbxproj index 2fef99ba0..a47e4d157 100644 --- a/hw/darwin/apple/X11.xcodeproj/project.pbxproj +++ b/hw/darwin/apple/X11.xcodeproj/project.pbxproj @@ -14,6 +14,7 @@ 527F241F0B5D938C007840A7 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 50F4F0A7039D6ACA0E82C0CB /* CoreFoundation.framework */; }; 527F24200B5D938C007840A7 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 570C5748047186C400ACF82F /* SystemConfiguration.framework */; }; 527F24370B5D9D89007840A7 /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 527F24260B5D938C007840A7 /* Info.plist */; }; + 52D9C0ED0BCDDF6B00CD2AFC /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 52D9C0EB0BCDDF6B00CD2AFC /* Localizable.strings */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -24,6 +25,7 @@ 50F4F0A7039D6ACA0E82C0CB /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = /System/Library/Frameworks/CoreFoundation.framework; sourceTree = ""; }; 527F24260B5D938C007840A7 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = Info.plist; sourceTree = ""; }; 527F24270B5D938C007840A7 /* X11.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = X11.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 52D9C0EC0BCDDF6B00CD2AFC /* English */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/Localizable.strings; sourceTree = ""; }; 570C5748047186C400ACF82F /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = /System/Library/Frameworks/SystemConfiguration.framework; sourceTree = ""; }; /* End PBXFileReference section */ @@ -71,6 +73,7 @@ 20286C2CFDCF999611CA2CEA /* Resources */ = { isa = PBXGroup; children = ( + 52D9C0EB0BCDDF6B00CD2AFC /* Localizable.strings */, 50459C5F038587C60ECA21EC /* X11.icns */, 0867D6AAFE840B52C02AAC07 /* InfoPlist.strings */, 02345980000FD03B11CA0E72 /* main.nib */, @@ -146,6 +149,7 @@ 527F24190B5D938C007840A7 /* InfoPlist.strings in Resources */, 527F241A0B5D938C007840A7 /* main.nib in Resources */, 527F241B0B5D938C007840A7 /* X11.icns in Resources */, + 52D9C0ED0BCDDF6B00CD2AFC /* Localizable.strings in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -189,6 +193,14 @@ name = InfoPlist.strings; sourceTree = ""; }; + 52D9C0EB0BCDDF6B00CD2AFC /* Localizable.strings */ = { + isa = PBXVariantGroup; + children = ( + 52D9C0EC0BCDDF6B00CD2AFC /* English */, + ); + name = Localizable.strings; + sourceTree = ""; + }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ @@ -224,12 +236,16 @@ DSTROOT = "$(DSTROOT)"; FRAMEWORK_SEARCH_PATHS = ""; GCC_SYMBOLS_PRIVATE_EXTERN = NO; - HEADER_SEARCH_PATHS = ""; + HEADER_SEARCH_PATHS = /usr/X11/include; INFOPLIST_FILE = Info.plist; INSTALL_PATH = $DSTROOT/Applications/Utilties; - LIBRARY_SEARCH_PATHS = ""; - OTHER_CFLAGS = "$(CFLAGS)"; - OTHER_LDFLAGS = "$(LDFLAGS)"; + LIBRARY_SEARCH_PATHS = /usr/X11/lib; + OTHER_CFLAGS = ""; + OTHER_LDFLAGS = ( + "-lXau", + "-lxcb", + "-lX11", + ); OTHER_REZFLAGS = ""; PRODUCT_NAME = X11; SECTORDER_FLAGS = ""; @@ -249,12 +265,16 @@ DSTROOT = "$(DSTROOT)"; FRAMEWORK_SEARCH_PATHS = ""; GCC_SYMBOLS_PRIVATE_EXTERN = NO; - HEADER_SEARCH_PATHS = ""; + HEADER_SEARCH_PATHS = /usr/X11/include; INFOPLIST_FILE = Info.plist; INSTALL_PATH = $DSTROOT/Applications/Utilties; - LIBRARY_SEARCH_PATHS = ""; - OTHER_CFLAGS = "$(CFLAGS)"; - OTHER_LDFLAGS = "$(LDFLAGS)"; + LIBRARY_SEARCH_PATHS = /usr/X11/lib; + OTHER_CFLAGS = ""; + OTHER_LDFLAGS = ( + "-lXau", + "-lxcb", + "-lX11", + ); OTHER_REZFLAGS = ""; PRODUCT_NAME = X11; SECTORDER_FLAGS = ""; @@ -273,12 +293,16 @@ DSTROOT = "$(DSTROOT)"; FRAMEWORK_SEARCH_PATHS = ""; GCC_SYMBOLS_PRIVATE_EXTERN = NO; - HEADER_SEARCH_PATHS = ""; + HEADER_SEARCH_PATHS = /usr/X11/include; INFOPLIST_FILE = Info.plist; INSTALL_PATH = $DSTROOT/Applications/Utilties; - LIBRARY_SEARCH_PATHS = ""; - OTHER_CFLAGS = "$(CFLAGS)"; - OTHER_LDFLAGS = "$(LDFLAGS)"; + LIBRARY_SEARCH_PATHS = /usr/X11/lib; + OTHER_CFLAGS = ""; + OTHER_LDFLAGS = ( + "-lXau", + "-lxcb", + "-lX11", + ); OTHER_REZFLAGS = ""; PRODUCT_NAME = X11; SECTORDER_FLAGS = ""; diff --git a/hw/darwin/apple/X11Application.h b/hw/darwin/apple/X11Application.h index 6b1d72643..fb153e750 100644 --- a/hw/darwin/apple/X11Application.h +++ b/hw/darwin/apple/X11Application.h @@ -1,4 +1,5 @@ /* X11Application.h -- subclass of NSApplication to multiplex events + $Id: X11Application.h,v 1.26 2003/08/08 19:16:13 jharper Exp $ Copyright (c) 2002-2007 Apple Inc. All rights reserved. @@ -79,7 +80,7 @@ extern void X11ApplicationMain (int argc, const char *argv[], extern int X11EnableKeyEquivalents; extern int quartzHasRoot, quartzEnableRootless; -#define APP_PREFS "com.apple.x11" +#define APP_PREFS "org.x.X11" #define PREFS_APPSMENU "apps_menu" #define PREFS_FAKEBUTTONS "enable_fake_buttons" diff --git a/hw/darwin/apple/X11Application.m b/hw/darwin/apple/X11Application.m index 57795f452..9ae470e46 100644 --- a/hw/darwin/apple/X11Application.m +++ b/hw/darwin/apple/X11Application.m @@ -1,6 +1,6 @@ /* X11Application.m -- subclass of NSApplication to multiplex events - Copyright (c) 2002-2007 Apple Inc. + Copyright (c) 2002-2007 Apple Inc. All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files @@ -34,10 +34,12 @@ /* ouch! */ #define BOOL X_BOOL +//# include "Xproto.h" # include "darwin.h" # include "../quartz/quartz.h" # define _APPLEWM_SERVER_ # include "X11/extensions/applewm.h" +//# include "X.h" # include "micmap.h" #undef BOOL @@ -47,20 +49,18 @@ #include #include -#define DEFAULTS_FILE "/etc/X11/xserver/Xquartz.plist" +#define DEFAULTS_FILE "/usr/X11/lib/X11/xserver/Xquartz.plist" int X11EnableKeyEquivalents = TRUE; int quartzHasRoot = FALSE, quartzEnableRootless = TRUE; -extern int darwinFakeButtons, input_check_flag; -// extern Bool enable_stereo; -Bool enable_stereo; //<-- this needs to go back to being an extern once glxCGL is fixed - -extern xEvent *darwinEvents; +extern int darwinFakeButtons; +extern Bool enable_stereo; X11Application *X11App; -#define ALL_KEY_MASKS (NSShiftKeyMask | NSControlKeyMask | NSAlternateKeyMask | NSCommandKeyMask) +#define ALL_KEY_MASKS (NSShiftKeyMask | NSControlKeyMask \ +| NSAlternateKeyMask | NSCommandKeyMask) @implementation X11Application @@ -79,21 +79,27 @@ static void send_nsevent (NSEventType type, NSEvent *e); but is statically linked into this X server. */ extern Bool QuartzModeBundleInit(void); -static void init_ports (void) { +static void +init_ports (void) +{ kern_return_t r; NSPort *p; - if (_port != MACH_PORT_NULL) return; + if (_port != MACH_PORT_NULL) + return; r = mach_port_allocate (mach_task_self (), MACH_PORT_RIGHT_RECEIVE, &_port); - if (r != KERN_SUCCESS) return; + if (r != KERN_SUCCESS) + return; p = [NSMachPort portWithMachPort:_port]; [p setDelegate:NSApp]; [p scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode]; } -static void message_kit_thread (SEL selector, NSObject *arg) { +static void +message_kit_thread (SEL selector, NSObject *arg) +{ message msg; kern_return_t r; @@ -108,24 +114,29 @@ static void message_kit_thread (SEL selector, NSObject *arg) { msg.arg = [arg retain]; r = mach_msg (&msg.hdr, MACH_SEND_MSG, msg.hdr.msgh_size, - 0, MACH_PORT_NULL, 0, MACH_PORT_NULL); + 0, MACH_PORT_NULL, 0, MACH_PORT_NULL); if (r != KERN_SUCCESS) - ErrorF("%s: mach_msg failed: %x\n", __FUNCTION__, r); + fprintf (stderr, "%s: mach_msg failed: %x\n", __FUNCTION__, r); } -- (void) handleMachMessage:(void *)_msg { +- (void) handleMachMessage:(void *)_msg +{ message *msg = _msg; [self performSelector:msg->selector withObject:msg->arg]; [msg->arg release]; } -- (void) set_controller:obj { - if (_controller == nil) _controller = [obj retain]; +- (void) set_controller:obj +{ + if (_controller == nil) + _controller = [obj retain]; } -- (void) dealloc { - if (_controller != nil) [_controller release]; +- (void) dealloc +{ + if (_controller != nil) + [_controller release]; if (_port != MACH_PORT_NULL) mach_port_deallocate (mach_task_self (), _port); @@ -133,7 +144,8 @@ static void message_kit_thread (SEL selector, NSObject *arg) { [super dealloc]; } -- (void) orderFrontStandardAboutPanel: (id) sender { +- (void) orderFrontStandardAboutPanel: (id) sender +{ NSMutableDictionary *dict; NSDictionary *infoDict; NSString *tem; @@ -146,45 +158,57 @@ static void message_kit_thread (SEL selector, NSObject *arg) { tem = [infoDict objectForKey:@"CFBundleShortVersionString"]; - [dict setObject:[NSString stringWithFormat:@"X11.app %@ - X.org X11R7.3", tem] - forKey:@"ApplicationVersion"]; + [dict setObject:[NSString stringWithFormat:@"X11.app %@ - X.org X11R7.2", + tem] forKey:@"ApplicationVersion"]; [self orderFrontStandardAboutPanelWithOptions: dict]; } -- (void) activateX:(BOOL)state { +- (void) activateX:(BOOL)state +{ /* Create a TSM document that supports full Unicode input, and have it activated while X is active (unless using the old keymapping files) */ static TSMDocumentID x11_document; - if (state) { - QuartzMessageServerThread (kXDarwinActivate, 0); - - if (!_x_active) { - if (x11_document == 0 && darwinKeymapFile == NULL) { - OSType types[1]; - types[0] = kUnicodeDocument; - NewTSMDocument (1, types, &x11_document, 0); - } - - if (x11_document != 0) ActivateTSMDocument (x11_document); - } - } else { - QuartzMessageServerThread (kXDarwinDeactivate, 0); - - if (_x_active && x11_document != 0) - DeactivateTSMDocument (x11_document); + if (state) + { + QuartzMessageServerThread (kXDarwinActivate, 0); + + if (!_x_active) + { + if (x11_document == 0 && darwinKeymapFile == NULL) + { + OSType types[1]; + types[0] = kUnicodeDocument; + NewTSMDocument (1, types, &x11_document, 0); + } + + if (x11_document != 0) + ActivateTSMDocument (x11_document); + } } - + else + { + QuartzMessageServerThread (kXDarwinDeactivate, 0); + + if (_x_active) + { + if (x11_document != 0) + DeactivateTSMDocument (x11_document); + } + } + _x_active = state; } -- (void) became_key:(NSWindow *)win { +- (void) became_key:(NSWindow *)win +{ [self activateX:NO]; } -- (void) sendEvent:(NSEvent *)e { +- (void) sendEvent:(NSEvent *)e +{ NSEventType type; BOOL for_appkit, for_x; @@ -194,140 +218,172 @@ static void message_kit_thread (SEL selector, NSObject *arg) { for_appkit = YES; for_x = YES; - switch (type) { + switch (type) + { case NSLeftMouseDown: case NSRightMouseDown: case NSOtherMouseDown: case NSLeftMouseUp: case NSRightMouseUp: case NSOtherMouseUp: - if ([e window] != nil) { - /* Pointer event has a window. Probably something for the kit. */ - - for_x = NO; - - if (_x_active) [self activateX:NO]; - } else if ([self modalWindow] == nil) { - /* Must be an X window. Tell appkit it doesn't have focus. */ + if ([e window] != nil) + { + /* Pointer event has a window. Probably something for the kit. */ - for_appkit = NO; - - if ([self isActive]) { - [self deactivate]; - - if (!_x_active && quartzProcs->IsX11Window([e window], [e windowNumber])) - [self activateX:YES]; - } - } - break; - + for_x = NO; + + if (_x_active) + [self activateX:NO]; + } + else if ([self modalWindow] == nil) + { + /* Must be an X window. Tell appkit it doesn't have focus. */ + + for_appkit = NO; + + if ([self isActive]) + { + [self deactivate]; + + if (!_x_active && quartzProcs->IsX11Window([e window], + [e windowNumber])) + [self activateX:YES]; + } + } + break; + case NSKeyDown: case NSKeyUp: - if (_x_active) { - static int swallow_up; - - /* No kit window is focused, so send it to X. */ - - for_appkit = NO; - - if (type == NSKeyDown) { - /* Before that though, see if there are any global - shortcuts bound to it. */ - - if (X11EnableKeyEquivalents - && [[self mainMenu] performKeyEquivalent:e]) { - swallow_up = [e keyCode]; - for_x = NO; - } else if (!quartzEnableRootless - && ([e modifierFlags] & ALL_KEY_MASKS) - == (NSCommandKeyMask | NSAlternateKeyMask) - && ([e keyCode] == 0 /*a*/ - || [e keyCode] == 53 /*Esc*/)) { - swallow_up = 0; - for_x = NO; + if (_x_active) + { + static int swallow_up; + + /* No kit window is focused, so send it to X. */ + + for_appkit = NO; + + if (type == NSKeyDown) + { + /* Before that though, see if there are any global + shortcuts bound to it. */ + + if (X11EnableKeyEquivalents + && [[self mainMenu] performKeyEquivalent:e]) + { + swallow_up = [e keyCode]; + for_x = NO; + } + else if (!quartzEnableRootless + && ([e modifierFlags] & ALL_KEY_MASKS) + == (NSCommandKeyMask | NSAlternateKeyMask) + && ([e keyCode] == 0 /*a*/ + || [e keyCode] == 53 /*Esc*/)) + { + swallow_up = 0; + for_x = NO; #ifdef DARWIN_DDX_MISSING - QuartzMessageServerThread (kXDarwinToggleFullscreen, 0); + QuartzMessageServerThread (kXDarwinToggleFullscreen, 0); #endif - } - } else { - /* If we saw a key equivalent on the down, don't pass - the up through to X. */ - - if (swallow_up != 0 && [e keyCode] == swallow_up) { - swallow_up = 0; - for_x = NO; - } - } - } - else for_x = NO; - break; + } + } + else + { + /* If we saw a key equivalent on the down, don't pass + the up through to X. */ + + if (swallow_up != 0 && [e keyCode] == swallow_up) + { + swallow_up = 0; + for_x = NO; + } + } + } + else + { + for_x = NO; + } + break; case NSFlagsChanged: - /* For the l33t X users who remap modifier keys to normal keysyms. */ - if (!_x_active) - for_x = NO; - break; + /* For the l33t X users who remap modifier keys to normal keysyms. */ + if (!_x_active) + for_x = NO; + break; case NSAppKitDefined: - switch ([e subtype]) { - case NSApplicationActivatedEventType: - for_x = NO; - if ([self modalWindow] == nil) { - for_appkit = NO; - - /* FIXME: hack to avoid having to pass the event to appkit, - which would cause it to raise one of its windows. */ - _appFlags._active = YES; - - [self activateX:YES]; -#ifdef DARWIN_DDX_MISSING - if ([e data2] & 0x10) QuartzMessageServerThread (kXDarwinBringAllToFront, 0); -#endif - } - break; + switch ([e subtype]) + { + case NSApplicationActivatedEventType: + for_x = NO; + if ([self modalWindow] == nil) + { + for_appkit = NO; + + /* FIXME: hack to avoid having to pass the event to appkit, + which would cause it to raise one of its windows. */ + _appFlags._active = YES; + + [self activateX:YES]; + if ([e data2] & 0x10) X11ApplicationSetFrontProcess(); + } + break; - case 18: /* ApplicationDidReactivate */ - if (quartzHasRoot) for_appkit = NO; - break; + case 18: /* ApplicationDidReactivate */ + if (quartzHasRoot) + for_appkit = NO; + break; - case NSApplicationDeactivatedEventType: - for_x = NO; - [self activateX:NO]; - break; - } - break; - + case NSApplicationDeactivatedEventType: + for_x = NO; + [self activateX:NO]; + break; + } + break; + default: break; /* for gcc */ } - if (for_appkit) [super sendEvent:e]; - if (for_x) send_nsevent (type, e); + if (for_appkit) + [super sendEvent:e]; + + if (for_x) + send_nsevent (type, e); } -- (void) set_window_menu:(NSArray *)list { +- (void) set_window_menu:(NSArray *)list +{ [_controller set_window_menu:list]; } -- (void) set_window_menu_check:(NSNumber *)n { +- (void) set_window_menu_check:(NSNumber *)n +{ [_controller set_window_menu_check:n]; } -- (void) set_apps_menu:(NSArray *)list { +- (void) set_apps_menu:(NSArray *)list +{ [_controller set_apps_menu:list]; } -- (void) set_front_process:unused { +- (void) set_front_process:unused +{ [NSApp activateIgnoringOtherApps:YES]; - if ([self modalWindow] == nil) [self activateX:YES]; + if ([self modalWindow] == nil) + [self activateX:YES]; } -- (void) set_can_quit:(NSNumber *)state { +- (void) set_can_quit:(NSNumber *)state +{ [_controller set_can_quit:[state boolValue]]; } -- (void) server_ready:unused { +- (void) server_ready:unused +{ [_controller server_ready]; } -- (void) show_hide_menubar:(NSNumber *)state { - if ([state boolValue]) ShowMenuBar (); - else HideMenuBar (); +- (void) show_hide_menubar:(NSNumber *)state +{ + if ([state boolValue]) + ShowMenuBar (); + else + HideMenuBar (); } @@ -344,7 +400,9 @@ static void cfrelease (CFAllocatorRef a, const void *b) { CFRelease (b); } -static CFMutableArrayRef nsarray_to_cfarray (NSArray *in) { +static CFMutableArrayRef +nsarray_to_cfarray (NSArray *in) +{ CFMutableArrayRef out; CFArrayCallBacks cb; NSObject *ns; @@ -359,22 +417,24 @@ static CFMutableArrayRef nsarray_to_cfarray (NSArray *in) { count = [in count]; out = CFArrayCreateMutable (NULL, count, &cb); - for (i = 0; i < count; i++) { - ns = [in objectAtIndex:i]; - - if ([ns isKindOfClass:[NSArray class]]) - cf = (CFTypeRef) nsarray_to_cfarray ((NSArray *) ns); - else - cf = CFRetain ((CFTypeRef) ns); - - CFArrayAppendValue (out, cf); - CFRelease (cf); + for (i = 0; i < count; i++) + { + ns = [in objectAtIndex:i]; + + if ([ns isKindOfClass:[NSArray class]]) + cf = (CFTypeRef) nsarray_to_cfarray ((NSArray *) ns); + else + cf = CFRetain ((CFTypeRef) ns); + + CFArrayAppendValue (out, cf); + CFRelease (cf); } - + return out; } - -static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) { +static NSMutableArray * +cfarray_to_nsarray (CFArrayRef in) +{ NSMutableArray *out; const CFTypeRef *cf; NSObject *ns; @@ -383,277 +443,320 @@ static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) { count = CFArrayGetCount (in); out = [[NSMutableArray alloc] initWithCapacity:count]; - for (i = 0; i < count; i++) { - cf = CFArrayGetValueAtIndex (in, i); + for (i = 0; i < count; i++) + { + cf = CFArrayGetValueAtIndex (in, i); - if (CFGetTypeID (cf) == CFArrayGetTypeID ()) - ns = cfarray_to_nsarray ((CFArrayRef) cf); - else - ns = [(id)cf retain]; - - [out addObject:ns]; - [ns release]; + if (CFGetTypeID (cf) == CFArrayGetTypeID ()) + ns = cfarray_to_nsarray ((CFArrayRef) cf); + else + ns = [(id)cf retain]; + + [out addObject:ns]; + [ns release]; } - + return out; } -- (CFPropertyListRef) prefs_get:(NSString *)key { +- (CFPropertyListRef) prefs_get:(NSString *)key +{ CFPropertyListRef value; value = CFPreferencesCopyAppValue ((CFStringRef) key, CFSTR (APP_PREFS)); - if (value == NULL) { - static CFDictionaryRef defaults; - - if (defaults == NULL) { - CFStringRef error = NULL; - CFDataRef data; - CFURLRef url; - SInt32 error_code; - - url = (CFURLCreateFromFileSystemRepresentation - (NULL, (unsigned char *)DEFAULTS_FILE, strlen (DEFAULTS_FILE), false)); - if (CFURLCreateDataAndPropertiesFromResource (NULL, url, &data, - NULL, NULL, &error_code)) { - defaults = (CFPropertyListCreateFromXMLData - (NULL, data, kCFPropertyListMutableContainersAndLeaves, &error)); - if (error != NULL) CFRelease (error); - CFRelease (data); - } - CFRelease (url); - - if (defaults != NULL) { - NSMutableArray *apps, *elt; - int count, i; - NSString *name, *nname; - - /* Localize the names in the default apps menu. */ - - apps = [(NSDictionary *)defaults objectForKey:@PREFS_APPSMENU]; - if (apps != nil) { - count = [apps count]; - for (i = 0; i < count; i++) { - elt = [apps objectAtIndex:i]; - if (elt != nil && [elt isKindOfClass:[NSArray class]]) { - name = [elt objectAtIndex:0]; - if (name != nil) { - nname = NSLocalizedString (name, nil); - if (nname != nil && nname != name) - [elt replaceObjectAtIndex:0 withObject:nname]; - } - } - } - } - } - } + if (value == NULL) + { + static CFDictionaryRef defaults; - if (defaults != NULL) value = CFDictionaryGetValue (defaults, key); - if (value != NULL) CFRetain (value); + if (defaults == NULL) + { + CFStringRef error = NULL; + CFDataRef data; + CFURLRef url; + SInt32 error_code; + + url = (CFURLCreateFromFileSystemRepresentation + (NULL, (unsigned char *)DEFAULTS_FILE, strlen (DEFAULTS_FILE), false)); + if (CFURLCreateDataAndPropertiesFromResource (NULL, url, &data, + NULL, NULL, + &error_code)) + { + defaults = (CFPropertyListCreateFromXMLData + (NULL, data, kCFPropertyListMutableContainersAndLeaves, &error)); + if (error != NULL) + CFRelease (error); + CFRelease (data); + } + CFRelease (url); + + if (defaults != NULL) + { + NSMutableArray *apps, *elt; + int count, i; + NSString *name, *nname; + + /* Localize the names in the default apps menu. */ + + apps = [(NSDictionary *)defaults objectForKey:@PREFS_APPSMENU]; + if (apps != nil) + { + count = [apps count]; + for (i = 0; i < count; i++) + { + elt = [apps objectAtIndex:i]; + if (elt != nil && [elt isKindOfClass:[NSArray class]]) + { + name = [elt objectAtIndex:0]; + if (name != nil) + { + nname = NSLocalizedString (name, nil); + if (nname != nil && nname != name) + [elt replaceObjectAtIndex:0 withObject:nname]; + } + } + } + } + } + } + + if (defaults != NULL) + value = CFDictionaryGetValue (defaults, key); + + if (value != NULL) + CFRetain (value); } return value; } -- (int) prefs_get_integer:(NSString *)key default:(int)def { - CFPropertyListRef value; - int ret; - - value = [self prefs_get:key]; - - if (value != NULL && CFGetTypeID (value) == CFNumberGetTypeID ()) - CFNumberGetValue (value, kCFNumberIntType, &ret); - else if (value != NULL && CFGetTypeID (value) == CFStringGetTypeID ()) - ret = CFStringGetIntValue (value); - else - ret = def; - - if (value != NULL) CFRelease (value); - - return ret; -} - -- (const char *) prefs_get_string:(NSString *)key default:(const char *)def { - CFPropertyListRef value; - const char *ret = NULL; - - value = [self prefs_get:key]; - - if (value != NULL && CFGetTypeID (value) == CFStringGetTypeID ()) { - NSString *s = (NSString *) value; - - ret = [s UTF8String]; - } - - if (value != NULL) CFRelease (value); - - return ret != NULL ? ret : def; -} - -- (float) prefs_get_float:(NSString *)key default:(float)def { - CFPropertyListRef value; - float ret = def; - - value = [self prefs_get:key]; - - if (value != NULL - && CFGetTypeID (value) == CFNumberGetTypeID () - && CFNumberIsFloatType (value)) - CFNumberGetValue (value, kCFNumberFloatType, &ret); - else if (value != NULL && CFGetTypeID (value) == CFStringGetTypeID ()) - ret = CFStringGetDoubleValue (value); +- (int) prefs_get_integer:(NSString *)key default:(int)def +{ + CFPropertyListRef value; + int ret; - if (value != NULL) CFRelease (value); - - return ret; + value = [self prefs_get:key]; + + if (value != NULL && CFGetTypeID (value) == CFNumberGetTypeID ()) + CFNumberGetValue (value, kCFNumberIntType, &ret); + else if (value != NULL && CFGetTypeID (value) == CFStringGetTypeID ()) + ret = CFStringGetIntValue (value); + else + ret = def; + + if (value != NULL) + CFRelease (value); + + return ret; } -- (int) prefs_get_boolean:(NSString *)key default:(int)def { - CFPropertyListRef value; - int ret = def; - - value = [self prefs_get:key]; - - if (value != NULL) { - if (CFGetTypeID (value) == CFNumberGetTypeID ()) - CFNumberGetValue (value, kCFNumberIntType, &ret); - else if (CFGetTypeID (value) == CFBooleanGetTypeID ()) - ret = CFBooleanGetValue (value); - else if (CFGetTypeID (value) == CFStringGetTypeID ()) { - const char *tem = [(NSString *) value lossyCString]; - if (strcasecmp (tem, "true") == 0 || strcasecmp (tem, "yes") == 0) - ret = YES; - else - ret = NO; +- (const char *) prefs_get_string:(NSString *)key default:(const char *)def +{ + CFPropertyListRef value; + const char *ret = NULL; + + value = [self prefs_get:key]; + + if (value != NULL && CFGetTypeID (value) == CFStringGetTypeID ()) + { + NSString *s = (NSString *) value; + + ret = [s UTF8String]; } - - CFRelease (value); - } - return ret; + + if (value != NULL) + CFRelease (value); + + return ret != NULL ? ret : def; } -- (NSArray *) prefs_get_array:(NSString *)key { - NSArray *ret = nil; - CFPropertyListRef value; - - value = [self prefs_get:key]; - - if (value != NULL) { - if (CFGetTypeID (value) == CFArrayGetTypeID ()) - ret = [cfarray_to_nsarray (value) autorelease]; - - CFRelease (value); - } - - return ret; +- (float) prefs_get_float:(NSString *)key default:(float)def +{ + CFPropertyListRef value; + float ret = def; + + value = [self prefs_get:key]; + + if (value != NULL + && CFGetTypeID (value) == CFNumberGetTypeID () + && CFNumberIsFloatType (value)) + { + CFNumberGetValue (value, kCFNumberFloatType, &ret); + } + else if (value != NULL && CFGetTypeID (value) == CFStringGetTypeID ()) + { + ret = CFStringGetDoubleValue (value); + } + + if (value != NULL) + CFRelease (value); + + return ret; } -- (void) prefs_set_integer:(NSString *)key value:(int)value { +- (int) prefs_get_boolean:(NSString *)key default:(int)def +{ + CFPropertyListRef value; + int ret = def; + + value = [self prefs_get:key]; + + if (value != NULL) + { + if (CFGetTypeID (value) == CFNumberGetTypeID ()) + CFNumberGetValue (value, kCFNumberIntType, &ret); + else if (CFGetTypeID (value) == CFBooleanGetTypeID ()) + ret = CFBooleanGetValue (value); + else if (CFGetTypeID (value) == CFStringGetTypeID ()) + { + const char *tem = [(NSString *) value lossyCString]; + if (strcasecmp (tem, "true") == 0 || strcasecmp (tem, "yes") == 0) + ret = YES; + else + ret = NO; + } + + CFRelease (value); + } + + return ret; +} + +- (NSArray *) prefs_get_array:(NSString *)key +{ + NSArray *ret = nil; + CFPropertyListRef value; + + value = [self prefs_get:key]; + + if (value != NULL) + { + if (CFGetTypeID (value) == CFArrayGetTypeID ()) + ret = [cfarray_to_nsarray (value) autorelease]; + + CFRelease (value); + } + + return ret; +} + +- (void) prefs_set_integer:(NSString *)key value:(int)value +{ CFNumberRef x; x = CFNumberCreate (NULL, kCFNumberIntType, &value); CFPreferencesSetValue ((CFStringRef) key, (CFTypeRef) x, CFSTR (APP_PREFS), - kCFPreferencesCurrentUser, kCFPreferencesAnyHost); + kCFPreferencesCurrentUser, kCFPreferencesAnyHost); CFRelease (x); } -- (void) prefs_set_float:(NSString *)key value:(float)value { +- (void) prefs_set_float:(NSString *)key value:(float)value +{ CFNumberRef x; x = CFNumberCreate (NULL, kCFNumberFloatType, &value); CFPreferencesSetValue ((CFStringRef) key, (CFTypeRef) x, CFSTR (APP_PREFS), - kCFPreferencesCurrentUser, kCFPreferencesAnyHost); + kCFPreferencesCurrentUser, kCFPreferencesAnyHost); CFRelease (x); } -- (void) prefs_set_boolean:(NSString *)key value:(int)value { - CFPreferencesSetValue ((CFStringRef) key, - (CFTypeRef) value ? kCFBooleanTrue - : kCFBooleanFalse, CFSTR (APP_PREFS), - kCFPreferencesCurrentUser, kCFPreferencesAnyHost); - +- (void) prefs_set_boolean:(NSString *)key value:(int)value +{ + CFPreferencesSetValue ((CFStringRef) key, + (CFTypeRef) value ? kCFBooleanTrue + : kCFBooleanFalse, CFSTR (APP_PREFS), + kCFPreferencesCurrentUser, kCFPreferencesAnyHost); + } -- (void) prefs_set_array:(NSString *)key value:(NSArray *)value { - CFArrayRef cfarray; - - cfarray = nsarray_to_cfarray (value); - CFPreferencesSetValue ((CFStringRef) key, - (CFTypeRef) cfarray, - CFSTR (APP_PREFS), - kCFPreferencesCurrentUser, kCFPreferencesAnyHost); - CFRelease (cfarray); +- (void) prefs_set_array:(NSString *)key value:(NSArray *)value +{ + CFArrayRef cfarray; + + cfarray = nsarray_to_cfarray (value); + CFPreferencesSetValue ((CFStringRef) key, + (CFTypeRef) cfarray, + CFSTR (APP_PREFS), + kCFPreferencesCurrentUser, kCFPreferencesAnyHost); + CFRelease (cfarray); } -- (void) prefs_set_string:(NSString *)key value:(NSString *)value { - CFPreferencesSetValue ((CFStringRef) key, (CFTypeRef) value, - CFSTR (APP_PREFS), kCFPreferencesCurrentUser, - kCFPreferencesAnyHost); +- (void) prefs_set_string:(NSString *)key value:(NSString *)value +{ + CFPreferencesSetValue ((CFStringRef) key, (CFTypeRef) value, + CFSTR (APP_PREFS), kCFPreferencesCurrentUser, + kCFPreferencesAnyHost); } -- (void) prefs_synchronize { +- (void) prefs_synchronize +{ CFPreferencesAppSynchronize (kCFPreferencesCurrentApplication); } -- (void) read_defaults { - const char *tem; - - quartzUseSysBeep = [self prefs_get_boolean:@PREFS_SYSBEEP - default:quartzUseSysBeep]; - quartzEnableRootless = [self prefs_get_boolean:@PREFS_ROOTLESS - default:quartzEnableRootless]; +- (void) read_defaults +{ + const char *tem; + + quartzUseSysBeep = [self prefs_get_boolean:@PREFS_SYSBEEP + default:quartzUseSysBeep]; + quartzEnableRootless = [self prefs_get_boolean:@PREFS_ROOTLESS + default:quartzEnableRootless]; #ifdef DARWIN_DDX_MISSING - quartzFullscreenDisableHotkeys = ![self prefs_get_boolean: - @PREFS_FULLSCREEN_HOTKEYS default: - !quartzFullscreenDisableHotkeys]; - quartzXpluginOptions = [self prefs_get_integer:@PREFS_XP_OPTIONS - default:quartzXpluginOptions]; + quartzFullscreenDisableHotkeys = ![self prefs_get_boolean: + @PREFS_FULLSCREEN_HOTKEYS default: + !quartzFullscreenDisableHotkeys]; + quartzXpluginOptions = [self prefs_get_integer:@PREFS_XP_OPTIONS + default:quartzXpluginOptions]; #endif - - darwinSwapAltMeta = [self prefs_get_boolean:@PREFS_SWAP_ALT_META - default:darwinSwapAltMeta]; - darwinFakeButtons = [self prefs_get_boolean:@PREFS_FAKEBUTTONS - default:darwinFakeButtons]; - if (darwinFakeButtons) { - const char *fake2, *fake3; - - fake2 = [self prefs_get_string:@PREFS_FAKE_BUTTON2 default:NULL]; - fake3 = [self prefs_get_string:@PREFS_FAKE_BUTTON3 default:NULL]; - - if (fake2 != NULL) darwinFakeMouse2Mask = DarwinParseModifierList(fake2); - if (fake3 != NULL) darwinFakeMouse3Mask = DarwinParseModifierList(fake3); + + darwinSwapAltMeta = [self prefs_get_boolean:@PREFS_SWAP_ALT_META + default:darwinSwapAltMeta]; + darwinFakeButtons = [self prefs_get_boolean:@PREFS_FAKEBUTTONS + default:darwinFakeButtons]; + if (darwinFakeButtons) + { + const char *fake2, *fake3; - } + fake2 = [self prefs_get_string:@PREFS_FAKE_BUTTON2 default:NULL]; + fake3 = [self prefs_get_string:@PREFS_FAKE_BUTTON3 default:NULL]; + + if (fake2 != NULL) darwinFakeMouse2Mask = DarwinParseModifierList(fake2); + if (fake3 != NULL) darwinFakeMouse3Mask = DarwinParseModifierList(fake3); + + } - X11EnableKeyEquivalents = [self prefs_get_boolean:@PREFS_KEYEQUIVS - default:X11EnableKeyEquivalents]; + X11EnableKeyEquivalents = [self prefs_get_boolean:@PREFS_KEYEQUIVS + default:X11EnableKeyEquivalents]; - darwinSyncKeymap = [self prefs_get_boolean:@PREFS_SYNC_KEYMAP - default:darwinSyncKeymap]; + darwinSyncKeymap = [self prefs_get_boolean:@PREFS_SYNC_KEYMAP + default:darwinSyncKeymap]; - tem = [self prefs_get_string:@PREFS_KEYMAP_FILE default:NULL]; - - if (tem != NULL) darwinKeymapFile = strdup (tem); - else darwinKeymapFile = NULL; + tem = [self prefs_get_string:@PREFS_KEYMAP_FILE default:NULL]; + if (tem != NULL) + darwinKeymapFile = strdup (tem); + else + darwinKeymapFile = NULL; - darwinDesiredDepth = [self prefs_get_integer:@PREFS_DEPTH - default:darwinDesiredDepth]; + darwinDesiredDepth = [self prefs_get_integer:@PREFS_DEPTH + default:darwinDesiredDepth]; - enable_stereo = [self prefs_get_boolean:@PREFS_ENABLE_STEREO - default:false]; + enable_stereo = [self prefs_get_boolean:@PREFS_ENABLE_STEREO + default:false]; } /* This will end up at the end of the responder chain. */ -- (void) copy:sender { - QuartzMessageServerThread (kXDarwinPasteboardNotify, 1, - AppleWMCopyToPasteboard); +- (void) copy:sender +{ + QuartzMessageServerThread (kXDarwinPasteboardNotify, 1, + AppleWMCopyToPasteboard); } -- (BOOL) x_active { +- (BOOL) x_active +{ return _x_active; } @@ -661,62 +764,75 @@ static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) { static NSArray * array_with_strings_and_numbers (int nitems, const char **items, - const char *numbers) { - NSMutableArray *array, *subarray; - NSString *string, *number; - int i; + const char *numbers) +{ + NSMutableArray *array, *subarray; + NSString *string; + NSString *number; + int i; - /* (Can't autorelease on the X server thread) */ - - array = [[NSMutableArray alloc] initWithCapacity:nitems]; - - for (i = 0; i < nitems; i++) { - subarray = [[NSMutableArray alloc] initWithCapacity:2]; - - string = [[NSString alloc] initWithUTF8String:items[i]]; - [subarray addObject:string]; - [string release]; - - if (numbers[i] != 0) { - number = [[NSString alloc] initWithFormat:@"%d", numbers[i]]; - [subarray addObject:number]; - [number release]; - } else - [subarray addObject:@""]; - - [array addObject:subarray]; - [subarray release]; - } - - return array; + /* (Can't autorelease on the X server thread) */ + + array = [[NSMutableArray alloc] initWithCapacity:nitems]; + + for (i = 0; i < nitems; i++) + { + subarray = [[NSMutableArray alloc] initWithCapacity:2]; + + string = [[NSString alloc] initWithUTF8String:items[i]]; + [subarray addObject:string]; + [string release]; + + if (numbers[i] != 0) + { + number = [[NSString alloc] initWithFormat:@"%d", numbers[i]]; + [subarray addObject:number]; + [number release]; + } + else + [subarray addObject:@""]; + + [array addObject:subarray]; + [subarray release]; + } + + return array; } -void X11ApplicationSetWindowMenu (int nitems, const char **items, - const char *shortcuts) { - NSArray *array; - array = array_with_strings_and_numbers (nitems, items, shortcuts); - - /* Send the array of strings over to the appkit thread */ - - message_kit_thread (@selector (set_window_menu:), array); - [array release]; +void +X11ApplicationSetWindowMenu (int nitems, const char **items, + const char *shortcuts) +{ + NSArray *array; + array = array_with_strings_and_numbers (nitems, items, shortcuts); + + /* Send the array of strings over to the appkit thread */ + + message_kit_thread (@selector (set_window_menu:), array); + [array release]; } -void X11ApplicationSetWindowMenuCheck (int idx) { - NSNumber *n; - - n = [[NSNumber alloc] initWithInt:idx]; - - message_kit_thread (@selector (set_window_menu_check:), n); - - [n release]; +void +X11ApplicationSetWindowMenuCheck (int idx) +{ + NSNumber *n; + + n = [[NSNumber alloc] initWithInt:idx]; + + message_kit_thread (@selector (set_window_menu_check:), n); + + [n release]; } -void X11ApplicationSetFrontProcess (void) { +void +X11ApplicationSetFrontProcess (void) +{ message_kit_thread (@selector (set_front_process:), nil); } -void X11ApplicationSetCanQuit (int state) { +void +X11ApplicationSetCanQuit (int state) +{ NSNumber *n; n = [[NSNumber alloc] initWithBool:state]; @@ -726,11 +842,15 @@ void X11ApplicationSetCanQuit (int state) { [n release]; } -void X11ApplicationServerReady (void) { +void +X11ApplicationServerReady (void) +{ message_kit_thread (@selector (server_ready:), nil); } -void X11ApplicationShowHideMenubar (int state) { +void +X11ApplicationShowHideMenubar (int state) +{ NSNumber *n; n = [[NSNumber alloc] initWithBool:state]; @@ -740,20 +860,27 @@ void X11ApplicationShowHideMenubar (int state) { [n release]; } -static void * create_thread (void *func, void *arg) { +static void * +create_thread (void *func, void *arg) +{ pthread_attr_t attr; pthread_t tid; pthread_attr_init (&attr); + pthread_attr_setscope (&attr, PTHREAD_SCOPE_SYSTEM); pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED); + pthread_create (&tid, &attr, func, arg); + pthread_attr_destroy (&attr); return (void *) tid; } -static void check_xinitrc (void) { +static void +check_xinitrc (void) +{ char *tem, buf[1024]; NSString *msg; @@ -761,7 +888,8 @@ static void check_xinitrc (void) { return; tem = getenv ("HOME"); - if (tem == NULL) goto done; + if (tem == NULL) + goto done; snprintf (buf, sizeof (buf), "%s/.xinitrc", tem); if (access (buf, F_OK) != 0) @@ -769,43 +897,48 @@ static void check_xinitrc (void) { /* FIXME: put localized strings into Resources/English.lproj */ - msg = NSLocalizedString (@"You have an existing ~/.xinitrc file.\n\n\ -Windows displayed by X11 applications may not have titlebars, or may look \ -different to windows displayed by native applications.\n\n\ -Would you like to move aside the existing file and use the standard X11 \ -environment?", @"Startup xinitrc dialog"); + msg = NSLocalizedString ( + @"You have an existing ~/.xinitrc file.\n\n\ + Windows displayed by X11 applications may not have titlebars, or may look \ + different to windows displayed by native applications.\n\n\ + Would you like to move aside the existing file and use the standard X11 \ + environment?", @"Startup xinitrc dialog"); if (NSRunAlertPanel (nil, msg, NSLocalizedString (@"Yes", @""), - NSLocalizedString (@"No", @""), nil) - == NSAlertDefaultReturn) { - char buf2[1024]; - int i = -1; - - snprintf (buf2, sizeof (buf2), "%s.old", buf); - - for (i = 1; access (buf2, F_OK) == 0; i++) - snprintf (buf2, sizeof (buf2), "%s.old.%d", buf, i); - - rename (buf, buf2); + NSLocalizedString (@"No", @""), nil) + == NSAlertDefaultReturn) + { + char buf2[1024]; + int i = -1; + + snprintf (buf2, sizeof (buf2), "%s.old", buf); + + for (i = 1; access (buf2, F_OK) == 0; i++) + snprintf (buf2, sizeof (buf2), "%s.old.%d", buf, i); + + rename (buf, buf2); } - done: + done: [X11App prefs_set_boolean:@PREFS_DONE_XINIT_CHECK value:YES]; [X11App prefs_synchronize]; } -void X11ApplicationMain (int argc, const char *argv[], - void (*server_thread) (void *), void *server_arg) { +void +X11ApplicationMain (int argc, const char *argv[], + void (*server_thread) (void *), void *server_arg) +{ NSAutoreleasePool *pool; #ifdef DEBUG - while (access ("/tmp/x11-block", F_OK) == 0) sleep (1); + while (access ("/tmp/x11-block", F_OK) == 0) + sleep (1); #endif pool = [[NSAutoreleasePool alloc] init]; X11App = (X11Application *) [X11Application sharedApplication]; - + init_ports (); [NSApp read_defaults]; @@ -813,8 +946,8 @@ void X11ApplicationMain (int argc, const char *argv[], [NSBundle loadNibNamed:@"main" owner:NSApp]; [[NSNotificationCenter defaultCenter] addObserver:NSApp - selector:@selector (became_key:) - name:NSWindowDidBecomeKeyNotification object:nil]; + selector:@selector (became_key:) + name:NSWindowDidBecomeKeyNotification object:nil]; check_xinitrc (); @@ -826,101 +959,173 @@ void X11ApplicationMain (int argc, const char *argv[], /* Calculate the height of the menubar so we can avoid it. */ aquaMenuBarHeight = NSHeight([[NSScreen mainScreen] frame]) - - NSMaxY([[NSScreen mainScreen] visibleFrame]) - 1; + NSMaxY([[NSScreen mainScreen] visibleFrame]) - 1; - if (!create_thread (server_thread, server_arg)) { - ErrorF("can't create secondary thread\n"); - exit(1); + if (!create_thread (server_thread, server_arg)) + { + fprintf (stderr, "can't create secondary thread\n"); + exit (1); } [NSApp run]; + + /* not reached */ } /* event conversion */ static inline unsigned short -convert_flags (unsigned int nsflags) { - unsigned int xflags = 0; +convert_flags (unsigned int nsflags) +{ + unsigned int xflags; if (nsflags == ~0) return 0xffff; + xflags = 0; + if (nsflags & NSAlphaShiftKeyMask) xflags |= LockMask; - if (nsflags & NSShiftKeyMask) xflags |= ShiftMask; - if (nsflags & NSControlKeyMask) xflags |= ControlMask; + if (nsflags & NSShiftKeyMask) xflags |= ShiftMask; + if (nsflags & NSControlKeyMask) xflags |= ControlMask; if (nsflags & NSAlternateKeyMask) xflags |= Mod1Mask; - if (nsflags & NSCommandKeyMask) xflags |= Mod2Mask; + if (nsflags & NSCommandKeyMask) xflags |= Mod2Mask; /* FIXME: secondaryfn? */ return xflags; } - -// This code should probably be merged with that in XDarwin's XServer.m - BB -static void send_nsevent (NSEventType type, NSEvent *e) { - // static unsigned int button_state = 0; +static void +send_nsevent (NSEventType type, NSEvent *e) +{ + static unsigned int button_state = 0; NSRect screen; NSPoint location; NSWindow *window; - int pointer_x, pointer_y, ev_button, ev_type; - // int num_events=0, i=0, state; + int pointer_x, pointer_y; xEvent xe; - /* convert location to global top-left coordinates */ - location = [e locationInWindow]; - window = [e window]; - screen = [[[NSScreen screens] objectAtIndex:0] frame]; - - if (window != nil) { - NSRect frame = [window frame]; - pointer_x = location.x + frame.origin.x; - pointer_y = (((screen.origin.y + screen.size.height) - - location.y) - frame.origin.y); - } else { - pointer_x = location.x; - pointer_y = (screen.origin.y + screen.size.height) - location.y; - } - - pointer_y -= aquaMenuBarHeight; - // state = convert_flags ([e modifierFlags]); - - switch (type) { - case NSLeftMouseDown: ev_button=1; ev_type=ButtonPress; goto handle_mouse; - case NSOtherMouseDown: ev_button=2; ev_type=ButtonPress; goto handle_mouse; - case NSRightMouseDown: ev_button=3; ev_type=ButtonPress; goto handle_mouse; - case NSLeftMouseUp: ev_button=1; ev_type=ButtonRelease; goto handle_mouse; - case NSOtherMouseUp: ev_button=2; ev_type=ButtonRelease; goto handle_mouse; - case NSRightMouseUp: ev_button=3; ev_type=ButtonRelease; goto handle_mouse; - case NSLeftMouseDragged: ev_button=1; ev_type=MotionNotify; goto handle_mouse; - case NSOtherMouseDragged: ev_button=2; ev_type=MotionNotify; goto handle_mouse; - case NSRightMouseDragged: ev_button=3; ev_type=MotionNotify; goto handle_mouse; - case NSMouseMoved: ev_button=0; ev_type=MotionNotify; goto handle_mouse; - handle_mouse: - - /* I'm not sure the below code is necessary or useful (-bb) - if(ev_type==ButtonPress) { - if (!quartzProcs->IsX11Window([e window], [e windowNumber])) { - fprintf(stderr, "Dropping event because it's not a window\n"); - break; - } - button_state |= (1 << ev_button); - DarwinSendPointerEvents(ev_type, ev_button, pointer_x, pointer_y); - } else if (ev_type==ButtonRelease && (button_state & (1 << ev_button)) == 0) break; - */ - DarwinSendPointerEvents(ev_type, ev_button, pointer_x, pointer_y); - break; - case NSScrollWheel: - DarwinSendScrollEvents([e deltaY], pointer_x, pointer_y); - break; - - case NSKeyDown: // do we need to translate these keyCodes? - case NSKeyUp: - DarwinSendKeyboardEvents((type == NSKeyDown)?KeyPress:KeyRelease, [e keyCode]); - break; + memset (&xe, 0, sizeof (xe)); + + /* This field should be filled in for every event */ + xe.u.keyButtonPointer.time = GetTimeInMillis(); + /* convert location to global top-left coordinates */ + location = [e locationInWindow]; + window = [e window]; + screen = [[[NSScreen screens] objectAtIndex:0] frame]; + + if (window != nil) { + NSRect frame = [window frame]; + pointer_x = location.x + frame.origin.x; + pointer_y = (((screen.origin.y + screen.size.height) + - location.y) - frame.origin.y); + } else { + pointer_x = location.x; + pointer_y = (screen.origin.y + screen.size.height) - location.y; + } + + xe.u.keyButtonPointer.rootX = pointer_x; + xe.u.keyButtonPointer.rootY = pointer_y; + + switch (type) { + float count; + + case NSLeftMouseDown: + xe.u.u.type = ButtonPress; + xe.u.u.detail = 1; + goto do_press_event; + + case NSRightMouseDown: + xe.u.u.type = ButtonPress; + xe.u.u.detail = 3; + goto do_press_event; + + case NSOtherMouseDown: + xe.u.u.type = ButtonPress; + xe.u.u.detail = 2; /* FIXME? */ + goto do_press_event; + +do_press_event: + if (!quartzProcs->IsX11Window([e window], [e windowNumber])) { + /* X server doesn't grok this window, drop the event. + + Note: theoretically this isn't necessary, but if I click + on the menubar, we get sent a LeftMouseDown when the + release happens, but no LeftMouseUp is ever seen! */ + + break; + } + goto do_event; + + case NSLeftMouseUp: + xe.u.u.type = ButtonRelease; + xe.u.u.detail = 1; + goto do_release_event; + + case NSRightMouseUp: + xe.u.u.type = ButtonRelease; + xe.u.u.detail = 3; + goto do_release_event; + + case NSOtherMouseUp: + xe.u.u.type = ButtonRelease; + xe.u.u.detail = 2; /* FIXME? */ + goto do_release_event; + +do_release_event: + if ((button_state & (1 << xe.u.u.detail)) == 0) + { + /* X didn't see the button press for this release, so skip it */ + break; + } + goto do_event; + + case NSMouseMoved: + case NSLeftMouseDragged: + case NSRightMouseDragged: + case NSOtherMouseDragged: + xe.u.u.type = MotionNotify; + goto do_event; + + case NSKeyDown: + xe.u.u.type = KeyPress; + xe.u.u.detail = [e keyCode]; + goto do_event; + + case NSKeyUp: + xe.u.u.type = KeyRelease; + xe.u.u.detail = [e keyCode]; + goto do_event; + + case NSScrollWheel: + xe.u.keyButtonPointer.state = convert_flags ([e modifierFlags]); + count = [e deltaY]; + xe.u.u.detail = count > 0.0f ? 4 : 5; + for (count = fabs(count); count > 0.0; count = count - 1.0f) { + xe.u.u.type = ButtonPress; + DarwinEQEnqueue(&xe); + xe.u.u.type = ButtonRelease; + DarwinEQEnqueue(&xe); + } + xe.u.u.type = 0; + break; + case NSFlagsChanged: - DarwinUpdateModKeys([e modifierFlags]); - break; + xe.u.u.type = kXDarwinUpdateModifiers; + xe.u.clientMessage.u.l.longs0 = [e modifierFlags]; + DarwinEQEnqueue (&xe); + break; + +do_event: + // xe.u.keyButtonPointer.state = convert_flags ([e modifierFlags]); + DarwinEQEnqueue (&xe); + break; + default: break; /* for gcc */ - } + } + + if (xe.u.u.type == ButtonPress) + button_state |= (1 << xe.u.u.detail); + else if (xe.u.u.type == ButtonRelease) + button_state &= ~(1 << xe.u.u.detail); } diff --git a/hw/darwin/apple/X11Controller.h b/hw/darwin/apple/X11Controller.h index 8d17fd9c3..954d0abb9 100644 --- a/hw/darwin/apple/X11Controller.h +++ b/hw/darwin/apple/X11Controller.h @@ -1,4 +1,5 @@ /* X11Controller.h -- connect the IB ui + $Id: X11Controller.h,v 1.21 2003/07/24 17:52:29 jharper Exp $ Copyright (c) 2002 Apple Computer, Inc. All rights reserved. diff --git a/hw/darwin/apple/X11Controller.m b/hw/darwin/apple/X11Controller.m index 3dc965b69..cc039b115 100644 --- a/hw/darwin/apple/X11Controller.m +++ b/hw/darwin/apple/X11Controller.m @@ -296,17 +296,13 @@ - (void) launch_client:(NSString *)filename { const char *command = [filename UTF8String]; - const char *shell; const char *argv[5]; int child1, child2 = 0; int status; - shell = getenv("SHELL"); - if (shell == NULL) shell = "/bin/bash"; - - argv[0] = shell; - argv[1] = "-l"; - argv[2] = "-c"; + argv[0] = "/usr/bin/login"; + argv[1] = "-fp"; + argv[2] = getlogin(); argv[3] = command; argv[4] = NULL; @@ -655,7 +651,7 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row - (IBAction) x11_help:sender { - AHLookupAnchor (CFSTR ("Mac Help"), CFSTR ("mchlp2276")); + AHLookupAnchor ((CFStringRef)NSLocalizedString(@"Mac Help", no comment), CFSTR ("mchlp2276")); } - (BOOL) validateMenuItem:(NSMenuItem *)item diff --git a/hw/darwin/apple/bundle-main.c b/hw/darwin/apple/bundle-main.c index ec7820dc6..34cbcbab5 100644 --- a/hw/darwin/apple/bundle-main.c +++ b/hw/darwin/apple/bundle-main.c @@ -70,14 +70,15 @@ #include #include +#include #include #include #define X_SERVER "/usr/X11/bin/Xquartz" #define XTERM_PATH "/usr/X11/bin/xterm" -#define WM_PATH "/usr/X11/bin/quartz-wm" -#define DEFAULT_XINITRC "/etc/X11/xinit/xinitrc" +#define WM_PATH "/usr/bin/quartz-wm" +#define DEFAULT_XINITRC "/usr/X11/lib/X11/xinit/xinitrc" #define DEFAULT_PATH "/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11/bin" /* what xinit does */ @@ -595,15 +596,15 @@ static Boolean display_exists_p (int number) { char buf[64]; - void *conn; + xcb_connection_t *conn; char *fullname = NULL; int idisplay, iscreen; char *conn_auth_name, *conn_auth_data; int conn_auth_namelen, conn_auth_datalen; -#ifdef USE_XTRANS_INTERNALS - extern void *_X11TransConnectDisplay (); - extern void _XDisconnectDisplay (); -#endif + + // extern void *_X11TransConnectDisplay (); + // extern void _XDisconnectDisplay (); + /* Since connecting to the display waits for a few seconds if the display doesn't exist, check for trivial non-existence - if the socket in /tmp exists or not.. (note: if the socket exists, the @@ -612,20 +613,22 @@ display_exists_p (int number) sprintf (buf, "/tmp/.X11-unix/X%d", number); if (access (buf, F_OK) != 0) return FALSE; -#ifdef USE_XTRANS_INTERNALS + /* This is a private function that we shouldn't really be calling, but it's the best way to see if the server exists (without needing to hold the necessary authentication to use it) */ sprintf (buf, ":%d", number); - conn = _X11TransConnectDisplay (buf, &fullname, &idisplay, &iscreen, + /* conn = _X11TransConnectDisplay (buf, &fullname, &idisplay, &iscreen, &conn_auth_name, &conn_auth_namelen, - &conn_auth_data, &conn_auth_datalen); + &conn_auth_data, &conn_auth_datalen); */ + conn = xcb_connect(buf, NULL); + if (conn == NULL) return FALSE; - _XDisconnectDisplay (conn); -#endif + // _XDisconnectDisplay (conn); + xcb_disconnect(conn); return TRUE; } diff --git a/hw/darwin/bundle/Dutch.lproj/Localizable.strings b/hw/darwin/bundle/Dutch.lproj/Localizable.strings index 6abd91072..4fe16b355 100644 Binary files a/hw/darwin/bundle/Dutch.lproj/Localizable.strings and b/hw/darwin/bundle/Dutch.lproj/Localizable.strings differ diff --git a/hw/darwin/bundle/Dutch.lproj/Makefile.am b/hw/darwin/bundle/Dutch.lproj/Makefile.am index a480ceeb3..49a3ec557 100644 --- a/hw/darwin/bundle/Dutch.lproj/Makefile.am +++ b/hw/darwin/bundle/Dutch.lproj/Makefile.am @@ -15,13 +15,15 @@ Dutchlprojdir = $(resourcesdir)/Dutch.lproj Dutchlproj_DATA = \ XDarwinHelp.html \ InfoPlist.strings \ - Credits.rtf Localizable.strings + Credits.rtf Localizable.strings Localizable.strings Dutchlprojnibdir = $(Dutchlprojdir)/MainMenu.nib -Dutchlprojnib_DATA = MainMenu.nib/classes.nib MainMenu.nib/objects.nib +Dutchlprojnib_DATA = \ + MainMenu.nib/classes.nib \ + MainMenu.nib/objects.nib InfoPlist.strings: $(srcdir)/../English.lproj/InfoPlist.strings.cpp - $(RAWCPP) $(RAWCPPFLAGS) $(XDEFS) $(CPP_FILES_FLAGS) $< | $(CPP_SED_MAGIC) | $(SED) -e's/__quote__/"/g' > $@ + $(RAWCPP) $(RAWCPPFLAGS) $(XDEFS) $(CPP_FILES_FLAGS) $< | $(CPP_SED_MAGIC) | $(SED) -e's/__quote__/"/g' | iconv -t UTF-16 > $@ XDarwinHelp.html: XDarwinHelp.html.cpp $(RAWCPP) $(RAWCPPFLAGS) $(XDEFS) $(XDEFS) $(CPP_FILES_FLAGS) $< | $(CPP_SED_MAGIC) > $@ @@ -30,6 +32,8 @@ CLEANFILES = XDarwinHelp.html InfoPlist.strings EXTRA_DIST = \ Credits.rtf Localizable.strings \ + Localizable.strings \ MainMenu.nib/classes.nib \ MainMenu.nib/objects.nib \ XDarwinHelp.html.cpp + diff --git a/hw/darwin/bundle/English.lproj/Localizable.strings b/hw/darwin/bundle/English.lproj/Localizable.strings index 2c25c1dc3..f2e8e3c23 100644 Binary files a/hw/darwin/bundle/English.lproj/Localizable.strings and b/hw/darwin/bundle/English.lproj/Localizable.strings differ diff --git a/hw/darwin/bundle/English.lproj/Makefile.am b/hw/darwin/bundle/English.lproj/Makefile.am index 45587086f..8d6f7e52a 100644 --- a/hw/darwin/bundle/English.lproj/Makefile.am +++ b/hw/darwin/bundle/English.lproj/Makefile.am @@ -17,10 +17,12 @@ Englishlproj_DATA = \ Credits.rtf Localizable.strings Englishlprojnibdir = $(Englishlprojdir)/MainMenu.nib -Englishlprojnib_DATA = MainMenu.nib/classes.nib MainMenu.nib/objects.nib +Englishlprojnib_DATA = \ + MainMenu.nib/classes.nib \ + MainMenu.nib/objects.nib InfoPlist.strings: InfoPlist.strings.cpp - $(RAWCPP) $(RAWCPPFLAGS) $(XDEFS) $(CPP_FILES_FLAGS) $< | $(CPP_SED_MAGIC) | $(SED) -e's/__quote__/"/g' > $@ + $(RAWCPP) $(RAWCPPFLAGS) $(XDEFS) $(CPP_FILES_FLAGS) $< | $(CPP_SED_MAGIC) | $(SED) -e's/__quote__/"/g' | iconv -t UTF-16 > $@ XDarwinHelp.html: XDarwinHelp.html.cpp $(RAWCPP) $(RAWCPPFLAGS) $(XDEFS) $(CPP_FILES_FLAGS) $< | $(CPP_SED_MAGIC) > $@ @@ -29,7 +31,9 @@ CLEANFILES = XDarwinHelp.html InfoPlist.strings EXTRA_DIST = \ Credits.rtf Localizable.strings \ + Localizable.strings \ MainMenu.nib/classes.nib \ MainMenu.nib/objects.nib \ XDarwinHelp.html.cpp \ InfoPlist.strings.cpp + diff --git a/hw/darwin/bundle/French.lproj/Makefile.am b/hw/darwin/bundle/French.lproj/Makefile.am index 656ba5c0d..4dca9342f 100644 --- a/hw/darwin/bundle/French.lproj/Makefile.am +++ b/hw/darwin/bundle/French.lproj/Makefile.am @@ -20,10 +20,12 @@ Frenchlproj_DATA = \ Credits.rtf Localizable.strings Frenchlprojnibdir = $(Frenchlprojdir)/MainMenu.nib -Frenchlprojnib_DATA = MainMenu.nib/classes.nib MainMenu.nib/objects.nib +Frenchlprojnib_DATA = \ + MainMenu.nib/classes.nib \ + MainMenu.nib/objects.nib InfoPlist.strings: $(srcdir)/../English.lproj/InfoPlist.strings.cpp - $(RAWCPP) $(RAWCPPFLAGS) $(XDEFS) $(CPP_FILES_FLAGS) $< | $(CPP_SED_MAGIC) | $(SED) -e's/__quote__/"/g' > $@ + $(RAWCPP) $(RAWCPPFLAGS) $(XDEFS) $(CPP_FILES_FLAGS) $< | $(CPP_SED_MAGIC) | $(SED) -e's/__quote__/"/g' | iconv -t UTF-16 > $@ XDarwinHelp.html: XDarwinHelp.html.cpp $(RAWCPP) $(RAWCPPFLAGS) $(XDEFS) $(CPP_FILES_FLAGS) $< | $(CPP_SED_MAGIC) > $@ @@ -36,3 +38,4 @@ EXTRA_DIST = \ MainMenu.nib/classes.nib \ MainMenu.nib/objects.nib \ XDarwinHelp.html.cpp + diff --git a/hw/darwin/bundle/German.lproj/Makefile.am b/hw/darwin/bundle/German.lproj/Makefile.am index 17af414ec..fcb5dd24f 100644 --- a/hw/darwin/bundle/German.lproj/Makefile.am +++ b/hw/darwin/bundle/German.lproj/Makefile.am @@ -15,13 +15,15 @@ Germanlprojdir = $(resourcesdir)/German.lproj Germanlproj_DATA = \ XDarwinHelp.html \ InfoPlist.strings \ - Credits.rtf Localizable.strings + Credits.rtf Localizable.strings Localizable.strings Germanlprojnibdir = $(Germanlprojdir)/MainMenu.nib -Germanlprojnib_DATA = MainMenu.nib/classes.nib MainMenu.nib/objects.nib +Germanlprojnib_DATA = \ + MainMenu.nib/classes.nib \ + MainMenu.nib/objects.nib InfoPlist.strings: $(srcdir)/../English.lproj/InfoPlist.strings.cpp - $(RAWCPP) $(RAWCPPFLAGS) $(XDEFS) $(CPP_FILES_FLAGS) $< | $(CPP_SED_MAGIC) | $(SED) -e's/__quote__/"/g' > $@ + $(RAWCPP) $(RAWCPPFLAGS) $(XDEFS) $(CPP_FILES_FLAGS) $< | $(CPP_SED_MAGIC) | $(SED) -e's/__quote__/"/g' | iconv -t UTF-16 > $@ XDarwinHelp.html: XDarwinHelp.html.cpp $(RAWCPP) $(RAWCPPFLAGS) $(XDEFS) $(XDEFS) $(CPP_FILES_FLAGS) $< | $(CPP_SED_MAGIC) > $@ @@ -34,3 +36,4 @@ EXTRA_DIST = \ MainMenu.nib/classes.nib \ MainMenu.nib/objects.nib \ XDarwinHelp.html.cpp + diff --git a/hw/darwin/bundle/Info.plist b/hw/darwin/bundle/Info.plist index bfef48d26..7e1770819 100644 --- a/hw/darwin/bundle/Info.plist +++ b/hw/darwin/bundle/Info.plist @@ -43,7 +43,7 @@ CFBundleIconFile XDarwin.icns CFBundleIdentifier - org.x.XDarwin + org.x.X11 CFBundleInfoDictionaryVersion 6.0 CFBundleName @@ -51,7 +51,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - XDarwin 1.4.0 + 2.0.0 CFBundleSignature ???? CFBundleVersion diff --git a/hw/darwin/bundle/Japanese.lproj/Makefile.am b/hw/darwin/bundle/Japanese.lproj/Makefile.am index 2cc524858..8d891edb5 100644 --- a/hw/darwin/bundle/Japanese.lproj/Makefile.am +++ b/hw/darwin/bundle/Japanese.lproj/Makefile.am @@ -19,10 +19,12 @@ Japaneselproj_DATA = \ Credits.rtf Localizable.strings Japaneselprojnibdir = $(Japaneselprojdir)/MainMenu.nib -Japaneselprojnib_DATA = MainMenu.nib/classes.nib MainMenu.nib/objects.nib +Japaneselprojnib_DATA = \ + MainMenu.nib/classes.nib \ + MainMenu.nib/objects.nib InfoPlist.strings: $(srcdir)/../English.lproj/InfoPlist.strings.cpp - $(RAWCPP) $(RAWCPPFLAGS) $(XDEFS) $(CPP_FILES_FLAGS) $< | $(CPP_SED_MAGIC) | $(SED) -e's/__quote__/"/g' > $@ + $(RAWCPP) $(RAWCPPFLAGS) $(XDEFS) $(CPP_FILES_FLAGS) $< | $(CPP_SED_MAGIC) | $(SED) -e's/__quote__/"/g' | iconv -t UTF-16 > $@ XDarwinHelp.html: XDarwinHelp.html.cpp $(RAWCPP) $(RAWCPPFLAGS) $(XDEFS) $(CPP_FILES_FLAGS) $< | $(CPP_SED_MAGIC) > $@ @@ -35,3 +37,4 @@ EXTRA_DIST = \ MainMenu.nib/classes.nib \ MainMenu.nib/objects.nib \ XDarwinHelp.html.cpp + diff --git a/hw/darwin/bundle/Portuguese.lproj/Makefile.am b/hw/darwin/bundle/Portuguese.lproj/Makefile.am index 81ba2be26..540649c7a 100644 --- a/hw/darwin/bundle/Portuguese.lproj/Makefile.am +++ b/hw/darwin/bundle/Portuguese.lproj/Makefile.am @@ -18,10 +18,12 @@ Portugueselproj_DATA = \ Credits.rtf Localizable.strings Portugueselprojnibdir = $(Portugueselprojdir)/MainMenu.nib -Portugueselprojnib_DATA = MainMenu.nib/classes.nib MainMenu.nib/objects.nib +Portugueselprojnib_DATA = \ + MainMenu.nib/classes.nib \ + MainMenu.nib/objects.nib InfoPlist.strings: $(srcdir)/../English.lproj/InfoPlist.strings.cpp - $(RAWCPP) $(RAWCPPFLAGS) $(XDEFS) $(CPP_FILES_FLAGS) $< | $(CPP_SED_MAGIC) | $(SED) -e's/__quote__/"/g' > $@ + $(RAWCPP) $(RAWCPPFLAGS) $(XDEFS) $(CPP_FILES_FLAGS) $< | $(CPP_SED_MAGIC) | $(SED) -e's/__quote__/"/g' | iconv -t UTF-16 > $@ XDarwinHelp.html: XDarwinHelp.html.cpp $(RAWCPP) $(RAWCPPFLAGS) $(XDEFS) $(CPP_FILES_FLAGS) $< | $(CPP_SED_MAGIC) > $@ @@ -34,3 +36,4 @@ EXTRA_DIST = \ MainMenu.nib/classes.nib \ MainMenu.nib/objects.nib \ XDarwinHelp.html.cpp + diff --git a/hw/darwin/bundle/Spanish.lproj/Makefile.am b/hw/darwin/bundle/Spanish.lproj/Makefile.am index 438d0c2bd..978ac3542 100644 --- a/hw/darwin/bundle/Spanish.lproj/Makefile.am +++ b/hw/darwin/bundle/Spanish.lproj/Makefile.am @@ -18,10 +18,12 @@ Spanishlproj_DATA = \ Credits.rtf Localizable.strings Spanishlprojnibdir = $(Spanishlprojdir)/MainMenu.nib -Spanishlprojnib_DATA = MainMenu.nib/classes.nib MainMenu.nib/objects.nib +Spanishlprojnib_DATA = \ + MainMenu.nib/classes.nib \ + MainMenu.nib/objects.nib InfoPlist.strings: $(srcdir)/../English.lproj/InfoPlist.strings.cpp - $(RAWCPP) $(RAWCPPFLAGS) $(XDEFS) $(CPP_FILES_FLAGS) $< | $(CPP_SED_MAGIC) | $(SED) -e's/__quote__/"/g' > $@ + $(RAWCPP) $(RAWCPPFLAGS) $(XDEFS) $(CPP_FILES_FLAGS) $< | $(CPP_SED_MAGIC) | $(SED) -e's/__quote__/"/g' | iconv -t UTF-16 > $@ XDarwinHelp.html: XDarwinHelp.html.cpp $(RAWCPP) $(RAWCPPFLAGS) $(XDEFS) $(CPP_FILES_FLAGS) $< | $(CPP_SED_MAGIC) > $@ @@ -34,3 +36,4 @@ EXTRA_DIST = \ MainMenu.nib/classes.nib \ MainMenu.nib/objects.nib \ XDarwinHelp.html.cpp + diff --git a/hw/darwin/bundle/Swedish.lproj/Makefile.am b/hw/darwin/bundle/Swedish.lproj/Makefile.am index 19f35a690..3cf542c4a 100644 --- a/hw/darwin/bundle/Swedish.lproj/Makefile.am +++ b/hw/darwin/bundle/Swedish.lproj/Makefile.am @@ -18,10 +18,12 @@ Swedishlproj_DATA = \ Credits.rtf Localizable.strings Swedishlprojnibdir = $(Swedishlprojdir)/MainMenu.nib -Swedishlprojnib_DATA = MainMenu.nib/classes.nib MainMenu.nib/objects.nib +Swedishlprojnib_DATA = \ + MainMenu.nib/classes.nib \ + MainMenu.nib/objects.nib InfoPlist.strings: $(srcdir)/../English.lproj/InfoPlist.strings.cpp - $(RAWCPP) $(RAWCPPFLAGS) $(XDEFS) $(CPP_FILES_FLAGS) $< | $(CPP_SED_MAGIC) | $(SED) -e's/__quote__/"/g' > $@ + $(RAWCPP) $(RAWCPPFLAGS) $(XDEFS) $(CPP_FILES_FLAGS) $< | $(CPP_SED_MAGIC) | $(SED) -e's/__quote__/"/g' | iconv -t UTF-16 > $@ XDarwinHelp.html: XDarwinHelp.html.cpp $(RAWCPP) $(RAWCPPFLAGS) $(XDEFS) $(CPP_FILES_FLAGS) $< | $(CPP_SED_MAGIC) > $@ @@ -34,3 +36,4 @@ EXTRA_DIST = \ MainMenu.nib/classes.nib \ MainMenu.nib/objects.nib \ XDarwinHelp.html.cpp + diff --git a/hw/darwin/bundle/ko.lproj/Makefile.am b/hw/darwin/bundle/ko.lproj/Makefile.am index 56dd6b310..a5462ff9f 100644 --- a/hw/darwin/bundle/ko.lproj/Makefile.am +++ b/hw/darwin/bundle/ko.lproj/Makefile.am @@ -19,10 +19,12 @@ kolproj_DATA = \ Credits.rtf Localizable.strings kolprojnibdir = $(kolprojdir)/MainMenu.nib -kolprojnib_DATA = MainMenu.nib/classes.nib MainMenu.nib/objects.nib +kolprojnib_DATA = \ + MainMenu.nib/classes.nib \ + MainMenu.nib/objects.nib InfoPlist.strings: $(srcdir)/../English.lproj/InfoPlist.strings.cpp - $(RAWCPP) $(RAWCPPFLAGS) $(XDEFS) $(CPP_FILES_FLAGS) $< | $(CPP_SED_MAGIC) | $(SED) -e's/__quote__/"/g' > $@ + $(RAWCPP) $(RAWCPPFLAGS) $(XDEFS) $(CPP_FILES_FLAGS) $< | $(CPP_SED_MAGIC) | $(SED) -e's/__quote__/"/g' | iconv -t UTF-16 > $@ XDarwinHelp.html: XDarwinHelp.html.cpp $(RAWCPP) $(RAWCPPFLAGS) $(XDEFS) $(CPP_FILES_FLAGS) $< | $(CPP_SED_MAGIC) > $@ @@ -35,3 +37,4 @@ EXTRA_DIST = \ MainMenu.nib/classes.nib \ MainMenu.nib/objects.nib \ XDarwinHelp.html.cpp + diff --git a/hw/darwin/iokit/Makefile.am b/hw/darwin/iokit/Makefile.am index 54464aec9..77227d77b 100644 --- a/hw/darwin/iokit/Makefile.am +++ b/hw/darwin/iokit/Makefile.am @@ -1,6 +1,6 @@ noinst_LIBRARIES = libiokit.a -AM_CFLAGS = @XORG_CFLAGS@ @DIX_CFLAGS@ +AM_CFLAGS = @XORG_CFLAGS@ INCLUDES = -I. -I.. -I$(srcdir) -I$(srcdir)/.. @XORG_INCS@ AM_DEFS = if XQUARTZ diff --git a/hw/darwin/launcher/Info.plist b/hw/darwin/launcher/Info.plist new file mode 100644 index 000000000..b5385b61a --- /dev/null +++ b/hw/darwin/launcher/Info.plist @@ -0,0 +1,30 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + X11 + CFBundleGetInfoString + 2.0, Copyright © 2003-2007, Apple Inc. + CFBundleIconFile + X11.icns + CFBundleIdentifier + org.x.X11_launcher + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + X11 + CFBundlePackageType + APPL + CFBundleShortVersionString + 2.0 + CFBundleSignature + x11l + LSUIElement + 1 + NSHumanReadableCopyright + Copyright © 2007, Apple Inc. + + diff --git a/hw/darwin/launcher/X11.icns b/hw/darwin/launcher/X11.icns new file mode 100644 index 000000000..d770e617d Binary files /dev/null and b/hw/darwin/launcher/X11.icns differ diff --git a/hw/darwin/launcher/X11.xcodeproj/project.pbxproj b/hw/darwin/launcher/X11.xcodeproj/project.pbxproj new file mode 100644 index 000000000..f82552ac5 --- /dev/null +++ b/hw/darwin/launcher/X11.xcodeproj/project.pbxproj @@ -0,0 +1,297 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 42; + objects = { + +/* Begin PBXBuildFile section */ + 527F241B0B5D938C007840A7 /* X11.icns in Resources */ = {isa = PBXBuildFile; fileRef = 50459C5F038587C60ECA21EC /* X11.icns */; }; + 527F241D0B5D938C007840A7 /* bundle-main.c in Sources */ = {isa = PBXBuildFile; fileRef = 50EE2AB703849F0B0ECA21EC /* bundle-main.c */; }; + 527F241F0B5D938C007840A7 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 50F4F0A7039D6ACA0E82C0CB /* CoreFoundation.framework */; }; + 527F24370B5D9D89007840A7 /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 527F24260B5D938C007840A7 /* Info.plist */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 50459C5F038587C60ECA21EC /* X11.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = X11.icns; sourceTree = ""; }; + 50EE2AB703849F0B0ECA21EC /* bundle-main.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = "bundle-main.c"; sourceTree = ""; }; + 50F4F0A7039D6ACA0E82C0CB /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = /System/Library/Frameworks/CoreFoundation.framework; sourceTree = ""; }; + 527F24260B5D938C007840A7 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = Info.plist; sourceTree = ""; }; + 527F24270B5D938C007840A7 /* X11.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = X11.app; sourceTree = BUILT_PRODUCTS_DIR; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 527F241E0B5D938C007840A7 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 527F241F0B5D938C007840A7 /* CoreFoundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 195DF8CFFE9D517E11CA2CBB /* Products */ = { + isa = PBXGroup; + children = ( + 527F24270B5D938C007840A7 /* X11.app */, + ); + name = Products; + sourceTree = ""; + }; + 20286C29FDCF999611CA2CEA /* X11 */ = { + isa = PBXGroup; + children = ( + 20286C2AFDCF999611CA2CEA /* Sources */, + 20286C2CFDCF999611CA2CEA /* Resources */, + 20286C32FDCF999611CA2CEA /* External Frameworks and Libraries */, + 195DF8CFFE9D517E11CA2CBB /* Products */, + 527F24260B5D938C007840A7 /* Info.plist */, + ); + name = X11; + sourceTree = ""; + }; + 20286C2AFDCF999611CA2CEA /* Sources */ = { + isa = PBXGroup; + children = ( + 50EE2AB703849F0B0ECA21EC /* bundle-main.c */, + ); + name = Sources; + sourceTree = ""; + }; + 20286C2CFDCF999611CA2CEA /* Resources */ = { + isa = PBXGroup; + children = ( + 50459C5F038587C60ECA21EC /* X11.icns */, + ); + name = Resources; + sourceTree = ""; + }; + 20286C32FDCF999611CA2CEA /* External Frameworks and Libraries */ = { + isa = PBXGroup; + children = ( + 50F4F0A7039D6ACA0E82C0CB /* CoreFoundation.framework */, + ); + name = "External Frameworks and Libraries"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + 527F24170B5D938C007840A7 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + 527F24160B5D938C007840A7 /* X11 */ = { + isa = PBXNativeTarget; + buildConfigurationList = 527F24220B5D938C007840A7 /* Build configuration list for PBXNativeTarget "X11" */; + buildPhases = ( + 527F24170B5D938C007840A7 /* Headers */, + 527F24180B5D938C007840A7 /* Resources */, + 527F241C0B5D938C007840A7 /* Sources */, + 527F241E0B5D938C007840A7 /* Frameworks */, + 527F24210B5D938C007840A7 /* Rez */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = X11; + productName = X11; + productReference = 527F24270B5D938C007840A7 /* X11.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 20286C28FDCF999611CA2CEA /* Project object */ = { + isa = PBXProject; + buildConfigurationList = 527F24080B5D8FFC007840A7 /* Build configuration list for PBXProject "X11" */; + compatibilityVersion = "Xcode 2.4"; + hasScannedForEncodings = 1; + mainGroup = 20286C29FDCF999611CA2CEA /* X11 */; + projectDirPath = ""; + projectRoot = ""; + shouldCheckCompatibility = 1; + targets = ( + 527F24160B5D938C007840A7 /* X11 */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 527F24180B5D938C007840A7 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 527F24370B5D9D89007840A7 /* Info.plist in Resources */, + 527F241B0B5D938C007840A7 /* X11.icns in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXRezBuildPhase section */ + 527F24210B5D938C007840A7 /* Rez */ = { + isa = PBXRezBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXRezBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 527F241C0B5D938C007840A7 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 527F241D0B5D938C007840A7 /* bundle-main.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 527F24090B5D8FFC007840A7 /* Development */ = { + isa = XCBuildConfiguration; + buildSettings = { + DSTROOT = "$(DSTROOT)"; + SKIP_INSTALL = YES; + }; + name = Development; + }; + 527F240A0B5D8FFC007840A7 /* Deployment */ = { + isa = XCBuildConfiguration; + buildSettings = { + DSTROOT = "$(DSTROOT)"; + SKIP_INSTALL = YES; + }; + name = Deployment; + }; + 527F240B0B5D8FFC007840A7 /* Default */ = { + isa = XCBuildConfiguration; + buildSettings = { + DSTROOT = "$(DSTROOT)"; + SKIP_INSTALL = YES; + }; + name = Default; + }; + 527F24230B5D938C007840A7 /* Development */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(NATIVE_ARCH_32_BIT)"; + COPY_PHASE_STRIP = NO; + DSTROOT = "$(DSTROOT)"; + FRAMEWORK_SEARCH_PATHS = ""; + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + HEADER_SEARCH_PATHS = /usr/X11/include; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = $DSTROOT/Applications/Utilties; + LIBRARY_SEARCH_PATHS = /usr/X11/lib; + OTHER_CFLAGS = ""; + OTHER_LDFLAGS = ( + "-lXau", + "-lxcb", + "-lX11", + ); + OTHER_REZFLAGS = ""; + PRODUCT_NAME = X11; + SECTORDER_FLAGS = ""; + WARNING_CFLAGS = ( + "-Wmost", + "-Wno-four-char-constants", + "-Wno-unknown-pragmas", + ); + WRAPPER_EXTENSION = app; + }; + name = Development; + }; + 527F24240B5D938C007840A7 /* Deployment */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = YES; + DSTROOT = "$(DSTROOT)"; + FRAMEWORK_SEARCH_PATHS = ""; + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + HEADER_SEARCH_PATHS = /usr/X11/include; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = $DSTROOT/Applications/Utilties; + LIBRARY_SEARCH_PATHS = /usr/X11/lib; + OTHER_CFLAGS = ""; + OTHER_LDFLAGS = ""; + OTHER_REZFLAGS = ""; + PRODUCT_NAME = X11; + SECTORDER_FLAGS = ""; + WARNING_CFLAGS = ( + "-Wmost", + "-Wno-four-char-constants", + "-Wno-unknown-pragmas", + ); + WRAPPER_EXTENSION = app; + }; + name = Deployment; + }; + 527F24250B5D938C007840A7 /* Default */ = { + isa = XCBuildConfiguration; + buildSettings = { + DSTROOT = "$(DSTROOT)"; + FRAMEWORK_SEARCH_PATHS = ""; + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + HEADER_SEARCH_PATHS = /usr/X11/include; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = $DSTROOT/Applications/Utilties; + LIBRARY_SEARCH_PATHS = /usr/X11/lib; + OTHER_CFLAGS = ""; + OTHER_LDFLAGS = ( + "-lXau", + "-lxcb", + "-lX11", + ); + OTHER_REZFLAGS = ""; + PRODUCT_NAME = X11; + SECTORDER_FLAGS = ""; + WARNING_CFLAGS = ( + "-Wmost", + "-Wno-four-char-constants", + "-Wno-unknown-pragmas", + ); + WRAPPER_EXTENSION = app; + }; + name = Default; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 527F24080B5D8FFC007840A7 /* Build configuration list for PBXProject "X11" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 527F24090B5D8FFC007840A7 /* Development */, + 527F240A0B5D8FFC007840A7 /* Deployment */, + 527F240B0B5D8FFC007840A7 /* Default */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Default; + }; + 527F24220B5D938C007840A7 /* Build configuration list for PBXNativeTarget "X11" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 527F24230B5D938C007840A7 /* Development */, + 527F24240B5D938C007840A7 /* Deployment */, + 527F24250B5D938C007840A7 /* Default */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Default; + }; +/* End XCConfigurationList section */ + }; + rootObject = 20286C28FDCF999611CA2CEA /* Project object */; +} diff --git a/hw/darwin/launcher/bundle-main.c b/hw/darwin/launcher/bundle-main.c new file mode 100644 index 000000000..988c04f68 --- /dev/null +++ b/hw/darwin/launcher/bundle-main.c @@ -0,0 +1,79 @@ +/* main.c -- X application launcher + + Copyright (c) 2007 Apple Inc. + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation files + (the "Software"), to deal in the Software without restriction, + including without limitation the rights to use, copy, modify, merge, + publish, distribute, sublicense, and/or sell copies of the Software, + and to permit persons to whom the Software is furnished to do so, + subject to the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT + HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + + Except as contained in this notice, the name(s) of the above + copyright holders shall not be used in advertising or otherwise to + promote the sale, use or other dealings in this Software without + prior written authorization. */ + +#include +#include +#include + +#include + +#define DEFAULT_APP "/usr/X11/bin/xterm" + +int main (int argc, char **argv) { + char *command = DEFAULT_APP; + const char *newargv[5]; + int child; + + + CFPropertyListRef PlistRef = CFPreferencesCopyAppValue(CFSTR("app_to_run"), + kCFPreferencesCurrentApplication); + + if ((PlistRef == NULL) || (CFGetTypeID(PlistRef) != CFStringGetTypeID())) { + CFPreferencesSetAppValue(CFSTR("app_to_run"), CFSTR(DEFAULT_APP), + kCFPreferencesCurrentApplication); + CFPreferencesAppSynchronize(kCFPreferencesCurrentApplication); + } else { + int len = CFStringGetLength((CFStringRef)PlistRef)+1; + command = (char *) malloc(len); + CFStringGetCString((CFStringRef)PlistRef, command, len, kCFStringEncodingASCII); + fprintf(stderr, "command=%s\n", command); + } + + if (PlistRef) CFRelease(PlistRef); + + newargv[0] = "/usr/bin/login"; + newargv[1] = "-fp"; + newargv[2] = getlogin(); + newargv[3] = command; + newargv[4] = NULL; + + child = fork(); + + switch (child) { + case -1: /* error */ + perror ("fork"); + return EXIT_FAILURE; + case 0: /* child */ + execvp (newargv[0], (char **const) newargv); + perror ("Couldn't exec"); + _exit (1); + } + + return 0; +} diff --git a/hw/darwin/quartz/Makefile.am b/hw/darwin/quartz/Makefile.am index 993cdb0ec..bc6d4fc29 100644 --- a/hw/darwin/quartz/Makefile.am +++ b/hw/darwin/quartz/Makefile.am @@ -1,14 +1,16 @@ noinst_LIBRARIES = libXQuartz.a -AM_CFLAGS = @XORG_CFLAGS@ @DIX_CFLAGS@ -AM_OBJCFLAGS = @XORG_CFLAGS@ @DIX_CFLAGS@ +AM_CFLAGS = @XORG_CFLAGS@ +AM_OBJCFLAGS = @XORG_CFLAGS@ INCLUDES = -I$(srcdir) -I$(srcdir)/.. @XORG_INCS@ AM_DEFS = -DHAS_CG_MACH_PORT -DHAS_KL_API if HAVE_X_PLUGIN AM_DEFS += -DBUILD_XPR +XPR = xpr endif DEFS = @DEFS@ $(AM_DEFS) -DXBINDIR=\"${bindir}\" +SUBDIRS = cr fullscreen $(XPR) libXQuartz_a_SOURCES = \ Preferences.m \ @@ -37,6 +39,7 @@ install-exec-local: man1_MANS = XDarwinStartup.man + EXTRA_DIST = \ applewmExt.h \ keysym2ucs.h \ diff --git a/hw/darwin/quartz/cr/Makefile.am b/hw/darwin/quartz/cr/Makefile.am new file mode 100644 index 000000000..abfac991c --- /dev/null +++ b/hw/darwin/quartz/cr/Makefile.am @@ -0,0 +1,21 @@ +noinst_LIBRARIES = libcr.a +AM_CFLAGS = @XORG_CFLAGS@ +AM_OBJCFLAGS = @XORG_CFLAGS@ +DEFS = @DEFS@ -DDEFER_NSWINDOW +INCLUDES = @XORG_INCS@ \ + -I../fullscreen \ + -I$(srcdir) -I$(srcdir)/.. -I$(srcdir)/../.. \ + -I$(top_srcdir)/miext/rootless \ + -I$(top_srcdir)/miext/rootless/safeAlpha \ + -I$(top_srcdir)/mi + +libcr_a_SOURCES = crAppleWM.m \ + crFrame.m \ + crScreen.m \ + ../fullscreen/quartzCursor.c \ + XView.m + +EXTRA_DIST = \ + cr.h \ + XView.h + diff --git a/hw/darwin/quartz/fullscreen/Makefile.am b/hw/darwin/quartz/fullscreen/Makefile.am new file mode 100644 index 000000000..37c767c35 --- /dev/null +++ b/hw/darwin/quartz/fullscreen/Makefile.am @@ -0,0 +1,9 @@ +noinst_LIBRARIES = libfullscreen.a +AM_CFLAGS = @XORG_CFLAGS@ +INCLUDES = @XORG_INCS@ -I$(srcdir) -I$(srcdir)/.. -I$(srcdir)/../.. + +libfullscreen_a_SOURCES = fullscreen.c \ + quartzCursor.c + +EXTRA_DIST = \ + quartzCursor.h diff --git a/hw/darwin/quartz/xpr/Makefile.am b/hw/darwin/quartz/xpr/Makefile.am new file mode 100644 index 000000000..980c7a4d6 --- /dev/null +++ b/hw/darwin/quartz/xpr/Makefile.am @@ -0,0 +1,30 @@ +noinst_LIBRARIES = libxpr.a +AM_CFLAGS = @XORG_CFLAGS@ +INCLUDES = @XORG_INCS@ \ + -I$(srcdir) -I$(srcdir)/.. -I$(srcdir)/../.. \ + -I$(top_srcdir)/miext/rootless \ + -I$(top_srcdir)/miext/rootless/safeAlpha \ + -I$(top_srcdir)/miext + +libxpr_a_SOURCES = \ + appledri.c \ + dri.c \ + xprAppleWM.c \ + xprCursor.c \ + xprFrame.c \ + xprScreen.c \ + x-hash.c \ + x-hook.c \ + x-list.c + +xprbundledir = @APPLE_APPLICATIONS_DIR@/Resources/xpr.bundle/Contents/MacOS + +EXTRA_DIST = \ + dri.h \ + dristruct.h \ + x-hash.h \ + x-hook.h \ + x-list.h \ + Xplugin.h \ + xpr.h + diff --git a/hw/darwin/quartz/xpr/appledri.h b/hw/darwin/quartz/xpr/appledri.h index c4e43be12..9c630373d 100644 --- a/hw/darwin/quartz/xpr/appledri.h +++ b/hw/darwin/quartz/xpr/appledri.h @@ -1,3 +1,4 @@ +/* $XFree86: xc/lib/GL/dri/xf86dri.h,v 1.7 2000/12/07 20:26:02 dawes Exp $ */ /************************************************************************** Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. diff --git a/hw/darwin/quartz/xpr/appledristr.h b/hw/darwin/quartz/xpr/appledristr.h index 8649fd329..36a2e891e 100644 --- a/hw/darwin/quartz/xpr/appledristr.h +++ b/hw/darwin/quartz/xpr/appledristr.h @@ -1,3 +1,4 @@ +/* $XFree86: xc/lib/GL/dri/xf86dristr.h,v 1.9 2001/03/21 16:01:08 dawes Exp $ */ /************************************************************************** Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. diff --git a/hw/darwin/utils/Makefile.am b/hw/darwin/utils/Makefile.am index 11a26111e..92bf151cb 100644 --- a/hw/darwin/utils/Makefile.am +++ b/hw/darwin/utils/Makefile.am @@ -7,5 +7,6 @@ dumpkeymap_LDFLAGS = -Wl,-framework,IOKit man1_MANS = dumpkeymap.man EXTRA_DIST = \ - README.txt \ - dumpkeymap.man + README.txt \ + dumpkeymap.man + diff --git a/hw/darwin/utils/event_status_driver.h b/hw/darwin/utils/event_status_driver.h new file mode 100644 index 000000000..8948f3349 --- /dev/null +++ b/hw/darwin/utils/event_status_driver.h @@ -0,0 +1,133 @@ +/* + * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * The contents of this file constitute Original Code as defined in and + * are subject to the Apple Public Source License Version 1.1 (the + * "License"). You may not use this file except in compliance with the + * License. Please obtain a copy of the License at + * http://www.apple.com/publicsource and read it before using this file. + * + * This Original Code and all software distributed under the License are + * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the + * License for the specific language governing rights and limitations + * under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ +/****************************************************************************** + event_status_driver.h + API for the events status driver. + This file contains public API. + mpaque 11Oct91 + + Copyright 1991 NeXT Computer, Inc. + + Modified: + +******************************************************************************/ + +#ifndef _DRIVERS_EVENT_STATUS_DRIVER_ +#define _DRIVERS_EVENT_STATUS_DRIVER_ + +__BEGIN_DECLS + +#include +#include +#include +#include + +/* + * Event System Handle: + * + * Information used by the system between calls to NXOpenEventSystem and + * NXCloseEventSystem. The application should not + * access any of the elements of this structure. + */ +typedef mach_port_t NXEventHandle; + +/* Open and Close */ +NXEventHandle NXOpenEventStatus(void); +void NXCloseEventStatus(NXEventHandle handle); + +/* Status */ +extern NXEventSystemInfoType NXEventSystemInfo(NXEventHandle handle, + char *flavor, + int *evs_info, + unsigned int *evs_info_cnt); +/* Keyboard */ +extern void NXSetKeyRepeatInterval(NXEventHandle handle, double seconds); +extern double NXKeyRepeatInterval(NXEventHandle handle); +extern void NXSetKeyRepeatThreshold(NXEventHandle handle, double threshold); +extern double NXKeyRepeatThreshold(NXEventHandle handle); +extern void NXResetKeyboard(NXEventHandle handle); + +/* Mouse */ +extern void NXSetClickTime(NXEventHandle handle, double seconds); +extern double NXClickTime(NXEventHandle handle); +extern void NXSetClickSpace(NXEventHandle handle, _NXSize_ *area); +extern void NXGetClickSpace(NXEventHandle handle, _NXSize_ *area); +extern void NXResetMouse(NXEventHandle handle); + +/* DEPRECATED API */ + +/* NXIdleTime has been deprecated as this API does not take into account + events posted through the CG API set. Instead, we strongly encourage + developers to make use of the CGSSecondsSinceLastInputEvent API. */ +extern double NXIdleTime(NXEventHandle handle) +AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4; + +/* These methods are NOT supported. */ +extern NXKeyMapping *NXSetKeyMapping(NXEventHandle h, NXKeyMapping *keymap) +AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4; + +extern int NXKeyMappingLength(NXEventHandle handle) +AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4; + +extern NXKeyMapping *NXGetKeyMapping(NXEventHandle h, NXKeyMapping *keymap) +AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4; + +/* These methods are NOT supported and will return NULL values. */ +extern void NXSetMouseScaling(NXEventHandle handle, NXMouseScaling *scaling) +AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4; + +extern void NXGetMouseScaling(NXEventHandle handle, NXMouseScaling *scaling) +AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4; + +extern void NXSetAutoDimThreshold(NXEventHandle handle, double seconds) +AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4; + +extern double NXAutoDimThreshold(NXEventHandle handle) +AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4; + +extern double NXAutoDimTime(NXEventHandle handle) +AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4; + +extern void NXSetAutoDimState(NXEventHandle handle, boolean_t dimmed) +AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4; + +extern boolean_t NXAutoDimState(NXEventHandle handle) +AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4; + +extern void NXSetAutoDimBrightness(NXEventHandle handle, double level) +AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4; + +extern double NXAutoDimBrightness(NXEventHandle handle) +AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4; + +extern void NXSetScreenBrightness(NXEventHandle handle, double level) +AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4; + +extern double NXScreenBrightness(NXEventHandle handle) +AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4; + +/* END DEPRECATED API */ + +__END_DECLS + +#endif /*_DRIVERS_EVENT_STATUS_DRIVER_ */ +