mirror of
https://github.com/yourtion/30dayMakeOS.git
synced 2026-02-06 19:43:19 +08:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8264071442 | ||
|
|
d77f778b8e | ||
|
|
991da3f569 |
@@ -42,6 +42,8 @@ void HariMain(void)
|
||||
};
|
||||
int key_to = 0, key_shift = 0, key_leds = (binfo->leds >> 4) & 7, keycmd_wait = -1;
|
||||
struct CONSOLE *cons;
|
||||
int j, x, y, mmx = -1, mmy = -1;
|
||||
struct SHEET *sht = 0;
|
||||
|
||||
init_gdtidt();
|
||||
init_pic();
|
||||
@@ -265,10 +267,53 @@ void HariMain(void)
|
||||
if (my > binfo->scrny - 1) {
|
||||
my = binfo->scrny - 1;
|
||||
}
|
||||
|
||||
sheet_slide(sht_mouse, mx, my);/* 包含sheet_refresh含sheet_refresh */
|
||||
if ((mdec.btn & 0x01) != 0) { /* 按下左键、移动sht_win */
|
||||
sheet_slide(sht_win, mx - 80, my - 8);
|
||||
|
||||
if ((mdec.btn & 0x01) != 0) { /* 按下左键 */
|
||||
if (mmx < 0) {
|
||||
/*如果处于通常模式*/
|
||||
/*按照从上到下的顺序寻找鼠标所指向的图层*/
|
||||
for (j = shtctl->top - 1; j > 0; j--) {
|
||||
sht = shtctl->sheets[j];
|
||||
x = mx - sht->vx0;
|
||||
y = my - sht->vy0;
|
||||
if (0 <= x && x < sht->bxsize && 0 <= y && y < sht->bysize) {
|
||||
if (sht->buf[y * sht->bxsize + x] != sht->col_inv) {
|
||||
sheet_updown(sht, shtctl->top - 1);
|
||||
if (3 <= x && x < sht->bxsize - 3 && 3 <= y && y < 21) {
|
||||
mmx = mx; /*进入窗口移动模式*/
|
||||
mmy = my;
|
||||
}
|
||||
if (sht->bxsize - 21 <= x && x < sht->bxsize - 5 && 5 <=y && y < 19) {
|
||||
/*点击“×”按钮*/
|
||||
if (sht->task != 0) { /*该窗口是否为应用程序窗口?*/
|
||||
cons = (struct CONSOLE *) *((int *) 0x0fec);
|
||||
cons_putstr0(cons, "\nBreak(mouse) :\n");
|
||||
io_cli(); /*强制结束处理中禁止切换任务*/
|
||||
task_cons->tss.eax = (int)
|
||||
&(task_cons->tss.esp0);
|
||||
task_cons->tss.eip = (int) asm_end_app;
|
||||
io_sti();
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/*如果处于窗口移动模式*/
|
||||
x = mx - mmx; /*计算鼠标的移动距离*/
|
||||
y = my - mmy;
|
||||
sheet_slide(sht, sht->vx0 + x, sht->vy0 + y);
|
||||
mmx = mx; /*更新为移动后的坐标*/
|
||||
mmy = my;
|
||||
}
|
||||
} else {
|
||||
/*没有按下左键*/
|
||||
mmx = -1; /*返回通常模式*/
|
||||
}
|
||||
|
||||
}
|
||||
} else if (i <= 1) { /* 光标用定时器*/
|
||||
if (i != 0) {
|
||||
|
||||
Reference in New Issue
Block a user