From 7a3f43b7cc0d3d33633ac884ba72e8c764f3f6df Mon Sep 17 00:00:00 2001 From: Ivica Ico Bukvic <ico@monsoon-hp.(none)> Date: Thu, 23 Feb 2012 23:51:47 -0500 Subject: [PATCH] added ability to deselect currently selected objects from the canvas if focusing outside the said canvas window --- src/g_editor.c | 3 ++- src/pd.tk | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/g_editor.c b/src/g_editor.c index df59c3923..1834d1923 100644 --- a/src/g_editor.c +++ b/src/g_editor.c @@ -4614,7 +4614,8 @@ void g_editor_setup(void) A_GIMME, A_NULL); class_addmethod(canvas_class, (t_method)canvas_motion, gensym("motion"), A_FLOAT, A_FLOAT, A_FLOAT, A_NULL); - + class_addmethod(canvas_class, (t_method)glist_noselect, + gensym("noselect"), A_NULL); /* ------------------------ menu actions ---------------------------- */ class_addmethod(canvas_class, (t_method)canvas_menuclose, gensym("menuclose"), A_DEFFLOAT, 0); diff --git a/src/pd.tk b/src/pd.tk index 847598a7f..1d0340b7b 100644 --- a/src/pd.tk +++ b/src/pd.tk @@ -2527,9 +2527,15 @@ proc pdtk_canvas_new {name width height geometry editable} { set pdtk_canvas_mouseup_name "" bind $name <FocusIn> "menu_fixeditmenu $name" + bind $name <FocusOut> { pdtk_noselect %W } focus $name.c } +proc pdtk_noselect {name} { + set topname [string trimright $name .c] + pd [concat $topname noselect \;] +} + #### jsarlo ##### proc pdtk_array_listview_setpage {arrayName page} { global pd_array_listview_page -- GitLab