1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-06-30 19:12:48 -05:00

Remove TermWin's is_minimised method.

Again, I've replaced it with a push-based notification going in the
other direction, so that when the terminal output stream includes a
query for 'is the window minimised?', the Terminal doesn't have to
consult the TermWin, because it already knows the answer.

The GTK API I'm using here (getting a GdkEventWindowState via
GtkWidget's window-state-event) is not present in GTK 1. The API I was
previously using (gdk_window_is_viewable) _is_, but it turns out that
that API doesn't reliably give the right answer: it only checks
visibility of GDK window ancestors, not X window ancestors. So in fact
GTK 1 PuTTY/pterm was only ever _pretending_ to reliably support the
'am I minimised' terminal query. Now it won't pretend any more.
This commit is contained in:
Simon Tatham
2021-02-07 19:59:20 +00:00
parent 42ad454f4f
commit 61571376cc
6 changed files with 26 additions and 25 deletions

View File

@ -565,15 +565,6 @@ static void gtkwin_set_maximised(TermWin *tw, bool maximised)
#endif
}
/*
* Report whether the window is minimised, for terminal reports.
*/
static bool gtkwin_is_minimised(TermWin *tw)
{
GtkFrontend *inst = container_of(tw, GtkFrontend, termwin);
return !gdk_window_is_viewable(gtk_widget_get_window(inst->window));
}
/*
* Report the window's position, for terminal reports.
*/
@ -670,6 +661,16 @@ gint delete_window(GtkWidget *widget, GdkEvent *event, GtkFrontend *inst)
return false;
}
#if GTK_CHECK_VERSION(2,0,0)
static void window_state_event(GtkWidget *widget, GdkEventWindowState *event,
gpointer user_data)
{
GtkFrontend *inst = (GtkFrontend *)user_data;
term_notify_minimised(
inst->term, event->new_window_state & GDK_WINDOW_STATE_ICONIFIED);
}
#endif
static void update_mouseptr(GtkFrontend *inst)
{
switch (inst->busy_status) {
@ -5148,7 +5149,6 @@ static const TermWinVtable gtk_termwin_vt = {
.set_title = gtkwin_set_title,
.set_icon_title = gtkwin_set_icon_title,
.set_minimised = gtkwin_set_minimised,
.is_minimised = gtkwin_is_minimised,
.set_maximised = gtkwin_set_maximised,
.move = gtkwin_move,
.set_zorder = gtkwin_set_zorder,
@ -5506,6 +5506,12 @@ void new_session_window(Conf *conf, const char *geometry_string)
term_size(inst->term, inst->height, inst->width,
conf_get_int(inst->conf, CONF_savelines));
#if GTK_CHECK_VERSION(2,0,0)
/* Delay this signal connection until after inst->term exists */
g_signal_connect(G_OBJECT(inst->window), "window_state_event",
G_CALLBACK(window_state_event), inst);
#endif
inst->exited = false;
start_backend(inst);