13
0

Implement group-tab sensitivity

This commit is contained in:
Robin Gareus 2021-03-28 17:43:17 +02:00
parent bfc72ac379
commit 88ed770bce
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -98,6 +98,10 @@ GroupTabs::on_button_press_event (GdkEventButton* ev)
{
using namespace Menu_Helpers;
if (!get_sensitive ()) {
return true;
}
double const p = primary_coordinate (ev->x, ev->y);
list<Tab>::iterator prev;
@ -253,18 +257,28 @@ void
GroupTabs::render (Cairo::RefPtr<Cairo::Context> const& ctx, cairo_rectangle_t*)
{
cairo_t* cr = ctx->cobj();
if (_dragging == 0) {
_tabs = compute_tabs ();
Gdk::Color c;
if (!get_sensitive ()) {
c = get_style()->get_base (Gtk::STATE_INSENSITIVE);
} else {
c = get_style()->get_base (Gtk::STATE_NORMAL);
}
/* background */
Gdk::Color c = get_style()->get_base (Gtk::STATE_NORMAL);
cairo_set_source_rgb (cr, c.get_red_p(), c.get_green_p(), c.get_blue_p());
cairo_rectangle (cr, 0, 0, get_width(), get_height());
cairo_fill (cr);
if (!get_sensitive ()) {
return;
}
if (_dragging == 0) {
_tabs = compute_tabs ();
}
/* tabs */
for (list<Tab>::const_iterator i = _tabs.begin(); i != _tabs.end(); ++i) {
@ -272,7 +286,6 @@ GroupTabs::render (Cairo::RefPtr<Cairo::Context> const& ctx, cairo_rectangle_t*)
}
}
/** Convert a click position to a tab.
* @param c Click position.
* @param prev Filled in with the previous tab to the click, or _tabs.end().