Merge pull request #102 from numerical/master

Fix pseudo transparency
This commit is contained in:
Simon Gomizelj 2013-06-17 10:12:38 -07:00
commit 0d0f54195a
1 changed files with 8 additions and 7 deletions

View File

@ -88,7 +88,7 @@ struct hint_info {
struct config_info {
hint_info hints;
char *browser;
gboolean dynamic_title, urgent_on_bell, clickable_url, opacity_set;
gboolean dynamic_title, urgent_on_bell, clickable_url, opacity_set, pseudo_transparency;
int tag;
char *config_file;
};
@ -105,7 +105,7 @@ struct draw_cb_info {
};
static void launch_browser(char *browser, char *url);
static void set_opacity(GtkWidget *window, VteTerminal *vte, double opacity);
static void set_opacity(GtkWidget *window, VteTerminal *vte, double opacity, gboolean pseudo);
static void window_title_cb(VteTerminal *vte, gboolean *dynamic_title);
static gboolean key_press_cb(VteTerminal *vte, GdkEventKey *event, keybind_info *info);
static gboolean entry_key_press_cb(GtkEntry *entry, GdkEventKey *event, keybind_info *info);
@ -130,9 +130,9 @@ void launch_browser(char *browser, char *url) {
g_spawn_async(nullptr, browser_cmd, nullptr, G_SPAWN_SEARCH_PATH, nullptr, nullptr, nullptr, nullptr);
}
static void set_opacity(GtkWidget *window, VteTerminal *vte, double opacity) {
static void set_opacity(GtkWidget *window, VteTerminal *vte, double opacity, gboolean psuedo) {
vte_terminal_set_background_saturation(vte, opacity);
vte_terminal_set_background_transparent(vte, false);
vte_terminal_set_background_transparent(vte, psuedo);
GdkScreen *screen = gtk_widget_get_screen(GTK_WIDGET(window));
GdkVisual *visual;
@ -1168,6 +1168,7 @@ static void set_config(GtkWindow *window, VteTerminal *vte, config_info *info,
info->dynamic_title = cfg_bool("dynamic_title", TRUE);
info->urgent_on_bell = cfg_bool("urgent_on_bell", TRUE);
info->clickable_url = cfg_bool("clickable_url", TRUE);
info->pseudo_transparency = cfg_bool("pseudo_transparency", FALSE);
if (info->clickable_url) {
info->tag =
@ -1234,7 +1235,7 @@ static void set_config(GtkWindow *window, VteTerminal *vte, config_info *info,
if (auto opacity = get_config_double(config, "options", "transparency")) {
if (!info->opacity_set) {
set_opacity(GTK_WIDGET(window), vte, *opacity);
set_opacity(GTK_WIDGET(window), vte, *opacity, info->pseudo_transparency);
}
}
@ -1337,7 +1338,7 @@ int main(int argc, char **argv) {
nullptr},
{vi_mode::insert, 0, 0, 0, 0},
{{nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, 0, 0, 0},
nullptr, FALSE, FALSE, FALSE, FALSE, -1, config_file}
nullptr, FALSE, FALSE, FALSE, FALSE, FALSE, -1, config_file}
};
load_config(GTK_WINDOW(window), vte, &info.config, geometry ? nullptr : &geometry);
@ -1401,7 +1402,7 @@ int main(int argc, char **argv) {
if (trans > 0.0) {
info.config.opacity_set = true;
set_opacity(GTK_WIDGET(window), vte, trans);
set_opacity(GTK_WIDGET(window), vte, trans, info.config.pseudo_transparency);
}
gtk_widget_grab_focus(vte_widget);