int major, minor;
XGCValues values;
- if (XShmQueryExtension(xfi->display) != False)
+ if (xfi->use_xshm)
{
- XShmQueryVersion(xfi->display, &major, &minor, &pixmaps);
+ if (XShmQueryExtension(xfi->display) != False)
+ {
+ XShmQueryVersion(xfi->display, &major, &minor, &pixmaps);
- if (pixmaps != True)
+ if (pixmaps != True)
+ {
+ printf("XShmQueryVersion failed\n");
+ return;
+ }
+ }
+ else
{
- printf("XShmQueryVersion failed\n");
+ printf("XShmQueryExtension failed\n");
return;
}
}
- else
- {
- printf("XShmQueryExtension failed\n");
- return;
- }
if (XDamageQueryExtension(xfi->display, &damage_event, &damage_error) == 0)
{
shmctl(xfi->fb_shm_info.shmid, IPC_RMID, 0);
+ printf("display: %p root_window: %p width: %d height: %d depth: %d\n",
+ xfi->display, xfi->root_window, xfi->fb_image->width, xfi->fb_image->height, xfi->fb_image->depth);
+
xfi->fb_pixmap = XShmCreatePixmap(xfi->display,
xfi->root_window, xfi->fb_image->data, &(xfi->fb_shm_info),
xfi->fb_image->width, xfi->fb_image->height, xfi->fb_image->depth);
xfi = (xfInfo*) malloc(sizeof(xfInfo));
ZeroMemory(xfi, sizeof(xfInfo));
- xfi->use_xshm = TRUE;
+ /**
+ * Recent X11 servers drop support for shared pixmaps
+ * To see if your X11 server supports shared pixmaps, use:
+ * xdpyinfo -ext MIT-SHM | grep "shared pixmaps"
+ */
+ xfi->use_xshm = FALSE;
+
xfi->display = XOpenDisplay(NULL);
XInitThreads();
xf_xdamage_init(xfi);
#endif
- xf_xshm_init(xfi);
+ if (xfi->use_xshm)
+ xf_xshm_init(xfi);
xfi->bytesPerPixel = 4;
{
xfPeerContext* xfp = (xfPeerContext*) client->context;
- if (xfp->activations == 1)
- pthread_create(&(xfp->thread), 0, xf_monitor_updates, (void*) client);
+ pthread_create(&(xfp->thread), 0, xf_monitor_updates, (void*) client);
}
static BOOL xf_peer_sleep_tsdiff(UINT32 *old_sec, UINT32 *old_usec, UINT32 new_sec, UINT32 new_usec)
image = xf_snapshot(xfp, x, y, width, height);
- rfx_compose_message(xfp->rfx_context, s, &rect, 1,
- (BYTE*) image->data, width, height, width * xfi->bytesPerPixel);
+ data = (BYTE*) image->data;
+ data = &data[(y * image->bytes_per_line) + (x * image->bits_per_pixel / 8)];
+
+ rfx_compose_message(xfp->rfx_context, s, &rect, 1, data,
+ width, height, image->bytes_per_line);
cmd->destLeft = x;
cmd->destTop = y;
if (!client->settings->RemoteFxCodec)
{
printf("Client does not support RemoteFX\n");
- return 0;
+ return FALSE;
}
/* A real server should tag the peer as activated here and start sending updates in main loop. */
client->settings->DesktopHeight = xfi->height;
client->update->DesktopResize(client->update->context);
- xfp->activated = FALSE;
- /* Return FALSE here would stop the execution of the peer mainloop. */
+ /* Return FALSE here would stop the execution of the peer main loop. */
return TRUE;
}
else
{
xf_peer_live_rfx(client);
- xfp->activations++;
}
return TRUE;