From c9c0d12ef55c878b0e361f9f6936bbb4c67b40fb Mon Sep 17 00:00:00 2001 From: forsyth Date: Sun, 22 Aug 2010 13:59:46 +0100 Subject: 20100822-1358 --- libtk/twind.c | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-) (limited to 'libtk/twind.c') diff --git a/libtk/twind.c b/libtk/twind.c index 19ea7afd..f08d1b0e 100644 --- a/libtk/twind.c +++ b/libtk/twind.c @@ -101,21 +101,19 @@ tktwindsize(Tk *tk, TkTindex *ix) tktextsize(tk, 1); } -/* - * check that w->focus is a window packed under tk. - * XXX couldn't this be done more simply by traversing - * directly upwards from w->focus and seeing whether - * it hits tk? (same applies to tkcvschkwfocus in cwind.c) - */ -static int -tktchkwfocus(TkTwind *w, Tk *tk) +void +tktxtforgetsub(Tk *sub, Tk *tk) { - if(w->focus == tk) - return 1; - for(tk = tk->slave; tk; tk = tk->next) - if(tktchkwfocus(w, tk)) - return 1; - return 0; + TkTwind *w; + TkTindex ix; + + if(!tktfindsubitem(sub, &ix)) + return; + w = ix.item->iwin; + if(w->focus == tk) { +if(0)print("tktxtforget sub %p %q focus %p %q\n", sub, tkname(sub), tk, tkname(tk)); + w->focus = nil; + } } static void @@ -136,11 +134,6 @@ tktwingeom(Tk *sub, int x, int y, int w, int h) win = ix.item->iwin; - if(win->focus != nil) { - if(tktchkwfocus(win, sub) == 0) - win->focus = nil; - } - win->width = w; win->height = h; -- cgit v1.2.3