Browse Source

fix event controller target

CPP-GTK4
yggverse 2 months ago
parent
commit
d2529ab859
  1. 50
      src/app/browser/main/tab.cpp

50
src/app/browser/main/tab.cpp

@ -31,31 +31,7 @@ Tab::Tab( @@ -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( @@ -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
);

Loading…
Cancel
Save