revision 838:9abb2fa58934
summary |
tree |
shortlog |
changelog |
graph |
changeset |
raw | bz2 | zip | gz changeset | 838:9abb2fa58934 |
parent | 837:4eae2ddccf9c |
child | 839:51f1c4195790 |
author | nkeynes |
date | Tue Sep 02 00:42:43 2008 +0000 (15 years ago) |
Add flag to maple devices indicating whether they need a mouse grab to operate
1.1 --- a/src/maple/controller.c Thu Aug 28 01:39:51 2008 +00001.2 +++ b/src/maple/controller.c Tue Sep 02 00:42:43 2008 +00001.3 @@ -45,7 +45,8 @@1.4 struct maple_device_class controller_class = { "Sega Controller", controller_new };1.6 static struct controller_device base_controller = {1.7 - { MAPLE_DEVICE_TAG, &controller_class, CONTROLLER_IDENT, CONTROLLER_VERSION,1.8 + { MAPLE_DEVICE_TAG, &controller_class, MAPLE_GRAB_DONTCARE,1.9 + CONTROLLER_IDENT, CONTROLLER_VERSION,1.10 controller_get_config, controller_set_config_value,1.11 controller_attach, controller_detach, controller_destroy,1.12 controller_clone, NULL, NULL, controller_get_cond, NULL, NULL, NULL },
2.1 --- a/src/maple/kbd.c Thu Aug 28 01:39:51 2008 +00002.2 +++ b/src/maple/kbd.c Tue Sep 02 00:42:43 2008 +00002.3 @@ -54,7 +54,8 @@2.4 struct maple_device_class keyboard_class = { "Sega Keyboard", keyboard_new };2.6 static struct keyboard_device base_keyboard = {2.7 - { MAPLE_DEVICE_TAG, &keyboard_class, KEYBOARD_IDENT, KEYBOARD_VERSION,2.8 + { MAPLE_DEVICE_TAG, &keyboard_class, MAPLE_GRAB_DONTCARE,2.9 + KEYBOARD_IDENT, KEYBOARD_VERSION,2.10 NULL, NULL, keyboard_attach, keyboard_detach, maple_default_destroy,2.11 keyboard_clone, NULL, NULL, keyboard_get_cond, NULL, NULL, NULL },2.12 {0,0,0,0,0,0,0,0},
3.1 --- a/src/maple/maple.c Thu Aug 28 01:39:51 2008 +00003.2 +++ b/src/maple/maple.c Tue Sep 02 00:42:43 2008 +00003.3 @@ -317,7 +317,8 @@3.4 }3.5 }3.7 -void maple_reattach_all() {3.8 +void maple_reattach_all()3.9 +{3.10 int i, j;3.11 for( i=0; i<4; i++ ) {3.12 for( j=0; j<6; j++ ) {3.13 @@ -332,6 +333,23 @@3.14 }3.15 }3.17 +gboolean maple_should_grab()3.18 +{3.19 + int mode = MAPLE_GRAB_DONTCARE;3.20 + int i,j;3.21 + for( i=0; i<4; i++ ) {3.22 + for( j=0; j<6; j++ ) {3.23 + if( maple_devices[i][j] != NULL ) {3.24 + maple_device_t dev = maple_devices[i][j];3.25 + if( dev->grab_mode > mode ) {3.26 + mode = dev->grab_mode;3.27 + }3.28 + }3.29 + }3.30 + }3.31 + return mode == MAPLE_GRAB_YES;3.32 +}3.33 +3.34 void maple_set_device_config_value( maple_device_t dev, unsigned int key, const gchar *value )3.35 {3.36 if( dev != NULL && dev->set_config_value != NULL ) {
4.1 --- a/src/maple/maple.h Thu Aug 28 01:39:51 2008 +00004.2 +++ b/src/maple/maple.h Tue Sep 02 00:42:43 2008 +00004.3 @@ -56,6 +56,10 @@4.4 #define MAPLE_FUNC_PURU_PURU 0x000100004.5 #define MAPLE_FUNC_MOUSE 0x000200004.7 +#define MAPLE_GRAB_DONTCARE 04.8 +#define MAPLE_GRAB_YES 14.9 +#define MAPLE_GRAB_NO 24.10 +4.11 #define MAPLE_DEVICE_TAG 0x4D41504C4.12 #define MAPLE_DEVICE(x) ((maple_device_t)x)4.14 @@ -73,6 +77,7 @@4.15 struct maple_device {4.16 uint32_t _tag;4.17 maple_device_class_t device_class;4.18 + int grab_mode;4.19 unsigned char ident[112];4.20 unsigned char version[80];4.21 lxdream_config_entry_t (*get_config)(struct maple_device *dev);4.22 @@ -109,6 +114,7 @@4.23 void maple_detach_device( unsigned int port, unsigned int periph );4.24 void maple_detach_all( );4.25 void maple_reattach_all( );4.26 +gboolean maple_should_grab();4.28 /**4.29 * Default destroy implementation that just frees the dev memory.
5.1 --- a/src/maple/mouse.c Thu Aug 28 01:39:51 2008 +00005.2 +++ b/src/maple/mouse.c Tue Sep 02 00:42:43 2008 +00005.3 @@ -57,7 +57,8 @@5.4 struct maple_device_class mouse_class = { "Sega Mouse", mouse_new };5.6 static struct mouse_device base_mouse = {5.7 - { MAPLE_DEVICE_TAG, &mouse_class, MOUSE_IDENT, MOUSE_VERSION,5.8 + { MAPLE_DEVICE_TAG, &mouse_class, MAPLE_GRAB_YES,5.9 + MOUSE_IDENT, MOUSE_VERSION,5.10 NULL, NULL, mouse_attach, mouse_detach, maple_default_destroy,5.11 mouse_clone, NULL, NULL, mouse_get_cond, NULL, NULL, NULL },5.12 0, {0,0,0,0,0,0,0,0},
.