[qwaq] Improve focus setting

The view is recorded as having focus but is not given focus until the
parent view is actually in focus. This fixes the locals view not having
focus at startup and thus blocking F7.
This commit is contained in:
Bill Currie 2020-03-26 18:27:02 +09:00
parent b2814700b9
commit adb7b018d9

View file

@ -97,7 +97,7 @@ trySetFocus (Group *self, int viewIndex)
View *view = [self.views objectAtIndex:viewIndex];
if (([view state] & (sfDrawn | sfDisabled)) == sfDrawn
&& [view options] & ofCanFocus) {
if (!self.owner || [self.owner state] & sfInFocus) {
if (!self.owner || ([self.owner state] & sfInFocus)) {
if (self.focused >= 0) {
[[self.views objectAtIndex: self.focused] loseFocus];
}
@ -106,6 +106,8 @@ trySetFocus (Group *self, int viewIndex)
self.focused = makeFirst (self, viewIndex);
}
[view takeFocus];
} else {
self.focused = viewIndex;
}
return 1;
}