Skip to content

Commit 6980225

Browse files
committed
强制结束并关闭窗口
1 parent 591fa69 commit 6980225

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

23_day/bootpack.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ struct SHEET {
156156
unsigned char *buf;
157157
int bxsize, bysize, vx0, vy0, col_inv, height, flags;
158158
struct SHTCTL *ctl;
159+
struct TASK *task;
159160
};
160161
struct SHTCTL {
161162
unsigned char *vram, *map;

23_day/console.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,8 @@ int cmd_app(struct CONSOLE *cons, int *fat, char *cmdline)
259259
char name[18], *p, *q;
260260
struct TASK *task = task_now();
261261
int i, segsiz, datsiz, esp, dathrb;
262+
struct SHTCTL *shtctl;
263+
struct SHEET *sht;
262264

263265
/*根据命令行生成文件名*/
264266
for (i = 0; i < 13; i++) {
@@ -298,6 +300,14 @@ int cmd_app(struct CONSOLE *cons, int *fat, char *cmdline)
298300
q[esp + i] = p[dathrb + i];
299301
}
300302
start_app(0x1b, 1003 * 8, esp, 1004 * 8, &(task->tss.esp0));
303+
shtctl = (struct SHTCTL *) *((int *) 0x0fe4);
304+
for (i = 0; i < MAX_SHEETS; i++) {
305+
sht = &(shtctl->sheets0[i]);
306+
if (sht->flags != 0 && sht->task == task) {
307+
/*找到被应用程序遗留的窗口*/
308+
sheet_free(sht); /*关闭*/
309+
}
310+
}
301311
memman_free_4k(memman, (int) q, segsiz);
302312
} else {
303313
cons_putstr0(cons, ".hrb file format error.\n");
@@ -333,6 +343,7 @@ int *hrb_api(int edi, int esi, int ebp, int esp, int ebx, int edx, int ecx, int
333343
return &(task->tss.esp0);
334344
} else if (edx == 5) {
335345
sht = sheet_alloc(shtctl);
346+
sht->task = task;
336347
sheet_setbuf(sht, (char *) ebx + ds_base, esi, edi, eax);
337348
make_window8((char *) ebx + ds_base, esi, edi, (char *) ecx + ds_base, 0);
338349
sheet_slide(sht, 100, 50);

23_day/sheet.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ struct SHEET *sheet_alloc(struct SHTCTL *ctl)
3838
sht = &ctl->sheets0[i];
3939
sht->flags = SHEET_USE; /* 标记为正在使用*/
4040
sht->height = -1; /* 隐藏 */
41+
sht->task = 0; /*不使用自动关闭功能*/
4142
return sht;
4243
}
4344
}

0 commit comments

Comments
 (0)