Merge branch 'master' of github.com:FreeRDP/FreeRDP

Conflicts:
	client/X11/xf_client.c
This commit is contained in:
Marc-André Moreau 2014-12-15 15:55:51 -05:00
commit f1bd547580
28 changed files with 156 additions and 27 deletions

View File

@ -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})

View File

@ -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})

View File

@ -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);
}
}
}

View File

@ -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)

View File

@ -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")

View File

@ -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;
@ -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
@ -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);

View File

@ -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;
@ -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)
{
@ -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);
@ -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);
@ -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);
@ -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);
@ -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)
{
@ -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);
@ -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);

View File

@ -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 */

View File

@ -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")
@ -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);

View File

@ -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

View File

@ -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)

View File

@ -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"
)

View File

@ -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"
)

View File

@ -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"
)

View File

@ -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"
)

View File

@ -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"
)

View File

@ -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"
)

View File

@ -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"
)

View File

@ -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"
)

View File

@ -32,9 +32,11 @@
include(CheckSymbolExists)
find_path(XI_INCLUDE_DIR NAMES X11/extensions/XInput2.h
PATHS /opt/X11/include
DOC "The Xi include directory")
find_library(XI_LIBRARY NAMES Xi
PATHS /opt/X11/lib
DOC "The Xi library")
include(FindPackageHandleStandardArgs)

View File

@ -29,11 +29,13 @@
#=============================================================================
find_path(XINERAMA_INCLUDE_DIR NAMES X11/extensions/Xinerama.h
PATHS /opt/X11/include
PATH_SUFFIXES X11/extensions
DOC "The Xinerama include directory"
)
find_library(XINERAMA_LIBRARY NAMES Xinerama
PATHS /opt/X11/lib
DOC "The Xinerama library"
)

View File

@ -27,9 +27,11 @@
#=============================================================================
find_path(XRENDER_INCLUDE_DIR NAMES X11/extensions/Xrender.h
PATHS /opt/X11/include
DOC "The Xrender include directory")
find_library(XRENDER_LIBRARY NAMES Xrender
PATHS /opt/X11/lib
DOC "The Xrender library")
include(FindPackageHandleStandardArgs)

View File

@ -29,10 +29,12 @@
#=============================================================================
find_path(XV_INCLUDE_DIR NAMES X11/extensions/Xv.h
PATHS /opt/X11/include
DOC "The Xv include directory"
)
find_library(XV_LIBRARY NAMES Xv
PATHS /opt/X11/lib
DOC "The Xv library"
)

View File

@ -44,8 +44,9 @@ include(CMakePackageConfigHelpers)
set(RDTK_VERSION_MAJOR "1")
set(RDTK_VERSION_MINOR "1")
set(RDTK_VERSION_REVISION "0")
set(RDTK_VERSION "${RDTK_VERSION_MAJOR}.${RDTK_VERSION_MINOR}")
set(RDTK_VERSION_FULL "${RDTK_VERSION}.${RDTK_VERSION_REVISION}")
set(RDTK_API_VERSION "${RDTK_VERSION_MAJOR}.${RDTK_VERSION_MINOR}")
set(RDTK_VERSION "${RDTK_API_VERSION}.${RDTK_VERSION_REVISION}")
set(RDTK_VERSION_FULL "${RDTK_VERSION}")
set(RDTK_VERSION_FULL ${RDTK_VERSION_FULL} PARENT_SCOPE)
# Default to release build type
@ -66,8 +67,10 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR}/include)
add_subdirectory(include)
add_subdirectory(librdtk)
if(WITH_X11)
add_subdirectory(sample)
if(WITH_SAMPLE)
if(WITH_X11)
add_subdirectory(sample)
endif()
endif()
# Exporting

View File

@ -58,6 +58,10 @@ add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS})
list(APPEND ${MODULE_PREFIX}_LIBS winpr)
list(APPEND ${MODULE_PREFIX}_LIBS freerdp)
if (WITH_LIBRARY_VERSIONING)
set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${RDTK_VERSION} SOVERSION ${RDTK_API_VERSION})
endif()
target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS})
install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR} EXPORT RdTkTargets)

View File

@ -48,8 +48,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_SERVER ${FILEPATH})
if(${FILEPATH} MATCHES "^([^/]*)/+${FILENAME}")
string(REGEX REPLACE "^([^/]*)/+${FILENAME}" "\\1" FREERDP_SERVER ${FILEPATH})
set(FREERDP_SERVER_ENABLED 0)
include(${FILEPATH})
if(FREERDP_SERVER_ENABLED)

View File

@ -238,6 +238,10 @@ list(APPEND ${MODULE_PREFIX}_LIBS rdtk)
target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS})
if (WITH_LIBRARY_VERSIONING)
set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${FREERDP_VERSION} SOVERSION ${FREERDP_API_VERSION})
endif()
install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT server)
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Server/shadow")

View File

@ -22,11 +22,11 @@
file(GLOB all_valid_subdirs RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*/CMakeLists.txt")
foreach(dir ${all_valid_subdirs})
if(${dir} MATCHES "^([^/]*)//CMakeLists.txt")
string(REGEX REPLACE "^([^/]*)//CMakeLists.txt" "\\1" dir_trimmed ${dir})
if(${dir} MATCHES "^([^/]*)/+CMakeLists.txt")
string(REGEX REPLACE "^([^/]*)/+CMakeLists.txt" "\\1" dir_trimmed ${dir})
message(STATUS "Adding third-party component ${dir_trimmed}")
add_subdirectory(${dir_trimmed})
endif()
endforeach(dir)
set(THIRD_PARTY_INCLUDES ${THIRD_PARTY_INCLUDES} PARENT_SCOPE)
set(THIRD_PARTY_INCLUDES ${THIRD_PARTY_INCLUDES} PARENT_SCOPE)