summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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