summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--src/Window.cc31
-rw-r--r--src/Window.hh2
3 files changed, 32 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 5958735..1400ad2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,9 @@
1 (Format: Year/Month/Day) 1 (Format: Year/Month/Day)
2Changes for 1.0.0: 2Changes for 1.0.0:
3*07/03/31: 3*07/03/31:
4 * Fix window menu context when opened by clicking on tab (Simon)
5 sf.net bug #1652185
6 Window.hh/cc
4 * Default value for $LAUNCHER, plus add util and util/fbrun to the 7 * Default value for $LAUNCHER, plus add util and util/fbrun to the
5 PATH when generating install menu so it can find fbrun (Simon) 8 PATH when generating install menu so it can find fbrun (Simon)
6 fluxbox-generate_menu.in Makefile.am data/Makefile.am 9 fluxbox-generate_menu.in Makefile.am data/Makefile.am
diff --git a/src/Window.cc b/src/Window.cc
index 079126b..ebc5923 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -2188,7 +2188,7 @@ void FluxboxWindow::restoreAttributes() {
2188/** 2188/**
2189 Show the window menu at pos mx, my 2189 Show the window menu at pos mx, my
2190*/ 2190*/
2191void FluxboxWindow::showMenu(int menu_x, int menu_y) { 2191void FluxboxWindow::showMenu(int menu_x, int menu_y, WinClient *client) {
2192 // move menu directly under titlebar 2192 // move menu directly under titlebar
2193 2193
2194 int head = screen().getHead(menu_x, menu_y); 2194 int head = screen().getHead(menu_x, menu_y);
@@ -2204,7 +2204,11 @@ void FluxboxWindow::showMenu(int menu_x, int menu_y) {
2204 else if (menu_x + static_cast<signed>(menu().width()) >= static_cast<signed>(screen().maxRight(head))) 2204 else if (menu_x + static_cast<signed>(menu().width()) >= static_cast<signed>(screen().maxRight(head)))
2205 menu_x = screen().maxRight(head) - menu().width() - 1; 2205 menu_x = screen().maxRight(head) - menu().width() - 1;
2206 2206
2207 WindowCmd<void>::setWindow(this); 2207 if (client && (client->fbwindow() == this))
2208 WindowCmd<void>::setClient(client);
2209 else
2210 WindowCmd<void>::setWindow(this);
2211
2208 menu().move(menu_x, menu_y); 2212 menu().move(menu_x, menu_y);
2209 menu().show(); 2213 menu().show();
2210 menu().raise(); 2214 menu().raise();
@@ -2223,13 +2227,34 @@ void FluxboxWindow::popupMenu() {
2223 return; 2227 return;
2224 } 2228 }
2225 2229
2230 /* Check if we're on a tab, we should make the menu for that tab */
2231 WinClient *client = 0;
2232 Window labelbutton = 0;
2233 int dest_x = 0, dest_y = 0;
2234 if (XTranslateCoordinates(FbTk::App::instance()->display(),
2235 parent().window(), frame().tabcontainer().window(),
2236 m_last_button_x, m_last_button_y, &dest_x, &dest_y,
2237 &labelbutton)) {
2238
2239 Client2ButtonMap::iterator it =
2240 find_if(m_labelbuttons.begin(),
2241 m_labelbuttons.end(),
2242 Compose(bind2nd(equal_to<Window>(), labelbutton),
2243 Compose(mem_fun(&TextButton::window),
2244 Select2nd<Client2ButtonMap::value_type>())));
2245
2246 // label button not found
2247 if (it != m_labelbuttons.end())
2248 client = it->first;
2249 }
2250
2226 menu().disableTitle(); 2251 menu().disableTitle();
2227 int menu_y = frame().titlebar().height() + frame().titlebar().borderWidth(); 2252 int menu_y = frame().titlebar().height() + frame().titlebar().borderWidth();
2228 if (!decorations.titlebar) // if we don't have any titlebar 2253 if (!decorations.titlebar) // if we don't have any titlebar
2229 menu_y = 0; 2254 menu_y = 0;
2230 if (m_last_button_x < x() || m_last_button_x > x() + static_cast<signed>(width())) 2255 if (m_last_button_x < x() || m_last_button_x > x() + static_cast<signed>(width()))
2231 m_last_button_x = x(); 2256 m_last_button_x = x();
2232 showMenu(m_last_button_x, menu_y + frame().y()); 2257 showMenu(m_last_button_x, menu_y + frame().y(), client);
2233} 2258}
2234 2259
2235 2260
diff --git a/src/Window.hh b/src/Window.hh
index 3206fdd..82cd492 100644
--- a/src/Window.hh
+++ b/src/Window.hh
@@ -266,7 +266,7 @@ public:
266 void changeBlackboxHints(const BlackboxHints &bh); 266 void changeBlackboxHints(const BlackboxHints &bh);
267 void updateFunctions(); 267 void updateFunctions();
268 void restoreAttributes(); 268 void restoreAttributes();
269 void showMenu(int mx, int my); 269 void showMenu(int mx, int my, WinClient *client = 0);
270 // popup menu on last button press position 270 // popup menu on last button press position
271 void popupMenu(); 271 void popupMenu();
272 272