From e24667785a10527bb084e71d48ab3b6785b16f54 Mon Sep 17 00:00:00 2001 From: yggverse Date: Tue, 17 Sep 2024 19:29:06 +0300 Subject: [PATCH] use entire tab area to change pin status --- src/app/browser/main/tab.cpp | 25 ++++++++++++++ src/app/browser/main/tab.hpp | 1 + src/app/browser/main/tab/label.cpp | 53 ------------------------------ src/app/browser/main/tab/label.hpp | 1 - 4 files changed, 26 insertions(+), 54 deletions(-) diff --git a/src/app/browser/main/tab.cpp b/src/app/browser/main/tab.cpp index a5e54d97..21c9268a 100644 --- a/src/app/browser/main/tab.cpp +++ b/src/app/browser/main/tab.cpp @@ -31,6 +31,31 @@ Tab::Tab( SCROLLABLE ); + // Init additional controllers + const auto EVENT__BUTTON_PRIMARY = Gtk::GestureClick::create(); + + /* use defaults + EVENT__BUTTON_PRIMARY->set_button( + GDK_BUTTON_PRIMARY + );*/ + + add_controller( + EVENT__BUTTON_PRIMARY + ); + + // Init events + EVENT__BUTTON_PRIMARY->signal_pressed().connect( + [this](int n, double x, double y) + { + if (n == 2) // double click + { + get_tabLabel( + get_current_page() + )->pin(); + } + } + ); + signal_switch_page().connect( [this](Gtk::Widget*, guint) { diff --git a/src/app/browser/main/tab.hpp b/src/app/browser/main/tab.hpp index ad2b8b68..a103e59c 100644 --- a/src/app/browser/main/tab.hpp +++ b/src/app/browser/main/tab.hpp @@ -5,6 +5,7 @@ #include #include #include +#include #include #include diff --git a/src/app/browser/main/tab/label.cpp b/src/app/browser/main/tab/label.cpp index 423eca4d..c38e4fc5 100644 --- a/src/app/browser/main/tab/label.cpp +++ b/src/app/browser/main/tab/label.cpp @@ -48,59 +48,6 @@ Label::Label( append( * labelTitle ); - - // Init primary button controller - const auto EVENT__BUTTON_PRIMARY = Gtk::GestureClick::create(); - - EVENT__BUTTON_PRIMARY->set_button( - GDK_BUTTON_PRIMARY - ); - - add_controller( - EVENT__BUTTON_PRIMARY - ); - - // Connect events - EVENT__BUTTON_PRIMARY->signal_pressed().connect( - [this](int n, double x, double y) - { - if (n == 2) // double click - { - update( - !is_pinned // toggle - ); - } - } - ); - - // Init middle button controller - const auto EVENT__BUTTON_MIDDLE = Gtk::GestureClick::create(); - - EVENT__BUTTON_MIDDLE->set_button( - GDK_BUTTON_MIDDLE - ); - - add_controller( - EVENT__BUTTON_MIDDLE - ); - - // Connect events - EVENT__BUTTON_MIDDLE->signal_pressed().connect( - [this](int n, double x, double y) - { - // @TODO activate tab - } - ); - - EVENT__BUTTON_MIDDLE->signal_released().connect( - [this](int n, double x, double y) - { - if (!is_pinned) - { - // @TODO action__tab_close->activate(); - } - } - ); } // Actions diff --git a/src/app/browser/main/tab/label.hpp b/src/app/browser/main/tab/label.hpp index 69c72192..51eb8f9a 100644 --- a/src/app/browser/main/tab/label.hpp +++ b/src/app/browser/main/tab/label.hpp @@ -7,7 +7,6 @@ #include #include #include -#include #include namespace app::browser::main::tab