diff options
author | Josh Rickmar <jrick@devio.us> | 2012-07-10 08:55:06 -0400 |
---|---|---|
committer | Josh Rickmar <jrick@devio.us> | 2012-07-10 08:55:06 -0400 |
commit | 99d110cd74bbd08011a754d1c11a08e51a90debe (patch) | |
tree | b8641edb041c2bf093d50d3ffc649168ba2f057b | |
parent | 1132d68aa111a6ae3eb3df093811791415f2bdcc (diff) | |
download | xombrero-99d110cd74bbd08011a754d1c11a08e51a90debe.tar.gz |
Enable GTK3 as default on FreeBSD and Linux, and make attempts to
improve coloring when using other invasive GTK3 themes. The URI bar should now be colored correctly, unless explicitly overridden in a user theme.
-rw-r--r-- | freebsd/Makefile | 8 | ||||
-rw-r--r-- | linux/Makefile | 9 | ||||
-rw-r--r-- | xombrero.c | 25 | ||||
-rw-r--r-- | xombrero.css | 47 | ||||
-rw-r--r-- | xombrero.h | 4 |
5 files changed, 63 insertions, 30 deletions
diff --git a/freebsd/Makefile b/freebsd/Makefile index efbaf5b..4c53ec9 100644 --- a/freebsd/Makefile +++ b/freebsd/Makefile @@ -1,4 +1,10 @@ -LIBS= gtk+-2.0 webkit-1.0 libsoup-2.4 gnutls gthread-2.0 +GTK_VERSION?= gtk3 +.if ${GTK_VERSION} == "gtk2" +LIBS= gtk+-2.0 webkit-1.0 +.else +LIBS= gtk+-3.0 webkitgtk-3.0 +.endif +LIBS+= libsoup-2.4 gnutls gthread-2.0 LDADD= -lutil -lgcrypt GTK_CFLAGS!= pkg-config --cflags $(LIBS) diff --git a/linux/Makefile b/linux/Makefile index a351d34..6e35266 100644 --- a/linux/Makefile +++ b/linux/Makefile @@ -1,7 +1,14 @@ JS_CF=$(shell pkg-config --silence-errors --cflags javascriptcoregtk-1.0) JS_LD=$(shell pkg-config --silence-errors --libs javascriptcoregtk-1.0) -LIBS= glib-2.0 gtk+-2.0 webkit-1.0 libsoup-2.4 gthread-2.0 gnutls libbsd +GTK_VERSION?= gtk3 +LIBS= glib-2.0 +ifeq ("${GTK_VERSION}", "gtk2") +LIBS+= gtk+-2.0 webkit-1.0 +else +LIBS+= gtk+-3.0 webkitgtk-3.0 +endif +LIBS+= libsoup-2.4 gthread-2.0 gnutls libbsd CFLAGS+= -O2 -Wall -ggdb3 -D_GNU_SOURCE -I. -I.. $(shell pkg-config --cflags $(LIBS)) $(JS_CF) LDADD+= $(shell pkg-config --libs $(LIBS)) $(JS_LD) -ldl -lgcrypt -lX11 diff --git a/xombrero.c b/xombrero.c index eb9d6f5..417c6d2 100644 --- a/xombrero.c +++ b/xombrero.c @@ -3745,7 +3745,6 @@ white: #endif } else { #if GTK_CHECK_VERSION(3, 0, 0) - /* XXX need to select the right XT_CSS_* */ name = get_css_name(col_str); gtk_widget_set_name(t->uri_entry, name); statusbar_modify_attr(t, name); @@ -4209,11 +4208,13 @@ notify_load_status_cb(WebKitWebView* wview, GParamSpec* pspec, struct tab *t) #endif /* DOM is changing, unreference the previous focused element */ +#if WEBKIT_CHECK_VERSION(1, 5, 0) t->active = NULL; if (t->active_text) { g_free(t->active_text); t->active_text = NULL; } +#endif /* take focus if we are visible */ focus_webview(t); @@ -6898,6 +6899,7 @@ create_kiosk_toolbar(struct tab *t) #if GTK_CHECK_VERSION(3, 0, 0) b = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); + gtk_widget_set_name(GTK_WIDGET(b), "toolbar"); #else b = gtk_hbox_new(FALSE, 0); #endif @@ -6927,9 +6929,7 @@ create_kiosk_toolbar(struct tab *t) /* create widgets but don't use them */ t->uri_entry = gtk_entry_new(); -#if GTK_CHECK_VERSION(3, 0, 0) - t->default_style = gtk_widget_get_style_context(t->uri_entry); -#else +#if !GTK_CHECK_VERSION(3, 0, 0) t->default_style = gtk_rc_get_style(t->uri_entry); #endif t->stop = create_button("Stop", GTK_STOCK_STOP, 0); @@ -6946,6 +6946,7 @@ create_toolbar(struct tab *t) #if GTK_CHECK_VERSION(3, 0, 0) b = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); + gtk_widget_set_name(GTK_WIDGET(b), "toolbar"); #else b = gtk_hbox_new(FALSE, 0); #endif @@ -7020,9 +7021,7 @@ create_toolbar(struct tab *t) 0); gtk_box_pack_start(GTK_BOX(b), eb2, FALSE, FALSE, 0); } -#if GTK_CHECK_VERSION(3, 0, 0) - t->default_style = gtk_widget_get_style_context(t->uri_entry); -#else +#if !GTK_CHECK_VERSION(3, 0, 0) t->default_style = gtk_rc_get_style(t->uri_entry); #endif @@ -7406,6 +7405,7 @@ statusbar_create(struct tab *t) #if GTK_CHECK_VERSION(3, 0, 0) t->statusbar_box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); + gtk_widget_set_name(GTK_WIDGET(t->statusbar_box), "statusbar"); #else t->statusbar_box = gtk_hbox_new(FALSE, 0); #endif @@ -7517,7 +7517,9 @@ create_new_tab(char *title, struct undo *u, int focus, int position) t->user_agent_id = 0; t->http_accept_id = 0; +#if WEBKIT_CHECK_VERSION(1, 5, 0) t->active = NULL; +#endif #if GTK_CHECK_VERSION(2, 20, 0) t->spinner = gtk_spinner_new(); @@ -7573,6 +7575,9 @@ create_new_tab(char *title, struct undo *u, int focus, int position) gtk_entry_set_has_frame(GTK_ENTRY(t->cmd), FALSE); gtk_box_pack_end(GTK_BOX(t->vbox), t->cmd, FALSE, FALSE, 0); gtk_widget_modify_font(GTK_WIDGET(t->cmd), cmd_font); +#if GTK_CHECK_VERSION(3, 0, 0) + gtk_widget_set_name(GTK_WIDGET(t->cmd), "cmd"); +#endif /* status bar */ statusbar_create(t); @@ -8295,12 +8300,12 @@ setup_css(void) provider = gtk_css_provider_new(); display = gdk_display_get_default(); screen = gdk_display_get_default_screen(display); - gtk_style_context_add_provider_for_screen(screen, - GTK_STYLE_PROVIDER(provider), - GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); snprintf(path, sizeof path, "%s" PS "%s", resource_dir, XT_CSS_FILE); file = g_file_new_for_path(path); gtk_css_provider_load_from_file(provider, file, NULL); + gtk_style_context_add_provider_for_screen(screen, + GTK_STYLE_PROVIDER(provider), + GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); g_object_unref(file); } #endif diff --git a/xombrero.css b/xombrero.css index 5524276..75a5715 100644 --- a/xombrero.css +++ b/xombrero.css @@ -20,44 +20,64 @@ @define-color blue lightblue; * { + border-width: 1px; padding: 0; margin: 0; } -:insensitive, -*:insensitive { - background-color: @bg_color; +.button :insensitive { + background-color: rgba(0,0,0,0); /* transparent */ } .entry { + border-width: 1px; padding: 2px; + color: @fg_color; +} + +#cmd .entry, +#statusbar .entry { + border-width: 0px; } .entry#red { - background-color: @red; + background-image: -gtk-gradient(linear, + left top, left bottom, + from (@red), to (@red)); } .entry#yellow { - background-color: @yellow; + background-image: -gtk-gradient(linear, + left top, left bottom, + from (@yellow), to (@yellow)); } .entry#green { - background-color: @green; + background-image: -gtk-gradient(linear, + left top, left bottom, + from (@green), to (@green)); } .entry#blue { - background-color: @blue; + background-image: -gtk-gradient(linear, + left top, left bottom, + from (@blue), to (@blue)); + color: @fg_color; } .entry:selected#red, .entry:selected#yellow, .entry:selected#green, .entry:selected#blue, +.entry.progressbar, .entry.progressbar#red, .entry.progressbar#yellow, .entry.progressbar#green, .entry.progressbar#blue { - background-color: @selected_bg_color; + background-image: -gtk-gradient(linear, + left top, left bottom, + from (@selected_bg_color), + to (@selected_bg_color)); color: @selected_fg_color; } @@ -71,19 +91,16 @@ border-width: 0; } -GtkBox { - border-width: 0; -} - -GtkMenuItem { +.menuitem { padding: 3px; } -GtkNotebook tab { +.notebook tab { background-color: shade(@bg_color, 0.85); color: @fg_color; + padding: 0px; } -GtkNotebook tab:active { +.notebook tab:active { background-color: @bg_color; } diff --git a/xombrero.h b/xombrero.h index 5ce02b9..bcd20cb 100644 --- a/xombrero.h +++ b/xombrero.h @@ -202,9 +202,7 @@ struct tab { GtkWidget *label; GtkWidget *spinner; GtkWidget *uri_entry; -#if GTK_CHECK_VERSION(3, 0, 0) - GtkStyleContext *default_style; -#else +#if !GTK_CHECK_VERSION(3, 0, 0) GtkStyle *default_style; #endif GtkWidget *search_entry; |