Skip to content
This repository
Browse code

Merge pull request #620 from llyzs/x11

x11: implement frame marker.
  • Loading branch information...
commit e7fd72b4d44722a8fff164716867cc0b2c766053 2 parents f5bafd6 + aca53f3
Vic Lee llyzs authored

Showing 2 changed files with 74 additions and 27 deletions. Show diff stats Hide diff stats

  1. +68 27 client/X11/xf_gdi.c
  2. +6 0 client/X11/xfreerdp.h
95 client/X11/xf_gdi.c
@@ -871,7 +871,68 @@ void xf_gdi_ellipse_cb(rdpContext* context, ELLIPSE_CB_ORDER* ellipse_cb)
871 871
872 872 void xf_gdi_surface_frame_marker(rdpContext* context, SURFACE_FRAME_MARKER* surface_frame_marker)
873 873 {
  874 + xfInfo* xfi = ((xfContext*) context)->xfi;
  875 +
  876 + switch (surface_frame_marker->frameAction)
  877 + {
  878 + case SURFACECMD_FRAMEACTION_BEGIN:
  879 + xfi->frame_begin = true;
  880 + xfi->frame_x1 = 0;
  881 + xfi->frame_y1 = 0;
  882 + xfi->frame_x2 = 0;
  883 + xfi->frame_y2 = 0;
  884 + break;
  885 +
  886 + case SURFACECMD_FRAMEACTION_END:
  887 + xfi->frame_begin = false;
  888 + if (xfi->frame_x2 > xfi->frame_x1 && xfi->frame_y2 > xfi->frame_y1)
  889 + {
  890 + XSetFunction(xfi->display, xfi->gc, GXcopy);
  891 + XSetFillStyle(xfi->display, xfi->gc, FillSolid);
  892 +
  893 + XCopyArea(xfi->display, xfi->primary, xfi->drawable, xfi->gc,
  894 + xfi->frame_x1, xfi->frame_y1,
  895 + xfi->frame_x2 - xfi->frame_x1, xfi->frame_y2 - xfi->frame_y1,
  896 + xfi->frame_x1, xfi->frame_y1);
  897 + gdi_InvalidateRegion(xfi->hdc, xfi->frame_x1, xfi->frame_y1,
  898 + xfi->frame_x2 - xfi->frame_x1, xfi->frame_y2 - xfi->frame_y1);
  899 + }
  900 + break;
  901 + }
  902 +}
