summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJess VanDerwalker <washu@sonic.net>2012-04-04 15:23:57 -0700
committerJeremy Huddleston <jeremyhu@apple.com>2012-04-05 11:47:46 -0700
commit0f1ccd10cd8e999b5d630296afccbf5d921e8306 (patch)
tree1faee6368ab41ac8894232afb60ef22f831291f2
parentbc97999157de7e7275f8265b1f4bb0707318ca6c (diff)
Namespaced input functions and removed window parameter.
Input functions are not prefixed with xcwm_input_*. Also removed the Mac window ID that was being passed into input functions for debugging purposes. Signed-off-by: Jess VanDerwalker <washu@sonic.net>
-rw-r--r--include/xcwm/xtoq.h15
-rw-r--r--src/libxcwm/input.c18
-rw-r--r--src/xtoq/XtoqController.m45
3 files changed, 35 insertions, 43 deletions
diff --git a/include/xcwm/xtoq.h b/include/xcwm/xtoq.h
index ce37575..aa063b3 100644
--- a/include/xcwm/xtoq.h
+++ b/include/xcwm/xtoq.h
@@ -166,16 +166,15 @@ xcwm_close(void);
* @param keyCode The key pressed.
*/
void
-xcwm_key_press (xcwm_context_t *context, int window, uint8_t code);
+xcwm_input_key_press (xcwm_context_t *context, uint8_t code);
/**
* function
* @param context xcwm_context_t
- * @param window The window that the key press was made in.
* @param keyCode The key released.
*/
void
-xcwm_key_release (xcwm_context_t *context, int window, uint8_t code);
+xcwm_input_key_release (xcwm_context_t *context, uint8_t code);
/**
* Uses the XTEST protocol to send input events to the X Server (The X Server
@@ -185,10 +184,9 @@ xcwm_key_release (xcwm_context_t *context, int window, uint8_t code);
* @param context xcwm_context_t
* @param x - x coordinate
* @param y - y coordinate
- * @param window The window that the key press was made in.
*/
void
-xcwm_button_press (xcwm_context_t *context, long x, long y, int window, int button);
+xcwm_input_button_press (xcwm_context_t *context, long x, long y, int button);
/**
* Uses the XTEST protocol to send input events to the X Server (The X Server
@@ -198,20 +196,19 @@ xcwm_button_press (xcwm_context_t *context, long x, long y, int window, int butt
* @param context xcwm_context_t
* @param x - x coordinate
* @param y - y coordinate
- * @param window The window that the key release was made in.
+ * @param button The id of the button pressed.
*/
void
-xcwm_button_release (xcwm_context_t *context, long x, long y, int window, int button);
+xcwm_input_button_release (xcwm_context_t *context, long x, long y, int button);
/**
* function
* @param context xcwm_context_t
* @param x - x coordinate
* @param y - y coordinate
- * @param window The window that the key release was made in.
*/
void
-xcwm_mouse_motion (xcwm_context_t *context, long x, long y, int window, int button);
+xcwm_input_mouse_motion (xcwm_context_t *context, long x, long y, int button);
/****************
* window.c
diff --git a/src/libxcwm/input.c b/src/libxcwm/input.c
index 12efbb7..c4359bf 100644
--- a/src/libxcwm/input.c
+++ b/src/libxcwm/input.c
@@ -29,7 +29,7 @@
#include "xcwm_internal.h"
void
-xcwm_key_press (xcwm_context_t *context, int window, uint8_t code)
+xcwm_input_key_press (xcwm_context_t *context, uint8_t code)
{
xcb_window_t none = { XCB_NONE };
@@ -37,11 +37,11 @@ xcwm_key_press (xcwm_context_t *context, int window, uint8_t code)
XCB_CURRENT_TIME, none, 0, 0, 1 );
xcb_flush(context->conn);
- printf("xcwm.c received key down - uint8_t '%i', from Mac window #%i to context.window %u\n", code, window, context->window);
+ printf("xcwm.c received key down - uint8_t '%i', to context.window %u\n", code, context->window);
}
void
-xcwm_key_release (xcwm_context_t *context, int window, uint8_t code)
+xcwm_input_key_release (xcwm_context_t *context, uint8_t code)
{
xcb_window_t none = { XCB_NONE };
@@ -49,30 +49,30 @@ xcwm_key_release (xcwm_context_t *context, int window, uint8_t code)
XCB_CURRENT_TIME, none,0 ,0 , 1 );
xcb_flush(context->conn);
- printf("xcwm.c received key release- uint8_t '%i', from Mac window #%i to context.window %u\n", code, window, context->window);
+ printf("xcwm.c received key release- uint8_t '%i', to context.window %u\n", code, context->window);
}
void
-xcwm_button_press (xcwm_context_t *context, long x, long y, int window, int button)
+xcwm_input_button_press (xcwm_context_t *context, long x, long y, int button)
{
//xcb_window_t none = { XCB_NONE };
xcb_test_fake_input (context->conn, XCB_BUTTON_PRESS, button, XCB_CURRENT_TIME,
context->window, 0, 0, 0);
xcb_flush(context->conn);
- printf("button down received by xtoq.c - (%ld,%ld) in Mac window #%i\n", x, y, window);
+ printf("button down received by xtoq.c - (%ld,%ld)\n", x, y);
}
void
-xcwm_button_release (xcwm_context_t *context, long x, long y, int window, int button)
+xcwm_input_button_release (xcwm_context_t *context, long x, long y, int button)
{
xcb_test_fake_input (context->conn, XCB_BUTTON_RELEASE, button, XCB_CURRENT_TIME,
context->window, 0, 0, 0);
xcb_flush(context->conn);
- printf("button release received by xcwm.c - (%ld,%ld) in Mac window #%i\n", x, y, window);
+ printf("button release received by xcwm.c - (%ld,%ld)\n", x, y);
}
void
-xcwm_mouse_motion (xcwm_context_t *context, long x, long y, int window, int button)
+xcwm_input_mouse_motion (xcwm_context_t *context, long x, long y,int button)
{
xcb_test_fake_input (context->conn, XCB_MOTION_NOTIFY, 0, XCB_CURRENT_TIME,
root_context->window, x, y, 0);
diff --git a/src/xtoq/XtoqController.m b/src/xtoq/XtoqController.m
index a9c3826..5db1462 100644
--- a/src/xtoq/XtoqController.m
+++ b/src/xtoq/XtoqController.m
@@ -178,12 +178,12 @@
int height = [[NSScreen mainScreen] frame].size.height;
dispatch_async(xcwmDispatchQueue,
- ^{ xcwm_mouse_motion (rootContext,
- [xNum intValue],
- //Converting OSX coordinates to X11
- height - WINDOWBAR - [yNum intValue],
- (int)[event windowNumber],
- 0);;});
+ ^{ xcwm_input_mouse_motion
+ (rootContext,
+ [xNum intValue],
+ //Converting OSX coordinates to X11
+ height - WINDOWBAR - [yNum intValue],
+ 0);});
}
- (void) keyDownInView: (NSNotification *) aNotification
@@ -196,10 +196,11 @@
const char* charcharstar = [charNSString UTF8String];
NSLog(@"%s pressed", charcharstar);
+ // FIXME: Uses a 'magic number' for offset into keymap - should a
+ // #define or gotten programmatically.
dispatch_async(xcwmDispatchQueue,
- ^{ xcwm_key_press(rootContext,
- (int)[event windowNumber],
- aChar + 8) ;});
+ ^{ xcwm_input_key_press(rootContext,
+ aChar + 8) ;});
}
- (void) keyUpInView: (NSNotification *) aNotification
@@ -209,9 +210,9 @@
NSEvent * event = [keyInfo objectForKey: @"1"];
unsigned short aChar = [event keyCode];
+ // FIXME: Uses a 'magic number' for offset.
dispatch_async(xcwmDispatchQueue,
- ^{ xcwm_key_release(rootContext,
- (int)[event windowNumber],
+ ^{ xcwm_input_key_release(rootContext,
aChar + 8) ;});
}
@@ -232,14 +233,12 @@
NSNumber * mouseButton = [NSNumber alloc];
mouseButton = [mouseDownInfo objectForKey:@"3"];
int buttonInt = [mouseButton intValue];
- //NSLog(@"Mouse Info: %@", [mouseDownInfo objectForKey: @"2"]);
dispatch_async(xcwmDispatchQueue,
- ^{ xcwm_button_press (rootContext,
- 0,
- 0,
- (int)[event windowNumber],
- buttonInt);;});
+ ^{ xcwm_input_button_press (rootContext,
+ 0,
+ 0,
+ buttonInt);;});
}
// on this side all I have is a xcwm_context , on the library side I need
@@ -248,24 +247,20 @@
{
CGFloat heightFloat;
NSDictionary *mouseReleaseInfo = [aNotification userInfo];
- // NSLog(@"Controller Got a XTOQmouseButtonDownEvent");
NSEvent * event = [mouseReleaseInfo objectForKey: @"1"];
- //NSRect bnd = NSMakeRect(0,0,512,386);
NSNumber * heightAsNumber = [NSNumber alloc];
heightAsNumber = [mouseReleaseInfo objectForKey: @"2"];
heightFloat = [heightAsNumber floatValue];
- //NSLog(@"Mouse Info: %@", [mouseDownInfo objectForKey: @"2"]);
NSNumber * mouseButton = [NSNumber alloc];
mouseButton = [mouseReleaseInfo objectForKey:@"3"];
int buttonInt = [mouseButton intValue];
dispatch_async(xcwmDispatchQueue,
- ^{ xcwm_button_release (rootContext,
- 0,
- 0,
- (int)[event windowNumber],
- buttonInt);;});
+ ^{ xcwm_input_button_release (rootContext,
+ 0,
+ 0,
+ buttonInt);;});
}