Skip to content

Commit

Permalink
Merge branch 'master' of github.com:FreeRDP/FreeRDP
Browse files Browse the repository at this point in the history
Conflicts:
	client/X11/xf_client.c
  • Loading branch information
awakecoding committed Dec 15, 2014
2 parents 0d56e26 + 65214b4 commit f1bd547
Show file tree
Hide file tree
Showing 28 changed files with 156 additions and 27 deletions.
4 changes: 2 additions & 2 deletions channels/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,8 @@ set(FILENAME "ChannelOptions.cmake")
file(GLOB FILEPATHS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*/${FILENAME}")

foreach(FILEPATH ${FILEPATHS})
if(${FILEPATH} MATCHES "^([^/]*)//${FILENAME}")
string(REGEX REPLACE "^([^/]*)//${FILENAME}" "\\1" DIR ${FILEPATH})
if(${FILEPATH} MATCHES "^([^/]*)/+${FILENAME}")
string(REGEX REPLACE "^([^/]*)/+${FILENAME}" "\\1" DIR ${FILEPATH})
set(CHANNEL_OPTION)
include(${FILEPATH})
if(${CHANNEL_OPTION})
Expand Down
2 changes: 2 additions & 0 deletions channels/client/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ set(${MODULE_PREFIX}_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/addin.c
${CMAKE_CURRENT_SOURCE_DIR}/addin.h)

if(CHANNEL_STATIC_CLIENT_ENTRIES)
list(REMOVE_DUPLICATES CHANNEL_STATIC_CLIENT_ENTRIES)
endif()

foreach(STATIC_ENTRY ${CHANNEL_STATIC_CLIENT_ENTRIES})
foreach(STATIC_MODULE ${CHANNEL_STATIC_CLIENT_MODULES})
Expand Down
1 change: 1 addition & 0 deletions channels/drdynvc/client/drdynvc_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,7 @@ static void* drdynvc_virtual_channel_client_thread(void* arg)
{
data = (wStream*) message.wParam;
drdynvc_order_recv(drdynvc, data);
Stream_Free(data, TRUE);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions client/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ set(FILENAME "ModuleOptions.cmake")
file(GLOB FILEPATHS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*/${FILENAME}")

foreach(FILEPATH ${FILEPATHS})
if(${FILEPATH} MATCHES "^([^/]*)//${FILENAME}")
string(REGEX REPLACE "^([^/]*)//${FILENAME}" "\\1" FREERDP_CLIENT ${FILEPATH})
if(${FILEPATH} MATCHES "^([^/]*)/+${FILENAME}")
string(REGEX REPLACE "^([^/]*)/+${FILENAME}" "\\1" FREERDP_CLIENT ${FILEPATH})
set(FREERDP_CLIENT_ENABLED 0)
include(${FILEPATH})
if(FREERDP_CLIENT_ENABLED)
Expand Down
6 changes: 6 additions & 0 deletions client/Mac/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@

project(MacFreeRDP-library)


if(${CMAKE_VERSION} GREATER 2.8.12)
cmake_policy(SET CMP0026 OLD)
cmake_policy(SET CMP0045 OLD)
endif()

set(MODULE_NAME "MacFreeRDP-library")
set(MODULE_OUTPUT_NAME "MacFreeRDP")
set(MODULE_PREFIX "FREERDP_CLIENT_MAC_LIBRARY")
Expand Down
15 changes: 14 additions & 1 deletion client/X11/xf_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,14 @@ void xf_unlock_x11(xfContext* xfc, BOOL display)
}
}

static void xf_calculate_color_shifts(UINT32 mask, UINT8* rsh, UINT8* lsh)
{
for (*lsh = 0; !(mask & 1); mask >>= 1)
(*lsh)++;
for (*rsh = 8; mask; mask >>= 1)
(*rsh)--;
}

BOOL xf_get_pixmap_info(xfContext* xfc)
{
int i;
Expand Down Expand Up @@ -720,7 +728,7 @@ BOOL xf_get_pixmap_info(xfContext* xfc)
}
}

if (vi)
if (xfc->visual)
{
/*
* Detect if the server visual has an inverted colormap
Expand All @@ -730,6 +738,11 @@ BOOL xf_get_pixmap_info(xfContext* xfc)
{
xfc->invert = TRUE;
}

/* calculate color shifts required for rdp order color conversion */
xf_calculate_color_shifts(vi->red_mask, &xfc->red_shift_r, &xfc->red_shift_l);
xf_calculate_color_shifts(vi->green_mask, &xfc->green_shift_r, &xfc->green_shift_l);
xf_calculate_color_shifts(vi->blue_mask, &xfc->blue_shift_r, &xfc->blue_shift_l);
}

