aboutsummaryrefslogtreecommitdiff
path: root/src/ui.cc
diff options
context:
space:
mode:
authorjcid <devnull@localhost>2008-05-21 19:06:17 +0200
committerjcid <devnull@localhost>2008-05-21 19:06:17 +0200
commitd5548b1511b131d6a56f24957e5d9c0a1e4e2faf (patch)
treebb411ab16057aebb3eeeba642adb8b21c1c20442 /src/ui.cc
parentd0125908f86d8f6c39850acbbd68c95091c08faa (diff)
- Set key bindings to its modifiers when alone only.
Diffstat (limited to 'src/ui.cc')
-rw-r--r--src/ui.cc16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/ui.cc b/src/ui.cc
index 3f855fd6..b63319a1 100644
--- a/src/ui.cc
+++ b/src/ui.cc
@@ -694,14 +694,18 @@ UI::UI(int win_w, int win_h, const char* label, const UI *cur_ui) :
//show();
}
+
/*
* FLTK event handler for this window.
*/
int UI::handle(int event)
{
+ _MSG("UI::handle event=%d\n", event);
int ret = 0, k = event_key();
- _MSG("UI::handle event=%d\n", event);
+ // We're only interested in some flags
+ // (not whether numlock is on for example)
+ unsigned modifier = event_state() & (SHIFT | CTRL | ALT | META);
// Let FLTK pass these events to child widgets.
if (event == KEY) {
@@ -714,7 +718,7 @@ int UI::handle(int event)
} else if (event == SHORTCUT) {
// Handle these shortcuts here.
- if (event_state(CTRL)) {
+ if (modifier == CTRL) {
if (k == 'b') {
a_UIcmd_book(user_data());
ret = 1;
@@ -748,16 +752,18 @@ int UI::handle(int event)
}
}
- if (event_key_state(LeftAltKey) && k == 'q') {
+ if (event_key_state(LeftAltKey) && modifier == ALT && k == 'q') {
a_UIcmd_close_all_bw();
ret = 1;
}
// Back and Forward navigation shortcuts
- if ((!event_state(SHIFT) && k == BackSpaceKey) || k == ',') {
+ if ((modifier == 0 && k == BackSpaceKey) ||
+ (modifier == 0 && k == ',')) {
a_UIcmd_back(user_data());
ret = 1;
- } else if ((event_state(SHIFT) && k == BackSpaceKey) || k == '.') {
+ } else if ((modifier == SHIFT && k == BackSpaceKey) ||
+ (modifier == 0 &&k == '.')) {
a_UIcmd_forw(user_data());
ret = 1;
}