summaryrefslogtreecommitdiff
path: root/src/xtoq/XtoqController.m
diff options
context:
space:
mode:
authorBraden Wooley <bwooley@pdx.edu>2012-03-09 06:57:58 -0800
committerBraden Wooley <bwooley@pdx.edu>2012-03-09 06:57:58 -0800
commitb4896853ca6fe3f419f1e1e5f0ce4451e8d36e53 (patch)
tree60b0a8044a9544e09a2c95c383804f6c2ee9c855 /src/xtoq/XtoqController.m
parent9e9cb7623f2b3bbfb15c729d5abd08f373c2798e (diff)
changed mouse movement to be screen relative not window, fixed y conversion functions
Diffstat (limited to 'src/xtoq/XtoqController.m')
-rw-r--r--src/xtoq/XtoqController.m37
1 files changed, 25 insertions, 12 deletions
diff --git a/src/xtoq/XtoqController.m b/src/xtoq/XtoqController.m
index 7e307b3..a935cc8 100644
--- a/src/xtoq/XtoqController.m
+++ b/src/xtoq/XtoqController.m
@@ -32,6 +32,7 @@
#import "XtoqController.h"
#define WINDOWBAR 22
+#define FILEBAR 23
@implementation XtoqController
@@ -46,14 +47,14 @@
- (int) xserverToOSX:(int)yValue windowHeight:(int)windowH {
int height = [[NSScreen mainScreen] frame].size.height;
- return height - WINDOWBAR - windowH + yValue;
+ return height - windowH + yValue;
}
- (int) osxToXserver:(int)yValue windowHeight:(int)windowH {
int height = [[NSScreen mainScreen] frame].size.height;
- return height - yValue - WINDOWBAR;
+ return height - yValue;
}
@@ -215,10 +216,13 @@
heightAsNumber = [mouseDownInfo objectForKey: @"2"];
heightFloat = [heightAsNumber floatValue];
//NSLog(@"Mouse Info: %@", [mouseDownInfo objectForKey: @"2"]);
+
+ float height = [[NSScreen mainScreen] frame].size.height;
+
dispatch_async(xtoqDispatchQueue,
^{ xtoq_button_press (rootContext,
- [event locationInWindow].x,
- heightFloat - [event locationInWindow].y,
+ [NSEvent mouseLocation].x,
+ height - FILEBAR - [NSEvent mouseLocation].y,
(int)[event windowNumber],
0);;});
}
@@ -236,12 +240,15 @@
heightAsNumber = [mouseReleaseInfo objectForKey: @"2"];
heightFloat = [heightAsNumber floatValue];
//NSLog(@"Mouse Info: %@", [mouseDownInfo objectForKey: @"2"]);
+
+ float height = [[NSScreen mainScreen] frame].size.height;
+
dispatch_async(xtoqDispatchQueue,
^{ xtoq_button_release (rootContext,
- [event locationInWindow].x,
- heightFloat - [event locationInWindow].y,
- (int)[event windowNumber],
- 0);;});
+ [NSEvent mouseLocation].x,
+ height - FILEBAR - [NSEvent mouseLocation].y,
+ (int)[event windowNumber],
+ 0);;});
}
@@ -259,12 +266,18 @@
heightAsNumber = [mouseDownInfo objectForKey: @"2"];
heightFloat = [heightAsNumber floatValue];
//NSLog(@"Mouse Info: %@", [mouseDownInfo objectForKey: @"2"]);
+
+ float height = [[NSScreen mainScreen] frame].size.height;
+
+ NSLog(@"Mouse x = %i, y = %i", (int)[NSEvent mouseLocation].x,
+ (int)[[NSScreen mainScreen] frame].size.height - FILEBAR - (int)[NSEvent mouseLocation].y);
+
dispatch_async(xtoqDispatchQueue,
^{ xtoq_mouse_motion (rootContext,
- [event locationInWindow].x,
- heightFloat - [event locationInWindow].y,
- (int)[event windowNumber],
- 0);;});
+ [NSEvent mouseLocation].x,
+ height - FILEBAR - [NSEvent mouseLocation].y,
+ (int)[event windowNumber],
+ 0);;});
}
- (void) makeMenu {