Commit 6289a612 authored by Ken Thomases's avatar Ken Thomases Committed by Alexandre Julliard

winemac: Add WineApplication methods to convert from Cocoa to Win32 coordinate space.

Cocoa coordinate space has its origin in the lower left of the primary screen and y increases up.
parent 5f06bf80
......@@ -43,6 +43,9 @@
CGEventSourceKeyboardType keyboardType;
NSEvent* lastFlagsChanged;
CGFloat primaryScreenHeight;
BOOL primaryScreenHeightValid;
}
@property (nonatomic) CGEventSourceKeyboardType keyboardType;
......
......@@ -225,6 +225,32 @@ int macdrv_err_on;
}
}
- (CGFloat) primaryScreenHeight
{
if (!primaryScreenHeightValid)
{
NSArray* screens = [NSScreen screens];
if ([screens count])
{
primaryScreenHeight = NSHeight([[screens objectAtIndex:0] frame]);
primaryScreenHeightValid = TRUE;
}
else
return 1280; /* arbitrary value */
}
return primaryScreenHeight;
}
- (NSPoint) flippedMouseLocation:(NSPoint)point
{
/* This relies on the fact that Cocoa's mouse location points are
actually off by one (precisely because they were flipped from
Quartz screen coordinates using this same technique). */
point.y = [self primaryScreenHeight] - point.y;
return point;
}
/*
* ---------- NSApplication method overrides ----------
......@@ -241,6 +267,11 @@ int macdrv_err_on;
/*
* ---------- NSApplicationDelegate methods ----------
*/
- (void)applicationDidChangeScreenParameters:(NSNotification *)notification
{
primaryScreenHeightValid = FALSE;
}
- (void)applicationDidResignActive:(NSNotification *)notification
{
macdrv_event event;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment