diff --git a/client/X11/xf_rail.c b/client/X11/xf_rail.c index c26d91053..4a933468b 100644 --- a/client/X11/xf_rail.c +++ b/client/X11/xf_rail.c @@ -140,6 +140,17 @@ void xf_rail_SetWindowIcon(rdpRail* rail, rdpWindow* window, rdpIcon* icon) xf_SetWindowIcon(xfi, xfw, icon); } +void xf_rail_SetWindowVisibilityRects(rdpRail* rail, rdpWindow* window) +{ + xfInfo* xfi; + xfWindow* xfw; + + xfi = (xfInfo*) rail->extra; + xfw = (xfWindow*) window->extra; + + xf_SetWindowVisibilityRects(xfi, xfw, window->visibilityRects, window->numVisibilityRects); +} + void xf_rail_DestroyWindow(rdpRail* rail, rdpWindow* window) { xfWindow* xfw; @@ -155,6 +166,7 @@ void xf_rail_register_callbacks(xfInfo* xfi, rdpRail* rail) rail->ShowWindow = xf_rail_ShowWindow; rail->SetWindowText = xf_rail_SetWindowText; rail->SetWindowIcon = xf_rail_SetWindowIcon; + rail->SetWindowVisibilityRects = xf_rail_SetWindowVisibilityRects; rail->DestroyWindow = xf_rail_DestroyWindow; } diff --git a/client/X11/xf_window.c b/client/X11/xf_window.c index 48d05128b..847079bd9 100644 --- a/client/X11/xf_window.c +++ b/client/X11/xf_window.c @@ -18,6 +18,7 @@ */ #include +#include #include "xf_window.h" @@ -385,6 +386,25 @@ void xf_SetWindowIcon(xfInfo* xfi, xfWindow* window, rdpIcon* icon) } } +void xf_SetWindowVisibilityRects(xfInfo* xfi, xfWindow* window, RECTANGLE_16* rects, int nrects) +{ + int i; + XRectangle* xrects; + + xrects = xmalloc(sizeof(XRectangle) * nrects); + + for (i = 0; i < nrects; i++) + { + xrects[i].x = rects[i].left; + xrects[i].y = rects[i].top; + xrects[i].width = rects[i].right - rects[i].left + 1; + xrects[i].height = rects[i].bottom - rects[i].top + 1; + } + + XShapeCombineRectangles(xfi->display, window->handle, ShapeBounding, 0, 0, xrects, nrects, ShapeSet, 0); + xfree(xrects); +} + void xf_DestroyWindow(xfInfo* xfi, xfWindow* window) { if (window->gc) diff --git a/client/X11/xf_window.h b/client/X11/xf_window.h index c12ba9bbc..e6df94b25 100644 --- a/client/X11/xf_window.h +++ b/client/X11/xf_window.h @@ -53,6 +53,7 @@ xfWindow* xf_CreateWindow(xfInfo* xfi, int x, int y, int width, int height, uint void xf_MoveWindow(xfInfo* xfi, xfWindow* window, int x, int y, int width, int height); void xf_ShowWindow(xfInfo* xfi, xfWindow* window, uint8 state); void xf_SetWindowIcon(xfInfo* xfi, xfWindow* window, rdpIcon* icon); +void xf_SetWindowVisibilityRects(xfInfo* xfi, xfWindow* window, RECTANGLE_16* rects, int nrects); void xf_DestroyWindow(xfInfo* xfi, xfWindow* window); #endif /* __XF_WINDOW_H */ diff --git a/include/freerdp/rail/rail.h b/include/freerdp/rail/rail.h index 371e8c484..536c41b15 100644 --- a/include/freerdp/rail/rail.h +++ b/include/freerdp/rail/rail.h @@ -39,6 +39,7 @@ typedef void (*railMoveWindow)(rdpRail* rail, rdpWindow* window); typedef void (*railShowWindow)(rdpRail* rail, rdpWindow* window, uint8 state); typedef void (*railSetWindowText)(rdpRail* rail, rdpWindow* window); typedef void (*railSetWindowIcon)(rdpRail* rail, rdpWindow* window, rdpIcon* icon); +typedef void (*railSetWindowVisibilityRects)(rdpRail* rail, rdpWindow* window); struct rdp_rail { @@ -54,6 +55,7 @@ struct rdp_rail railShowWindow ShowWindow; railSetWindowText SetWindowText; railSetWindowIcon SetWindowIcon; + railSetWindowVisibilityRects SetWindowVisibilityRects; }; FREERDP_API void rail_register_update_callbacks(rdpRail* rail, rdpUpdate* update); diff --git a/libfreerdp-rail/window.c b/libfreerdp-rail/window.c index 60d7a6ef7..e521da8de 100644 --- a/libfreerdp-rail/window.c +++ b/libfreerdp-rail/window.c @@ -224,6 +224,12 @@ void window_state_update(rdpWindow* window, WINDOW_ORDER_INFO* orderInfo, WINDOW { int i; + if (window->windowRects != NULL) + xfree(window->windowRects); + + window->windowRects = window_state->windowRects; + window->numWindowRects = window_state->numWindowRects; + for (i = 0; i < window_state->numWindowRects; i++) { printf("Window Rect #%d: left:%d top:%d right:%d bottom:%d\n", i, @@ -245,6 +251,12 @@ void window_state_update(rdpWindow* window, WINDOW_ORDER_INFO* orderInfo, WINDOW { int i; + if (window->visibilityRects != NULL) + xfree(window->visibilityRects); + + window->visibilityRects = window_state->visibilityRects; + window->numVisibilityRects = window_state->numVisibilityRects; + for (i = 0; i < window_state->numVisibilityRects; i++) { printf("Visibility Rect #%d: left:%d top:%d right:%d bottom:%d\n", i, @@ -267,6 +279,11 @@ void rail_CreateWindow(rdpRail* rail, rdpWindow* window) } IFCALL(rail->CreateWindow, rail, window); + + if (window->fieldFlags & WINDOW_ORDER_FIELD_VISIBILITY) + { + IFCALL(rail->SetWindowVisibilityRects, rail, window); + } } void rail_UpdateWindow(rdpRail* rail, rdpWindow* window) @@ -339,7 +356,7 @@ void rail_UpdateWindow(rdpRail* rail, rdpWindow* window) if (window->fieldFlags & WINDOW_ORDER_FIELD_VISIBILITY) { - + IFCALL(rail->SetWindowVisibilityRects, rail, window); } }