summaryrefslogtreecommitdiff
path: root/src/abaddon.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/abaddon.cpp')
-rw-r--r--src/abaddon.cpp20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/abaddon.cpp b/src/abaddon.cpp
index ec567e7..630e584 100644
--- a/src/abaddon.cpp
+++ b/src/abaddon.cpp
@@ -68,14 +68,13 @@ Abaddon &Abaddon::Get() {
return instance;
}
-#ifdef WITH_LIBHANDY
- #ifdef _WIN32
+#ifdef _WIN32
constexpr static guint BUTTON_BACK = 4;
constexpr static guint BUTTON_FORWARD = 5;
- #else
+#else
constexpr static guint BUTTON_BACK = 8;
constexpr static guint BUTTON_FORWARD = 9;
- #endif
+#endif
static bool HandleButtonEvents(GdkEvent *event, MainWindow *main_window) {
if (event->type != GDK_BUTTON_PRESS) return false;
@@ -85,6 +84,7 @@ static bool HandleButtonEvents(GdkEvent *event, MainWindow *main_window) {
auto *window = gtk_widget_get_toplevel(widget);
if (static_cast<void *>(window) != static_cast<void *>(main_window->gobj())) return false; // is this the right way???
+#ifdef WITH_LIBHANDY
switch (event->button.button) {
case BUTTON_BACK:
main_window->GoBack();
@@ -93,6 +93,7 @@ static bool HandleButtonEvents(GdkEvent *event, MainWindow *main_window) {
main_window->GoForward();
break;
}
+#endif
return false;
}
@@ -108,6 +109,15 @@ static bool HandleKeyEvents(GdkEvent *event, MainWindow *main_window) {
const bool ctrl = (event->key.state & GDK_CONTROL_MASK) == GDK_CONTROL_MASK;
const bool shft = (event->key.state & GDK_SHIFT_MASK) == GDK_SHIFT_MASK;
+ constexpr static guint EXCLUDE_STATES = GDK_CONTROL_MASK | GDK_SHIFT_MASK;
+
+ if (!(event->key.state & EXCLUDE_STATES) && event->key.keyval == GDK_KEY_Alt_L) {
+ if (Abaddon::Get().GetSettings().AltMenu) {
+ main_window->ToggleMenuVisibility();
+ }
+ }
+
+#ifdef WITH_LIBHANDY
if (ctrl) {
switch (event->key.keyval) {
case GDK_KEY_Tab:
@@ -134,6 +144,7 @@ static bool HandleKeyEvents(GdkEvent *event, MainWindow *main_window) {
return true;
}
}
+#endif
return false;
}
@@ -143,7 +154,6 @@ static void MainEventHandler(GdkEvent *event, void *main_window) {
if (HandleKeyEvents(event, static_cast<MainWindow *>(main_window))) return;
gtk_main_do_event(event);
}
-#endif
int Abaddon::StartGTK() {
m_gtk_app = Gtk::Application::create("com.github.uowuo.abaddon");