874 903
  904 +static void xf_gdi_surface_update_frame(xfInfo* xfi, uint16 tx, uint16 ty, uint16 width, uint16 height)
  905 +{
  906 + if (xfi->remote_app != true)
  907 + {
  908 + if (xfi->frame_begin)
  909 + {
  910 + if (xfi->frame_x2 > xfi->frame_x1 && xfi->frame_y2 > xfi->frame_y1)
  911 + {
  912 + xfi->frame_x1 = MIN(xfi->frame_x1, tx);
  913 + xfi->frame_y1 = MIN(xfi->frame_y1, ty);
  914 + xfi->frame_x2 = MAX(xfi->frame_x2, tx + width);
  915 + xfi->frame_y2 = MAX(xfi->frame_y2, ty + height);
  916 + }
  917 + else
  918 + {
  919 + xfi->frame_x1 = tx;
  920 + xfi->frame_y1 = ty;
  921 + xfi->frame_x2 = tx + width;
  922 + xfi->frame_y2 = ty + height;
  923 + }
  924 + }
  925 + else
  926 + {
  927 + XCopyArea(xfi->display, xfi->primary, xfi->drawable, xfi->gc,
  928 + tx, ty, width, height, tx, ty);
  929 + gdi_InvalidateRegion(xfi->hdc, tx, ty, width, height);
  930 + }
  931 + }
  932 + else
  933 + {
  934 + gdi_InvalidateRegion(xfi->hdc, tx, ty, width, height);
  935 + }
875 936 }
876 937
877 938 void xf_gdi_surface_bits(rdpContext* context, SURFACE_BITS_COMMAND* surface_bits_command)
@@ -914,13 +975,7 @@ void xf_gdi_surface_bits(rdpContext* context, SURFACE_BITS_COMMAND* surface_bits
914 975 tx = message->rects[i].x + surface_bits_command->destLeft;
915 976 ty = message->rects[i].y + surface_bits_command->destTop;
916 977
917   - if (xfi->remote_app != true)
918   - {
919   - XCopyArea(xfi->display, xfi->primary, xfi->drawable, xfi->gc,
920   - tx, ty, message->rects[i].width, message->rects[i].height, tx, ty);
921   - }
922   -
923   - gdi_InvalidateRegion(xfi->hdc, tx, ty, message->rects[i].width, message->rects[i].height);
  978 + xf_gdi_surface_update_frame(xfi, tx, ty, message->rects[i].width, message->rects[i].height);
924 979 }
925 980
926 981 XSetClipMask(xfi->display, xfi->gc, None);
@@ -947,16 +1002,9 @@ void xf_gdi_surface_bits(rdpContext* context, SURFACE_BITS_COMMAND* surface_bits
947 1002 surface_bits_command->width, surface_bits_command->height);
948 1003 XFree(image);
949 1004
950   - if (xfi->remote_app != true)
951   - {
952   - XCopyArea(xfi->display, xfi->primary, xfi->window->handle, xfi->gc,
953   - surface_bits_command->destLeft, surface_bits_command->destTop,
954   - surface_bits_command->width, surface_bits_command->height,
955   - surface_bits_command->destLeft, surface_bits_command->destTop);
956   - }
957   -
958   - gdi_InvalidateRegion(xfi->hdc, surface_bits_command->destLeft, surface_bits_command->destTop,
959   - surface_bits_command->width, surface_bits_command->height);
  1005 + xf_gdi_surface_update_frame(xfi,
  1006 + surface_bits_command->destLeft, surface_bits_command->destTop,
  1007 + surface_bits_command->width, surface_bits_command->height);
960 1008
961 1009 XSetClipMask(xfi->display, xfi->gc, None);
962 1010 }
@@ -982,16 +1030,9 @@ void xf_gdi_surface_bits(rdpContext* context, SURFACE_BITS_COMMAND* surface_bits
982 1030 surface_bits_command->width, surface_bits_command->height);
983 1031 XFree(image);
984 1032
985   - if (xfi->remote_app != true)
986   - {
987   - XCopyArea(xfi->display, xfi->primary, xfi->window->handle, xfi->gc,
988   - surface_bits_command->destLeft, surface_bits_command->destTop,
989   - surface_bits_command->width, surface_bits_command->height,
990   - surface_bits_command->destLeft, surface_bits_command->destTop);
991   - }
992   -
993   - gdi_InvalidateRegion(xfi->hdc, surface_bits_command->destLeft, surface_bits_command->destTop,
994   - surface_bits_command->width, surface_bits_command->height);
  1033 + xf_gdi_surface_update_frame(xfi,
  1034 + surface_bits_command->destLeft, surface_bits_command->destTop,
  1035 + surface_bits_command->width, surface_bits_command->height);
995 1036
996 1037 XSetClipMask(xfi->display, xfi->gc, None);
997 1038 } else {
6 client/X11/xfreerdp.h
@@ -116,6 +116,12 @@ struct xf_info
116 116 boolean sw_gdi;
117 117 uint8* primary_buffer;
118 118
  119 + boolean frame_begin;
  120 + uint16 frame_x1;
  121 + uint16 frame_y1;
  122 + uint16 frame_x2;
  123 + uint16 frame_y2;
  124 +
119 125 boolean focused;
120 126 boolean mouse_active;
121 127 boolean mouse_motion;

0 comments on commit e7fd72b

Please sign in to comment.
Something went wrong with that request. Please try again.