1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
|
diff -uNr fluxbox-0.1.13-orig/src/Basemenu.cc fluxbox-0.1.13/src/Basemenu.cc
--- fluxbox-0.1.13-orig/src/Basemenu.cc 2002-11-15 23:24:59.000000000 +0900
+++ fluxbox-0.1.13/src/Basemenu.cc 2002-11-20 14:11:11.000000000 +0900
@@ -136,6 +136,8 @@
m_screen->getDepth(), InputOutput,
m_screen->getVisual(), attrib_mask, &attrib);
fluxbox->saveMenuSearch(menu.frame, this);
+
+ menu.highlighted = -1;
}
@@ -428,6 +430,7 @@
torn = visible = false;
which_sub = which_press = which_sub = -1;
+ menu.highlighted = -1;
XUnmapWindow(m_display, menu.window);
}
@@ -759,6 +762,11 @@
break;
}
}
+ if (highlight) {
+ if (menu.highlighted != (int)index)
+ drawItem(menu.highlighted, False, True);
+ menu.highlighted = index;
+ }
}
@@ -1078,3 +1086,41 @@
menu.bevel_w = m_screen->getBevelWidth();
update();
}
+
+void Basemenu::highlightNextItem() {
+ if (menu.highlighted >= 0)
+ drawItem(menu.highlighted, False, True);
+
+ menu.highlighted++;
+ if (menu.highlighted >= (int)menuitems.size())
+ menu.highlighted = 0;
+
+ drawItem(menu.highlighted, True);
+}
+
+void Basemenu::highlightPrevItem() {
+ if (menu.highlighted >= 0)
+ drawItem(menu.highlighted, False, True);
+
+ menu.highlighted--;
+ if (menu.highlighted < 0)
+ menu.highlighted = menuitems.size() - 1;
+
+ drawItem(menu.highlighted, True);
+}
+
+void Basemenu::selectMenuItem() {
+ if (menu.highlighted >= 0)
+ itemSelected(1, menu.highlighted);
+}
+
+void Basemenu::openSubmenu() {
+ if (menu.highlighted >= 0)
+ if (hasSubmenu(menu.highlighted)) {
+ drawSubmenu(menu.highlighted);
+ }
+}
+
+void Basemenu::closeMenu() {
+ internal_hide();
+}
diff -uNr fluxbox-0.1.13-orig/src/Basemenu.hh fluxbox-0.1.13/src/Basemenu.hh
--- fluxbox-0.1.13-orig/src/Basemenu.hh 2002-11-04 03:45:30.000000000 +0900
+++ fluxbox-0.1.13/src/Basemenu.hh 2002-11-20 14:11:11.000000000 +0900
@@ -88,6 +88,11 @@
virtual void drawSubmenu(unsigned int index);
virtual void show();
virtual void hide();
+ virtual void highlightNextItem();
+ virtual void highlightPrevItem();
+ virtual void selectMenuItem();
+ virtual void openSubmenu();
+ virtual void closeMenu();
/*@}*/
/**
@@ -153,6 +158,7 @@
grab_x, grab_y;
unsigned int width, height, title_h, frame_h, item_w, item_h, bevel_w,
bevel_h;
+ int highlighted;
} menu;
};
diff -uNr fluxbox-0.1.13-orig/src/Keys.cc fluxbox-0.1.13/src/Keys.cc
--- fluxbox-0.1.13-orig/src/Keys.cc 2002-11-13 23:34:24.000000000 +0900
+++ fluxbox-0.1.13/src/Keys.cc 2002-11-20 14:11:11.000000000 +0900
@@ -122,6 +122,12 @@
{"ToggleDecor", TOGGLEDECOR},
{"ToggleTab", TOGGLETAB},
{"RootMenu", ROOTMENU},
+ {"WindowMenu", WINDOWMENU},
+ {"NextMenuItem", NEXTMENUITEM},
+ {"PrevMenuItem", PREVMENUITEM},
+ {"SelectMenuItem", SELECTMENUITEM},
+ {"OpenSubmenu", OPENSUBMENU},
+ {"CloseMenu", CLOSEMENU},
{0, LASTKEYGRAB}
};
diff -uNr fluxbox-0.1.13-orig/src/Keys.hh fluxbox-0.1.13/src/Keys.hh
--- fluxbox-0.1.13-orig/src/Keys.hh 2002-11-13 23:35:01.000000000 +0900
+++ fluxbox-0.1.13/src/Keys.hh 2002-11-20 14:11:11.000000000 +0900
@@ -59,6 +59,10 @@
TOGGLEDECOR,// toggle visibility of decor (title, frame, handles)
TOGGLETAB, // toggle visibilty of tab
ROOTMENU, // pop up rootmenu
+ WINDOWMENU, // pop up windowmenu
+ NEXTMENUITEM, PREVMENUITEM, // navigate to next/prev item
+ SELECTMENUITEM, // select current menu item
+ OPENSUBMENU, CLOSEMENU, // open/close (sub)menu
LASTKEYGRAB //mark end of keygrabbs
};
/**
diff -uNr fluxbox-0.1.13-orig/src/fluxbox.cc fluxbox-0.1.13/src/fluxbox.cc
--- fluxbox-0.1.13-orig/src/fluxbox.cc 2002-11-15 21:19:17.000000000 +0900
+++ fluxbox-0.1.13/src/fluxbox.cc 2002-11-20 14:11:48.000000000 +0900
@@ -1391,6 +1391,25 @@
}
}
break;
+ case Keys::NEXTMENUITEM:
+ case Keys::PREVMENUITEM:
+ case Keys::SELECTMENUITEM:
+ case Keys::OPENSUBMENU:
+ case Keys::CLOSEMENU:
+ {
+ Basemenu *target = 0;
+ std::map<Window, Basemenu *>::iterator it = menuSearch.begin();
+ std::map<Window, Basemenu *>::iterator it_end = menuSearch.end();
+ for (int i = 0; it != it_end; ++it, ++i) {
+ Basemenu *menu = it->second;
+ if (menu != target && menu->isVisible() && menu->currentSubmenu() < 0) {
+ target = menu;
+ }
+ }
+ if (target != 0)
+ doMenuAction(target, action);
+ }
+ break;
default: //try to see if its a window action
doWindowAction(action, key->getParam());
}
@@ -1404,6 +1423,27 @@
}
+void Fluxbox::doMenuAction(Basemenu *target, Keys::KeyAction action) {
+ switch (action) {
+ case Keys::NEXTMENUITEM:
+ target->highlightNextItem();
+ break;
+ case Keys::PREVMENUITEM:
+ target->highlightPrevItem();
+ break;
+ case Keys::SELECTMENUITEM:
+ target->selectMenuItem();
+ break;
+ case Keys::OPENSUBMENU:
+ target->openSubmenu();
+ break;
+ case Keys::CLOSEMENU:
+ target->closeMenu();
+ break;
+ default:
+ break;
+ }
+}
void Fluxbox::doWindowAction(Keys::KeyAction action, const int param) {
if (!focused_window)
return;
@@ -1551,6 +1591,26 @@
case Keys::TOGGLETAB:
focused_window->setTab(!focused_window->hasTab());
break;
+ case Keys::WINDOWMENU:
+ {
+ Windowmenu *menu = 0;
+
+ menu = focused_window->getWindowmenu();
+ if (menu) {
+ int x, y;
+ x = focused_window->getXFrame();
+ y = focused_window->getYFrame();
+ focused_window->showMenu(x, y);
+// menu->move(x, y);
+// if (! menu->isVisible()) {
+// menu->show();
+// XRaiseWindow(getXDisplay(), menu->windowID());
+// XRaiseWindow(getXDisplay(), menu->getSendToMenu()->windowID());
+// XRaiseWindow(getXDisplay(), menu->getSendGroupToMenu()->windowID());
+// }
+ }
+ }
+ break;
default: //do nothing
break;
}
diff -uNr fluxbox-0.1.13-orig/src/fluxbox.hh fluxbox-0.1.13/src/fluxbox.hh
--- fluxbox-0.1.13-orig/src/fluxbox.hh 2002-10-24 06:47:59.000000000 +0900
+++ fluxbox-0.1.13/src/fluxbox.hh 2002-11-20 14:11:11.000000000 +0900
@@ -221,6 +221,7 @@
void handleClientMessage(XClientMessageEvent &ce);
void handleKeyEvent(XKeyEvent &ke);
void doWindowAction(Keys::KeyAction action, const int param);
+ void doMenuAction(Basemenu *menu, Keys::KeyAction action);
ResourceManager m_resourcemanager, m_screen_rm;
|