Search
lxdream.org :: lxdream/src/cocoaui/cocoa_ctrl.m :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/cocoaui/cocoa_ctrl.m
changeset 1043:ec716f2b8ffb
prev1041:5fcc39857c5c
next1058:37f6fdc738e7
author nkeynes
date Sat Jun 27 09:55:00 2009 +0000 (14 years ago)
permissions -rw-r--r--
last change Ensure each VMU is only attached once
Handle removal of sub-devices when detaching parent device
file annotate diff log raw
1.1 --- a/src/cocoaui/cocoa_ctrl.m Fri Jun 26 05:47:04 2009 +0000
1.2 +++ b/src/cocoaui/cocoa_ctrl.m Sat Jun 27 09:55:00 2009 +0000
1.3 @@ -649,6 +649,12 @@
1.4 }
1.5 if( new_device_class == NULL ) {
1.6 maple_detach_device(port,slot);
1.7 + if( slot == 0 ) {
1.8 + /* If we detached the top-level dev, any children are automatically detached */
1.9 + for( i=1; i<=MAPLE_USER_SLOTS; i++ ) {
1.10 + [popup[MAPLE_DEVID(port,i)] selectItemWithTag: 0];
1.11 + }
1.12 + }
1.13 } else {
1.14 if( new_device_class == &controller_class && save_controller[tag] != NULL ) {
1.15 new_device = save_controller[tag];
1.16 @@ -657,6 +663,14 @@
1.17 new_device = maple_new_device( new_device_class->name );
1.18 }
1.19 if( MAPLE_IS_VMU(new_device) ) {
1.20 + /* Remove the VMU from any other attachment point */
1.21 + for( i=0; i<MAPLE_MAX_DEVICES; i++ ) {
1.22 + maple_device_t dev = maple_get_device(MAPLE_DEVID_PORT(i),MAPLE_DEVID_SLOT(i));
1.23 + if( dev != NULL && MAPLE_IS_VMU(dev) && MAPLE_VMU_HAS_NAME(dev,vmu_filename) ) {
1.24 + maple_detach_device(MAPLE_DEVID_PORT(i),MAPLE_DEVID_SLOT(i));
1.25 + [popup[i] selectItemWithTag: 0];
1.26 + }
1.27 + }
1.28 MAPLE_SET_VMU_NAME(new_device,vmu_filename);
1.29 }
1.30 maple_attach_device(new_device,port,slot);
.