Ticket #2181: Menu.diff.bad

File Menu.diff.bad, 2.8 KB (added by shinta, 16 years ago)
Line 
1Index: src/kits/interface/Menu.cpp
2===================================================================
3--- src/kits/interface/Menu.cpp (リビジョン 25277)
4+++ src/kits/interface/Menu.cpp (作業コピー)
5@@ -34,6 +34,8 @@
6
7 #include "utf8_functions.h"
8
9+#include <iostream>
10+
11 #define USE_CACHED_MENUWINDOW 1
12
13 using std::nothrow;
14@@ -204,7 +206,8 @@
15 fIgnoreHidden(true),
16 fTriggerEnabled(true),
17 fRedrawAfterSticky(false),
18- fAttachAborted(false)
19+ fAttachAborted(false),
20+ fKeyboardNavigated(false)
21 {
22 _InitData(NULL);
23 }
24@@ -237,7 +240,8 @@
25 fIgnoreHidden(true),
26 fTriggerEnabled(true),
27 fRedrawAfterSticky(false),
28- fAttachAborted(false)
29+ fAttachAborted(false),
30+ fKeyboardNavigated(false)
31 {
32 _InitData(NULL);
33 }
34@@ -283,7 +287,8 @@
35 fIgnoreHidden(true),
36 fTriggerEnabled(true),
37 fRedrawAfterSticky(false),
38- fAttachAborted(false)
39+ fAttachAborted(false),
40+ fKeyboardNavigated(false)
41 {
42 _InitData(archive);
43 }
44@@ -822,16 +827,19 @@
45 // TODO: Test how it works on beos and implement it correctly
46 switch (bytes[0]) {
47 case B_UP_ARROW:
48+ fKeyboardNavigated = true;
49 if (fLayout == B_ITEMS_IN_COLUMN)
50 _SelectNextItem(fSelected, false);
51 break;
52
53 case B_DOWN_ARROW:
54+ fKeyboardNavigated = true;
55 if (fLayout == B_ITEMS_IN_COLUMN)
56 _SelectNextItem(fSelected, true);
57 break;
58
59 case B_LEFT_ARROW:
60+ fKeyboardNavigated = true;
61 if (fLayout == B_ITEMS_IN_ROW)
62 _SelectNextItem(fSelected, false);
63 else {
64@@ -850,6 +858,7 @@
65 break;
66
67 case B_RIGHT_ARROW:
68+ fKeyboardNavigated = true;
69 if (fLayout == B_ITEMS_IN_ROW)
70 _SelectNextItem(fSelected, true);
71 else {
72@@ -1472,7 +1481,8 @@
73 // Mouse pointer outside menu:
74 // If there's no other submenu opened,
75 // deselect the current selected item
76- if (fSelected != NULL
77+ if ((!fKeyboardNavigated || buttons != 0)
78+ && fSelected != NULL
79 && (fSelected->Submenu() == NULL
80 || fSelected->Submenu()->Window() == NULL)) {
81 _SelectItem(NULL);
82@@ -1510,9 +1520,11 @@
83
84 if (newLocation != location || newButtons != buttons) {
85 if (!releasedOnce && newButtons == 0 && buttons != 0)
86- releasedOnce = true;
87+ releasedOnce = true;
88+ cout << "BMenu::_Track() location: " << location.x << ", " << location.y << " newLocation: " << newLocation.x << ", " << newLocation.y << endl;
89 location = newLocation;
90- buttons = newButtons;
91+ buttons = newButtons;
92+ fKeyboardNavigated = false;
93 }
94
95 if (releasedOnce)
96Index: headers/os/interface/Menu.h
97===================================================================
98--- headers/os/interface/Menu.h (リビジョン 25277)
99+++ headers/os/interface/Menu.h (作業コピー)
100@@ -277,6 +277,7 @@
101 bool fTriggerEnabled;
102 bool fRedrawAfterSticky;
103 bool fAttachAborted;
104+ bool fKeyboardNavigated;
105 };
106
107 #endif // _MENU_H