From d2529ab85987ce69f8a45d6182a5c4a8ac2848c9 Mon Sep 17 00:00:00 2001 From: yggverse Date: Tue, 17 Sep 2024 21:34:04 +0300 Subject: [PATCH] fix event controller target --- src/app/browser/main/tab.cpp | 50 +++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 24 deletions(-) diff --git a/src/app/browser/main/tab.cpp b/src/app/browser/main/tab.cpp index 10f76e6..f36906c 100644 --- a/src/app/browser/main/tab.cpp +++ b/src/app/browser/main/tab.cpp @@ -31,31 +31,7 @@ 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 - { - tabLabel( - get_current_page() - )->pin(); - } - } - ); - signal_switch_page().connect( [this](Gtk::Widget*, guint) { @@ -223,6 +199,32 @@ int Tab::append( ); } + // Init page controller + const auto EVENT__BUTTON_PRIMARY = Gtk::GestureClick::create(); + + /* use defaults + EVENT__BUTTON_PRIMARY->set_button( + GDK_BUTTON_PRIMARY + );*/ + + TAB_LABEL->get_parent()->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 + { + tabLabel( + get_current_page() + )->pin(); + } + } + ); + + // Refresh window update( PAGE_NUMBER );