From f23375b14e41e075360617ecd821385d057137e6 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Wed, 23 Mar 2016 22:03:46 +0000 Subject: [PATCH] Delegate GTK window creation to gtkmain.c. This is a weird thing to have to do, but it is necessary: the OS X PuTTY will need its top-level windows to be instances of a thing called GtkApplicationWindow, rather than plain GtkWindow. Hence, the actual creation of windows needs to be somewhere that isn't centralised between the two kinds of front end. --- unix/gtkmain.c | 5 +++++ unix/gtkwin.c | 2 +- unix/unix.h | 3 +++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/unix/gtkmain.c b/unix/gtkmain.c index eb731ea8..00db3464 100644 --- a/unix/gtkmain.c +++ b/unix/gtkmain.c @@ -532,6 +532,11 @@ int do_cmdline(int argc, char **argv, int do_everything, int *allow_launch, return err; } +GtkWidget *make_gtk_toplevel_window(void *frontend) +{ + return gtk_window_new(GTK_WINDOW_TOPLEVEL); +} + extern int cfgbox(Conf *conf); int main(int argc, char **argv) diff --git a/unix/gtkwin.c b/unix/gtkwin.c index 3ed58b08..49db1fe5 100644 --- a/unix/gtkwin.c +++ b/unix/gtkwin.c @@ -4120,7 +4120,7 @@ struct gui_data *new_session_window(Conf *conf, const char *geometry_string) exit(1); } } - inst->window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + inst->window = make_gtk_toplevel_window(inst); { const char *winclass = conf_get_str(inst->conf, CONF_winclass); if (*winclass) diff --git a/unix/unix.h b/unix/unix.h index 3b8982c2..12ab8b1c 100644 --- a/unix/unix.h +++ b/unix/unix.h @@ -102,6 +102,9 @@ struct gui_data *new_session_window(Conf *conf, const char *geometry_string); void launch_duplicate_session(Conf *conf); void launch_new_session(void); void launch_saved_session(const char *str); +#ifdef MAY_REFER_TO_GTK_IN_HEADERS +GtkWidget *make_gtk_toplevel_window(void *frontend); +#endif /* Defined in gtkcomm.c */ void gtkcomm_setup(void); -- 2.45.2