XFree(vis);
Expand Down
74 changes: 63 additions & 11 deletions client/X11/xf_gdi.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,58 @@ BOOL xf_set_rop3(xfContext* xfc, int rop3)
return TRUE;
}

UINT32 xf_convert_rdp_order_color(xfContext* xfc, UINT32 color)
{
UINT32 r, g, b;

switch (xfc->srcBpp)
{
case 32:
case 24:
if (xfc->visual->red_mask == 0xFF0000 &&
xfc->visual->green_mask == 0xFF00 &&
xfc->visual->blue_mask == 0xFF)
{
return color;
}
GetRGB32(r, g, b, color);
break;

case 16:
color = (color & 0xFF00) | ((color >> 16) & 0xFF);
if (xfc->visual->red_mask == 0xF800 &&
xfc->visual->green_mask == 0x07E0 &&
xfc->visual->blue_mask == 0x001F)
{
return color;
}
GetRGB16(r, g, b, color);
break;

case 15:
color = (color & 0xFF00) | ((color >> 16) & 0xFF);
GetRGB15(r, g, b, color);
break;

case 8:
color = (color >> 16) & (UINT32) 0xFF;
if (xfc->palette)
{
r = xfc->palette[(color * 4) + 2];
g = xfc->palette[(color * 4) + 1];
b = xfc->palette[(color * 4) + 0];
}
break;

default:
return color;
}

return ( ((r >> xfc->red_shift_r) << xfc->red_shift_l) |
((g >> xfc->green_shift_r) << xfc->green_shift_l) |
((b >> xfc->blue_shift_r) << xfc->blue_shift_l) );
}

