Skip to content

Commit

Permalink
Merge pull request thestinger#102 from numerical/master
Browse files Browse the repository at this point in the history
Fix pseudo transparency
  • Loading branch information
vodik committed Jun 17, 2013
2 parents 86b6842 + d9a9765 commit 0d0f541
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions termite.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand All @@ -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);
Expand All @@ -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;
Expand Down Expand Up @@ -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 =
Expand Down Expand Up @@ -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);
}
}

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 0d0f541

Please sign in to comment.