"Shift to prevent autoconnect" is broken?

Mark Rowe <[email protected]> Thu, 13 Jan 2005 20:44:49 +1300
Newsgroups gmane.network.fire.devel
Message-ID <[email protected]>
Hi,

I was fiddling around the other day and noticed that the old trick of 
holding down shift to prevent accounts from autoconnecting no longer 
seems to work.  I had a look back through previous CVS revisions, and 
the code in question doesn't appear to have changed in a long long 
time.  Am I imagining things?  Is this really broken?  If so, I've 
attached a patch which I'd like to squeeze in to 1.5.1.  If someone can 
confirm that this isn't behaving correctly I will commit the fix.

Regards,

Mark Rowe
<http://bdash.net.nz/>
fire-shift-to-disable-autoconnect.patch (application/octet-stream, 2.1 KB)
Index: MainController.m
===================================================================
RCS file: /cvsroot/fire/fire/MainController.m,v
retrieving revision 1.282
diff -c -r1.282 MainController.m
*** MainController.m	5 Jan 2005 04:51:38 -0000	1.282
--- MainController.m	9 Jan 2005 14:22:19 -0000
***************
*** 106,112 ****
  io_object_t 			powerConnection;
  
  static int CompareMenuItems(NSMenuItem *item1, NSMenuItem *item2, void *context);
- static BOOL isPressed(unsigned char *theKeyMap, unsigned short scanCode);
  static void sleepNotification(void *refcon, io_service_t service, natural_t messageType, void *messageArgument);
  
  int CompareMenuItems(NSMenuItem* item1, NSMenuItem* item2, void* context)
--- 106,111 ----
***************
*** 114,127 ****
      return [[item1 title] caseInsensitiveCompare:[item2 title]];
  }
  
- #define SHIFT_KEY_CODE	56
- 
- BOOL isPressed(unsigned char* theKeyMap, unsigned short scanCode)
- {
-     //k = any keyboard scan code, 0-127
-     return ((theKeyMap[scanCode>>3] >> (scanCode & 7)) & 1);
- }
- 
  #ifdef FIRE_STATUS_BAR
  
  @interface MainController(StatusMenu)
--- 113,118 ----
***************
*** 962,971 ****
      
      // Auto-launch services
      {
!         KeyMap theKeys;
!         GetKeys(theKeys);
!         if (isPressed((unsigned char*)theKeys,SHIFT_KEY_CODE)) {
!             //Disable autoconnect when the shift key is down
              [[self consoleController] addMessageToConsole:NSLocalizedString(@"Autoconnect disabled.",@"")];
          } else {
              [[[self serviceController] accounts] makeObjectsPerformSelector:@selector(autoConnect)];
--- 953,962 ----
      
      // Auto-launch services
      {
!         UInt16 modifiers = GetCurrentKeyModifiers();
!         int shiftKeyMask = (1 << shiftKeyBit) | (1 << rightShiftKeyBit);
!         if ((modifiers & shiftKeyMask) != 0) {
!             // Disable autoconnect when the shift key is down
              [[self consoleController] addMessageToConsole:NSLocalizedString(@"Autoconnect disabled.",@"")];
          } else {
              [[[self serviceController] accounts] makeObjectsPerformSelector:@selector(autoConnect)];
smime.p7s (application/pkcs7-signature, 3.9 KB) - not displayed