// // Update mouse status and issue events on it if necessary. // This function doesn't block, but is normally only called when // there is known to be some data waiting to be read from the mouse. // BOOL GsCheckMouseEvent(void) { MWCOORD rootx; // latest mouse x position MWCOORD rooty; // latest mouse y position int newbuttons; // latest buttons int mousestatus; // latest mouse status // Read the latest mouse status: display_puts("mouse read\n"); mousestatus = GdReadMouse(&rootx, &rooty, &newbuttons); if(mousestatus < 0) { display_puts("Mouse error\n"); return FALSE; } else if(mousestatus) { // Deliver events as appropriate: /* display_puts("mouse "); sint2dec(rootx,s); display_puts(s); display_puts(","); sint2dec(rooty,s); display_puts(s); display_puts(","); long2hex(newbuttons,s); display_puts(s); display_puts("\n"); */ if(newbuttons&0x1) tstColorGd++; GdSetForegroundPixelVal(psd, tstColorGd); GdPoint(psd, rootx, rooty); return TRUE; } return FALSE; }
COLORREF WINAPI SetPixel(HDC hdc, int x, int y, COLORREF crColor) { HWND hwnd; POINT pt; hwnd = MwPrepareDC(hdc); if(!hwnd) return 0; /* doesn't return previous color*/ pt.x = x; pt.y = y; if(MwIsClientDC(hdc)) ClientToScreen(hwnd, &pt); /* draw point in passed color*/ GdSetForegroundColor(hdc->psd, crColor); GdPoint(hdc->psd, pt.x, pt.y); return 0; /* doesn't return previous color*/ }