aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk
diff options
context:
space:
mode:
authorMark Tiefenbruck <mark@fluxbox.org>2007-12-18 05:44:17 (GMT)
committerMark Tiefenbruck <mark@fluxbox.org>2007-12-18 05:44:17 (GMT)
commitc01bd6e9fd98dd0f70ffc1d01df86e73719cd5e0 (patch)
tree7e25c017727402a33fd8e4c851b5bab9e6add568 /src/FbTk
parent31df2d8bd618cae590d9b0e76aee11021d4c77d3 (diff)
downloadfluxbox-c01bd6e9fd98dd0f70ffc1d01df86e73719cd5e0.zip
fluxbox-c01bd6e9fd98dd0f70ffc1d01df86e73719cd5e0.tar.bz2
holding control will now keep the menu open
Diffstat (limited to 'src/FbTk')
-rw-r--r--src/FbTk/Menu.cc4
-rw-r--r--src/FbTk/MenuItem.cc5
-rw-r--r--src/FbTk/MenuItem.hh2
-rw-r--r--src/FbTk/MultiButtonMenuItem.cc2
-rw-r--r--src/FbTk/MultiButtonMenuItem.hh2
5 files changed, 8 insertions, 7 deletions
diff --git a/src/FbTk/Menu.cc b/src/FbTk/Menu.cc
index 3be0d14..bb51d92 100644
--- a/src/FbTk/Menu.cc
+++ b/src/FbTk/Menu.cc
@@ -888,7 +888,7 @@ void Menu::buttonReleaseEvent(XButtonEvent &re) {
888 if (m_active_index == w && isItemEnabled(w) && 888 if (m_active_index == w && isItemEnabled(w) &&
889 re.x > ix && re.x < (signed) (ix + menu.item_w) && 889 re.x > ix && re.x < (signed) (ix + menu.item_w) &&
890 re.y > iy && re.y < (signed) (iy + theme().itemHeight())) { 890 re.y > iy && re.y < (signed) (iy + theme().itemHeight())) {
891 menuitems[w]->click(re.button, re.time); 891 menuitems[w]->click(re.button, re.time, re.state);
892 } else { 892 } else {
893 int old = m_active_index; 893 int old = m_active_index;
894 m_active_index = w; 894 m_active_index = w;
@@ -1054,7 +1054,7 @@ void Menu::keyPressEvent(XKeyEvent &event) {
1054 else { 1054 else {
1055 // send fake button click 1055 // send fake button click
1056 int button = (event.state & ShiftMask) ? 3 : 1; 1056 int button = (event.state & ShiftMask) ? 3 : 1;
1057 find(m_active_index)->click(button, event.time); 1057 find(m_active_index)->click(button, event.time, event.state);
1058 m_need_update = true; 1058 m_need_update = true;
1059 updateMenu(); 1059 updateMenu();
1060 } 1060 }
diff --git a/src/FbTk/MenuItem.cc b/src/FbTk/MenuItem.cc
index 7d309f4..1e708d3 100644
--- a/src/FbTk/MenuItem.cc
+++ b/src/FbTk/MenuItem.cc
@@ -30,12 +30,13 @@
30#include "App.hh" 30#include "App.hh"
31#include "StringUtil.hh" 31#include "StringUtil.hh"
32#include "Menu.hh" 32#include "Menu.hh"
33#include <X11/keysym.h>
33 34
34namespace FbTk { 35namespace FbTk {
35 36
36void MenuItem::click(int button, int time) { 37void MenuItem::click(int button, int time, unsigned int mods) {
37 if (m_command.get() != 0) { 38 if (m_command.get() != 0) {
38 if (m_menu && m_close_on_click) 39 if (m_menu && m_close_on_click && (mods & ControlMask) == 0)
39 m_menu->hide(); 40 m_menu->hide();
40 // we need a local variable, since the command may destroy this object 41 // we need a local variable, since the command may destroy this object
41 RefCount<Command> tmp(m_command); 42 RefCount<Command> tmp(m_command);
diff --git a/src/FbTk/MenuItem.hh b/src/FbTk/MenuItem.hh
index 3b02f2e..b6777b7 100644
--- a/src/FbTk/MenuItem.hh
+++ b/src/FbTk/MenuItem.hh
@@ -138,7 +138,7 @@ public:
138 @param button the button number 138 @param button the button number
139 @param time the time stamp 139 @param time the time stamp
140 */ 140 */
141 virtual void click(int button, int time); 141 virtual void click(int button, int time, unsigned int mods);
142 /// must use this to show submenu to ensure consistency for object like window menu in ClientMenu (see Workspace.cc) 142 /// must use this to show submenu to ensure consistency for object like window menu in ClientMenu (see Workspace.cc)
143 virtual void showSubmenu(); 143 virtual void showSubmenu();
144 RefCount<Command> &command() { return m_command; } 144 RefCount<Command> &command() { return m_command; }
diff --git a/src/FbTk/MultiButtonMenuItem.cc b/src/FbTk/MultiButtonMenuItem.cc
index b3fa1aa..591c13d 100644
--- a/src/FbTk/MultiButtonMenuItem.cc
+++ b/src/FbTk/MultiButtonMenuItem.cc
@@ -52,7 +52,7 @@ void MultiButtonMenuItem::setCommand(int button, FbTk::RefCount<FbTk::Command> &
52 m_button_exe[button - 1] = cmd; 52 m_button_exe[button - 1] = cmd;
53} 53}
54 54
55void MultiButtonMenuItem::click(int button, int time) { 55void MultiButtonMenuItem::click(int button, int time, unsigned int mods) {
56 if (button <= 0 || button > static_cast<signed>(buttons()) || buttons() == 0) 56 if (button <= 0 || button > static_cast<signed>(buttons()) || buttons() == 0)
57 return; 57 return;
58 58
diff --git a/src/FbTk/MultiButtonMenuItem.hh b/src/FbTk/MultiButtonMenuItem.hh
index 3e82d67..4bc1276 100644
--- a/src/FbTk/MultiButtonMenuItem.hh
+++ b/src/FbTk/MultiButtonMenuItem.hh
@@ -38,7 +38,7 @@ public:
38 /// sets command to specified button 38 /// sets command to specified button
39 void setCommand(int button, FbTk::RefCount<FbTk::Command> &cmd); 39 void setCommand(int button, FbTk::RefCount<FbTk::Command> &cmd);
40 /// executes command for the button click 40 /// executes command for the button click
41 virtual void click(int button, int time); 41 virtual void click(int button, int time, unsigned int mods);
42 /// @return number of buttons this instance handles 42 /// @return number of buttons this instance handles
43 inline unsigned int buttons() const { return m_buttons; } 43 inline unsigned int buttons() const { return m_buttons; }
44 44