[haiku-commits] haiku: hrev45857 - src/kits/tracker

  • From: stpere@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sat, 13 Jul 2013 23:00:57 +0200 (CEST)

hrev45857 adds 1 changeset to branch 'master'
old head: 073218a8aeef62ef94d49852f27a9f075bfe53f8
new head: 4ba4d40bb2b3b689b8faf3746952756dcc268cdc
overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=4ba4d40+%5E073218a

----------------------------------------------------------------------------

4ba4d40: Addons shortcuts: fix override
  
  Under some specific circumstances (changing the key and the modifier in a 
specific way
  at the same time), Tracker would get confused and not change the shortcut.
  
  Thanks Diver

                                [ Philippe Saint-Pierre <stpere@xxxxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev45857
Commit:      4ba4d40bb2b3b689b8faf3746952756dcc268cdc
URL:         http://cgit.haiku-os.org/haiku/commit/?id=4ba4d40
Author:      Philippe Saint-Pierre <stpere@xxxxxxxxx>
Date:        Sat Jul 13 20:57:40 2013 UTC

----------------------------------------------------------------------------

1 file changed, 6 insertions(+), 14 deletions(-)
src/kits/tracker/DeskWindow.cpp | 20 ++++++--------------

----------------------------------------------------------------------------

diff --git a/src/kits/tracker/DeskWindow.cpp b/src/kits/tracker/DeskWindow.cpp
index d17e9ba..405949a 100644
--- a/src/kits/tracker/DeskWindow.cpp
+++ b/src/kits/tracker/DeskWindow.cpp
@@ -167,6 +167,7 @@ LoadAddOnDir(directory_which dirName, BDeskWindow* window,
                                        item->key = shortcut[0];
                                AddOneShortcut(model, item->key, 
kDefaultModifiers, window);
                                item->defaultKey = item->key;
+                               item->modifiers = kDefaultModifiers;
                                list->AddItem(item);
                        }
                        free(name);
@@ -309,14 +310,10 @@ BDeskWindow::ApplyShortcutPreferences(bool update)
                while (fileMsg.FindMessage("spec", i++, &message) == B_OK) {
        
                        int32 key;
-                       BMessage actMsg;
-                       
-                       if (message.FindInt32("key", &key) == B_OK
-                               && message.FindMessage("act", &actMsg) == B_OK) 
{
-
+                       if (message.FindInt32("key", &key) == B_OK) {
                                // only handle shortcuts referring add-ons
                                BString command;
-                               if (actMsg.FindString("largv", &command) != 
B_OK)
+                               if (message.FindString("command", &command) != 
B_OK)
                                        continue;
                                BPath path;
                                bool isInAddons = false;
@@ -347,8 +344,9 @@ BDeskWindow::ApplyShortcutPreferences(bool update)
                                const char* shortcut = GetKeyName(key);
                                if (strlen(shortcut) != 1)
                                        continue;
-                       
-                               uint32 modifiers = 0;
+
+                               uint32 modifiers = B_COMMAND_KEY;
+                                       // it's required by interface kit to at 
least have B_COMMAND_KEY
                                int32 value;
                                if (message.FindInt32("mcidx", 0, &value) == 
B_OK)
                                        modifiers |= (value != 0 ? B_SHIFT_KEY 
: 0);
@@ -356,15 +354,9 @@ BDeskWindow::ApplyShortcutPreferences(bool update)
                                if (message.FindInt32("mcidx", 1, &value) == 
B_OK)
                                        modifiers |= (value != 0 ? 
B_CONTROL_KEY : 0);
 
-                               if (message.FindInt32("mcidx", 2, &value) == 
B_OK)
-                                       modifiers |= (value != 0 ? 
B_COMMAND_KEY : 0);
-
                                if (message.FindInt32("mcidx", 3, &value) == 
B_OK)
                                        modifiers |= (value != 0 ? B_OPTION_KEY 
: 0);
 
-                               if (modifiers == 0)
-                                       modifiers = kDefaultModifiers;
-
                                Model model(&entry);
                                AddonShortcut* item = 
fAddonsList->EachElement(FindElement,
                                        &model);


Other related posts:

  • » [haiku-commits] haiku: hrev45857 - src/kits/tracker - stpere