summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config.mk3
-rw-r--r--doc/dwb.14
-rw-r--r--doc/dwb.1.txt4
-rw-r--r--m4/settings.m48
-rw-r--r--src/commands.c7
-rw-r--r--src/config.h2
-rw-r--r--src/dwb.c42
-rw-r--r--src/dwb.h6
-rw-r--r--src/scripts.c4
-rw-r--r--src/view.c15
10 files changed, 72 insertions, 23 deletions
diff --git a/config.mk b/config.mk
index b234d947..ee37bb26 100644
--- a/config.mk
+++ b/config.mk
@@ -157,11 +157,12 @@ endif
CFLAGS_OPTIONS := $(CFLAGS)
-ifeq (USEGTK3, 1)
+ifeq (${USEGTK3}, 1)
CPPFLAGS+=-DGTK_DISABLE_SINGLE_INCLUDES
CPPFLAGS+=-DGTK_DISABLE_DEPRECATED
CPPFLAGS+=-DGDK_DISABLE_DEPRECATED
CPPFLAGS+=-DGSEAL_ENABLE
+M4FLAGS += --define=WITH_GTK3=1
endif
diff --git a/doc/dwb.1 b/doc/dwb.1
index 69d99ead..30d19ead 100644
--- a/doc/dwb.1
+++ b/doc/dwb.1
@@ -3652,7 +3652,7 @@ or a combination, default value:
\fIall\fR\&.
.RE
.PP
-\fBtab\-orientation\fR
+\fBtab\-orientation (GTK2 only)\fR
.RS 4
Orientation of tabs, possible values are
\fIhorizontal\fR,
@@ -3664,7 +3664,7 @@ will be ignored, instead tabs are placed left/right to the webview respectively,
\fIhorizontal\fR\&.
.RE
.PP
-\fBtab\-width\fR
+\fBtab\-width (GTK2 only)\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\&.
diff --git a/doc/dwb.1.txt b/doc/dwb.1.txt
index f4851ec8..9965d2bb 100644
--- a/doc/dwb.1.txt
+++ b/doc/dwb.1.txt
@@ -1545,13 +1545,13 @@ 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*::
+*tab-orientation (GTK2 only)*::
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*::
+*tab-width (GTK2 only)*::
Width of vertical tabs in pixel, will be ignored for horizontal tabs, horizontal tabs
will always use the complete space, default value '100'.
diff --git a/m4/settings.m4 b/m4/settings.m4
index 2c5ba874..ed15fa73 100644
--- a/m4/settings.m4
+++ b/m4/settings.m4
@@ -30,8 +30,8 @@ html_input(proxy-url, text, The HTTP-proxy url)
html_input(save-session, checkbox, Whether to Automatically save sessions)
html_input(single-instance, checkbox, Whether to have only one instance)
ifdef(`WITH_LIBSOUP_2_38',
-html_input(ssl-use-system-ca-file, checkbox, Whether to use the system certification file),
-html_input(ssl-ca-file, text, Path to ssl-certificate)
+`html_input(ssl-use-system-ca-file, checkbox, Whether to use the system certification file)' ,
+`html_input(ssl-ca-file, text, Path to ssl-certificate)'
)
dnl SSL_CERTIFICATION
html_input(ssl-strict, checkbox, Whether to allow only safe ssl-certificates)
@@ -98,8 +98,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'')
+ifdef(`WITH_GTK3', ,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''))
+ifdef(`WITH_GTK3', ,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 c98fb99e..aa8d5f37 100644
--- a/src/commands.c
+++ b/src/commands.c
@@ -934,8 +934,13 @@ 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.tabcontainer), CURRENT_VIEW()->tabevent, l-(newpos+1));
+#if _HAS_GTK3
+ gtk_box_reorder_child(GTK_BOX(dwb.gui.tabbox), CURRENT_VIEW()->tabevent, l-(newpos+1));
gtk_box_reorder_child(GTK_BOX(dwb.gui.mainbox), CURRENT_VIEW()->scroll, newpos);
+#else
+ gtk_box_reorder_child(GTK_BOX(dwb.gui.tabcontainer), CURRENT_VIEW()->tabevent, l-(newpos+1));
+ gtk_box_reorder_child(GTK_BOX(dwb.gui.tabwrapperbox), CURRENT_VIEW()->scroll, newpos);
+#endif
dwb.state.views = g_list_remove_link(dwb.state.views, dwb.state.fview);
diff --git a/src/config.h b/src/config.h
index 8d3da555..101b11eb 100644
--- a/src/config.h
+++ b/src/config.h
@@ -1189,10 +1189,12 @@ static WebSettings DWB_SETTINGS[] = {
SETTING_GLOBAL | SETTING_ONINIT, CHAR, { .p = "0" }, (S_Func)dwb_set_cookie_expiration, { 0 }, },
{ { "passthrough-keys", "Whether to enable webkit builtin shortcuts", },
SETTING_GLOBAL | SETTING_ONINIT, CHAR, { .p = "webkit" }, (S_Func)dwb_set_passthrough, { 0 }, },
+#if !_HAS_GTK3
{ { "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 }, },
+#endif
//{ { "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 bf6e472d..1a1eeae4 100644
--- a/src/dwb.c
+++ b/src/dwb.c
@@ -84,8 +84,10 @@ 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);
+#if !_HAS_GTK3
static DwbStatus dwb_set_tab_orientation(GList *gl, WebSettings *s);
static DwbStatus dwb_set_tab_width(GList *gl, WebSettings *s);
+#endif
static DwbStatus dwb_set_cookie_expiration(GList *gl, WebSettings *s);
static void dwb_set_statusbar_color();
//static DwbStatus dwb_set_javascript_debugging(GList *gl, WebSettings *s);
@@ -191,6 +193,7 @@ dwb_set_passthrough(GList *gl, WebSettings *s)
return STATUS_ERROR;
return STATUS_OK;
}/*}}}*/
+#if !_HAS_GTK3
static DwbStatus
dwb_set_tab_orientation(GList *gl, WebSettings *s)
{
@@ -211,6 +214,7 @@ dwb_set_tab_width(GList *gl, WebSettings *s)
{
return dwb_pack(GET_CHAR("widget-packing"), true);
}
+#endif
static DwbStatus
dwb_set_cookie_expiration(GList *gl, WebSettings *s)
{
@@ -4142,10 +4146,13 @@ dwb_pack(const char *layout, gboolean rebuild)
if (rebuild)
{
- gtk_widget_remove_from_parent(dwb.gui.tabbox);
gtk_widget_remove_from_parent(dwb.gui.downloadbar);
- //gtk_widget_remove_from_parent(dwb.gui.mainbox);
+#if _HAS_GTK3
+ gtk_widget_remove_from_parent(dwb.gui.mainbox);
+#else
gtk_widget_remove_from_parent(dwb.gui.tabwrapperbox);
+#endif
+ gtk_widget_remove_from_parent(dwb.gui.tabbox);
gtk_widget_remove_from_parent(dwb.gui.statusbox);
gtk_widget_remove_from_parent(dwb.gui.bottombox);
}
@@ -4154,12 +4161,16 @@ dwb_pack(const char *layout, gboolean rebuild)
switch (*bak)
{
case 't':
+#if !_HAS_GTK3
if (dwb.misc.tab_orientation == TAB_HORIZONTAL)
+#endif
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':
+#if ! _HAS_GTK3
if (dwb.misc.tab_orientation == TAB_HORIZONTAL)
+#endif
gtk_box_pack_start(GTK_BOX(dwb.gui.vbox), dwb.gui.tabbox, false, false, 0);
dwb.state.bar_visible &= ~BAR_VIS_TOP;
break;
@@ -4167,7 +4178,11 @@ dwb_pack(const char *layout, gboolean rebuild)
gtk_box_pack_start(GTK_BOX(dwb.gui.vbox), dwb.gui.downloadbar, false, false, 0);
break;
case 'w':
+#if _HAS_GTK3
+ gtk_box_pack_start(GTK_BOX(dwb.gui.vbox), dwb.gui.mainbox, true, true, 0);
+#else
gtk_box_pack_start(GTK_BOX(dwb.gui.vbox), dwb.gui.tabwrapperbox, true, true, 0);
+#endif
wv = true;
break;
case 's':
@@ -4196,11 +4211,12 @@ dwb_pack(const char *layout, gboolean rebuild)
}
+#if !_HAS_GTK3
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_box_set_child_packing(GTK_BOX(dwb.gui.tabbox), dwb.gui.tabcontainer, false, false, 0, GTK_PACK_START);
gtk_widget_set_size_request(dwb.gui.tabcontainer, -1, -1);
}
else
@@ -4220,6 +4236,7 @@ dwb_pack(const char *layout, gboolean rebuild)
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);
}
+#endif
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.tabbox, dwb.state.bar_visible & BAR_VIS_TOP);
@@ -4271,25 +4288,24 @@ dwb_init_gui()
/* Main */
#if _HAS_GTK3
dwb.gui.vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
- dwb.gui.tabcontainer = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 1);
- gtk_box_set_homogeneous(GTK_BOX(dwb.gui.tabcontainer), true);
+ dwb.gui.tabbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 1);
+ gtk_box_set_homogeneous(GTK_BOX(dwb.gui.tabbox), 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.tabcontainer = gtk_hbox_new(true, 1);
dwb.gui.mainbox = gtk_hbox_new(true, 1);
+
dwb.gui.tabwrapperbox = gtk_hbox_new(false, 0);
+ gtk_box_set_homogeneous(GTK_BOX(dwb.gui.tabwrapperbox), false);
+
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_end(GTK_BOX(dwb.gui.tabbox), dwb.gui.dummybox, false, false, 0);
gtk_box_pack_start(GTK_BOX(dwb.gui.tabwrapperbox), dwb.gui.mainbox, true, true, 0);
-
+ gtk_box_pack_start(GTK_BOX(dwb.gui.tabbox), dwb.gui.tabcontainer, false, false, 0);
+#endif
/* Downloadbar */
#if _HAS_GTK3
@@ -4343,8 +4359,10 @@ dwb_init_gui()
gtk_container_add(GTK_CONTAINER(dwb.gui.window), dwb.gui.vbox);
+#if !_HAS_GTK3
gtk_widget_show(dwb.gui.tabwrapperbox);
gtk_widget_show(dwb.gui.tabbox);
+#endif
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 35db3c54..eff0cffb 100644
--- a/src/dwb.h
+++ b/src/dwb.h
@@ -741,10 +741,12 @@ struct _Setting {
struct _Gui {
GtkWidget *window;
GtkWidget *vbox;
+#if !_HAS_GTK3
GtkWidget *tabcontainer;
GtkWidget *tabwrapperbox;
- GtkWidget *tabbox;
GtkWidget *dummybox;
+#endif
+ GtkWidget *tabbox;
GtkWidget *mainbox;
GtkWidget *downloadbar;
/* Statusbar */
@@ -808,7 +810,9 @@ struct _Misc {
ProgressBarStyle progress_bar_style;
int passthrough;
+#if ! _HAS_GTK3
TabOrientation tab_orientation;
+#endif
//gboolean javascript_debugging;
};
diff --git a/src/scripts.c b/src/scripts.c
index 99f72a58..49de344e 100644
--- a/src/scripts.c
+++ b/src/scripts.c
@@ -3922,7 +3922,11 @@ 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)
{
+#if _HAS_GTK3
+ return make_object_for_class(ctx, s_secure_widget_class, G_OBJECT(dwb.gui.tabbox), true);
+#else
return make_object_for_class(ctx, s_secure_widget_class, G_OBJECT(dwb.gui.tabcontainer), true);
+#endif
}
/**
* The box used for the main content. Child of mainBox
diff --git a/src/view.c b/src/view.c
index 639ae94a..79cb1285 100644
--- a/src/view.c
+++ b/src/view.c
@@ -1541,7 +1541,10 @@ view_create_web_view()
gtk_misc_set_alignment(GTK_MISC(v->tablabel), 0.0, 0.5);
gtk_label_set_ellipsize(GTK_LABEL(v->tablabel), PANGO_ELLIPSIZE_END);
+
gtk_box_pack_end(GTK_BOX(v->tabbox), v->tablabel, true, true, 3);
+
+
GdkPixbuf *pb = gdk_pixbuf_new_from_xpm_data(dummy_icon);
v->tabicon = gtk_image_new_from_pixbuf(pb);
@@ -1805,7 +1808,11 @@ view_add(const char *uri, gboolean background)
return NULL;
}
View *v = view_create_web_view();
+#if _HAS_GTK3
+ gtk_box_pack_end(GTK_BOX(dwb.gui.tabbox), v->tabevent, true, true, 0);
+#else
gtk_box_pack_end(GTK_BOX(dwb.gui.tabcontainer), v->tabevent, true, true, 0);
+#endif
int length = g_list_length(dwb.state.views);
if (dwb.state.fview)
@@ -1820,7 +1827,11 @@ view_add(const char *uri, gboolean background)
else
p = g_list_position(dwb.state.views, dwb.state.fview) + 1;
+#if _HAS_GTK3
+ gtk_box_reorder_child(GTK_BOX(dwb.gui.tabbox), v->tabevent, length - p);
+#else
gtk_box_reorder_child(GTK_BOX(dwb.gui.tabcontainer), v->tabevent, length - p);
+#endif
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);
@@ -1850,8 +1861,12 @@ view_add(const char *uri, gboolean background)
gtk_widget_hide(dwb.gui.tabbox);
else if (length == 1 && (dwb.state.bar_visible & BAR_VIS_TOP))
{
+#if _HAS_GTK3
+ gtk_widget_show_all(dwb.gui.tabbox);
+#else
gtk_widget_show(dwb.gui.tabbox);
gtk_widget_show_all(dwb.gui.tabcontainer);
+#endif
}
}
if (EMIT_SCRIPT(CREATE_TAB))