64 |
|
[super dealloc]; |
65 |
|
} |
66 |
|
|
67 |
< |
// Mouse click in this window. If window is not active, should click be passed to this view? |
67 |
> |
// Mouse click in this window. If window is not active, |
68 |
> |
// should the click be passed to this view? |
69 |
|
- (BOOL) acceptsFirstMouse: (NSEvent *) event |
70 |
|
{ |
71 |
|
return [self mouseInView]; |
115 |
|
|
116 |
|
- (BOOL) mouseInView: (NSEvent *) event |
117 |
|
{ |
117 |
– |
NSPoint loc = [event locationInWindow]; |
118 |
|
NSRect box; |
119 |
+ |
NSPoint loc; |
120 |
+ |
|
121 |
|
if ( fullScreen ) |
122 |
< |
return YES; |
122 |
> |
{ |
123 |
> |
box = displayBox; |
124 |
> |
loc = [NSEvent mouseLocation]; |
125 |
> |
} |
126 |
|
else |
127 |
+ |
{ |
128 |
|
box = [self frame]; |
129 |
< |
D(NSLog (@"%s - loc.x=%f, loc.y=%f, box.origin.x=%f, box.origin.y=%f", |
130 |
< |
__PRETTY_FUNCTION__, loc.x, loc.y, box.origin.x, box.origin.y)); |
129 |
> |
loc = [event locationInWindow]; |
130 |
> |
} |
131 |
> |
|
132 |
> |
D(NSLog (@"%s - loc.x=%f, loc.y=%f, box.origin.x=%f, box.origin.y=%f, box.size.width=%f, box.size.height=%f", __PRETTY_FUNCTION__, loc.x, loc.y, box.origin.x, box.origin.y, box.size.width, box.size.height)); |
133 |
|
return [self mouse: loc inRect: box]; |
134 |
|
} |
135 |
|
|
142 |
|
return [self mouse: loc inRect: box]; |
143 |
|
} |
144 |
|
|
137 |
– |
|
145 |
|
// |
146 |
|
// Custom methods |
147 |
|
// |
236 |
|
drawView = NO; |
237 |
|
} |
238 |
|
|
239 |
< |
- (void) startedFullScreen |
239 |
> |
- (void) startedFullScreen: (CGDirectDisplayID) display |
240 |
|
{ |
241 |
+ |
CGRect displayBounds = CGDisplayBounds(display); |
242 |
+ |
|
243 |
|
fullScreen = YES; |
244 |
+ |
memcpy(&displayBox, &displayBounds, sizeof(displayBox)); |
245 |
+ |
screen_height = (int)displayBounds.size.height; |
246 |
|
} |
247 |
|
|
248 |
|
- (short) width |
311 |
|
|
312 |
|
- (BOOL) processMouseMove: (NSEvent *) event |
313 |
|
{ |
314 |
< |
NSPoint locInView; |
314 |
> |
NSPoint location; |
315 |
|
|
316 |
|
if ( fullScreen ) |
317 |
< |
locInView = [NSEvent mouseLocation]; |
307 |
< |
// CGAssociateMouseAndMouseCursorPosition(bool) |
308 |
< |
// which will let you unlink the mouse input and the mouse cursor. So I |
309 |
< |
// unlink the two, and the cursor doesn't move, but I still receive |
310 |
< |
// MouseMoved events and can get the movement value using |
311 |
< |
// CGGetLastMouseDelta. |
317 |
> |
location = [NSEvent mouseLocation]; |
318 |
|
else |
319 |
< |
locInView = [self convertPoint: [event locationInWindow] fromView:nil]; |
319 |
> |
location = [self convertPoint: [event locationInWindow] fromView:nil]; |
320 |
|
|
321 |
< |
if ( NSEqualPoints(locInView, mouse) ) |
321 |
> |
if ( NSEqualPoints(location, mouse) ) |
322 |
|
return NO; |
323 |
|
|
324 |
< |
mouse = locInView; |
324 |
> |
mouse = location; |
325 |
|
|
326 |
|
if ( fullScreen ) |
327 |
|
{ |