aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenrik Kinnunen <fluxgen@fluxbox.org>2008-05-13 13:50:17 (GMT)
committerHenrik Kinnunen <fluxgen@fluxbox.org>2008-05-13 15:06:26 (GMT)
commit5ecebae4770cbe7e4feea46d2c074a818f1c9662 (patch)
tree6ae650effda6528ebb5e40846a02dbe5a79e82d1
parentc31638038aabd93c74373c7ee00fbefbc68d28ae (diff)
downloadfluxbox_paul-5ecebae4770cbe7e4feea46d2c074a818f1c9662.zip
fluxbox_paul-5ecebae4770cbe7e4feea46d2c074a818f1c9662.tar.bz2
Fixed startup bug for window menu in iconbar.
The window menu in the iconbutton was not updated properly the first time it was used ( before right clicking in the real window titlebar).
-rw-r--r--src/IconbarTool.cc7
-rw-r--r--src/Window.cc22
-rw-r--r--src/Window.hh6
3 files changed, 21 insertions, 14 deletions
diff --git a/src/IconbarTool.cc b/src/IconbarTool.cc
index b2a57d0..b6e2900 100644
--- a/src/IconbarTool.cc
+++ b/src/IconbarTool.cc
@@ -214,16 +214,11 @@ class ShowMenu: public FbTk::Command<void> {
214public: 214public:
215 explicit ShowMenu(FluxboxWindow &win):m_win(win) { } 215 explicit ShowMenu(FluxboxWindow &win):m_win(win) { }
216 void execute() { 216 void execute() {
217 // hide the menu if it's already showing for this FluxboxWindow
218 if (m_win.menu().isVisible() && FbMenu::window() == &m_win) {
219 m_win.menu().hide();
220 return;
221 }
222 // get last button pos 217 // get last button pos
223 const XEvent &event = Fluxbox::instance()->lastEvent(); 218 const XEvent &event = Fluxbox::instance()->lastEvent();
224 int x = event.xbutton.x_root - (m_win.menu().width() / 2); 219 int x = event.xbutton.x_root - (m_win.menu().width() / 2);
225 int y = event.xbutton.y_root - (m_win.menu().height() / 2); 220 int y = event.xbutton.y_root - (m_win.menu().height() / 2);
226 m_win.showMenu(x, y); 221 m_win.popupMenu(x, y);
227 } 222 }
228private: 223private:
229 FluxboxWindow &m_win; 224 FluxboxWindow &m_win;
diff --git a/src/Window.cc b/src/Window.cc
index c16d366..3b5e917 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -2172,25 +2172,31 @@ void FluxboxWindow::showMenu(int menu_x, int menu_y) {
2172 menu().grabInputFocus(); 2172 menu().grabInputFocus();
2173} 2173}
2174 2174
2175void FluxboxWindow::popupMenu(int x, int y) {
2176 // hide menu if it was opened for this window before
2177 if (menu().isVisible() && FbMenu::window() == this) {
2178 menu().hide();
2179 return;
2180 }
2181
2182 menu().disableTitle();
2183
2184 showMenu(x, y);
2185}
2186
2175/** 2187/**
2176 Moves the menu to last button press position and shows it, 2188 Moves the menu to last button press position and shows it,
2177 if it's already visible it'll be hidden 2189 if it's already visible it'll be hidden
2178 */ 2190 */
2179void FluxboxWindow::popupMenu() { 2191void FluxboxWindow::popupMenu() {
2180 2192
2181 // hide menu if it was opened for this window before
2182 if (menu().isVisible() && FbMenu::window() == this) {
2183 menu().hide();
2184 return;
2185 }
2186
2187 menu().disableTitle();
2188 int menu_y = frame().titlebar().height() + frame().titlebar().borderWidth(); 2193 int menu_y = frame().titlebar().height() + frame().titlebar().borderWidth();
2189 if (!decorations.titlebar) // if we don't have any titlebar 2194 if (!decorations.titlebar) // if we don't have any titlebar
2190 menu_y = 0; 2195 menu_y = 0;
2191 if (m_last_button_x < x() || m_last_button_x > x() + static_cast<signed>(width())) 2196 if (m_last_button_x < x() || m_last_button_x > x() + static_cast<signed>(width()))
2192 m_last_button_x = x(); 2197 m_last_button_x = x();
2193 showMenu(m_last_button_x, menu_y + frame().y()); 2198
2199 popupMenu(m_last_button_x, menu_y + frame().y());
2194} 2200}
2195 2201
2196 2202
diff --git a/src/Window.hh b/src/Window.hh
index de5bfe4..c05f525 100644
--- a/src/Window.hh
+++ b/src/Window.hh
@@ -323,6 +323,12 @@ public:
323 * @param my position 323 * @param my position
324 */ 324 */
325 void showMenu(int mx, int my); 325 void showMenu(int mx, int my);
326
327 /** popup window menu at specific location
328 * @param x
329 * @param y
330 */
331 void popupMenu(int x, int y);
326 // popup menu on last button press position 332 // popup menu on last button press position
327 void popupMenu(); 333 void popupMenu();
328 334