| |
Changeset 81
- Timestamp:
- 04/13/07 17:51:30
(2 years ago)
- Author:
- mike
- Message:
[fix] "#define kju_debug 1" for verbous log messages (txs Andreas F for suggestion)
[fix] added openbios-sparc32 to sparc package (txs Andreas F)
[fix] simplyfied "make install" (txs Andreas F for suggestion)
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r80 |
r81 |
|
| | 1 | Q-0.9.0d81 |
|---|
| | 2 | [fix] "#define kju_debug 1" for verbous log messages (txs Andreas F for suggestion) |
|---|
| | 3 | [fix] added openbios-sparc32 to sparc package (txs Andreas F) |
|---|
| | 4 | [fix] simplyfied "make install" (txs Andreas F for suggestion) |
|---|
| | 5 | |
|---|
| 1 | 6 | Q-0.9.0d80 |
|---|
| 2 | 7 | [fix] tools: localizationStringsUpdate: semicolon |
|---|
| r67 |
r81 |
|
| 33 | 33 | nibtool -d "../$(prefix)/Q.app/Contents/Resources/"$$d".lproj/cocoaControlPreferences.strings" "../$(prefix)/Q.app/Contents/Resources/English.lproj/cocoaControlPreferences.nib" -W "../$(prefix)/Q.app/Contents/Resources/"$$d".lproj/cocoaControlPreferences.nib"; \ |
|---|
| 34 | 34 | nibtool -d "../$(prefix)/Q.app/Contents/Resources/"$$d".lproj/cocoaDownload.strings" "../$(prefix)/Q.app/Contents/Resources/English.lproj/cocoaDownload.nib" -W "../$(prefix)/Q.app/Contents/Resources/"$$d".lproj/cocoaDownload.nib"; \ |
|---|
| 35 | | done |
|---|
| | 35 | done |
|---|
| 36 | 36 | |
|---|
| 37 | 37 | for d in $(TARGET_DIRS); do \ |
|---|
| … | … | |
| 53 | 53 | ;; \ |
|---|
| 54 | 54 | sparc-softmmu) \ |
|---|
| 55 | | install -m 755 -s ../../tmp/qemu/$$d/qemu-system-sparc "../$(prefix)/Q.app/Contents/MacOS/"$$d".app/Contents/MacOS/"$$d \ |
|---|
| | 55 | install -m 755 -s ../../tmp/qemu/$$d/qemu-system-sparc "../$(prefix)/Q.app/Contents/MacOS/"$$d".app/Contents/MacOS/"$$d; \ |
|---|
| | 56 | install -m 644 ../../tmp/qemu/pc-bios/openbios-sparc32 "../$(prefix)/Q.app/Contents/MacOS/"$$d".app/Contents/Resources/qemu/" \ |
|---|
| 56 | 57 | ;; \ |
|---|
| 57 | 58 | mips-softmmu) \ |
|---|
| … | … | |
| 70 | 71 | |
|---|
| 71 | 72 | # generate OS X .app Packages and install it to /applications |
|---|
| 72 | | install: |
|---|
| 73 | | rm -rf "/Applications/Q.app"; |
|---|
| 74 | | mkdir -p "/Applications/Q.app/Contents/MacOS/"; |
|---|
| 75 | | mkdir -p "/Applications/Q.app/Contents/Resources/English.lproj/Q Help/"; |
|---|
| 76 | | install -m 755 -s ../../tmp/qemu/qemu-img "/Applications/Q.app/Contents/MacOS/"; |
|---|
| 77 | | install -m 755 -s qemu-control "/Applications/Q.app/Contents/MacOS/"; |
|---|
| 78 | | sed 's/QEMU_VERSION/$(VERSION)/;s/QKJU_VERSION/$(QVERSION)/' Info.plist > "/Applications/Q.app/Contents/Info.plist"; |
|---|
| 79 | | echo "APPLQKJU" > "/Applications/Q.app/Contents/PkgInfo"; |
|---|
| 80 | | cp -R Resources/* "/Applications/Q.app/Contents/Resources/"; |
|---|
| 81 | | install -m 644 ../../tmp/qemu/qemu-doc.html "/Applications/Q.app/Contents/Resources/English.lproj/Q Help/html/"; |
|---|
| 82 | | install -m 644 ../../tmp/qemu/qemu-tech.html "/Applications/Q.app/Contents/Resources/English.lproj/Q Help/html/"; |
|---|
| 83 | | |
|---|
| 84 | | for d in $(TARGET_DIRS); do \ |
|---|
| 85 | | mkdir -p "/Applications/Q.app/Contents/MacOS//"$$d".app/Contents/MacOS/"; \ |
|---|
| 86 | | mkdir -p "/Applications/Q.app/Contents/MacOS/"$$d".app/Contents/Resources/qemu/"; \ |
|---|
| 87 | | cp -R ../../tmp/qemu/host-cocoa/Resources/* "/Applications/Q.app/Contents/MacOS/"$$d".app/Contents/Resources/"; \ |
|---|
| 88 | | echo "APPLQEMU" > "/Applications/Q.app/Contents/MacOS/"$$d".app/Contents/PkgInfo"; \ |
|---|
| 89 | | sed 's/QEMU_TARGET/'$$d'/;s/QEMU_VERSION/$(VERSION)/;s/QKJU_VERSION/$(QVERSION)/' ../../tmp/qemu/host-cocoa/Info.plist > "/Applications/Q.app/Contents/MacOS/"$$d".app/Contents/Info.plist"; \ |
|---|
| 90 | | case "$$d" in \ |
|---|
| 91 | | i386-softmmu) \ |
|---|
| 92 | | install -m 755 -s ../../tmp/qemu/$$d/qemu "/Applications/Q.app/Contents/MacOS/"$$d".app/Contents/MacOS/"$$d \ |
|---|
| 93 | | ;; \ |
|---|
| 94 | | x86_64-softmmu) \ |
|---|
| 95 | | install -m 755 -s ../../tmp/qemu/$$d/qemu-system-x86_64 "/Applications/Q.app/Contents/MacOS/"$$d".app/Contents/MacOS/"$$d \ |
|---|
| 96 | | ;; \ |
|---|
| 97 | | ppc-softmmu) \ |
|---|
| 98 | | install -m 755 -s ../../tmp/qemu/$$d/qemu-system-ppc "/Applications/Q.app/Contents/MacOS/"$$d".app/Contents/MacOS/"$$d; \ |
|---|
| 99 | | install -m 644 ../../tmp/qemu/pc-bios/ppc_rom.bin "/Applications/Q.app/Contents/MacOS/"$$d".app/Contents/Resources/qemu/" \ |
|---|
| 100 | | ;; \ |
|---|
| 101 | | sparc-softmmu) \ |
|---|
| 102 | | install -m 755 -s ../../tmp/qemu/$$d/qemu-system-sparc "/Applications/Q.app/Contents/MacOS/"$$d".app/Contents/MacOS/"$$d \ |
|---|
| 103 | | ;; \ |
|---|
| 104 | | mips-softmmu) \ |
|---|
| 105 | | install -m 755 -s ../../tmp/qemu/$$d/qemu-system-mips "/Applications/Q.app/Contents/MacOS/"$$d".app/Contents/MacOS/"$$d \ |
|---|
| 106 | | ;; \ |
|---|
| 107 | | arm-softmmu) \ |
|---|
| 108 | | install -m 755 -s ../../tmp/qemu/$$d/qemu-system-arm "/Applications/Q.app/Contents/MacOS/"$$d".app/Contents/MacOS/"$$d \ |
|---|
| 109 | | ;; \ |
|---|
| 110 | | esac; \ |
|---|
| 111 | | install -m 644 ../../tmp/qemu/pc-bios/bios.bin "/Applications/Q.app/Contents/MacOS/"$$d".app/Contents/Resources/qemu/"; \ |
|---|
| 112 | | install -m 644 ../../tmp/qemu/pc-bios/vgabios.bin "/Applications/Q.app/Contents/MacOS/"$$d".app/Contents/Resources/qemu/"; \ |
|---|
| 113 | | install -m 644 ../../tmp/qemu/pc-bios/vgabios-cirrus.bin "/Applications/Q.app/Contents/MacOS/"$$d".app/Contents/Resources/qemu/"; \ |
|---|
| 114 | | install -m 644 ../../tmp/qemu/pc-bios/video.x "/Applications/Q.app/Contents/MacOS/"$$d".app/Contents/Resources/qemu/"; \ |
|---|
| 115 | | install -m 644 ../../tmp/qemu/pc-bios/linux_boot.bin "/Applications/Q.app/Contents/MacOS/"$$d".app/Contents/Resources/qemu/"; \ |
|---|
| 116 | | done |
|---|
| | 73 | install: app |
|---|
| | 74 | rm -rf "/Applications/Q.app" |
|---|
| | 75 | cp -r "../$(prefix)/Q.app" "/Applications/Q.app" |
|---|
| r79 |
r81 |
|
| 784 | 784 | |
|---|
| 785 | 785 | [[thisPC objectForKey:@"Temporary"] setObject:path forKey:@"-cocoapath"]; |
|---|
| | 786 | #if kju_debug |
|---|
| 786 | 787 | NSLog(@"-cocoapath: %@", path); |
|---|
| | 788 | #endif |
|---|
| 787 | 789 | [[thisPC objectForKey:@"PC Data"] setObject:name forKey:@"name"]; |
|---|
| 788 | 790 | |
|---|
| … | … | |
| 1099 | 1101 | /* set the -cocoapath */ |
|---|
| 1100 | 1102 | [[thisPC objectForKey:@"Temporary"] setObject:[NSString stringWithFormat:@"%@/%@.qvm", [userDefaults objectForKey:@"dataPath"], name] forKey:@"-cocoapath"]; |
|---|
| | 1103 | #if kju_debug |
|---|
| 1101 | 1104 | NSLog(@"cocoapath: %@", [[thisPC objectForKey:@"Temporary"] objectForKey:@"-cocoapath"]); |
|---|
| | 1105 | #endif |
|---|
| 1102 | 1106 | |
|---|
| 1103 | 1107 | /* Create .qvm */ |
|---|
| … | … | |
| 1129 | 1133 | // copy over into .qvm |
|---|
| 1130 | 1134 | [fileManager copyPath:[[qemux objectAtIndex:i] objectForKey:[hds objectAtIndex:ii]] toPath:[NSString stringWithFormat:@"%@/%@", [[thisPC objectForKey:@"Temporary"] objectForKey:@"-cocoapath"], [[[qemux objectAtIndex:i] objectForKey:[hds objectAtIndex:ii]] lastPathComponent]] handler:nil]; |
|---|
| | 1135 | #if kju_debug |
|---|
| 1131 | 1136 | NSLog(@"copy allowed, done."); |
|---|
| | 1137 | #endif |
|---|
| 1132 | 1138 | } |
|---|
| | 1139 | #if kju_debug |
|---|
| 1133 | 1140 | NSLog(@"hd: %@", [[qemux objectAtIndex:i] objectForKey:[hds objectAtIndex:ii]]); |
|---|
| 1134 | 1141 | NSLog(@"copy from %@ to %@", [[qemux objectAtIndex:i] objectForKey:[hds objectAtIndex:ii]], [NSString stringWithFormat:@"%@/%@", [[thisPC objectForKey:@"Temporary"] objectForKey:@"-cocoapath"], [[[qemux objectAtIndex:i] objectForKey:[hds objectAtIndex:ii]] lastPathComponent]]); |
|---|
| | 1142 | #endif |
|---|
| 1135 | 1143 | } |
|---|
| 1136 | 1144 | |
|---|
| … | … | |
| 1561 | 1569 | |
|---|
| 1562 | 1570 | file = [filename stringByAppendingPathComponent:[@"Contents/Resources/Guest" stringByAppendingPathComponent:file]]; |
|---|
| | 1571 | #if kju_debug |
|---|
| 1563 | 1572 | NSLog(@"file: %@", file); |
|---|
| | 1573 | #endif |
|---|
| 1564 | 1574 | |
|---|
| 1565 | 1575 | /* ready now, show progressPanel */ |
|---|
| … | … | |
| 1700 | 1710 | - (void) startPC:(NSString *)filename |
|---|
| 1701 | 1711 | { |
|---|
| 1702 | | NSLog(@"cocoaControlController: startPC:%@", filename); |
|---|
| | 1712 | // NSLog(@"cocoaControlController: startPC:%@", filename); |
|---|
| 1703 | 1713 | |
|---|
| 1704 | 1714 | NSData *data = [NSData dataWithContentsOfFile:[NSString stringWithFormat:@"%@/configuration.plist", filename]]; |
|---|
| … | … | |
| 1813 | 1823 | } |
|---|
| 1814 | 1824 | |
|---|
| | 1825 | #if kju_debug |
|---|
| 1815 | 1826 | for (i = 0; i < [arguments count]; i++) |
|---|
| 1816 | 1827 | NSLog(@"Argument: %@", [arguments objectAtIndex:i]); |
|---|
| 1817 | | |
|---|
| | 1828 | #endif |
|---|
| | 1829 | |
|---|
| 1818 | 1830 | /* save Status */ |
|---|
| 1819 | 1831 | [[thisPC objectForKey:@"PC Data"] setObject:@"running" forKey:@"state"]; |
|---|
| r45 |
r81 |
|
| 2 | 2 | * QEMU Cocoa Control Distributed Object Server |
|---|
| 3 | 3 | * |
|---|
| 4 | | * Copyright (c) 2006 Mike Kronenberg |
|---|
| | 4 | * Copyright (c) 2006 - 2007 Mike Kronenberg |
|---|
| 5 | 5 | * |
|---|
| 6 | 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
|---|
| … | … | |
| 35 | 35 | - (id) init |
|---|
| 36 | 36 | { |
|---|
| 37 | | // NSLog(@"cocoaControlDOServer: init:%@ withName:%@\n", [guest description], name); |
|---|
| 38 | | |
|---|
| 39 | | [super init]; |
|---|
| 40 | | |
|---|
| 41 | | NSConnection *theConnection; |
|---|
| 42 | | theConnection = [NSConnection defaultConnection]; |
|---|
| 43 | | [theConnection setRootObject:self]; |
|---|
| 44 | | |
|---|
| 45 | | if ([theConnection registerName:@"qdoserver"] == NO) { |
|---|
| 46 | | NSLog(@"cocoaControlDOServer: could not establisch qcontrol server"); |
|---|
| 47 | | } |
|---|
| 48 | | |
|---|
| 49 | | guests = [[NSMutableDictionary alloc] init]; |
|---|
| 50 | | [guests retain]; |
|---|
| 51 | | |
|---|
| 52 | | printf("finished init\n"); |
|---|
| 53 | | |
|---|
| 54 | | return self; |
|---|
| | 37 | // NSLog(@"cocoaControlDOServer: init:%@ withName:%@\n", [guest description], name); |
|---|
| | 38 | |
|---|
| | 39 | [super init]; |
|---|
| | 40 | |
|---|
| | 41 | NSConnection *theConnection; |
|---|
| | 42 | theConnection = [NSConnection defaultConnection]; |
|---|
| | 43 | [theConnection setRootObject:self]; |
|---|
| | 44 | |
|---|
| | 45 | if ([theConnection registerName:@"qdoserver"] == NO) { |
|---|
| | 46 | NSLog(@"cocoaControlDOServer: could not establisch qcontrol server"); |
|---|
| | 47 | } |
|---|
| | 48 | |
|---|
| | 49 | guests = [[NSMutableDictionary alloc] init]; |
|---|
| | 50 | [guests retain]; |
|---|
| | 51 | |
|---|
| | 52 | return self; |
|---|
| 55 | 53 | } |
|---|
| 56 | 54 | |
|---|
| 57 | 55 | -(void) setSender:(id)sender |
|---|
| 58 | 56 | { |
|---|
| 59 | | // NSLog(@"cocoaControlDOServer: setSender"); |
|---|
| | 57 | // NSLog(@"cocoaControlDOServer: setSender"); |
|---|
| 60 | 58 | |
|---|
| 61 | 59 | qControl = sender; |
|---|
| … | … | |
| 64 | 62 | - (BOOL) guestRegister: (id) guest withName: (NSString *) name |
|---|
| 65 | 63 | { |
|---|
| 66 | | // NSLog(@"cocoaControlDOServer: registerGuest:%@ withName:%@\n", [guest description], name); |
|---|
| 67 | | |
|---|
| 68 | | if ([guests objectForKey:name] == nil) { |
|---|
| 69 | | [guests setObject:guest forKey:name]; |
|---|
| 70 | | // NSLog(@"OK"); |
|---|
| 71 | | return TRUE; |
|---|
| 72 | | } else { |
|---|
| 73 | | NSLog(@"cocoaControlDOServer: guestRegister: failed"); |
|---|
| 74 | | return FALSE; |
|---|
| 75 | | } |
|---|
| | 64 | // NSLog(@"cocoaControlDOServer: registerGuest:%@ withName:%@\n", [guest description], name); |
|---|
| | 65 | |
|---|
| | 66 | if ([guests objectForKey:name] == nil) { |
|---|
| | 67 | [guests setObject:guest forKey:name]; |
|---|
| | 68 | // NSLog(@"OK"); |
|---|
| | 69 | return TRUE; |
|---|
| | 70 | } else { |
|---|
| | 71 | NSLog(@"cocoaControlDOServer: guestRegister: failed"); |
|---|
| | 72 | return FALSE; |
|---|
| | 73 | } |
|---|
| 76 | 74 | } |
|---|
| 77 | 75 | |
|---|
| 78 | 76 | - (BOOL) guestUnregisterWithName: (NSString *) name |
|---|
| 79 | 77 | { |
|---|
| 80 | | // NSLog(@"cocoaControlDOServer: unregisterGuestWithName:%@\n", name); |
|---|
| 81 | | |
|---|
| 82 | | if ([guests objectForKey:name] != nil) { |
|---|
| 83 | | [guests removeObjectForKey:name]; |
|---|
| 84 | | // NSLog(@"OK"); |
|---|
| 85 | | return TRUE; |
|---|
| 86 | | } else { |
|---|
| 87 | | NSLog(@"cocoaControlDOServer: guestUnregisterWithName: failed"); |
|---|
| 88 | | return FALSE; |
|---|
| 89 | | } |
|---|
| | 78 | // NSLog(@"cocoaControlDOServer: unregisterGuestWithName:%@\n", name); |
|---|
| | 79 | |
|---|
| | 80 | if ([guests objectForKey:name] != nil) { |
|---|
| | 81 | [guests removeObjectForKey:name]; |
|---|
| | 82 | // NSLog(@"OK"); |
|---|
| | 83 | return TRUE; |
|---|
| | 84 | } else { |
|---|
| | 85 | NSLog(@"cocoaControlDOServer: guestUnregisterWithName: failed"); |
|---|
| | 86 | return FALSE; |
|---|
| | 87 | } |
|---|
| 90 | 88 | } |
|---|
| 91 | 89 | |
|---|
| … | … | |
| 97 | 95 | NSArray *keys = [guests allKeys]; |
|---|
| 98 | 96 | int a = [keys count] - 1; |
|---|
| 99 | | |
|---|
| | 97 | |
|---|
| 100 | 98 | if (previousGuestName) { |
|---|
| 101 | 99 | for (i = 0; i < [keys count]; i++) { |
|---|
| … | … | |
| 111 | 109 | } |
|---|
| 112 | 110 | } |
|---|
| 113 | | |
|---|
| | 111 | |
|---|
| 114 | 112 | ProcessSerialNumber psn; |
|---|
| 115 | 113 | id obj = nil; |
|---|
| 116 | 114 | BOOL nFullscreen = FALSE; |
|---|
| 117 | | |
|---|
| | 115 | |
|---|
| 118 | 116 | if (a > -1) { |
|---|
| 119 | | /* move QEMU to front */ |
|---|
| 120 | | GetProcessForPID( [[[qControl pcsTasks] objectForKey:[keys objectAtIndex:a]] processIdentifier], &psn ); |
|---|
| 121 | | obj = [guests objectForKey:[keys objectAtIndex:a]]; |
|---|
| 122 | | if ([obj fullscreen]) |
|---|
| | 117 | /* move QEMU to front */ |
|---|
| | 118 | GetProcessForPID( [[[qControl pcsTasks] objectForKey:[keys objectAtIndex:a]] processIdentifier], &psn ); |
|---|
| | 119 | obj = [guests objectForKey:[keys objectAtIndex:a]]; |
|---|
| | 120 | if ([obj fullscreen]) |
|---|
| 123 | 121 | nFullscreen = TRUE; |
|---|
| 124 | 122 | } else |
|---|
| 125 | 123 | GetProcessForPID( [[NSProcessInfo processInfo ] processIdentifier ], &psn ); |
|---|
| 126 | | |
|---|
| | 124 | |
|---|
| 127 | 125 | if (fullscreen||nFullscreen) { |
|---|
| 128 | 126 | /* setup transition */ |
|---|
| … | … | |
| 133 | 131 | transitionSpecifications.type = 7; //transition; |
|---|
| 134 | 132 | transitionSpecifications.option = 2; //option; |
|---|
| | 133 | transitionSpecifications.wid = 0; //wid |
|---|
| | 134 | transitionSpecifications.backColour = 0; //background color |
|---|
| | 135 | |
|---|
| | 136 | /* freeze desktop: OSStatus CGSNewTransition(const CGSConnection cid, const CGSTransitionSpec* transitionSpecifications, int *transitionHandle) */ |
|---|
| | 137 | CGSNewTransition(cid, &transitionSpecifications, &transitionHandle); |
|---|
| | 138 | |
|---|
| | 139 | /* change windows */ |
|---|
| | 140 | if (nFullscreen) |
|---|
| | 141 | [obj guestUnhide]; |
|---|
| | 142 | |
|---|
| | 143 | if (fullscreen) |
|---|
| | 144 | [[guests objectForKey:name] guestHide]; |
|---|
| | 145 | |
|---|
| | 146 | if (a > -1) //avoid activating "Q Control" |
|---|
| | 147 | SetFrontProcess( &psn ); |
|---|
| | 148 | else { |
|---|
| | 149 | [[qControl mainWindow] orderWindow:NSWindowAbove relativeTo:[[guests objectForKey:name] guestWindowNumber]]; |
|---|
| | 150 | SetFrontProcess( &psn ); |
|---|
| | 151 | } |
|---|
| | 152 | |
|---|
| | 153 | /* wait */ |
|---|
| | 154 | usleep(10000); |
|---|
| | 155 | |
|---|
| | 156 | /* run transition: OSStatus CGSInvokeTransition(const CGSConnection cid, int transitionHandle, float duration) */ |
|---|
| | 157 | CGSInvokeTransition(cid, transitionHandle, 1.0); |
|---|
| | 158 | |
|---|
| | 159 | } else { |
|---|
| | 160 | if (a > -1) //avoid activating "Q Control" |
|---|
| | 161 | SetFrontProcess( &psn ); |
|---|
| | 162 | else { |
|---|
| | 163 | [[qControl mainWindow] orderWindow:NSWindowAbove relativeTo:[[guests objectForKey:name] guestWindowNumber]]; |
|---|
| | 164 | SetFrontProcess( &psn ); |
|---|
| | 165 | } |
|---|
| | 166 | } |
|---|
| | 167 | |
|---|
| | 168 | return true; |
|---|
| | 169 | } |
|---|
| | 170 | |
|---|
| | 171 | - (BOOL) guestSwitch: (NSString *) name fullscreen:(BOOL)fullscreen nextGuestName:(NSString *)nextGuestName |
|---|
| | 172 | { |
|---|
| | 173 | // NSLog(@"guestSwitch: windowSwitchKeyPressed:%@ fullscreen:%d nextGuest:%@\n", name, fullscreen, nextGuestName); |
|---|
| | 174 | |
|---|
| | 175 | int i; |
|---|
| | 176 | int a = 0; |
|---|
| | 177 | NSArray *keys = [guests allKeys]; |
|---|
| | 178 | |
|---|
| | 179 | if (nextGuestName) { |
|---|
| | 180 | for (i = 0; i < [keys count]; i++) { |
|---|
| | 181 | if ([[keys objectAtIndex:i] isEqual:nextGuestName]) { |
|---|
| | 182 | a = i; |
|---|
| | 183 | } |
|---|
| | 184 | } |
|---|
| | 185 | } else { |
|---|
| | 186 | for (i = 0; i < [keys count]; i++) { |
|---|
| | 187 | if ([[keys objectAtIndex:i] isEqual:name]) { |
|---|
| | 188 | a = i + 1; |
|---|
| | 189 | } |
|---|
| | 190 | } |
|---|
| | 191 | } |
|---|
| | 192 | |
|---|
| | 193 | ProcessSerialNumber psn; |
|---|
| | 194 | id obj = nil; |
|---|
| | 195 | BOOL nFullscreen = FALSE; |
|---|
| | 196 | |
|---|
| | 197 | if (a < [keys count]) { |
|---|
| | 198 | /* move QEMU to front */ |
|---|
| | 199 | GetProcessForPID( [[[qControl pcsTasks] objectForKey:[keys objectAtIndex:a]] processIdentifier], &psn ); |
|---|
| | 200 | obj = [guests objectForKey:[keys objectAtIndex:a]]; |
|---|
| | 201 | if ([obj fullscreen]) |
|---|
| | 202 | nFullscreen = TRUE; |
|---|
| | 203 | } else |
|---|
| | 204 | GetProcessForPID( [[NSProcessInfo processInfo ] processIdentifier ], &psn ); |
|---|
| | 205 | |
|---|
| | 206 | if (fullscreen||nFullscreen) { |
|---|
| | 207 | /* setup transition */ |
|---|
| | 208 | CGSConnection cid = _CGSDefaultConnection(); |
|---|
| | 209 | int transitionHandle = -1; |
|---|
| | 210 | CGSTransitionSpec transitionSpecifications; |
|---|
| | 211 | |
|---|
| | 212 | transitionSpecifications.type = 7; //transition; |
|---|
| | 213 | transitionSpecifications.option = 1; //option; |
|---|
| 135 | 214 | transitionSpecifications.wid = 0; //wid |
|---|
| 136 | 215 | transitionSpecifications.backColour = 0; //background color |
|---|
| … | … | |
| 146 | 225 | [[guests objectForKey:name] guestHide]; |
|---|
| 147 | 226 | |
|---|
| 148 | | if (a > -1) //avoid activating "Q Control" |
|---|
| | 227 | if (a < [keys count]) //avoid activating "Q Control" |
|---|
| 149 | 228 | SetFrontProcess( &psn ); |
|---|
| 150 | 229 | else { |
|---|
| … | … | |
| 152 | 231 | SetFrontProcess( &psn ); |
|---|
| 153 | 232 | } |
|---|
| 154 | | |
|---|
| | 233 | |
|---|
| 155 | 234 | /* wait */ |
|---|
| 156 | 235 | usleep(10000); |
|---|
| 157 | | |
|---|
| | 236 | |
|---|
| 158 | 237 | /* run transition: OSStatus CGSInvokeTransition(const CGSConnection cid, int transitionHandle, float duration) */ |
|---|
| 159 | 238 | CGSInvokeTransition(cid, transitionHandle, 1.0); |
|---|
| 160 | | |
|---|
| 161 | | } else { |
|---|
| 162 | | if (a > -1) //avoid activating "Q Control" |
|---|
| | 239 | |
|---|
| | 240 | } else { |
|---|
| | 241 | if (a < [keys count]) //avoid activating "Q Control" |
|---|
| 163 | 242 | SetFrontProcess( &psn ); |
|---|
| 164 | 243 | else { |
|---|
| … | … | |
| 168 | 247 | } |
|---|
| 169 | 248 | |
|---|
| 170 | | return true; |
|---|
| 171 | | } |
|---|
| 172 | | |
|---|
| 173 | | - (BOOL) guestSwitch: (NSString *) name fullscreen:(BOOL)fullscreen nextGuestName:(NSString *)nextGuestName |
|---|
| 174 | | { |
|---|
| 175 | | // NSLog(@"guestSwitch: windowSwitchKeyPressed:%@ fullscreen:%d nextGuest:%@\n", name, fullscreen, nextGuestName); |
|---|
| 176 | | |
|---|
| 177 | | int i; |
|---|
| 178 | | int a = 0; |
|---|
| 179 | | NSArray *keys = [guests allKeys]; |
|---|
| 180 | | |
|---|
| 181 | | if (nextGuestName) { |
|---|
| 182 | | for (i = 0; i < [keys count]; i++) { |
|---|
| 183 | | if ([[keys objectAtIndex:i] isEqual:nextGuestName]) { |
|---|
| 184 | | a = i; |
|---|
| 185 | | } |
|---|
| 186 | | } |
|---|
| 187 | | } else { |
|---|
| 188 | | for (i = 0; i < [keys count]; i++) { |
|---|
| 189 | | if ([[keys objectAtIndex:i] isEqual:name]) { |
|---|
| 190 | | a = i + 1; |
|---|
| 191 | | } |
|---|
| 192 | | } |
|---|
| 193 | | } |
|---|
| 194 | | |
|---|
| 195 | | ProcessSerialNumber psn; |
|---|
| 196 | | id obj = nil; |
|---|
| 197 | | BOOL nFullscreen = FALSE; |
|---|
| 198 | | |
|---|
| 199 | | if (a < [keys count]) { |
|---|
| 200 | | /* move QEMU to front */ |
|---|
| 201 | | GetProcessForPID( [[[qControl pcsTasks] objectForKey:[keys objectAtIndex:a]] processIdentifier], &psn ); |
|---|
| 202 | | obj = [guests objectForKey:[keys objectAtIndex:a]]; |
|---|
| 203 | | if ([obj fullscreen]) |
|---|
| 204 | | nFullscreen = TRUE; |
|---|
| 205 | | } else |
|---|
| 206 | | GetProcessForPID( [[NSProcessInfo processInfo ] processIdentifier ], &psn ); |
|---|
| 207 | | |
|---|
| 208 | | if (fullscreen||nFullscreen) { |
|---|
| 209 | | /* setup transition */ |
|---|
| 210 | | CGSConnection cid = _CGSDefaultConnection(); |
|---|
| 211 | | int transitionHandle = -1; |
|---|
| 212 | | CGSTransitionSpec transitionSpecifications; |
|---|
| 213 | | |
|---|
| 214 | | transitionSpecifications.type = 7; //transition; |
|---|
| 215 | | transitionSpecifications.option = 1; //option; |
|---|
| 216 | | transitionSpecifications.wid = 0; //wid |
|---|
| 217 | | transitionSpecifications.backColour = 0; //background color |
|---|
| 218 | | |
|---|
| 219 | | /* freeze desktop: OSStatus CGSNewTransition(const CGSConnection cid, const CGSTransitionSpec* transitionSpecifications, int *transitionHandle) */ |
|---|
| 220 | | CGSNewTransition(cid, &transitionSpecifications, &transitionHandle); |
|---|
| 221 | | |
|---|
| 222 | | /* change windows */ |
|---|
| 223 | | if (nFullscreen) |
|---|
| 224 | | [obj guestUnhide]; |
|---|
| 225 | | |
|---|
| 226 | | if (fullscreen) |
|---|
| 227 | | [[guests objectForKey:name] guestHide]; |
|---|
| 228 | | |
|---|
| 229 | | if (a < [keys count]) //avoid activating "Q Control" |
|---|
| 230 | | SetFrontProcess( &psn ); |
|---|
| 231 | | else { |
|---|
| 232 | | [[qControl mainWindow] orderWindow:NSWindowAbove relativeTo:[[guests objectForKey:name] guestWindowNumber]]; |
|---|
| 233 | | SetFrontProcess( &psn ); |
|---|
| 234 | | } |
|---|
| 235 | | |
|---|
| 236 | | /* wait */ |
|---|
| 237 | | usleep(10000); |
|---|
| 238 | | |
|---|
| 239 | | /* run transition: OSStatus CGSInvokeTransition(const CGSConnection cid, int transitionHandle, float duration) */ |
|---|
| 240 | | CGSInvokeTransition(cid, transitionHandle, 1.0); |
|---|
| 241 | | |
|---|
| 242 | | } else { |
|---|
| 243 | | if (a < [keys count]) //avoid activating "Q Control" |
|---|
| 244 | | SetFrontProcess( &psn ); |
|---|
| 245 | | else { |
|---|
| 246 | | [[qControl mainWindow] orderWindow:NSWindowAbove relativeTo:[[guests objectForKey:name] guestWindowNumber]]; |
|---|
| 247 | | SetFrontProcess( &psn ); |
|---|
| 248 | | } |
|---|
| 249 | | } |
|---|
| 250 | | |
|---|
| 251 | | return true; |
|---|
| | 249 | return true; |
|---|
| 252 | 250 | } |
|---|
| 253 | 251 | |
|---|
| 254 | 252 | - (int) guestWindowLevel: (NSString *) guest |
|---|
| 255 | 253 | { |
|---|
| 256 | | // NSLog(@"cocoaControlDOServer: guestWindowLevel: %@", guest); |
|---|
| 257 | | |
|---|
| 258 | | id obj = [guests objectForKey:guest]; |
|---|
| 259 | | if (obj != nil) { |
|---|
| 260 | | // NSLog(@"OK"); |
|---|
| 261 | | return [obj guestWindowLevel]; |
|---|
| 262 | | } else { |
|---|
| 263 | | NSLog(@"cocoaControlDOServer: guestWindowLevel: failed"); |
|---|
| 264 | | return FALSE; |
|---|
| 265 | | } |
|---|
| | 254 | // NSLog(@"cocoaControlDOServer: guestWindowLevel: %@", guest); |
|---|
| | 255 | |
|---|
| | 256 | id obj = [guests objectForKey:guest]; |
|---|
| | 257 | if (obj != nil) { |
|---|
| | 258 | // NSLog(@"OK"); |
|---|
| | 259 | return [obj guestWindowLevel]; |
|---|
| | 260 | } else { |
|---|
| | 261 | NSLog(@"cocoaControlDOServer: guestWindowLevel: failed"); |
|---|
| | 262 | return FALSE; |
|---|
| | 263 | } |
|---|
| 266 | 264 | } |
|---|
| 267 | 265 | |
|---|
| 268 | 266 | - (int) guestWindowNumber: (NSString *) guest |
|---|
| 269 | 267 | { |
|---|
| 270 | | // NSLog(@"cocoaControlDOServer: guestWindowNumber: %@", guest); |
|---|
| 271 | | |
|---|
| 272 | | id obj = [guests objectForKey:guest]; |
|---|
| 273 | | if (obj != nil) { |
|---|
| 274 | | // NSLog(@"OK"); |
|---|
| 275 | | return [obj guestWindowNumber]; |
|---|
| 276 | | } else { |
|---|
| 277 | | NSLog(@"cocoaControlDOServer: guestWindowNumber: failed"); |
|---|
| 278 | | return FALSE; |
|---|
| 279 | | } |
|---|
| | 268 | // NSLog(@"cocoaControlDOServer: guestWindowNumber: %@", guest); |
|---|
| | 269 | |
|---|
| | 270 | id obj = [guests objectForKey:guest]; |
|---|
| | 271 | if (obj != nil) { |
|---|
| | 272 | // NSLog(@"OK"); |
|---|
| | 273 | return [obj guestWindowNumber]; |
|---|
| | 274 | } else { |
|---|
| | 275 | // NSLog(@"cocoaControlDOServer: guestWindowNumber: failed"); |
|---|
| | 276 | return FALSE; |
|---|
| | 277 | } |
|---|
| 280 | 278 | } |
|---|
| 281 | 279 | |
|---|
| 282 | 280 | - (BOOL) guestOrderFrontRegardless: (NSString *) guest |
|---|
| 283 | 281 | { |
|---|
| 284 | | // NSLog(@"cocoaControlDOServer: bringToFront: %@", guest); |
|---|
| 285 | | |
|---|
| 286 | | id obj = [guests objectForKey:guest]; |
|---|
| 287 | | if (obj != nil) { |
|---|
| 288 | | // NSLog(@"OK"); |
|---|
| 289 | | return [obj guestOrderFrontRegardless]; |
|---|
| 290 | | } else { |
|---|
| 291 | | NSLog(@"cocoaControlDOServer: guestOrderFrontRegardless"); |
|---|
| 292 | | return FALSE; |
|---|
| 293 | | } |
|---|
| | 282 | // NSLog(@"cocoaControlDOServer: bringToFront: %@", guest); |
|---|
| | 283 | |
|---|
| | 284 | id obj = [guests objectForKey:guest]; |
|---|
| | 285 | if (obj != nil) { |
|---|
| | 286 | // NSLog(@"OK"); |
|---|
| | 287 | return [obj guestOrderFrontRegardless]; |
|---|
| | 288 | } else { |
|---|
| | 289 | NSLog(@"cocoaControlDOServer: guestOrderFrontRegardless"); |
|---|
| | 290 | return FALSE; |
|---|
| | 291 | } |
|---|
| 294 | 292 | } |
|---|
| 295 | 293 | |
|---|
| 296 | 294 | - (BOOL) guestOrderWindow:(NSWindowOrderingMode)place relativeTo:(int)otherWindowNumber guest:(NSString *) guest |
|---|
| 297 | 295 | { |
|---|
| 298 | | // NSLog(@"cocoaControlDOServer: guestOrderWindow: %@", guest); |
|---|
| 299 | | |
|---|
| 300 | | id obj = [guests objectForKey:guest]; |
|---|
| 301 | | if (obj != nil) { |
|---|
| 302 | | // NSLog(@"OK"); |
|---|
| 303 | | return [obj guestOrderWindow:place relativeTo:otherWindowNumber]; |
|---|
| 304 | | } else { |
|---|
| 305 | | NSLog(@"cocoaControlDOServer: guestOrderWindow: failed"); |
|---|
| 306 | | return FALSE; |
|---|
| 307 | | } |
|---|
| | 296 | // NSLog(@"cocoaControlDOServer: guestOrderWindow: %@", guest); |
|---|
| | 297 | |
|---|
| | 298 | id obj = [guests objectForKey:guest]; |
|---|
| | 299 | if (obj != nil) { |
|---|
| | 300 | // NSLog(@"OK"); |
|---|
| | 301 | return [obj guestOrderWindow:place relativeTo:otherWindowNumber]; |
|---|
| | 302 | } else { |
|---|
| | 303 | NSLog(@"cocoaControlDOServer: guestOrderWindow: failed"); |
|---|
| | 304 | return FALSE; |
|---|
| | 305 | } |
|---|
| 308 | 306 | } |
|---|
| 309 | 307 | |
|---|
| 310 | 308 | - (BOOL) guestHide: (NSString *) guest |
|---|
| 311 | 309 | { |
|---|
| 312 | | // NSLog(@"cocoaControlDOServer: hide: %@", guest); |
|---|
| 313 | | |
|---|
| 314 | | id obj = [guests objectForKey:guest]; |
|---|
| 315 | | if (obj != nil) { |
|---|
| 316 | | // NSLog(@"OK"); |
|---|
| 317 | | return [obj guestHide]; |
|---|
| 318 | | } else { |
|---|
| 319 | | NSLog(@"cocoaControlDOServer: guestHide: failed"); |
|---|
| 320 | | return FALSE; |
|---|
| 321 | | } |
|---|
| | 310 | // NSLog(@"cocoaControlDOServer: hide: %@", guest); |
|---|
| | 311 | |
|---|
| | 312 | id obj = [guests objectForKey:guest]; |
|---|
| | 313 | if (obj != nil) { |
|---|
| | 314 | // NSLog(@"OK"); |
|---|
| | 315 | return [obj guestHide]; |
|---|
| | 316 | } else { |
|---|
| | 317 | NSLog(@"cocoaControlDOServer: guestHide: failed"); |
|---|
| | 318 | return FALSE; |
|---|
| | 319 | } |
|---|
| 322 | 320 | } |
|---|
| 323 | 321 | |
|---|
| 324 | 322 | - (BOOL) guestUnhide: (NSString *) guest |
|---|
| 325 | 323 | { |
|---|
| 326 | | // NSLog(@"cocoaControlDOServer: show: %@", guest); |
|---|
| 327 | | |
|---|
| 328 | | id obj = [guests objectForKey:guest]; |
|---|
| 329 | | if (obj != nil) { |
|---|
| 330 | | // NSLog(@"OK"); |
|---|
| 331 | | return [obj guestUnhide]; |
|---|
| 332 | | } else { |
|---|
| 333 | | NSLog(@"cocoaControlDOServer: cocoaControlDOServer: failed"); |
|---|
| 334 | | return FALSE; |
|---|
| 335 | | } |
|---|
| | 324 | // NSLog(@"cocoaControlDOServer: show: %@", guest); |
|---|
| | 325 | |
|---|
| | 326 | id obj = [guests objectForKey:guest]; |
|---|
| | 327 | if (obj != nil) { |
|---|
| | 328 | // NSLog(@"OK"); |
|---|
| | 329 | return [obj guestUnhide]; |
|---|
| | 330 | } else { |
|---|
| | 331 | NSLog(@"cocoaControlDOServer: cocoaControlDOServer: failed"); |
|---|
| | 332 | return FALSE; |
|---|
| | 333 | } |
|---|
| 336 | 334 | } |
|---|
| 337 | 335 | |
|---|
| 338 | 336 | - (BOOL) guestPause: (NSString *) guest |
|---|
| 339 | 337 | { |
|---|
| 340 | | // NSLog(@"cocoaControlDOServer: pause: %@", guest); |
|---|
| 341 | | |
|---|
| 342 | | id obj = [guests objectForKey:guest]; |
|---|
| 343 | | if (obj != nil) { |
|---|
| 344 | | // NSLog(@"OK"); |
|---|
| 345 | | return [obj guestPause]; |
|---|
| 346 | | } else { |
|---|
| 347 | | NSLog(@"cocoaControlDOServer: cocoaControlDOServer: failed"); |
|---|
| 348 | | return FALSE; |
|---|
| 349 | | } |
|---|
| | 338 | // NSLog(@"cocoaControlDOServer: pause: %@", guest); |
|---|
| | 339 | |
|---|
| | 340 | id obj = [guests objectForKey:guest]; |
|---|
| | 341 | if (obj != nil) { |
|---|
| | 342 | // NSLog(@"OK"); |
|---|
| | 343 | return [obj guestPause]; |
|---|
| | 344 | } else { |
|---|
| | 345 | NSLog(@"cocoaControlDOServer: cocoaControlDOServer: failed"); |
|---|
| | 346 | return FALSE; |
|---|
| | 347 | } |
|---|
| 350 | 348 | } |
|---|
| 351 | 349 | |
|---|
| 352 | 350 | - (BOOL) guestStop: (NSString *) guest |
|---|
| 353 | 351 | { |
|---|
| 354 | | // NSLog(@"cocoaControlDOServer: stop: %@", guest); |
|---|
| 355 | | |
|---|
| 356 | | id obj = [guests objectForKey:guest]; |
|---|
| 357 | | if (obj != nil) { |
|---|
| 358 | | // NSLog(@"OK"); |
|---|
| 359 | | return [obj guestStop]; |
|---|
| 360 | | } else { |
|---|
| 361 | | NSLog(@"cocoaControlDOServer: cocoaControlDOServer: failed"); |
|---|
| 362 | | return FALSE; |
|---|
| 363 | | } |
|---|
| | 352 | // NSLog(@"cocoaControlDOServer: stop: %@", guest); |
|---|
| | 353 | |
|---|
| | 354 | id obj = [guests objectForKey:guest]; |
|---|
| | 355 | if (obj != nil) { |
|---|
| | 356 | // NSLog(@"OK"); |
|---|
| | 357 | return [obj guestStop]; |
|---|
| | 358 | } else { |
|---|
| | 359 | NSLog(@"cocoaControlDOServer: cocoaControlDOServer: failed"); |
|---|
| | 360 | return FALSE; |
|---|
| | 361 | } |
|---|
| 364 | 362 | } |
|---|
| 365 | 363 | @end |
|---|
Download in other formats:
| |