summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGravatar waker <wakeroid@gmail.com>2013-01-12 19:54:34 +0100
committerGravatar waker <wakeroid@gmail.com>2013-01-12 19:54:34 +0100
commitd607cadc62ed40d5d9d891abcc2e4f5d631f1e5f (patch)
tree0aedd41994e2edd54b8a7c80994e1844f0b265b3 /plugins
parentfff290008796d9149a2ed3dc6852a50bff055da7 (diff)
limit max tab width
Diffstat (limited to 'plugins')
-rw-r--r--plugins/gtkui/ddbtabstrip.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/plugins/gtkui/ddbtabstrip.c b/plugins/gtkui/ddbtabstrip.c
index 2c62e0e9..2ec549da 100644
--- a/plugins/gtkui/ddbtabstrip.c
+++ b/plugins/gtkui/ddbtabstrip.c
@@ -340,6 +340,7 @@ static int text_vert_offset = -2;
static int tab_overlap_size = 0; // widget_height/2
static int tabs_left_margin = 4;
static int min_tab_size = 80;
+static int max_tab_size = 200;
static int tab_moved = 0;
@@ -484,6 +485,9 @@ ddb_tabstrip_get_tab_width (DdbTabStrip *ts, int tab) {
if (width < min_tab_size) {
width = min_tab_size;
}
+ else if (width > max_tab_size) {
+ width = max_tab_size;
+ }
return width;
}
@@ -674,6 +678,9 @@ tabstrip_render (DdbTabStrip *ts, cairo_t *cr) {
if (widths[idx] < min_tab_size) {
widths[idx] = min_tab_size;
}
+ else if (widths[idx] > max_tab_size) {
+ widths[idx] = max_tab_size;
+ }
}
x = -hscroll + tabs_left_margin;
@@ -695,7 +702,7 @@ tabstrip_render (DdbTabStrip *ts, cairo_t *cr) {
plt_get_title_wrapper (idx, tab_title, sizeof (tab_title));
set_tab_text_color (ts, idx, tab_selected);
- draw_text (&ts->drawctx, x + text_left_padding, y - text_vert_offset, w, 0, tab_title);
+ draw_text (&ts->drawctx, x + text_left_padding, y - text_vert_offset, w - (text_left_padding + text_right_padding), 0, tab_title);
}
x += w - tab_overlap_size;
}
@@ -737,7 +744,7 @@ tabstrip_render (DdbTabStrip *ts, cairo_t *cr) {
char tab_title[100];
plt_get_title_wrapper (idx, tab_title, sizeof (tab_title));
set_tab_text_color (ts, idx, tab_selected);
- draw_text (&ts->drawctx, x + text_left_padding, y - text_vert_offset, w, 0, tab_title);
+ draw_text (&ts->drawctx, x + text_left_padding, y - text_vert_offset, w - (text_left_padding + text_right_padding), 0, tab_title);
}
else {
need_draw_moving = 1;
@@ -760,7 +767,7 @@ tabstrip_render (DdbTabStrip *ts, cairo_t *cr) {
char tab_title[100];
plt_get_title_wrapper (idx, tab_title, sizeof (tab_title));
set_tab_text_color (ts, idx, tab_selected);
- draw_text (&ts->drawctx, x + text_left_padding, y - text_vert_offset, w, 0, tab_title);
+ draw_text (&ts->drawctx, x + text_left_padding, y - text_vert_offset, w - (text_left_padding + text_right_padding), 0, tab_title);
}
break;
}
@@ -824,6 +831,9 @@ get_tab_under_cursor (DdbTabStrip *ts, int x) {
if (w < min_tab_size) {
w = min_tab_size;
}
+ else if (w > max_tab_size) {
+ w = max_tab_size;
+ }
fw += w;
fw -= tab_overlap_size;
if (fw > x) {