private void AddExpose (Hwnd hwnd, bool client, int x, int y, int width, int height) {
// Don't waste time
if ((hwnd == null) || (x > hwnd.Width) || (y > hwnd.Height) || ((x + width) < 0) || ((y + height) < 0)) {
return;
}
// Keep the invalid area as small as needed
if ((x + width) > hwnd.width) {
width = hwnd.width - x;
}
if ((y + height) > hwnd.height) {
height = hwnd.height - y;
}
if (client) {
hwnd.AddInvalidArea(x, y, width, height);
if (!hwnd.expose_pending) {
if (!hwnd.nc_expose_pending) {
hwnd.Queue.Paint.Enqueue(hwnd);
}
hwnd.expose_pending = true;
}
} else {
hwnd.AddNcInvalidArea (x, y, width, height);
if (!hwnd.nc_expose_pending) {
if (!hwnd.expose_pending) {
hwnd.Queue.Paint.Enqueue(hwnd);
}
hwnd.nc_expose_pending = true;
}
}
}