summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Applications/FileManager/main.cpp2
-rw-r--r--Applications/ProcessManager/main.cpp2
-rw-r--r--Applications/Terminal/main.cpp2
-rw-r--r--Kernel/KeyboardDevice.cpp28
-rw-r--r--LibGUI/GAction.cpp6
-rw-r--r--LibGUI/GAction.h5
6 files changed, 35 insertions, 10 deletions
diff --git a/Applications/FileManager/main.cpp b/Applications/FileManager/main.cpp
index 3e166b0661..a3a9eafed3 100644
--- a/Applications/FileManager/main.cpp
+++ b/Applications/FileManager/main.cpp
@@ -64,7 +64,7 @@ int main(int argc, char** argv)
auto menubar = make<GMenuBar>();
auto app_menu = make<GMenu>("FileManager");
- app_menu->add_action(GAction::create("Quit", String(), [] (const GAction&) {
+ app_menu->add_action(GAction::create("Quit", { Mod_Alt, Key_F4 }, [] (const GAction&) {
GApplication::the().quit(0);
return;
}));
diff --git a/Applications/ProcessManager/main.cpp b/Applications/ProcessManager/main.cpp
index c2d6c15df4..390af60790 100644
--- a/Applications/ProcessManager/main.cpp
+++ b/Applications/ProcessManager/main.cpp
@@ -50,7 +50,7 @@ int main(int argc, char** argv)
auto menubar = make<GMenuBar>();
auto app_menu = make<GMenu>("ProcessManager");
- app_menu->add_action(GAction::create("Quit", String(), [] (const GAction&) {
+ app_menu->add_action(GAction::create("Quit", { Mod_Alt, Key_F4 }, [] (const GAction&) {
GApplication::the().quit(0);
return;
}));
diff --git a/Applications/Terminal/main.cpp b/Applications/Terminal/main.cpp
index 5d77272c1e..6bb0482efd 100644
--- a/Applications/Terminal/main.cpp
+++ b/Applications/Terminal/main.cpp
@@ -100,7 +100,7 @@ int main(int argc, char** argv)
auto menubar = make<GMenuBar>();
auto app_menu = make<GMenu>("Terminal");
- app_menu->add_action(GAction::create("Quit", String(), [] (const GAction&) {
+ app_menu->add_action(GAction::create("Quit", { Mod_Alt, Key_F4 }, [] (const GAction&) {
dbgprintf("Terminal: Quit menu activated!\n");
GApplication::the().quit(0);
return;
diff --git a/Kernel/KeyboardDevice.cpp b/Kernel/KeyboardDevice.cpp
index 7cdaf3f6d9..8bbc8c76a1 100644
--- a/Kernel/KeyboardDevice.cpp
+++ b/Kernel/KeyboardDevice.cpp
@@ -50,9 +50,9 @@ static KeyCode unshifted_key_map[0x80] =
Key_Alt, // 54
Key_Invalid, Key_Invalid,
Key_Space, // 57
- Key_Invalid, Key_Invalid,
- Key_Invalid, // 60
- Key_Invalid, Key_Invalid, Key_Invalid, Key_Invalid, Key_Invalid, Key_Invalid, Key_Invalid, Key_Invalid, Key_Invalid,
+ Key_Invalid, // 58
+ Key_F1, Key_F2, Key_F3, Key_F4, Key_F5, Key_F6, Key_F7, Key_F8, Key_F9, Key_F10,
+ Key_Invalid,
Key_Invalid, // 70
Key_Invalid,
Key_Up,
@@ -65,6 +65,13 @@ static KeyCode unshifted_key_map[0x80] =
Key_Invalid,
Key_Down, // 80
Key_PageDown,
+ Key_Invalid,
+ Key_Invalid,
+ Key_Invalid,
+ Key_Invalid,
+ Key_Invalid,
+ Key_F11,
+ Key_F12,
};
static KeyCode shifted_key_map[0x100] =
@@ -81,10 +88,10 @@ static KeyCode shifted_key_map[0x100] =
Key_Z, Key_X, Key_C, Key_V, Key_B, Key_N, Key_M, Key_LessThan, Key_GreaterThan, Key_QuestionMark,
Key_Alt,
Key_Invalid, Key_Invalid,
- Key_Space,
- Key_Invalid, Key_Invalid,
- Key_Invalid, // 60
- Key_Invalid, Key_Invalid, Key_Invalid, Key_Invalid, Key_Invalid, Key_Invalid, Key_Invalid, Key_Invalid, Key_Invalid,
+ Key_Space, // 57
+ Key_Invalid, // 58
+ Key_F1, Key_F2, Key_F3, Key_F4, Key_F5, Key_F6, Key_F7, Key_F8, Key_F9, Key_F10,
+ Key_Invalid,
Key_Invalid, // 70
Key_Invalid,
Key_Up,
@@ -97,6 +104,13 @@ static KeyCode shifted_key_map[0x100] =
Key_Invalid,
Key_Down, // 80
Key_PageDown,
+ Key_Invalid,
+ Key_Invalid,
+ Key_Invalid,
+ Key_Invalid,
+ Key_Invalid,
+ Key_F11,
+ Key_F12,
};
void KeyboardDevice::key_state_changed(byte raw, bool pressed)
diff --git a/LibGUI/GAction.cpp b/LibGUI/GAction.cpp
index 27321c2ff4..770c5ebc5d 100644
--- a/LibGUI/GAction.cpp
+++ b/LibGUI/GAction.cpp
@@ -20,6 +20,12 @@ GAction::GAction(const String& text, RetainPtr<GraphicsBitmap>&& icon, Function<
{
}
+GAction::GAction(const String& text, const GShortcut& shortcut, Function<void(const GAction&)> on_activation_callback)
+ : GAction(text, shortcut, nullptr, move(on_activation_callback))
+{
+}
+
+
GAction::GAction(const String& text, const GShortcut& shortcut, RetainPtr<GraphicsBitmap>&& icon, Function<void(const GAction&)> on_activation_callback)
: on_activation(move(on_activation_callback))
, m_text(text)
diff --git a/LibGUI/GAction.h b/LibGUI/GAction.h
index 959995d38b..f85cda11f0 100644
--- a/LibGUI/GAction.h
+++ b/LibGUI/GAction.h
@@ -21,6 +21,10 @@ public:
{
return adopt(*new GAction(text, move(icon), move(callback)));
}
+ static Retained<GAction> create(const String& text, const GShortcut& shortcut, Function<void(const GAction&)> callback)
+ {
+ return adopt(*new GAction(text, shortcut, move(callback)));
+ }
static Retained<GAction> create(const String& text, const GShortcut& shortcut, RetainPtr<GraphicsBitmap>&& icon, Function<void(const GAction&)> callback)
{
return adopt(*new GAction(text, shortcut, move(icon), move(callback)));
@@ -38,6 +42,7 @@ public:
private:
GAction(const String& text, Function<void(const GAction&)> = nullptr);
+ GAction(const String& text, const GShortcut&, Function<void(const GAction&)> = nullptr);
GAction(const String& text, const GShortcut&, RetainPtr<GraphicsBitmap>&& icon, Function<void(const GAction&)> = nullptr);
GAction(const String& text, RetainPtr<GraphicsBitmap>&& icon, Function<void(const GAction&)> = nullptr);
GAction(const String& text, const String& custom_data = String(), Function<void(const GAction&)> = nullptr);