const int TIMER_BUMPSCROLL = 1;
const int TIMER_POINTER_INTERVAL = 2;
const int TIMER_POINTER_3BUTTON = 3;
+const int TIMER_UPDATE = 4;
//
bumpScrollTimer.setHWND(handle);
bumpScrollTimer.setId(TIMER_BUMPSCROLL);
+ // Initialise the update timer
+ updateTimer.setHWND(handle);
+ updateTimer.setId(TIMER_UPDATE);
+
// Hook the clipboard
clipboard.setNotifier(this);
case TIMER_POINTER_3BUTTON:
ptr.handleTimer(callback, wParam);
break;
+ case TIMER_UPDATE:
+ updateWindow();
+ break;
}
break;
#endif
}
+void DesktopWindow::updateWindow()
+{
+ Rect rect;
+
+ updateTimer.stop();
+
+ rect = damage.get_bounding_rect();
+ damage.clear();
+
+ RECT invalid = {rect.tl.x, rect.tl.y, rect.br.x, rect.br.y};
+ InvalidateRect(frameHandle, &invalid, FALSE);
+}
+
void
DesktopWindow::hideLocalCursor() {
// - Blit the cursor backing store over the cursor
renderLocalCursor();
invalidateDesktopRect(cursorBackingRect, false);
+ // Since we render the cursor onto the framebuffer, we need to update
+ // right away to get a responsive cursor.
+ updateWindow();
}
}
rect = desktopToClient(buffer->calculateScaleBoundary(crect));
} else rect = desktopToClient(crect);
if (rect.intersect(client_size).is_empty()) return false;
- RECT invalid = {rect.tl.x, rect.tl.y, rect.br.x, rect.br.y};
- InvalidateRect(frameHandle, &invalid, FALSE);
+ damage.assign_union(rfb::Region(rect));
+ if (!updateTimer.isActive())
+ updateTimer.start(100);
return true;
}
}
+void DesktopWindow::framebufferUpdateEnd()
+{
+ updateWindow();
+}
+
+
void
DesktopWindow::setName(const char* name) {
if (name != desktopName) {
// - Set the local clipboard
void serverCutText(const char* str, rdr::U32 len);
+ // - Completion of one FramebufferUpdate
+ void framebufferUpdateEnd();
+
// - Draw into the desktop buffer & update the window
void fillRect(const Rect& r, Pixel pix);
void imageRect(const Rect& r, void* pixels);
Point bumpScrollDelta;
IntervalTimer bumpScrollTimer;
+ // Track modified areas of the framebuffer
+ void updateWindow();
+
// Locally-rendered VNC cursor
void hideLocalCursor();
void showLocalCursor();
bool fullscreenActive;
bool fullscreenRestore;
+ // Damage tracking
+ rfb::Region damage;
+ IntervalTimer updateTimer;
+
// Cursor handling
Cursor cursor;
bool systemCursorVisible; // Should system-cursor be drawn?