On Wed, Aug 22, 2018 at 2:00 PM, R0b0t1 <r03...@gmail.com> wrote: > It looks like freerdp is not processing the new events for some > reason, but I am not sure of any functions to call to ensure they are > processed. A worker thread is ticking along in the background and SDL2 > is receiving events. >
A sudden realization and a test later I found the issue was simply the screen did not update frequently enough. On one hand this seems like it can't explain all of what I observed, but updating in between input and window events removes the issues. The FreeRDP "client" thread is still using WaitForMultipleObjects. What should I be doing to draw more frequently? How do I ensure I do not draw a stale image? What I am doing currently is attached. Technically the proper operation of the code below is not guaranteed as the callback is, as I understand it, called on the thread invoking freerdp_check_event_handles and not the main thread, but modifying the code so that it runs constantly but still on the non-main thread produces acceptable behavior. Without knowing the minutiae of FreeRDP's operation the easiest solution would be to have another wakeup source I could use to paint with my own code, but perhaps there is a bug in FreeRDP? When using the code below there is also issues with regions of the window being invalidated and not updated, but this might be a problem with my use of SDL2 (even though I should be blitting the entire window surface). Cheers, R0b0t1 BOOL rdpuppet_begin_paint(rdpContext *context) { printf("rdpuppet_begin_paint\n"); if (!context) return false; rdpGdi *gdi = context->gdi; if (!gdi || !gdi->primary || !gdi->primary->hdc) return false; HGDI_WND hwnd = gdi->primary->hdc->hwnd; if (!hwnd || !hwnd->invalid) return false; hwnd->invalid->null = true; hwnd->ninvalid = 0; // For application. const struct rdpuppet_context *rdpc = (const struct rdpuppet_context *)context; rdpGdi *rdg = rdpc->rdp_context.gdi; SDL_Texture *texture = rdpc->texture; SDL_Renderer *renderer = rdpc->renderer; SDL_LockTexture(texture, NULL, (void **)&rdg->primary->bitmap->data, (int *)&rdg->primary->bitmap->scanline); SDL_UpdateTexture(texture, NULL, rdg->primary->bitmap->data, rdg->primary->bitmap->scanline); //SDL_UnlockTexture(texture); SDL_RenderCopy(renderer, texture, NULL, NULL); SDL_RenderPresent(renderer); return true; } ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ FreeRDP-devel mailing list FreeRDP-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freerdp-devel