From 4f9d02dab352ad85877383d57e01ba3a6144c5b4 Mon Sep 17 00:00:00 2001 From: Brendan Taylor Date: Thu, 21 Oct 2010 15:08:01 -0600 Subject: don't parse and set status background every time the status bar is redrawn --- src/callbacks.c | 13 +++++++++++++ src/callbacks.h | 3 +++ src/uzbl-core.c | 11 +---------- 3 files changed, 17 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/callbacks.c b/src/callbacks.c index d2352b2..8944262 100644 --- a/src/callbacks.c +++ b/src/callbacks.c @@ -45,6 +45,19 @@ set_authentication_handler() { return; } +void +set_status_background() { + GdkColor color; + gdk_color_parse (uzbl.behave.status_background, &color); + /* labels and hboxes do not draw their own background. applying this + * on the vbox/main_window is ok as the statusbar is the only affected + * widget. (if not, we could also use GtkEventBox) */ + if (uzbl.gui.main_window) + gtk_widget_modify_bg (uzbl.gui.main_window, GTK_STATE_NORMAL, &color); + else if (uzbl.gui.plug) + gtk_widget_modify_bg (GTK_WIDGET(uzbl.gui.plug), GTK_STATE_NORMAL, &color); +} + void set_icon() { if(file_exists(uzbl.gui.icon)) { diff --git a/src/callbacks.h b/src/callbacks.h index fdd08e4..9c6a096 100644 --- a/src/callbacks.h +++ b/src/callbacks.h @@ -15,6 +15,9 @@ set_proxy_url(); void set_authentication_handler(); +void +set_status_background(); + void set_icon(); diff --git a/src/uzbl-core.c b/src/uzbl-core.c index 7be98c3..2d83f39 100644 --- a/src/uzbl-core.c +++ b/src/uzbl-core.c @@ -93,7 +93,7 @@ const struct var_name_to_ptr_t { { "show_status", PTR_V_INT(uzbl.behave.show_status, 1, cmd_set_status)}, { "status_top", PTR_V_INT(uzbl.behave.status_top, 1, move_statusbar)}, { "status_format", PTR_V_STR(uzbl.behave.status_format, 1, NULL)}, - { "status_background", PTR_V_STR(uzbl.behave.status_background, 1, NULL)}, + { "status_background", PTR_V_STR(uzbl.behave.status_background, 1, set_status_background)}, { "title_format_long", PTR_V_STR(uzbl.behave.title_format_long, 1, NULL)}, { "title_format_short", PTR_V_STR(uzbl.behave.title_format_short, 1, NULL)}, { "icon", PTR_V_STR(uzbl.gui.icon, 1, set_icon)}, @@ -2006,15 +2006,6 @@ update_title (void) { gtk_label_set_markup(GTK_LABEL(uzbl.gui.mainbar_label), parsed); g_free(parsed); } - if (b->status_background) { - GdkColor color; - gdk_color_parse (b->status_background, &color); - //labels and hboxes do not draw their own background. applying this on the vbox/main_window is ok as the statusbar is the only affected widget. (if not, we could also use GtkEventBox) - if (uzbl.gui.main_window) - gtk_widget_modify_bg (uzbl.gui.main_window, GTK_STATE_NORMAL, &color); - else if (uzbl.gui.plug) - gtk_widget_modify_bg (GTK_WIDGET(uzbl.gui.plug), GTK_STATE_NORMAL, &color); - } } else { if (b->title_format_long) { parsed = expand(b->title_format_long, 0); -- cgit v1.2.3 From 68ce1a4d1b5f9503ef89a798eb4936a7dd9ad9f8 Mon Sep 17 00:00:00 2001 From: Brendan Taylor Date: Thu, 21 Oct 2010 15:12:21 -0600 Subject: only set the window title if it's actually changed. fixes weird hangs in xmonad --- src/uzbl-core.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/uzbl-core.c b/src/uzbl-core.c index 2d83f39..54975b9 100644 --- a/src/uzbl-core.c +++ b/src/uzbl-core.c @@ -1993,11 +1993,12 @@ void update_title (void) { Behaviour *b = &uzbl.behave; gchar *parsed; + const gchar *current_title = gtk_window_get_title (GTK_WINDOW(uzbl.gui.main_window)); if (b->show_status) { - if (b->title_format_short) { + if (b->title_format_short && uzbl.gui.main_window) { parsed = expand(b->title_format_short, 0); - if (uzbl.gui.main_window) + if(current_title && strcmp(current_title, parsed)) gtk_window_set_title (GTK_WINDOW(uzbl.gui.main_window), parsed); g_free(parsed); } @@ -2007,9 +2008,9 @@ update_title (void) { g_free(parsed); } } else { - if (b->title_format_long) { + if (b->title_format_long && uzbl.gui.main_window) { parsed = expand(b->title_format_long, 0); - if (uzbl.gui.main_window) + if(current_title && strcmp(current_title, parsed)) gtk_window_set_title (GTK_WINDOW(uzbl.gui.main_window), parsed); g_free(parsed); } -- cgit v1.2.3