66 |
|
|
67 |
|
- (void) sendEvent: (NSEvent *)event; |
68 |
|
{ |
69 |
< |
NSEventType type = [event type]; |
70 |
< |
|
71 |
< |
if ( type == NSKeyUp || type == NSKeyDown || type == NSFlagsChanged ) |
72 |
< |
[self dispatchKeyEvent: event |
73 |
< |
type: type]; |
69 |
> |
if ( [self isAnyEmulatorDisplayingSheets] || ! [self isAnyEmulatorRunning] ) |
70 |
> |
[super sendEvent: event]; |
71 |
|
else |
72 |
< |
[self dispatchEvent: event |
73 |
< |
type: type]; |
72 |
> |
{ |
73 |
> |
NSEventType type = [event type]; |
74 |
> |
|
75 |
> |
if ( type == NSKeyUp || type == NSKeyDown || type == NSFlagsChanged ) |
76 |
> |
[self dispatchKeyEvent: event |
77 |
> |
type: type]; |
78 |
> |
else |
79 |
> |
[self dispatchEvent: event |
80 |
> |
type: type]; |
81 |
> |
} |
82 |
|
} |
83 |
|
|
84 |
|
// NSApplication methods which are invoked through delegation |
149 |
|
for ( tmp = 0; tmp < [emulators count], ++tmp ) |
150 |
|
{ |
151 |
|
theEmulator = [emulators objectAtIndex: tmp]; |
152 |
< |
if ( [ theEmulator isRunning ] && [[theEmulator window] isKeyWindow ] ) |
152 |
> |
view = [theEmulator screen]; |
153 |
> |
|
154 |
> |
if ( [ theEmulator isRunning ] && |
155 |
> |
( [[theEmulator window] isKeyWindow] || [view isFullScreen] ) ) |
156 |
|
break; |
157 |
|
} |
158 |
|
|
159 |
|
if ( tmp < [emulators count] ) // i.e. if we exited the for loop |
160 |
|
#else |
161 |
< |
if ( [theEmulator isRunning] && [[theEmulator window] isKeyWindow ] ) |
161 |
> |
view = [theEmulator screen]; |
162 |
> |
|
163 |
> |
if ( [theEmulator isRunning] && |
164 |
> |
( [[theEmulator window] isKeyWindow] || [view isFullScreen] ) ) |
165 |
|
#endif |
166 |
|
{ |
167 |
< |
view = [theEmulator screen]; |
157 |
< |
|
167 |
> |
D(NSLog(@"Got a key event - %d\n", [event keyCode])); |
168 |
|
switch ( type ) |
169 |
|
{ |
170 |
|
case NSKeyUp: |
191 |
|
- (void) dispatchEvent: (NSEvent *)event |
192 |
|
type: (NSEventType)type |
193 |
|
{ |
194 |
+ |
EmulatorView *view; |
195 |
+ |
|
196 |
|
#ifdef ENABLE_MULTIPLE |
197 |
|
// We need to work out what window's Emulator should receive these messages |
198 |
|
|
202 |
|
for ( tmp = 0; tmp < [emulators count], ++tmp ) |
203 |
|
{ |
204 |
|
theEmulator = [emulators objectAtIndex: tmp]; |
205 |
< |
if ( [ theEmulator isRunning ] && [[theEmulator window] isMainWindow ] ) |
205 |
> |
view = [theEmulator screen]; |
206 |
> |
|
207 |
> |
if ( [theEmulator isRunning] && |
208 |
> |
( [[theEmulator window] isMainWindow] || [view isFullScreen] ) ) |
209 |
|
break; |
210 |
|
} |
211 |
|
|
212 |
|
if ( tmp < [emulators count] ) // i.e. if we exited the for loop |
213 |
|
#else |
214 |
< |
if ( FULLSCREEN || |
215 |
< |
( [theEmulator isRunning] && [[theEmulator window] isMainWindow ] ) ) |
214 |
> |
view = [theEmulator screen]; |
215 |
> |
|
216 |
> |
if ( [theEmulator isRunning] && |
217 |
> |
( [[theEmulator window] isMainWindow] || [view isFullScreen] ) ) |
218 |
|
#endif |
219 |
|
{ |
220 |
< |
EmulatorView *view = [theEmulator screen]; |
204 |
< |
|
205 |
< |
// if ( [view mouseInView] ) |
206 |
< |
if ( [view mouseInView: event] || FULLSCREEN ) |
220 |
> |
if ( [view mouseInView: event] ) |
221 |
|
{ |
222 |
|
switch ( type ) |
223 |
|
{ |
291 |
|
|
292 |
|
#endif |
293 |
|
|
294 |
+ |
- (BOOL) isAnyEmulatorDisplayingSheets |
295 |
+ |
{ |
296 |
+ |
#ifdef ENABLE_MULTIPLE |
297 |
+ |
int tmp; |
298 |
+ |
|
299 |
+ |
for ( tmp = 0; tmp < [emulators count], ++tmp ) |
300 |
+ |
if ( [[[emulators objectAtIndex: tmp] window] attachedSheet] ) |
301 |
+ |
break; |
302 |
+ |
|
303 |
+ |
if ( tmp < [emulators count] ) // i.e. if we exited the for loop |
304 |
+ |
#else |
305 |
+ |
if ( [[theEmulator window] attachedSheet] ) |
306 |
+ |
#endif |
307 |
+ |
return TRUE; |
308 |
+ |
|
309 |
+ |
return FALSE; |
310 |
+ |
} |
311 |
+ |
|
312 |
|
- (BOOL) isAnyEmulatorRunning |
313 |
|
{ |
314 |
|
#ifdef ENABLE_MULTIPLE |