summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/api/Makefile7
-rw-r--r--doc/dwb.122
-rw-r--r--doc/dwb.1.txt10
-rw-r--r--m4/settings.m42
-rw-r--r--src/commands.c4
-rw-r--r--src/config.h4
-rw-r--r--src/dwb.c103
-rw-r--r--src/dwb.h17
-rw-r--r--src/scripts.c2
-rw-r--r--src/view.c18
10 files changed, 151 insertions, 38 deletions
diff --git a/doc/api/Makefile b/doc/api/Makefile
index f5fa65b2..b3765cf8 100644
--- a/doc/api/Makefile
+++ b/doc/api/Makefile
@@ -6,17 +6,10 @@ include $(BASEDIR)/config.mk
all: web man webman
-web: jsapi.html
-
-latex: jsapi.tex
-
man: dwb-js.7
webman: jsapi.7.html
-jsapi.html: jsapi.txt
- asciidoc -b html5 -a toc2 $<
-
jsapi.7.html: jsapi.7.txt
asciidoc -b html5 -a toc2 $<
diff --git a/doc/dwb.1 b/doc/dwb.1
index d9b6873e..e3660c0c 100644
--- a/doc/dwb.1
+++ b/doc/dwb.1
@@ -2,12 +2,12 @@
.\" Title: dwb
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.78.0 <http://docbook.sf.net/>
-.\" Date: 04/10/2013
+.\" Date: 04/15/2013
.\" Manual: \ \&
.\" Source: \ \&
.\" Language: English
.\"
-.TH "DWB" "1" "04/10/2013" "\ \&" "\ \&"
+.TH "DWB" "1" "04/15/2013" "\ \&" "\ \&"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
@@ -3641,6 +3641,24 @@ or a combination, default value:
\fIall\fR\&.
.RE
.PP
+\fBtab\-orientation\fR
+.RS 4
+Orientation of tabs, possible values are
+\fIhorizontal\fR,
+\fIvertical\-left\fR
+and
+\fIvertical\-right\fR, if set to vertical\-left or vertical\-right t and T in
+\fIwidget\-packing\fR
+will be ignored, instead tabs are placed left/right to the webview respectively, default value:
+\fIhorizontal\fR\&.
+.RE
+.PP
+\fBtab\-width\fR
+.RS 4
+Width of vertical tabs in pixel, will be ignored for horizontal tabs, horizontal tabs will always use the complete space, default value
+\fI100\fR\&.
+.RE
+.PP
\fBtabbar\-visible\fR
.RS 4
When the tabbar is hidden specifies the number of seconds the tabbar is visible when switching between tabs, default value:
diff --git a/doc/dwb.1.txt b/doc/dwb.1.txt
index ecaab28b..ed41de50 100644
--- a/doc/dwb.1.txt
+++ b/doc/dwb.1.txt
@@ -1539,6 +1539,16 @@ Type of files to sync, see also *file-sync-interval*.
Possible values are 'all', 'cookies', 'history', 'session' or a combination,
default value: 'all'.
+*tab-orientation*::
+Orientation of tabs, possible values are 'horizontal', 'vertical-left' and
+'vertical-right', if set to vertical-left or vertical-right t and T in
+'widget-packing' will be ignored, instead tabs are placed left/right to the
+webview respectively, default value: 'horizontal'.
+
+*tab-width*::
+Width of vertical tabs in pixel, will be ignored for horizontal tabs, horizontal tabs
+will always use the complete space, default value '100'.
+
*tabbar-visible*::
When the tabbar is hidden specifies the number of seconds the tabbar is visible
when switching between tabs, default value: '2'.
diff --git a/m4/settings.m4 b/m4/settings.m4
index c0b44f06..a89d7507 100644
--- a/m4/settings.m4
+++ b/m4/settings.m4
@@ -97,6 +97,8 @@ html_select(new-tab-position-policy, html_options(right, left, rightmost, leftmo
html_select(progress-bar-style, html_options(default, simple), The progress bar style)
html_input(show-single-tab, checkbox, Whether to show the tabbar if only one tab is open)
html_input(scrollbars, checkbox, Whether scrollbars should be enabled)
+html_select(tab-orientation, html_options(horizontal, vertical-left, vertical-right), ``Orientation of tabs, if set to vertical-left or -right t and T in widget-packing is ignored'')
+html_input(tab-width, text, ``Width of vertical tabs, will be ignored for horizontal tabs'')
html_input(tabbar-visible, text, Number of seconds a hidden tabbar is visible when switching between tabs)
html_input(tabbed-browsing, checkbox, Whether to enable tabbed browsing)
html_input(user-stylesheet-uri, text, The uri of a stylesheet applied to every page)
diff --git a/src/commands.c b/src/commands.c
index 43d9def3..c98fb99e 100644
--- a/src/commands.c
+++ b/src/commands.c
@@ -829,7 +829,7 @@ commands_only(KeyMap *km, Arg *arg)
static void
commands_set_bars(int status)
{
- gtk_widget_set_visible(dwb.gui.topbox, (status & BAR_VIS_TOP) && (GET_BOOL("show-single-tab") || dwb.state.views->next));
+ gtk_widget_set_visible(dwb.gui.tabbox, (status & BAR_VIS_TOP) && (GET_BOOL("show-single-tab") || dwb.state.views->next));
gtk_widget_set_visible(dwb.gui.bottombox, status & BAR_VIS_STATUS);
if ((status & BAR_VIS_STATUS) )
dom_remove_from_parent(WEBKIT_DOM_NODE(CURRENT_VIEW()->hover.element), NULL);
@@ -934,7 +934,7 @@ commands_tab_move(KeyMap *km, Arg *arg)
case TAB_MOVE_RIGHT : newpos = MAX(MIN(l-1, g_list_position(dwb.state.views, dwb.state.fview)+NUMMOD), 0); break;
default : newpos = MAX(MIN(l, NUMMOD)-1, 0); break;
}
- gtk_box_reorder_child(GTK_BOX(dwb.gui.topbox), CURRENT_VIEW()->tabevent, l-(newpos+1));
+ gtk_box_reorder_child(GTK_BOX(dwb.gui.tabcontainer), CURRENT_VIEW()->tabevent, l-(newpos+1));
gtk_box_reorder_child(GTK_BOX(dwb.gui.mainbox), CURRENT_VIEW()->scroll, newpos);
dwb.state.views = g_list_remove_link(dwb.state.views, dwb.state.fview);
diff --git a/src/config.h b/src/config.h
index 9643c639..4d5a2396 100644
--- a/src/config.h
+++ b/src/config.h
@@ -1187,6 +1187,10 @@ static WebSettings DWB_SETTINGS[] = {
SETTING_GLOBAL, INTEGER, { .i = 11 }, NULL, { 0 }, },
{ { "passthrough-keys", "Whether to enable webkit builtin shortcuts", },
SETTING_GLOBAL | SETTING_ONINIT, CHAR, { .p = "webkit" }, (S_Func)dwb_set_passthrough, { 0 }, },
+ { { "tab-orientation", "Whether to enable webkit builtin shortcuts", },
+ SETTING_GLOBAL | SETTING_ONINIT, CHAR, { .p = "horizontal" }, (S_Func)dwb_set_tab_orientation, { 0 }, },
+ { { "tab-width", "Tab width for vertical tabs", },
+ SETTING_GLOBAL, INTEGER, { .i = 100 }, (S_Func)dwb_set_tab_width, { 0 }, },
//{ { "javascript-debugging", "If set will be used for 'Accept-Language' header in all requests", },
// SETTING_GLOBAL | SETTING_ONINIT, BOOLEAN, { .b = false }, (S_Func)dwb_set_javascript_debugging, { 0 }, },
};/*}}}*/
diff --git a/src/dwb.c b/src/dwb.c
index 50fff392..bc1b57b8 100644
--- a/src/dwb.c
+++ b/src/dwb.c
@@ -84,6 +84,8 @@ static DwbStatus dwb_set_do_not_track(GList *gl, WebSettings *s);
static DwbStatus dwb_set_show_single_tab(GList *gl, WebSettings *s);
static DwbStatus dwb_set_accept_language(GList *gl, WebSettings *s);
static DwbStatus dwb_set_passthrough(GList *gl, WebSettings *s);
+static DwbStatus dwb_set_tab_orientation(GList *gl, WebSettings *s);
+static DwbStatus dwb_set_tab_width(GList *gl, WebSettings *s);
static void dwb_set_statusbar_color();
//static DwbStatus dwb_set_javascript_debugging(GList *gl, WebSettings *s);
#ifdef WITH_LIBSOUP_2_38
@@ -188,6 +190,26 @@ dwb_set_passthrough(GList *gl, WebSettings *s)
return STATUS_ERROR;
return STATUS_OK;
}/*}}}*/
+static DwbStatus
+dwb_set_tab_orientation(GList *gl, WebSettings *s)
+{
+ if (!g_strcmp0(s->arg_local.p, "horizontal"))
+ dwb.misc.tab_orientation = TAB_HORIZONTAL;
+ else if (!g_strcmp0(s->arg_local.p, "vertical-left"))
+ dwb.misc.tab_orientation = TAB_VERTICAL_LEFT;
+ else if (!g_strcmp0(s->arg_local.p, "vertical-right"))
+ dwb.misc.tab_orientation = TAB_VERTICAL_RIGHT;
+ else
+ return STATUS_ERROR;
+ if (! (s->apply & SETTING_INITIALIZE))
+ dwb_pack(GET_CHAR("widget-packing"), true);
+ return STATUS_OK;
+}/*}}}*/
+static DwbStatus
+dwb_set_tab_width(GList *gl, WebSettings *s)
+{
+ return dwb_pack(GET_CHAR("widget-packing"), true);
+}
/*{{{*/
static DwbStatus
@@ -242,9 +264,9 @@ dwb_set_show_single_tab(GList *gl, WebSettings *s) {
if (dwb.state.views && !dwb.state.views->next)
{
if (!dwb.misc.show_single_tab)
- gtk_widget_hide(dwb.gui.topbox);
+ gtk_widget_hide(dwb.gui.tabbox);
else if (dwb.state.bar_visible & BAR_VIS_TOP)
- gtk_widget_show(dwb.gui.topbox);
+ gtk_widget_show(dwb.gui.tabbox);
}
return STATUS_OK;
}/*}}}*/
@@ -302,11 +324,14 @@ static DwbStatus
dwb_set_widget_packing(GList *gl, WebSettings *s)
{
DwbStatus ret = STATUS_OK;
- if (dwb_pack(s->arg_local.p, true) != STATUS_OK)
+ if (! (s->apply && SETTING_INITIALIZE) )
{
- g_free(s->arg_local.p);
- s->arg_local.p = g_strdup(DEFAULT_WIDGET_PACKING);
- ret = STATUS_ERROR;
+ if (dwb_pack(s->arg_local.p, true) != STATUS_OK)
+ {
+ g_free(s->arg_local.p);
+ s->arg_local.p = g_strdup(DEFAULT_WIDGET_PACKING);
+ ret = STATUS_ERROR;
+ }
}
return ret;
}/*}}}*/
@@ -1506,7 +1531,7 @@ dwb_hide_tabbar(int *running)
{
if (! (dwb.state.bar_visible & BAR_VIS_TOP))
{
- gtk_widget_hide(dwb.gui.topbox);
+ gtk_widget_hide(dwb.gui.tabbox);
}
*running = 0;
return false;
@@ -1562,7 +1587,7 @@ dwb_focus_view(GList *gl, const char *event)
dwb_focus(gl);
if (! (dwb.state.bar_visible & BAR_VIS_TOP) && dwb.misc.tabbar_delay > 0)
{
- gtk_widget_show(dwb.gui.topbox);
+ gtk_widget_show(dwb.gui.tabbox);
if (running != 0)
g_source_remove(running);
running = g_timeout_add(dwb.misc.tabbar_delay * 1000, (GSourceFunc)dwb_hide_tabbar, &running);
@@ -3932,7 +3957,11 @@ dwb_init_settings()
g_hash_table_insert(dwb.settings, key, s);
if (s->apply & SETTING_BUILTIN || s->apply & SETTING_ONINIT)
+ {
+ s->apply |= SETTING_INITIALIZE;
s->func(NULL, s);
+ s->apply &= ~SETTING_INITIALIZE;
+ }
g_free(value);
}
@@ -4100,9 +4129,10 @@ dwb_pack(const char *layout, gboolean rebuild)
if (rebuild)
{
- gtk_widget_remove_from_parent(dwb.gui.topbox);
+ gtk_widget_remove_from_parent(dwb.gui.tabbox);
gtk_widget_remove_from_parent(dwb.gui.downloadbar);
- gtk_widget_remove_from_parent(dwb.gui.mainbox);
+ //gtk_widget_remove_from_parent(dwb.gui.mainbox);
+ gtk_widget_remove_from_parent(dwb.gui.tabwrapperbox);
gtk_widget_remove_from_parent(dwb.gui.statusbox);
gtk_widget_remove_from_parent(dwb.gui.bottombox);
}
@@ -4111,18 +4141,20 @@ dwb_pack(const char *layout, gboolean rebuild)
switch (*bak)
{
case 't':
- gtk_box_pack_start(GTK_BOX(dwb.gui.vbox), dwb.gui.topbox, false, false, 0);
+ if (dwb.misc.tab_orientation == TAB_HORIZONTAL)
+ gtk_box_pack_start(GTK_BOX(dwb.gui.vbox), dwb.gui.tabbox, false, false, 0);
dwb.state.bar_visible |= BAR_VIS_TOP;
break;
case 'T':
- gtk_box_pack_start(GTK_BOX(dwb.gui.vbox), dwb.gui.topbox, false, false, 0);
+ if (dwb.misc.tab_orientation == TAB_HORIZONTAL)
+ gtk_box_pack_start(GTK_BOX(dwb.gui.vbox), dwb.gui.tabbox, false, false, 0);
dwb.state.bar_visible &= ~BAR_VIS_TOP;
break;
case 'd':
gtk_box_pack_start(GTK_BOX(dwb.gui.vbox), dwb.gui.downloadbar, false, false, 0);
break;
case 'w':
- gtk_box_pack_start(GTK_BOX(dwb.gui.vbox), dwb.gui.mainbox, true, true, 0);
+ gtk_box_pack_start(GTK_BOX(dwb.gui.vbox), dwb.gui.tabwrapperbox, true, true, 0);
wv = true;
break;
case 's':
@@ -4150,9 +4182,34 @@ dwb_pack(const char *layout, gboolean rebuild)
bak++;
}
+
+ if (dwb.misc.tab_orientation == TAB_HORIZONTAL)
+ {
+ gtk_widget_hide(dwb.gui.dummybox);
+ gtk_orientable_set_orientation(GTK_ORIENTABLE(dwb.gui.tabcontainer), GTK_ORIENTATION_HORIZONTAL);
+ gtk_box_set_child_packing(GTK_BOX(dwb.gui.tabbox), dwb.gui.tabcontainer, true, true, 0, GTK_PACK_START);
+ gtk_widget_set_size_request(dwb.gui.tabcontainer, -1, -1);
+ }
+ else
+ {
+ gtk_box_pack_start(GTK_BOX(dwb.gui.tabwrapperbox), dwb.gui.tabbox, false, false, 0);
+ if (dwb.misc.tab_orientation == TAB_VERTICAL_LEFT)
+ {
+ gtk_box_reorder_child(GTK_BOX(dwb.gui.tabwrapperbox), dwb.gui.tabbox, 0);
+ }
+ else
+ {
+ gtk_box_reorder_child(GTK_BOX(dwb.gui.tabwrapperbox), dwb.gui.tabbox, -1);
+ }
+ gtk_orientable_set_orientation(GTK_ORIENTABLE(dwb.gui.tabcontainer), GTK_ORIENTATION_VERTICAL);
+ gtk_widget_set_size_request(dwb.gui.tabcontainer, GET_INT("tab-width"), -1);
+ gtk_box_set_child_packing(GTK_BOX(dwb.gui.tabbox), dwb.gui.tabcontainer, false, false, 0, GTK_PACK_START);
+ gtk_box_set_child_packing(GTK_BOX(dwb.gui.tabbox), dwb.gui.dummybox, true, true, 0, GTK_PACK_START);
+ gtk_widget_show(dwb.gui.dummybox);
+ }
gtk_widget_show_all(dwb.gui.statusbox);
gtk_widget_set_visible(dwb.gui.bottombox, dwb.state.bar_visible & BAR_VIS_STATUS);
- gtk_widget_set_visible(dwb.gui.topbox, dwb.state.bar_visible & BAR_VIS_TOP);
+ gtk_widget_set_visible(dwb.gui.tabbox, dwb.state.bar_visible & BAR_VIS_TOP);
return ret;
}
@@ -4201,15 +4258,25 @@ dwb_init_gui()
/* Main */
#if _HAS_GTK3
dwb.gui.vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
- dwb.gui.topbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 1);
- gtk_box_set_homogeneous(GTK_BOX(dwb.gui.topbox), true);
+ dwb.gui.tabcontainer = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 1);
+ gtk_box_set_homogeneous(GTK_BOX(dwb.gui.tabcontainer), true);
dwb.gui.mainbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 1);
gtk_box_set_homogeneous(GTK_BOX(dwb.gui.mainbox), true);
+ dwb.gui.tabwrapperbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 1);
+ gtk_box_set_homogeneous(GTK_BOX(dwb.gui.tabwrapperbox), false);
+ dwb.gui.dummbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 1);
#else
dwb.gui.vbox = gtk_vbox_new(false, 0);
- dwb.gui.topbox = gtk_hbox_new(true, 1);
+ dwb.gui.tabcontainer = gtk_hbox_new(true, 1);
dwb.gui.mainbox = gtk_hbox_new(true, 1);
+ dwb.gui.tabwrapperbox = gtk_hbox_new(false, 0);
+ dwb.gui.dummybox = gtk_vbox_new(true, 1);
#endif
+ dwb.gui.tabbox = gtk_vbox_new(false, 0);
+ gtk_box_pack_start(GTK_BOX(dwb.gui.tabbox), dwb.gui.tabcontainer, false, false, 0);
+ gtk_box_pack_end(GTK_BOX(dwb.gui.tabbox), dwb.gui.dummybox, true, true, 0);
+ gtk_box_pack_start(GTK_BOX(dwb.gui.tabwrapperbox), dwb.gui.mainbox, true, true, 0);
+
/* Downloadbar */
#if _HAS_GTK3
@@ -4263,6 +4330,8 @@ dwb_init_gui()
gtk_container_add(GTK_CONTAINER(dwb.gui.window), dwb.gui.vbox);
+ gtk_widget_show(dwb.gui.tabwrapperbox);
+ gtk_widget_show(dwb.gui.tabbox);
gtk_widget_show(dwb.gui.mainbox);
gtk_widget_show(dwb.gui.vbox);
gtk_widget_show(dwb.gui.window);
diff --git a/src/dwb.h b/src/dwb.h
index c979c8e6..35db3c54 100644
--- a/src/dwb.h
+++ b/src/dwb.h
@@ -271,6 +271,14 @@ typedef enum _TabMoveDirection {
TAB_MOVE_RIGHT,
} TabMoveDirection;
+
+typedef enum _TabOrientation {
+ TAB_HORIZONTAL,
+ TAB_VERTICAL_LEFT,
+ TAB_VERTICAL_RIGHT,
+
+} TabOrientation;
+
typedef enum _TabPosition {
TAB_POSITION_LEFT = 1<<0,
TAB_POSITION_RIGHT = 1<<1,
@@ -625,7 +633,6 @@ struct _State {
gint last_tab;
gboolean do_not_track;
- guint current_groups;
};
typedef enum _SettingsApply {
@@ -633,6 +640,7 @@ typedef enum _SettingsApply {
SETTING_GLOBAL = 1<<1,
SETTING_ONINIT = 1<<2,
SETTING_PER_VIEW = 1<<3,
+ SETTING_INITIALIZE = 1<<4,
} SettingsApply;
struct _WebSettings {
@@ -733,7 +741,10 @@ struct _Setting {
struct _Gui {
GtkWidget *window;
GtkWidget *vbox;
- GtkWidget *topbox;
+ GtkWidget *tabcontainer;
+ GtkWidget *tabwrapperbox;
+ GtkWidget *tabbox;
+ GtkWidget *dummybox;
GtkWidget *mainbox;
GtkWidget *downloadbar;
/* Statusbar */
@@ -797,6 +808,8 @@ struct _Misc {
ProgressBarStyle progress_bar_style;
int passthrough;
+ TabOrientation tab_orientation;
+
//gboolean javascript_debugging;
};
enum Files {
diff --git a/src/scripts.c b/src/scripts.c
index b459a0cd..a083a632 100644
--- a/src/scripts.c
+++ b/src/scripts.c
@@ -3922,7 +3922,7 @@ gui_get_main_box(JSContextRef ctx, JSObjectRef object, JSStringRef property, JSV
static JSValueRef
gui_get_tab_box(JSContextRef ctx, JSObjectRef object, JSStringRef property, JSValueRef* exception)
{
- return make_object_for_class(ctx, s_secure_widget_class, G_OBJECT(dwb.gui.topbox), true);
+ return make_object_for_class(ctx, s_secure_widget_class, G_OBJECT(dwb.gui.tabcontainer), true);
}
/**
* The box used for the main content. Child of mainBox
diff --git a/src/view.c b/src/view.c
index 7797d0ac..639ae94a 100644
--- a/src/view.c
+++ b/src/view.c
@@ -1728,8 +1728,8 @@ view_remove(GList *gl)
if ( !(new_fview = dwb.state.fview->prev) )
new_fview = g_list_first(dwb.state.views)->next;
}
- if (dwb.state.bar_visible & BAR_VIS_TOP && !gtk_widget_get_visible(dwb.gui.topbox))
- gtk_widget_show_all(dwb.gui.topbox);
+ if (dwb.state.bar_visible & BAR_VIS_TOP && !gtk_widget_get_visible(dwb.gui.tabbox))
+ gtk_widget_show(dwb.gui.tabbox);
}
else if (dwb.state.nummod - 1 == position)
{
@@ -1759,7 +1759,7 @@ view_remove(GList *gl)
dwb.state.views = g_list_delete_link(dwb.state.views, gl);
if (!dwb.state.views->next && !dwb.misc.show_single_tab)
- gtk_widget_hide(dwb.gui.topbox);
+ gtk_widget_hide(dwb.gui.tabbox);
gtk_widget_show(CURRENT_VIEW()->scroll);
@@ -1805,7 +1805,8 @@ view_add(const char *uri, gboolean background)
return NULL;
}
View *v = view_create_web_view();
- gtk_box_pack_end(GTK_BOX(dwb.gui.topbox), v->tabevent, true, true, 0);
+ gtk_box_pack_end(GTK_BOX(dwb.gui.tabcontainer), v->tabevent, true, true, 0);
+
int length = g_list_length(dwb.state.views);
if (dwb.state.fview)
{
@@ -1819,7 +1820,7 @@ view_add(const char *uri, gboolean background)
else
p = g_list_position(dwb.state.views, dwb.state.fview) + 1;
- gtk_box_reorder_child(GTK_BOX(dwb.gui.topbox), v->tabevent, length - p);
+ gtk_box_reorder_child(GTK_BOX(dwb.gui.tabcontainer), v->tabevent, length - p);
gtk_box_insert(GTK_BOX(dwb.gui.mainbox), v->scroll, true, true, 0, p, GTK_PACK_START);
dwb.state.views = g_list_insert(dwb.state.views, v, p);
ret = g_list_nth(dwb.state.views, p);
@@ -1846,9 +1847,12 @@ view_add(const char *uri, gboolean background)
if (!dwb.misc.show_single_tab)
{
if (length == 0)
- gtk_widget_hide(dwb.gui.topbox);
+ gtk_widget_hide(dwb.gui.tabbox);
else if (length == 1 && (dwb.state.bar_visible & BAR_VIS_TOP))
- gtk_widget_show(dwb.gui.topbox);
+ {
+ gtk_widget_show(dwb.gui.tabbox);
+ gtk_widget_show_all(dwb.gui.tabcontainer);
+ }
}
if (EMIT_SCRIPT(CREATE_TAB))
{