From e893421dba5e8fd952a0e39d9a3e4b9e650b5b6f Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Thu, 26 Mar 2020 14:46:48 +0900 Subject: [PATCH] [qwaq] Get context from owner instead of prev view The previous view might be nil, which would result in the new view not getting a context. --- ruamoko/qwaq/qwaq-group.h | 2 ++ ruamoko/qwaq/qwaq-group.r | 11 +++++++++++ ruamoko/qwaq/qwaq-proxyview.h | 3 +++ ruamoko/qwaq/qwaq-proxyview.r | 10 ++++++++-- 4 files changed, 24 insertions(+), 2 deletions(-) diff --git a/ruamoko/qwaq/qwaq-group.h b/ruamoko/qwaq/qwaq-group.h index 3d9c53e65..70e2663a0 100644 --- a/ruamoko/qwaq/qwaq-group.h +++ b/ruamoko/qwaq/qwaq-group.h @@ -18,6 +18,8 @@ id context; } -initWithContext: (id) context owner: (View *) owner; +-(id)context; +-setContext: (id) context; -insert: (View *) view; -insertDrawn: (View *) view; -insertSelected: (View *) view; diff --git a/ruamoko/qwaq/qwaq-group.r b/ruamoko/qwaq/qwaq-group.r index a78837c5a..5ae197a2a 100644 --- a/ruamoko/qwaq/qwaq-group.r +++ b/ruamoko/qwaq/qwaq-group.r @@ -24,6 +24,17 @@ [views release]; } +-(id)context +{ + return context; +} + +-setContext: (id) context +{ + self.context = context; + return self; +} + -insert: (View *) view { [views addObject: view]; diff --git a/ruamoko/qwaq/qwaq-proxyview.h b/ruamoko/qwaq/qwaq-proxyview.h index 7789678fc..449ac5fd6 100644 --- a/ruamoko/qwaq/qwaq-proxyview.h +++ b/ruamoko/qwaq/qwaq-proxyview.h @@ -3,9 +3,12 @@ #include "qwaq-view.h" +@class Group; + @interface ProxyView : Object { View *view; + Group *owner; } -initWithView:(View *) view; -setView: (View *) view; diff --git a/ruamoko/qwaq/qwaq-proxyview.r b/ruamoko/qwaq/qwaq-proxyview.r index e0f2bb469..b5946eba5 100644 --- a/ruamoko/qwaq/qwaq-proxyview.r +++ b/ruamoko/qwaq/qwaq-proxyview.r @@ -1,3 +1,4 @@ +#include "qwaq-group.h" #include "qwaq-proxyview.h" @implementation ProxyView @@ -18,10 +19,15 @@ return self; } +-setOwner:(Group *)owner +{ + self.owner = owner; + return [view setOwner:owner]; +} + -setView:(View *) view { int state = [self.view state]; - id context = [self.view context]; if (state & sfInFocus) { [self.view loseFocus]; @@ -30,7 +36,7 @@ [self.view setContext:nil]; self.view = view; - [view setContext:context]; + [view setContext:[owner context]]; if (state & sfDrawn) { [view draw]; }