bool RenderScreenImpl::makeCurrent(const GLContext & context)
{
    HWND hwnd = static_cast<HWND>(r_renderScreen.getWindow().getHandle());
    if (hwnd)
    {
        updatePixelFormat(context);

        HGLRC hrc = context.getImpl()->getHandle();
        HDC hdc = m_hdc;

        return hrc && hdc && wglMakeCurrent(hdc, hrc);
    }
    return false;
}
void RemoteViewerCore::sendFbUpdateRequest(bool incremental)
{
  {
    AutoLock al(&m_requestUpdateLock);
    bool requestUpdate = m_isNeedRequestUpdate;
    m_isNeedRequestUpdate = false;
    if (!requestUpdate)
      return;
  }

  bool isRefresh = false;
  bool isUpdateFbProperties = false;
  if (updatePixelFormat()) {
    isUpdateFbProperties = true;
  }

  {
    AutoLock al(&m_refreshingLock);
    if (m_isRefreshing) {
      m_isRefreshing= false;
      isRefresh = true;
    }
  }

  bool isIncremental = incremental && !isRefresh && !isUpdateFbProperties;
  Rect updateRect;
  {
    AutoLock al(&m_fbLock);
    updateRect = m_frameBuffer.getDimension().getRect();
  }

  if (isIncremental) {
    m_logWriter.debug(_T("Sending frame buffer incremental update request [%dx%d]..."),
                      updateRect.getWidth(), updateRect.getHeight());
  } else {
    m_logWriter.debug(_T("Sending frame buffer full update request [%dx%d]..."),
                      updateRect.getWidth(), updateRect.getHeight());
  }

  RfbFramebufferUpdateRequestClientMessage fbUpdReq(isIncremental, updateRect);
  fbUpdReq.send(m_output);
  m_logWriter.debug(_T("Frame buffer update request is sent"));
}