void Paint() { if (this->disableCount == 0) { cursor.Erase(); cursor.Paint(this->posX, this->posY); } commonParams->mouse.x = this->prevX = this->posX; commonParams->mouse.y = this->prevY = this->posY; commonParams->mouse.buttons = this->prevButton = this->button; }
void MessageLoop() { for (MessageInfo receive;;) { if (Message::receive(&receive)) continue; switch(receive.header) { case MSG_ADD: /* arg1 = tid */ this->destList->add(receive.arg1); Message::reply(&receive); break; case MSG_REMOVE: /* arg1 = tid */ this->destList->remove(receive.arg1); Message::reply(&receive); break; case MSG_MOUSE_ENABLE_CURSOR: if (this->disableCount > 0) { this->disableCount--; if (this->disableCount == 0) cursor.Paint(this->prevX, this->prevY); } Message::reply(&receive); break; case MSG_MOUSE_DISABLE_CURSOR: if (this->disableCount == 0) cursor.Erase(); this->disableCount++; Message::reply(&receive); break; case MSG_MOUSE_GET_CURSOR_POSITION: Message::reply(&receive, this->prevX, this->prevY); break; case MSG_MOUSE_SET_CURSOR_POSITION: this->posX = receive.arg1; this->posY = receive.arg2; Paint(); Message::reply(&receive); SendMouseInformation(); break; case MSG_INTERRUPTED: /* we get not all data */ if (GetMouseData() != 2) break; /* state not changed. */ if (!SetCurosor()) break; Paint(); SendMouseInformation(); break; default: /* ignore */ // _printf("mouse:header=%x", receive.header); break; } } }