[qwaq] Fix window closure

Now the device windows close properly when an input device is removed.
This commit is contained in:
Bill Currie 2021-09-26 10:07:34 +09:00
parent 192b76ddc6
commit ac25d9f1c1
14 changed files with 49 additions and 4 deletions

View file

@ -52,6 +52,7 @@ free_defs (LocalsData *self)
obj_free (data);
data = nil;
}
[super dealloc];
}
-setFunction:(unsigned) fnum

View file

@ -57,6 +57,7 @@
}
obj_free (element_views);
obj_free (element_rows);
[super dealloc];
}
-draw

View file

@ -26,6 +26,7 @@
obj_free (ptr_data);
}
[ptr_view release];
[super dealloc];
}
-draw

View file

@ -64,6 +64,7 @@
}
obj_free (field_views);
obj_free (field_rows);
[super dealloc];
}
-draw

View file

@ -22,7 +22,7 @@
-draw
{
[super draw];
[self mvprintf:{0, 0}, "%*.*d", xlen, xlen, axis.value];
[self mvprintf:{0, 0}, "%*d", xlen, axis.value];
return self;
}

View file

@ -20,6 +20,8 @@
-updateAxis:(int)axis value:(int)value;
-updateButton:(int)button state:(int)state;
-(int)devid;
-(string)name;
-(string)id;
-redraw;
@end

View file

@ -43,13 +43,15 @@
-(void)dealloc
{
[application removeView:window];
[axis_data release];
obj_free (device.axes);
obj_free (device.buttons);
str_free (device.name);
str_free (device.id);
obj_free (device);
[application removeView:window];
[super dealloc];
}
-updateAxis:(int)axis value:(int)value
@ -68,6 +70,16 @@
return devid;
}
-(string)name
{
return device.name;
}
-(string)id
{
return device.id;
}
-redraw
{
[axis_view redraw];

View file

@ -111,6 +111,7 @@ arp_end (void)
Device *device = [Device withDevice:dev id:devid];
[devices addObject:device];
}
event.what = qe_none;
break;
case qe_dev_rem:
for (int i = [devices count]; i-- > 0; ) {
@ -120,6 +121,7 @@ arp_end (void)
break;
}
}
event.what = qe_none;
break;
case qe_axis:
for (int i = [devices count]; i-- > 0; ) {
@ -131,6 +133,7 @@ arp_end (void)
break;
}
}
event.what = qe_none;
break;
case qe_button:
for (int i = [devices count]; i-- > 0; ) {
@ -142,6 +145,7 @@ arp_end (void)
break;
}
}
event.what = qe_none;
break;
}
if (event.what != qe_none) {

View file

@ -15,6 +15,7 @@
@end
@protocol TextContext
- (void) release;
- blitFromBuffer: (DrawBuffer *) srcBuffer to: (Point) pos from: (Rect) rect;
- clearReact: (Rect) rect;
- (Extent) size;

View file

@ -71,7 +71,9 @@
{
int index = [views indexOfObject: view];
if (index != NotFound) {
[views removeObjectAtIndex: index];
if (focused == index) {
focused--;
[self selectPrev];
if (focused == index) {
focused = -1;
@ -79,7 +81,6 @@
} else if (focused > index) {
focused--;
}
[views removeObjectAtIndex: index];
if (mouse_within == view) {
mouse_within = nil;
}

View file

@ -73,6 +73,13 @@ static TextContext *screen;
return self;
}
-(void)delloc
{
if (window != stdscr) {
destroy_window (window);
}
}
-(window_t) window
{
return window;

View file

@ -12,6 +12,7 @@
+(TitleBar *)withTitle:(string)title;
-initWithTitle:(string)title;
-setTitle:(string)newTitle;
-(string)title;
@end
#endif//__qwaq_ui_titlebar_h

View file

@ -29,6 +29,11 @@
return self;
}
-(string)title
{
return title;
}
-setOwner: (Group *) owner
{
[super setOwner: owner];

View file

@ -71,6 +71,14 @@
return self;
}
-(void)dealloc
{
destroy_panel (panel);
[textContext release];
[objects release];
[super dealloc];
}
-updateScreenCursor
{
window_t window = [(id)textContext window];