From 14b05069b61d8d86d52415acb1adea7a61547ac6 Mon Sep 17 00:00:00 2001 From: "N.N." Date: Mon, 29 Mar 2004 17:09:53 +0000 Subject: toxy alpha10 svn path=/trunk/externals/miXed/; revision=1502 --- shared/hammer/gui.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) (limited to 'shared/hammer/gui.c') diff --git a/shared/hammer/gui.c b/shared/hammer/gui.c index 5e98ff8..131ddfe 100644 --- a/shared/hammer/gui.c +++ b/shared/hammer/gui.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2003 krzYszcz and others. +/* Copyright (c) 2003-2004 krzYszcz and others. * For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ @@ -131,9 +131,11 @@ static void hammergui__remouse(t_hammergui *snk) static void hammergui_dobindfocus(t_hammergui *snk) { sys_vgui("bind Canvas <> \ - {pd [concat %s _focus %%W 1 \\;]}\n", snk->g_gui->s_name); + {if {[hammergui_ispatcher %%W]} \ + {pd [concat %s _focus %%W 1 \\;]}}\n", snk->g_gui->s_name); sys_vgui("bind Canvas <> \ - {pd [concat %s _focus %%W 0 \\;]}\n", snk->g_gui->s_name); + {if {[hammergui_ispatcher %%W]} \ + {pd [concat %s _focus %%W 0 \\;]}}\n", snk->g_gui->s_name); } static void hammergui__refocus(t_hammergui *snk) @@ -152,9 +154,11 @@ static void hammergui__refocus(t_hammergui *snk) static void hammergui_dobindvised(t_hammergui *snk) { sys_vgui("bind Canvas <> \ - {pd [concat %s _vised %%W 1 \\;]}\n", snk->g_gui->s_name); + {if {[hammergui_ispatcher %%W]} \ + {pd [concat %s _vised %%W 1 \\;]}}\n", snk->g_gui->s_name); sys_vgui("bind Canvas <> \ - {pd [concat %s _vised %%W 0 \\;]}\n", snk->g_gui->s_name); + {if {[hammergui_ispatcher %%W]} \ + {pd [concat %s _vised %%W 0 \\;]}}\n", snk->g_gui->s_name); } static void hammergui__revised(t_hammergui *snk) @@ -192,6 +196,17 @@ static void hammergui_setup(void) class_addmethod(hammergui_class, (t_method)hammergui__vised, ps__vised, A_SYMBOL, A_FLOAT, 0); + /* Protect against pdCmd being called (via "Canvas " binding) + during Tcl_Finalize(). FIXME this should be a standard exit handler. */ + sys_gui("proc hammergui_exithook {cmd op} {proc pd {} {}}\n"); + sys_gui("trace add execution exit enter hammergui_exithook\n"); + + sys_gui("proc hammergui_ispatcher {cv} {\n"); + sys_gui(" if {[string range $cv 0 1] == \".x\""); + sys_gui(" && [string range $cv end-1 end] == \".c\"} {\n"); + sys_gui(" return 1} else {return 0}\n"); + sys_gui("}\n"); + sys_gui("proc hammergui_remouse {} {\n"); sys_gui(" bind all <> {}\n"); sys_gui(" bind all <> {}\n"); -- cgit v1.2.1