Pixmap xf_brush_new(xfContext* xfc, int width, int height, int bpp, BYTE* data)
{
GC gc;
Expand Down Expand Up @@ -463,8 +515,8 @@ void xf_gdi_patblt(rdpContext* context, PATBLT_ORDER* patblt)
brush = &patblt->brush;
xf_set_rop3(xfc, gdi_rop3_code(patblt->bRop));

foreColor = freerdp_convert_gdi_order_color(patblt->foreColor, context->settings->ColorDepth, xfc->format, xfc->palette);
backColor = freerdp_convert_gdi_order_color(patblt->backColor, context->settings->ColorDepth, xfc->format, xfc->palette);
foreColor = xf_convert_rdp_order_color(xfc, patblt->foreColor);
backColor = xf_convert_rdp_order_color(xfc, patblt->backColor);

if (brush->style == GDI_BS_SOLID)
{
Expand Down Expand Up @@ -565,7 +617,7 @@ void xf_gdi_opaque_rect(rdpContext* context, OPAQUE_RECT_ORDER* opaque_rect)

xf_lock_x11(xfc, FALSE);

color = freerdp_convert_gdi_order_color(opaque_rect->color, context->settings->ColorDepth, xfc->format, xfc->palette);
color = xf_convert_rdp_order_color(xfc, opaque_rect->color);

XSetFunction(xfc->display, xfc->gc, GXcopy);
XSetFillStyle(xfc->display, xfc->gc, FillSolid);
Expand Down Expand Up @@ -593,7 +645,7 @@ void xf_gdi_multi_opaque_rect(rdpContext* context, MULTI_OPAQUE_RECT_ORDER* mult

xf_lock_x11(xfc, FALSE);

color = freerdp_convert_gdi_order_color(multi_opaque_rect->color, context->settings->ColorDepth, xfc->format, xfc->palette);
color = xf_convert_rdp_order_color(xfc, multi_opaque_rect->color);

XSetFunction(xfc->display, xfc->gc, GXcopy);
XSetFillStyle(xfc->display, xfc->gc, FillSolid);
Expand Down Expand Up @@ -629,7 +681,7 @@ void xf_gdi_line_to(rdpContext* context, LINE_TO_ORDER* line_to)
xf_lock_x11(xfc, FALSE);

xf_set_rop2(xfc, line_to->bRop2);
color = freerdp_convert_gdi_order_color(line_to->penColor, context->settings->ColorDepth, xfc->format, xfc->palette);
color = xf_convert_rdp_order_color(xfc, line_to->penColor);

XSetFillStyle(xfc->display, xfc->gc, FillSolid);
XSetForeground(xfc->display, xfc->gc, color);
Expand Down Expand Up @@ -705,7 +757,7 @@ void xf_gdi_polyline(rdpContext* context, POLYLINE_ORDER* polyline)
xf_lock_x11(xfc, FALSE);

xf_set_rop2(xfc, polyline->bRop2);
color = freerdp_convert_gdi_order_color(polyline->penColor, context->settings->ColorDepth, xfc->format, xfc->palette);
color = xf_convert_rdp_order_color(xfc, polyline->penColor);

XSetFillStyle(xfc->display, xfc->gc, FillSolid);
XSetForeground(xfc->display, xfc->gc, color);
Expand Down Expand Up @@ -773,8 +825,8 @@ void xf_gdi_mem3blt(rdpContext* context, MEM3BLT_ORDER* mem3blt)
brush = &mem3blt->brush;
bitmap = (xfBitmap*) mem3blt->bitmap;
xf_set_rop3(xfc, gdi_rop3_code(mem3blt->bRop));
foreColor = freerdp_convert_gdi_order_color(mem3blt->foreColor, context->settings->ColorDepth, xfc->format, xfc->palette);
backColor = freerdp_convert_gdi_order_color(mem3blt->backColor, context->settings->ColorDepth, xfc->format, xfc->palette);
foreColor = xf_convert_rdp_order_color(xfc, mem3blt->foreColor);
backColor = xf_convert_rdp_order_color(xfc, mem3blt->backColor);

if (brush->style == GDI_BS_PATTERN)
{
Expand Down Expand Up @@ -840,7 +892,7 @@ void xf_gdi_polygon_sc(rdpContext* context, POLYGON_SC_ORDER* polygon_sc)
xf_lock_x11(xfc, FALSE);

xf_set_rop2(xfc, polygon_sc->bRop2);
brush_color = freerdp_convert_gdi_order_color(polygon_sc->brushColor, context->settings->ColorDepth, xfc->format, xfc->palette);
brush_color = xf_convert_rdp_order_color(xfc, polygon_sc->brushColor);

npoints = polygon_sc->numPoints + 1;
points = malloc(sizeof(XPoint) * npoints);
Expand Down Expand Up @@ -900,8 +952,8 @@ void xf_gdi_polygon_cb(rdpContext* context, POLYGON_CB_ORDER* polygon_cb)

brush = &(polygon_cb->brush);
xf_set_rop2(xfc, polygon_cb->bRop2);
foreColor = freerdp_convert_gdi_order_color(polygon_cb->foreColor, context->settings->ColorDepth, xfc->format, xfc->palette);
backColor = freerdp_convert_gdi_order_color(polygon_cb->backColor, context->settings->ColorDepth, xfc->format, xfc->palette);
foreColor = xf_convert_rdp_order_color(xfc, polygon_cb->foreColor);
backColor = xf_convert_rdp_order_color(xfc, polygon_cb->backColor);

npoints = polygon_cb->numPoints + 1;
points = malloc(sizeof(XPoint) * npoints);
Expand Down
1 change: 1 addition & 0 deletions client/X11/xf_gdi.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,6 @@

void xf_gdi_register_update_callbacks(rdpUpdate* update);
void xf_gdi_bitmap_update(rdpContext* context, BITMAP_UPDATE* bitmapUpdate);
UINT32 xf_convert_rdp_order_color(xfContext* xfc, UINT32 color);

#endif /* __XF_GDI_H */
5 changes: 3 additions & 2 deletions client/X11/xf_graphics.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include <freerdp/codec/jpeg.h>

#include "xf_graphics.h"
#include "xf_gdi.h"

#include <freerdp/log.h>
#define TAG CLIENT_TAG("x11")
Expand Down Expand Up @@ -381,8 +382,8 @@ void xf_Glyph_BeginDraw(rdpContext* context, int x, int y, int width, int height
{
xfContext* xfc = (xfContext*) context;

bgcolor = freerdp_convert_gdi_order_color(bgcolor, context->settings->ColorDepth, xfc->format, xfc->palette);
fgcolor = freerdp_convert_gdi_order_color(fgcolor, context->settings->ColorDepth, xfc->format, xfc->palette);
bgcolor = xf_convert_rdp_order_color(xfc, bgcolor);
fgcolor = xf_convert_rdp_order_color(xfc, fgcolor);

xf_lock_x11(xfc, FALSE);

Expand Down
7 changes: 7 additions & 0 deletions client/X11/xfreerdp.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,13 @@ struct xf_context
UINT16 frame_x2;
UINT16 frame_y2;

UINT8 red_shift_l;
UINT8 red_shift_r;
UINT8 green_shift_l;
UINT8 green_shift_r;
UINT8 blue_shift_l;
UINT8 blue_shift_r;

int XInputOpcode;

#ifdef WITH_XRENDER
Expand Down
11 changes: 11 additions & 0 deletions cmake/FindX11.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,26 @@
# limitations under the License.
#=============================================================================

if (APPLE)
set(CMAKE_FIND_FRAMEWORK_OLD ${CMAKE_FIND_FRAMEWORK})
set(CMAKE_FIND_FRAMEWORK LAST)
endif ()

find_path(X11_INCLUDE_DIR NAMES X11/Xlib.h
PATH_SUFFIXES X11
PATHS /opt/X11/include
DOC "The X11 include directory"
)

find_library(X11_LIBRARY NAMES X11
PATHS /opt/X11/lib
DOC "The X11 library"
)

if(APPLE)
set(CMAKE_FIND_FRAMEWORK ${CMAKE_FIND_FRAMEWORK_OLD})
endif()

include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(X11 DEFAULT_MSG X11_LIBRARY X11_INCLUDE_DIR)

Expand Down
2 changes: 2 additions & 0 deletions cmake/FindXKBFile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,12 @@

find_path(XKBFILE_INCLUDE_DIR NAMES X11/extensions/XKBfile.h
PATH_SUFFIXES X11/extensions
PATHS /opt/X11/include
DOC "The XKBFile include directory"
)

find_library(XKBFILE_LIBRARY NAMES xkbfile
PATHS /opt/X11/lib
DOC "The XKBFile library"
)

Expand Down
2 changes: 2 additions & 0 deletions cmake/FindXRandR.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,12 @@

find_path(XRANDR_INCLUDE_DIR NAMES X11/extensions/Xrandr.h
PATH_SUFFIXES X11/extensions
PATHS /opt/X11/include
DOC "The XRANDR include directory"
)

find_library(XRANDR_LIBRARY NAMES Xrandr
PATHS /opt/X11/lib
DOC "The XRANDR library"
)

Expand Down
2 changes: 2 additions & 0 deletions cmake/FindXShm.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,12 @@

find_path(XSHM_INCLUDE_DIR NAMES X11/extensions/XShm.h
PATH_SUFFIXES X11/extensions
PATHS /opt/X11/include
DOC "The XShm include directory"
)

find_library(XSHM_LIBRARY NAMES Xext
PATHS /opt/X11/lib
DOC "The XShm library"
)

Expand Down
2 changes: 2 additions & 0 deletions cmake/FindXTest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,12 @@

find_path(XTEST_INCLUDE_DIR NAMES X11/extensions/XTest.h
PATH_SUFFIXES X11/extensions
PATHS /opt/X11/include
DOC "The XTest include directory"
)

find_library(XTEST_LIBRARY NAMES Xtst
PATHS /opt/X11/lib
DOC "The XTest library"
)

Expand Down
2 changes: 2 additions & 0 deletions cmake/FindXcursor.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,12 @@

find_path(XCURSOR_INCLUDE_DIR NAMES X11/Xcursor/Xcursor.h
PATH_SUFFIXES X11/Xcursor
PATHS /opt/X11/include
DOC "The Xcursor include directory"
)

find_library(XCURSOR_LIBRARY NAMES Xcursor
PATHS /opt/X11/lib
DOC "The Xcursor library"
)

Expand Down
2 changes: 2 additions & 0 deletions cmake/FindXdamage.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,12 @@

find_path(XDAMAGE_INCLUDE_DIR NAMES X11/extensions/Xdamage.h
PATH_SUFFIXES X11/extensions
PATHS /opt/X11/include
DOC "The Xdamage include directory"
)

find_library(XDAMAGE_LIBRARY NAMES Xdamage
PATHS /opt/X11/lib
DOC "The Xdamage library"
)

Expand Down
2 changes: 2 additions & 0 deletions cmake/FindXext.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,12 @@

find_path(XEXT_INCLUDE_DIR NAMES X11/extensions/Xext.h
PATH_SUFFIXES X11/extensions
PATHS /opt/X11/include
DOC "The Xext include directory"
)

find_library(XEXT_LIBRARY NAMES Xext
PATHS /opt/X11/lib
DOC "The Xext library"
)

Expand Down
2 changes: 2 additions & 0 deletions cmake/FindXfixes.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,12 @@

find_path(XFIXES_INCLUDE_DIR NAMES X11/extensions/Xfixes.h
PATH_SUFFIXES X11/extensions
PATHS /opt/X11/include
DOC "The Xfixes include directory"
)

find_library(XFIXES_LIBRARY NAMES Xfixes
PATHS /opt/X11/lib
DOC "The Xfixes library"
)

Expand Down
Loading

0 comments on commit f1bd547

Please sign in to comment.