Commit 6fc44350 authored by Sergio Costas's avatar Sergio Costas

Now remembers better the last focus

parent 8b4e5c77
......@@ -44,6 +44,7 @@ namespace Terminus {
private Gdk.EventKey new_window_key;
private Gdk.EventKey next_tab_key;
private Gdk.EventKey previous_tab_key;
private bool had_focus;
public signal void ended(Terminus.Terminal terminal);
public signal void split_horizontal(Terminus.Terminal terminal);
......@@ -60,6 +61,7 @@ namespace Terminus {
public Terminal(Terminus.Base main_container, Terminus.Container top_container) {
had_focus = true; // when creating a new terminal, it must take the focus
this.map.connect_after( () => {
// this ensures that the title is updated when the window is shown
GLib.Timeout.add(500,update_title_cb);
......@@ -86,20 +88,24 @@ namespace Terminus {
});
this.vte_terminal.focus_in_event.connect_after( (event) => {
this.update_title();
this.had_focus = true;
return false;
});
this.vte_terminal.focus_out_event.connect_after( (event) => {
this.update_title();
this.had_focus = false;
return false;
});
this.vte_terminal.resize_window.connect_after( (x,y) => {
this.update_title();
});
this.vte_terminal.map.connect_after( (w) => {
GLib.Timeout.add(500, () => {
this.vte_terminal.grab_focus();
return false;
});
if (this.had_focus) {
GLib.Timeout.add(500, () => {
this.vte_terminal.grab_focus();
return false;
});
}
});
Terminus.settings.bind("scroll-on-output",this.vte_terminal,"scroll_on_output",GLib.SettingsBindFlags.DEFAULT);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment