summaryrefslogtreecommitdiff
path: root/libtk/twind.c
diff options
context:
space:
mode:
authorforsyth <forsyth@vitanuova.com>2010-08-22 13:59:46 +0100
committerforsyth <forsyth@vitanuova.com>2010-08-22 13:59:46 +0100
commitc9c0d12ef55c878b0e361f9f6936bbb4c67b40fb (patch)
tree51b281d84a574b539803d8c0a68873b77b2408fd /libtk/twind.c
parent43d5f895e7e089a8ca755eca0a19386de5f59f61 (diff)
20100822-1358
Diffstat (limited to 'libtk/twind.c')
-rw-r--r--libtk/twind.c31
1 files changed, 12 insertions, 19 deletions
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;