diff --git a/0.73_My_PuTTY/putty.h b/0.73_My_PuTTY/putty.h index c259f70..feec756 100644 --- a/0.73_My_PuTTY/putty.h +++ b/0.73_My_PuTTY/putty.h @@ -1178,6 +1178,7 @@ struct TermWinVtable { void (*set_cursor_pos)(TermWin *, int x, int y); void (*set_raw_mouse_mode)(TermWin *, bool enable); + void (*set_focus_reporting_mode)(TermWin *, bool enable); void (*set_scrollbar)(TermWin *, int total, int start, int page); @@ -1234,6 +1235,8 @@ static inline void win_set_cursor_pos(TermWin *win, int x, int y) { win->vt->set_cursor_pos(win, x, y); } static inline void win_set_raw_mouse_mode(TermWin *win, bool enable) { win->vt->set_raw_mouse_mode(win, enable); } +static inline void win_set_focus_reporting_mode(TermWin *win, bool enable) +{ win->vt->set_focus_reporting_mode(win, enable); } static inline void win_set_scrollbar(TermWin *win, int t, int s, int p) { win->vt->set_scrollbar(win, t, s, p); } static inline void win_bell(TermWin *win, int mode) @@ -1384,6 +1387,7 @@ NORETURN void cleanup_exit(int); X(BOOL, NONE, no_applic_c) /* totally disable app cursor keys */ \ X(BOOL, NONE, no_applic_k) /* totally disable app keypad */ \ X(BOOL, NONE, no_mouse_rep) /* totally disable mouse reporting */ \ + X(BOOL, NONE, no_focus_rep) /* totally disable mouse reporting */ \ X(BOOL, NONE, no_remote_resize) /* disable remote resizing */ \ X(BOOL, NONE, no_alt_screen) /* disable alternate screen */ \ X(BOOL, NONE, no_remote_wintitle) /* disable remote retitling */ \ diff --git a/0.73_My_PuTTY/settings.c b/0.73_My_PuTTY/settings.c index abb60b5..55acd3a 100644 --- a/0.73_My_PuTTY/settings.c +++ b/0.73_My_PuTTY/settings.c @@ -649,6 +649,7 @@ void save_open_settings(settings_w *sesskey, Conf *conf) write_setting_b(sesskey, "NoApplicationKeys", conf_get_bool(conf, CONF_no_applic_k)); write_setting_b(sesskey, "NoApplicationCursors", conf_get_bool(conf, CONF_no_applic_c)); write_setting_b(sesskey, "NoMouseReporting", conf_get_bool(conf, CONF_no_mouse_rep)); + write_setting_b(sesskey, "NoFocusReporting", conf_get_bool(conf, CONF_no_focus_rep)); write_setting_b(sesskey, "NoRemoteResize", conf_get_bool(conf, CONF_no_remote_resize)); write_setting_b(sesskey, "NoAltScreen", conf_get_bool(conf, CONF_no_alt_screen)); write_setting_b(sesskey, "NoRemoteWinTitle", conf_get_bool(conf, CONF_no_remote_wintitle)); @@ -1191,6 +1192,7 @@ void load_open_settings(settings_r *sesskey, Conf *conf) gppb(sesskey, "NoApplicationKeys", false, conf, CONF_no_applic_k); gppb(sesskey, "NoApplicationCursors", false, conf, CONF_no_applic_c); gppb(sesskey, "NoMouseReporting", false, conf, CONF_no_mouse_rep); + gppb(sesskey, "NoFocusReporting", false, conf, CONF_no_focus_rep); gppb(sesskey, "NoRemoteResize", false, conf, CONF_no_remote_resize); gppb(sesskey, "NoAltScreen", false, conf, CONF_no_alt_screen); gppb(sesskey, "NoRemoteWinTitle", false, conf, CONF_no_remote_wintitle); diff --git a/0.73_My_PuTTY/terminal.c b/0.73_My_PuTTY/terminal.c index 67aea3b..647123c 100644 --- a/0.73_My_PuTTY/terminal.c +++ b/0.73_My_PuTTY/terminal.c @@ -1530,6 +1530,7 @@ void term_copy_stuff_from_conf(Terminal *term) term->no_applic_k = conf_get_bool(term->conf, CONF_no_applic_k); term->no_dbackspace = conf_get_bool(term->conf, CONF_no_dbackspace); term->no_mouse_rep = conf_get_bool(term->conf, CONF_no_mouse_rep); + term->no_focus_rep = conf_get_bool(term->conf, CONF_no_focus_rep); term->no_remote_charset = conf_get_bool(term->conf, CONF_no_remote_charset); term->no_remote_resize = conf_get_bool(term->conf, CONF_no_remote_resize); term->no_remote_wintitle = conf_get_bool(term->conf, CONF_no_remote_wintitle); @@ -2737,6 +2738,9 @@ static void toggle_mode(Terminal *term, int mode, int query, bool state) term->xterm_mouse_mode = state ? MM_ANY_EVENT : MM_NONE; win_set_raw_mouse_mode(term->win, state); break; + case 1004: + win_set_focus_reporting_mode(term->win, state); + break; case 1005: /* use XTERM 1005 mouse protocol */ term->xterm_mouse_protocol = state ? MP_XTERM : MP_NORMAL; break; @@ -7764,7 +7768,16 @@ void term_provide_logctx(Terminal *term, LogContext *logctx) void term_set_focus(Terminal *term, bool has_focus) { - term->has_focus = has_focus; + if( term->has_focus != has_focus) { + term->has_focus = has_focus; + + if(term->report_focus && term->ldisc) { + if (has_focus) + ldisc_send(term->ldisc, "\033[I", 3,false); + else + ldisc_send(term->ldisc, "\033[O", 3,false); + } + } term_schedule_cblink(term); } diff --git a/0.73_My_PuTTY/terminal.h b/0.73_My_PuTTY/terminal.h index 2896e2d..6582fa4 100644 --- a/0.73_My_PuTTY/terminal.h +++ b/0.73_My_PuTTY/terminal.h @@ -331,6 +331,8 @@ struct terminal_tag { bool no_applic_k; bool no_dbackspace; bool no_mouse_rep; + bool no_focus_rep; + bool report_focus; bool no_remote_charset; bool no_remote_resize; bool no_remote_wintitle; diff --git a/0.73_My_PuTTY/windows/window.c b/0.73_My_PuTTY/windows/window.c index a8d2531..1bed26f 100644 --- a/0.73_My_PuTTY/windows/window.c +++ b/0.73_My_PuTTY/windows/window.c @@ -382,6 +382,7 @@ static int wintw_char_width(TermWin *, int uc); static void wintw_free_draw_ctx(TermWin *); static void wintw_set_cursor_pos(TermWin *, int x, int y); static void wintw_set_raw_mouse_mode(TermWin *, bool enable); +static void wintw_set_focus_reporting_mode(TermWin *, bool enable); static void wintw_set_scrollbar(TermWin *, int total, int start, int page); static void wintw_bell(TermWin *, int mode); static void wintw_clip_write( @@ -414,6 +415,7 @@ static const TermWinVtable windows_termwin_vt = { wintw_free_draw_ctx, wintw_set_cursor_pos, wintw_set_raw_mouse_mode, + wintw_set_focus_reporting_mode, wintw_set_scrollbar, wintw_bell, wintw_clip_write, @@ -2021,6 +2023,24 @@ static void wintw_set_raw_mouse_mode(TermWin *tw, bool activate) update_mouse_pointer(); } +/* + * set or clear the "window focus messages" mode + */ +static void wintw_set_focus_reporting_mode(TermWin *tw, bool activate) +{ + activate = activate && !conf_get_bool(conf, CONF_no_focus_rep); + + if (activate != term->report_focus) + { + term->report_focus = activate; + //send first activation notification message + if (activate) + { + SendKeyboard(hwnd, "\033[I"); + } + } +} + /* * Print a message box and close the connection. */ diff --git a/kitty_savedump.c b/kitty_savedump.c index fe2cb25..1cad51c 100644 --- a/kitty_savedump.c +++ b/kitty_savedump.c @@ -331,6 +331,7 @@ void SaveDumpConfig( FILE *fp, Conf * conf ) { fprintf( fp, "no_applic_c=%d\n", conf_get_bool(conf,CONF_no_applic_c) ) ; fprintf( fp, "no_applic_k=%d\n", conf_get_bool(conf,CONF_no_applic_k) ) ; fprintf( fp, "no_mouse_rep=%d\n", conf_get_bool(conf,CONF_no_mouse_rep) ) ; + fprintf( fp, "no_focus_rep=%d\n", conf_get_bool(conf,CONF_no_focus_rep) ) ; fprintf( fp, "no_remote_resize=%d\n", conf_get_bool(conf,CONF_no_remote_resize) ) ; fprintf( fp, "no_alt_screen=%d\n", conf_get_bool(conf,CONF_no_alt_screen) ) ; fprintf( fp, "no_remote_wintitle=%d\n", conf_get_bool(conf,CONF_no_remote_wintitle) ) ; diff --git a/kitty_settings.c b/kitty_settings.c index c76fa0b..2d73dc8 100644 --- a/kitty_settings.c +++ b/kitty_settings.c @@ -155,6 +155,7 @@ void save_open_settings_forced(char *filename, Conf *conf) { write_setting_b_forced(sesskey, "NoApplicationKeys", conf_get_bool(conf, CONF_no_applic_k)); write_setting_b_forced(sesskey, "NoApplicationCursors", conf_get_bool(conf, CONF_no_applic_c)); write_setting_b_forced(sesskey, "NoMouseReporting", conf_get_bool(conf, CONF_no_mouse_rep)); + write_setting_b_forced(sesskey, "NoFocusReporting", conf_get_bool(conf, CONF_no_focus_rep)); write_setting_b_forced(sesskey, "NoRemoteResize", conf_get_bool(conf, CONF_no_remote_resize)); write_setting_b_forced(sesskey, "NoAltScreen", conf_get_bool(conf, CONF_no_alt_screen)); write_setting_b_forced(sesskey, "NoRemoteWinTitle", conf_get_bool(conf, CONF_no_remote_wintitle)); @@ -690,6 +691,7 @@ void load_open_settings_forced(char *filename, Conf *conf) { gppb_forced(sesskey, "NoApplicationKeys", false, conf, CONF_no_applic_k); gppb_forced(sesskey, "NoApplicationCursors", false, conf, CONF_no_applic_c); gppb_forced(sesskey, "NoMouseReporting", false, conf, CONF_no_mouse_rep); + gppb_forced(sesskey, "NoFocusReporting", false, conf, CONF_no_focus_rep); gppb_forced(sesskey, "NoRemoteResize", false, conf, CONF_no_remote_resize); gppb_forced(sesskey, "NoAltScreen", false, conf, CONF_no_alt_screen); gppb_forced(sesskey, "NoRemoteWinTitle", false, conf, CONF_no_remote_wintitle);