diff --git a/.gitignore b/.gitignore index b63a86ea3..d0d340874 100644 --- a/.gitignore +++ b/.gitignore @@ -93,7 +93,6 @@ cunit/test_freerdp client/X11/xfreerdp client/Mac/xcode client/Sample/sfreerdp -client/DirectFB/dfreerdp client/Wayland/wlfreerdp server/Sample/sfreerdp-server server/X11/xfreerdp-server @@ -142,4 +141,4 @@ packaging/deb/freerdp-nightly/freerdp-nightly-dbg .idea # VisualStudio Code -.vscode \ No newline at end of file +.vscode diff --git a/CMakeLists.txt b/CMakeLists.txt index 3de85c502..0781c525b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -682,10 +682,6 @@ set(X11_FEATURE_DESCRIPTION "X11 client and server") set(WAYLAND_FEATURE_PURPOSE "Wayland") set(WAYLAND_FEATURE_DESCRIPTION "Wayland client") -set(DIRECTFB_FEATURE_TYPE "OPTIONAL") -set(DIRECTFB_FEATURE_PURPOSE "DirectFB") -set(DIRECTFB_FEATURE_DESCRIPTION "DirectFB client") - set(ZLIB_FEATURE_TYPE "REQUIRED") set(ZLIB_FEATURE_PURPOSE "compression") set(ZLIB_FEATURE_DESCRIPTION "data compression") @@ -782,7 +778,6 @@ if(WIN32) set(X11_FEATURE_TYPE "DISABLED") set(WAYLAND_FEATURE_TYPE "DISABLED") set(ZLIB_FEATURE_TYPE "DISABLED") - set(DIRECTFB_FEATURE_TYPE "DISABLED") set(OSS_FEATURE_TYPE "DISABLED") set(ALSA_FEATURE_TYPE "DISABLED") set(PULSE_FEATURE_TYPE "DISABLED") @@ -796,7 +791,6 @@ if(WIN32) endif() if(APPLE) - set(DIRECTFB_FEATURE_TYPE "DISABLED") set(FFMPEG_FEATURE_TYPE "OPTIONAL") set(VAAPI_FEATURE_TYPE "DISABLED") set(GSTREAMER_1_0_FEATURE_TYPE "OPTIONAL") @@ -833,7 +827,6 @@ endif(UNIX AND NOT ANDROID) if(ANDROID) set(X11_FEATURE_TYPE "DISABLED") set(WAYLAND_FEATURE_TYPE "DISABLED") - set(DIRECTFB_FEATURE_TYPE "DISABLED") set(OSS_FEATURE_TYPE "DISABLED") set(ALSA_FEATURE_TYPE "DISABLED") set(PULSE_FEATURE_TYPE "DISABLED") @@ -848,10 +841,6 @@ endif() find_feature(X11 ${X11_FEATURE_TYPE} ${X11_FEATURE_PURPOSE} ${X11_FEATURE_DESCRIPTION}) find_feature(Wayland ${WAYLAND_FEATURE_TYPE} ${WAYLAND_FEATURE_PURPOSE} ${WAYLAND_FEATURE_DESCRIPTION}) -find_feature(DirectFB ${DIRECTFB_FEATURE_TYPE} ${DIRECTFB_FEATURE_PURPOSE} ${DIRECTFB_FEATURE_DESCRIPTION}) -if (${WITH_DIRECTFB}) - message(WARNING "DIRECTFB is orphaned and not maintained see docs/README.directfb for details") -endif() find_feature(ZLIB ${ZLIB_FEATURE_TYPE} ${ZLIB_FEATURE_PURPOSE} ${ZLIB_FEATURE_DESCRIPTION}) find_feature(OpenSSL ${OPENSSL_FEATURE_TYPE} ${OPENSSL_FEATURE_PURPOSE} ${OPENSSL_FEATURE_DESCRIPTION}) diff --git a/client/.gitignore b/client/.gitignore index 574a1de7b..7c1ea95a9 100644 --- a/client/.gitignore +++ b/client/.gitignore @@ -1,7 +1,6 @@ /* !/Android !/common -!/DirectFB !/iOS !/Mac !/Sample diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index 4c2e4df56..7cba44e94 100644 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -26,10 +26,6 @@ if(FREERDP_VENDOR AND WITH_CLIENT) if(WITH_SAMPLE) add_subdirectory(Sample) endif() - - if(WITH_DIRECTFB) - add_subdirectory(DirectFB) - endif() endif() if(WITH_X11) diff --git a/client/DirectFB/CMakeLists.txt b/client/DirectFB/CMakeLists.txt deleted file mode 100644 index 6cf7cead9..000000000 --- a/client/DirectFB/CMakeLists.txt +++ /dev/null @@ -1,40 +0,0 @@ -# FreeRDP: A Remote Desktop Protocol Implementation -# FreeRDP DirectFB Client -# -# Copyright 2012 Marc-Andre Moreau -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set(MODULE_NAME "dfreerdp") -set(MODULE_PREFIX "FREERDP_CLIENT_DIRECTFB") - -include_directories(${DIRECTFB_INCLUDE_DIRS}) - -set(${MODULE_PREFIX}_SRCS - df_event.c - df_event.h - df_graphics.c - df_graphics.c - dfreerdp.c - dfreerdp.h) - -add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) - -set(${MODULE_PREFIX}_LIBS ${DIRECTFB_LIBRARIES}) -set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} freerdp-client) -set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} winpr freerdp) - -target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS}) -install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR}) - -set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Client/DirectFB") diff --git a/client/DirectFB/ModuleOptions.cmake b/client/DirectFB/ModuleOptions.cmake deleted file mode 100644 index 2ef9266f0..000000000 --- a/client/DirectFB/ModuleOptions.cmake +++ /dev/null @@ -1,4 +0,0 @@ - -set(FREERDP_CLIENT_NAME "dfreerdp") -set(FREERDP_CLIENT_PLATFORM "DirectFB") -set(FREERDP_CLIENT_VENDOR "FreeRDP") diff --git a/client/DirectFB/df_event.c b/client/DirectFB/df_event.c deleted file mode 100644 index 5ec8b9635..000000000 --- a/client/DirectFB/df_event.c +++ /dev/null @@ -1,271 +0,0 @@ -/** - * FreeRDP: A Remote Desktop Protocol Implementation - * DirectFB Event Handling - * - * Copyright 2011 Marc-Andre Moreau - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include -#include - -#include - -#include "df_event.h" - -static BYTE keymap[256]; -static BYTE functionmap[128]; - -void df_keyboard_init() -{ - ZeroMemory(keymap, sizeof(keymap)); - - /* Map DirectFB keycodes to Virtual Key Codes */ - - keymap[DIKI_A - DIKI_UNKNOWN] = VK_KEY_A; - keymap[DIKI_B - DIKI_UNKNOWN] = VK_KEY_B; - keymap[DIKI_C - DIKI_UNKNOWN] = VK_KEY_C; - keymap[DIKI_D - DIKI_UNKNOWN] = VK_KEY_D; - keymap[DIKI_E - DIKI_UNKNOWN] = VK_KEY_E; - keymap[DIKI_F - DIKI_UNKNOWN] = VK_KEY_F; - keymap[DIKI_G - DIKI_UNKNOWN] = VK_KEY_G; - keymap[DIKI_H - DIKI_UNKNOWN] = VK_KEY_H; - keymap[DIKI_I - DIKI_UNKNOWN] = VK_KEY_I; - keymap[DIKI_J - DIKI_UNKNOWN] = VK_KEY_J; - keymap[DIKI_K - DIKI_UNKNOWN] = VK_KEY_K; - keymap[DIKI_L - DIKI_UNKNOWN] = VK_KEY_L; - keymap[DIKI_M - DIKI_UNKNOWN] = VK_KEY_M; - keymap[DIKI_N - DIKI_UNKNOWN] = VK_KEY_N; - keymap[DIKI_O - DIKI_UNKNOWN] = VK_KEY_O; - keymap[DIKI_P - DIKI_UNKNOWN] = VK_KEY_P; - keymap[DIKI_Q - DIKI_UNKNOWN] = VK_KEY_Q; - keymap[DIKI_R - DIKI_UNKNOWN] = VK_KEY_R; - keymap[DIKI_S - DIKI_UNKNOWN] = VK_KEY_S; - keymap[DIKI_T - DIKI_UNKNOWN] = VK_KEY_T; - keymap[DIKI_U - DIKI_UNKNOWN] = VK_KEY_U; - keymap[DIKI_V - DIKI_UNKNOWN] = VK_KEY_V; - keymap[DIKI_W - DIKI_UNKNOWN] = VK_KEY_W; - keymap[DIKI_X - DIKI_UNKNOWN] = VK_KEY_X; - keymap[DIKI_Y - DIKI_UNKNOWN] = VK_KEY_Y; - keymap[DIKI_Z - DIKI_UNKNOWN] = VK_KEY_Z; - - keymap[DIKI_0 - DIKI_UNKNOWN] = VK_KEY_0; - keymap[DIKI_1 - DIKI_UNKNOWN] = VK_KEY_1; - keymap[DIKI_2 - DIKI_UNKNOWN] = VK_KEY_2; - keymap[DIKI_3 - DIKI_UNKNOWN] = VK_KEY_3; - keymap[DIKI_4 - DIKI_UNKNOWN] = VK_KEY_4; - keymap[DIKI_5 - DIKI_UNKNOWN] = VK_KEY_5; - keymap[DIKI_6 - DIKI_UNKNOWN] = VK_KEY_6; - keymap[DIKI_7 - DIKI_UNKNOWN] = VK_KEY_7; - keymap[DIKI_8 - DIKI_UNKNOWN] = VK_KEY_8; - keymap[DIKI_9 - DIKI_UNKNOWN] = VK_KEY_9; - - keymap[DIKI_F1 - DIKI_UNKNOWN] = VK_F1; - keymap[DIKI_F2 - DIKI_UNKNOWN] = VK_F2; - keymap[DIKI_F3 - DIKI_UNKNOWN] = VK_F3; - keymap[DIKI_F4 - DIKI_UNKNOWN] = VK_F4; - keymap[DIKI_F5 - DIKI_UNKNOWN] = VK_F5; - keymap[DIKI_F6 - DIKI_UNKNOWN] = VK_F6; - keymap[DIKI_F7 - DIKI_UNKNOWN] = VK_F7; - keymap[DIKI_F8 - DIKI_UNKNOWN] = VK_F8; - keymap[DIKI_F9 - DIKI_UNKNOWN] = VK_F9; - keymap[DIKI_F10 - DIKI_UNKNOWN] = VK_F10; - keymap[DIKI_F11 - DIKI_UNKNOWN] = VK_F11; - keymap[DIKI_F12 - DIKI_UNKNOWN] = VK_F12; - - keymap[DIKI_COMMA - DIKI_UNKNOWN] = VK_OEM_COMMA; - keymap[DIKI_PERIOD - DIKI_UNKNOWN] = VK_OEM_PERIOD; - keymap[DIKI_MINUS_SIGN - DIKI_UNKNOWN] = VK_OEM_MINUS; - keymap[DIKI_EQUALS_SIGN - DIKI_UNKNOWN] = VK_OEM_PLUS; - - keymap[DIKI_ESCAPE - DIKI_UNKNOWN] = VK_ESCAPE; - keymap[DIKI_LEFT - DIKI_UNKNOWN] = VK_LEFT; - keymap[DIKI_RIGHT - DIKI_UNKNOWN] = VK_RIGHT; - keymap[DIKI_UP - DIKI_UNKNOWN] = VK_UP; - keymap[DIKI_DOWN - DIKI_UNKNOWN] = VK_DOWN; - keymap[DIKI_CONTROL_L - DIKI_UNKNOWN] = VK_LCONTROL; - keymap[DIKI_CONTROL_R - DIKI_UNKNOWN] = VK_RCONTROL; - keymap[DIKI_SHIFT_L - DIKI_UNKNOWN] = VK_LSHIFT; - keymap[DIKI_SHIFT_R - DIKI_UNKNOWN] = VK_RSHIFT; - keymap[DIKI_ALT_L - DIKI_UNKNOWN] = VK_LMENU; - keymap[DIKI_ALT_R - DIKI_UNKNOWN] = VK_RMENU; - keymap[DIKI_TAB - DIKI_UNKNOWN] = VK_TAB; - keymap[DIKI_ENTER - DIKI_UNKNOWN] = VK_RETURN; - keymap[DIKI_SPACE - DIKI_UNKNOWN] = VK_SPACE; - keymap[DIKI_BACKSPACE - DIKI_UNKNOWN] = VK_BACK; - keymap[DIKI_INSERT - DIKI_UNKNOWN] = VK_INSERT; - keymap[DIKI_DELETE - DIKI_UNKNOWN] = VK_DELETE; - keymap[DIKI_HOME - DIKI_UNKNOWN] = VK_HOME; - keymap[DIKI_END - DIKI_UNKNOWN] = VK_END; - keymap[DIKI_PAGE_UP - DIKI_UNKNOWN] = VK_PRIOR; - keymap[DIKI_PAGE_DOWN - DIKI_UNKNOWN] = VK_NEXT; - keymap[DIKI_CAPS_LOCK - DIKI_UNKNOWN] = VK_CAPITAL; - keymap[DIKI_NUM_LOCK - DIKI_UNKNOWN] = VK_NUMLOCK; - keymap[DIKI_SCROLL_LOCK - DIKI_UNKNOWN] = VK_SCROLL; - keymap[DIKI_PRINT - DIKI_UNKNOWN] = VK_PRINT; - keymap[DIKI_PAUSE - DIKI_UNKNOWN] = VK_PAUSE; - keymap[DIKI_KP_DIV - DIKI_UNKNOWN] = VK_DIVIDE; - keymap[DIKI_KP_MULT - DIKI_UNKNOWN] = VK_MULTIPLY; - keymap[DIKI_KP_MINUS - DIKI_UNKNOWN] = VK_SUBTRACT; - keymap[DIKI_KP_PLUS - DIKI_UNKNOWN] = VK_ADD; - keymap[DIKI_KP_ENTER - DIKI_UNKNOWN] = VK_RETURN; - keymap[DIKI_KP_DECIMAL - DIKI_UNKNOWN] = VK_DECIMAL; - - keymap[DIKI_QUOTE_LEFT - DIKI_UNKNOWN] = VK_OEM_3; - keymap[DIKI_BRACKET_LEFT - DIKI_UNKNOWN] = VK_OEM_4; - keymap[DIKI_BRACKET_RIGHT - DIKI_UNKNOWN] = VK_OEM_6; - keymap[DIKI_BACKSLASH - DIKI_UNKNOWN] = VK_OEM_5; - keymap[DIKI_SEMICOLON - DIKI_UNKNOWN] = VK_OEM_1; - keymap[DIKI_QUOTE_RIGHT - DIKI_UNKNOWN] = VK_OEM_7; - keymap[DIKI_COMMA - DIKI_UNKNOWN] = VK_OEM_COMMA; - keymap[DIKI_PERIOD - DIKI_UNKNOWN] = VK_OEM_PERIOD; - keymap[DIKI_SLASH - DIKI_UNKNOWN] = VK_OEM_2; - - keymap[DIKI_LESS_SIGN - DIKI_UNKNOWN] = 0; - - keymap[DIKI_KP_0 - DIKI_UNKNOWN] = VK_NUMPAD0; - keymap[DIKI_KP_1 - DIKI_UNKNOWN] = VK_NUMPAD1; - keymap[DIKI_KP_2 - DIKI_UNKNOWN] = VK_NUMPAD2; - keymap[DIKI_KP_3 - DIKI_UNKNOWN] = VK_NUMPAD3; - keymap[DIKI_KP_4 - DIKI_UNKNOWN] = VK_NUMPAD4; - keymap[DIKI_KP_5 - DIKI_UNKNOWN] = VK_NUMPAD5; - keymap[DIKI_KP_6 - DIKI_UNKNOWN] = VK_NUMPAD6; - keymap[DIKI_KP_7 - DIKI_UNKNOWN] = VK_NUMPAD7; - keymap[DIKI_KP_8 - DIKI_UNKNOWN] = VK_NUMPAD8; - keymap[DIKI_KP_9 - DIKI_UNKNOWN] = VK_NUMPAD9; - - keymap[DIKI_META_L - DIKI_UNKNOWN] = VK_LWIN; - keymap[DIKI_META_R - DIKI_UNKNOWN] = VK_RWIN; - keymap[DIKI_SUPER_L - DIKI_UNKNOWN] = VK_APPS; - - ZeroMemory(functionmap, sizeof(functionmap)); - - functionmap[DFB_FUNCTION_KEY(23) - DFB_FUNCTION_KEY(0)] = VK_HANGUL; - functionmap[DFB_FUNCTION_KEY(24) - DFB_FUNCTION_KEY(0)] = VK_HANJA; - -} - -void df_send_mouse_button_event(rdpInput* input, BOOL down, UINT32 button, UINT16 x, UINT16 y) -{ - UINT16 flags; - - flags = (down) ? PTR_FLAGS_DOWN : 0; - - if (button == DIBI_LEFT) - flags |= PTR_FLAGS_BUTTON1; - else if (button == DIBI_RIGHT) - flags |= PTR_FLAGS_BUTTON2; - else if (button == DIBI_MIDDLE) - flags |= PTR_FLAGS_BUTTON3; - - if (flags != 0) - input->MouseEvent(input, flags, x, y); -} - -void df_send_mouse_motion_event(rdpInput* input, UINT16 x, UINT16 y) -{ - input->MouseEvent(input, PTR_FLAGS_MOVE, x, y); -} - -void df_send_mouse_wheel_event(rdpInput* input, INT16 axisrel, UINT16 x, UINT16 y) -{ - UINT16 flags = PTR_FLAGS_WHEEL; - - if (axisrel < 0) - flags |= 0x0078; - else - flags |= PTR_FLAGS_WHEEL_NEGATIVE | 0x0088; - - input->MouseEvent(input, flags, x, y); -} - -void df_send_keyboard_event(rdpInput* input, BOOL down, BYTE keycode, BYTE function) -{ - DWORD scancode = 0; - BYTE vkcode = VK_NONE; - - if (keycode) - vkcode = keymap[keycode]; - else if (function) - vkcode = functionmap[function]; - - if (vkcode != VK_NONE) - scancode = GetVirtualScanCodeFromVirtualKeyCode(vkcode, input->context->settings->KeyboardType); - - if (scancode) - freerdp_input_send_keyboard_event_ex(input, down, scancode); -} - -BOOL df_event_process(freerdp* instance, DFBEvent* event) -{ - int flags; - rdpGdi* gdi; - dfInfo* dfi; - int pointer_x; - int pointer_y; - DFBInputEvent* input_event; - - gdi = instance->context->gdi; - dfi = ((dfContext*) instance->context)->dfi; - - dfi->layer->GetCursorPosition(dfi->layer, &pointer_x, &pointer_y); - - if (event->clazz == DFEC_INPUT) - { - flags = 0; - input_event = (DFBInputEvent*) event; - - switch (input_event->type) - { - case DIET_AXISMOTION: - - if (pointer_x > (gdi->width - 1)) - pointer_x = gdi->width - 1; - - if (pointer_y > (gdi->height - 1)) - pointer_y = gdi->height - 1; - - if (input_event->axis == DIAI_Z) - { - df_send_mouse_wheel_event(instance->input, input_event->axisrel, pointer_x, pointer_y); - } - else - { - df_send_mouse_motion_event(instance->input, pointer_x, pointer_y); - } - break; - - case DIET_BUTTONPRESS: - df_send_mouse_button_event(instance->input, TRUE, input_event->button, pointer_x, pointer_y); - break; - - case DIET_BUTTONRELEASE: - df_send_mouse_button_event(instance->input, FALSE, input_event->button, pointer_x, pointer_y); - break; - - case DIET_KEYPRESS: - df_send_keyboard_event(instance->input, TRUE, input_event->key_id - DIKI_UNKNOWN, input_event->key_symbol - DFB_FUNCTION_KEY(0)); - break; - - case DIET_KEYRELEASE: - df_send_keyboard_event(instance->input, FALSE, input_event->key_id - DIKI_UNKNOWN, input_event->key_symbol - DFB_FUNCTION_KEY(0)); - break; - - case DIET_UNKNOWN: - break; - } - } - - return TRUE; -} diff --git a/client/DirectFB/df_event.h b/client/DirectFB/df_event.h deleted file mode 100644 index fc00674f3..000000000 --- a/client/DirectFB/df_event.h +++ /dev/null @@ -1,28 +0,0 @@ -/** - * FreeRDP: A Remote Desktop Protocol Implementation - * DirectFB Event Handling - * - * Copyright 2011 Marc-Andre Moreau - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef FREERDP_CLIENT_DF_EVENT_H -#define FREERDP_CLIENT_DF_EVENT_H - -#include "dfreerdp.h" - -void df_keyboard_init(void); -BOOL df_event_process(freerdp* instance, DFBEvent* event); - -#endif /* FREERDP_CLIENT_DF_EVENT_H */ diff --git a/client/DirectFB/df_graphics.c b/client/DirectFB/df_graphics.c deleted file mode 100644 index 3a20ab8fd..000000000 --- a/client/DirectFB/df_graphics.c +++ /dev/null @@ -1,139 +0,0 @@ -/** - * FreeRDP: A Remote Desktop Protocol Implementation - * DirectFB Graphical Objects - * - * Copyright 2011 Marc-Andre Moreau - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include - -#include "df_graphics.h" - -/* Pointer Class */ - -void df_Pointer_New(rdpContext* context, rdpPointer* pointer) -{ - dfInfo* dfi; - DFBResult result; - dfPointer* df_pointer; - DFBSurfaceDescription dsc; - - dfi = ((dfContext*) context)->dfi; - df_pointer = (dfPointer*) pointer; - - dsc.flags = DSDESC_CAPS | DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PIXELFORMAT; - dsc.caps = DSCAPS_SYSTEMONLY; - dsc.width = pointer->width; - dsc.height = pointer->height; - dsc.pixelformat = DSPF_ARGB; - - result = dfi->dfb->CreateSurface(dfi->dfb, &dsc, &(df_pointer->surface)); - - if (result == DFB_OK) - { - int pitch; - BYTE* point = NULL; - - df_pointer->xhot = pointer->xPos; - df_pointer->yhot = pointer->yPos; - - result = df_pointer->surface->Lock(df_pointer->surface, - DSLF_WRITE, (void**) &point, &pitch); - - if (result != DFB_OK) - { - DirectFBErrorFatal("Error while creating pointer surface", result); - return; - } - - if ((pointer->andMaskData != 0) && (pointer->xorMaskData != 0)) - { - freerdp_alpha_cursor_convert(point, pointer->xorMaskData, pointer->andMaskData, - pointer->width, pointer->height, pointer->xorBpp, dfi->clrconv); - } - - if (pointer->xorBpp > 24) - { - freerdp_image_swap_color_order(point, pointer->width, pointer->height); - } - - df_pointer->surface->Unlock(df_pointer->surface); - } -} - -void df_Pointer_Free(rdpContext* context, rdpPointer* pointer) -{ - dfPointer* df_pointer = (dfPointer*) pointer; - df_pointer->surface->Release(df_pointer->surface); -} - -void df_Pointer_Set(rdpContext* context, rdpPointer* pointer) -{ - dfInfo* dfi; - DFBResult result; - dfPointer* df_pointer; - - dfi = ((dfContext*) context)->dfi; - df_pointer = (dfPointer*) pointer; - - dfi->layer->SetCooperativeLevel(dfi->layer, DLSCL_ADMINISTRATIVE); - - dfi->layer->SetCursorOpacity(dfi->layer, df_pointer ? 255: 0); - - if(df_pointer != NULL) - { - result = dfi->layer->SetCursorShape(dfi->layer, - df_pointer->surface, df_pointer->xhot, df_pointer->yhot); - - if (result != DFB_OK) - { - DirectFBErrorFatal("SetCursorShape Error", result); - return; - } - } - - dfi->layer->SetCooperativeLevel(dfi->layer, DLSCL_SHARED); -} - -void df_Pointer_SetNull(rdpContext* context) -{ - df_Pointer_Set(context, NULL); -} - -void df_Pointer_SetDefault(rdpContext* context) -{ - -} - -/* Graphics Module */ - -void df_register_graphics(rdpGraphics* graphics) -{ - rdpPointer* pointer; - - pointer = (rdpPointer*) malloc(sizeof(rdpPointer)); - ZeroMemory(pointer, sizeof(rdpPointer)); - pointer->size = sizeof(dfPointer); - - pointer->New = df_Pointer_New; - pointer->Free = df_Pointer_Free; - pointer->Set = df_Pointer_Set; - pointer->SetNull = df_Pointer_SetNull; - pointer->SetDefault = df_Pointer_SetDefault; - - graphics_register_pointer(graphics, pointer); - free(pointer); -} - diff --git a/client/DirectFB/df_graphics.h b/client/DirectFB/df_graphics.h deleted file mode 100644 index bf9066843..000000000 --- a/client/DirectFB/df_graphics.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FreeRDP: A Remote Desktop Protocol Implementation - * DirectFB Graphical Objects - * - * Copyright 2011 Marc-Andre Moreau - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef FREERDP_CLIENT_DF_GRAPHICS_H -#define FREERDP_CLIENT_DF_GRAPHICS_H - -#include "dfreerdp.h" - -void df_register_graphics(rdpGraphics* graphics); - -#endif /* FREERDP_CLIENT_DF_GRAPHICS_H */ diff --git a/client/DirectFB/dfreerdp.c b/client/DirectFB/dfreerdp.c deleted file mode 100644 index 8e11b01ca..000000000 --- a/client/DirectFB/dfreerdp.c +++ /dev/null @@ -1,469 +0,0 @@ -/** - * FreeRDP: A Remote Desktop Protocol Implementation - * DirectFB Client - * - * Copyright 2011 Marc-Andre Moreau - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include -#include -#include - -#include -#include -#include - -#include -#include -#include -#include - -#include -#include - -#include "df_event.h" -#include "df_graphics.h" - -#include "dfreerdp.h" - -#include -#define TAG CLIENT_TAG("directFB") - -static HANDLE g_sem; -static int g_thread_count = 0; - -struct thread_data -{ - freerdp* instance; -}; - -BOOL df_context_new(freerdp* instance, rdpContext* context) -{ - return TRUE; -} - -void df_context_free(freerdp* instance, rdpContext* context) -{ -} - -void df_begin_paint(rdpContext* context) -{ - rdpGdi* gdi = context->gdi; - gdi->primary->hdc->hwnd->invalid->null = TRUE; -} - -void df_end_paint(rdpContext* context) -{ - rdpGdi* gdi; - dfInfo* dfi; - gdi = context->gdi; - dfi = ((dfContext*) context)->dfi; - - if (gdi->primary->hdc->hwnd->invalid->null) - return; - -#if 1 - dfi->update_rect.x = gdi->primary->hdc->hwnd->invalid->x; - dfi->update_rect.y = gdi->primary->hdc->hwnd->invalid->y; - dfi->update_rect.w = gdi->primary->hdc->hwnd->invalid->w; - dfi->update_rect.h = gdi->primary->hdc->hwnd->invalid->h; -#else - dfi->update_rect.x = 0; - dfi->update_rect.y = 0; - dfi->update_rect.w = gdi->width; - dfi->update_rect.h = gdi->height; -#endif - dfi->primary->Blit(dfi->primary, dfi->surface, &(dfi->update_rect), - dfi->update_rect.x, dfi->update_rect.y); -} - -BOOL df_get_fds(freerdp* instance, void** rfds, int* rcount, void** wfds, - int* wcount) -{ - dfInfo* dfi; - dfi = ((dfContext*) instance->context)->dfi; - rfds[*rcount] = (void*)(long)(dfi->read_fds); - (*rcount)++; - return TRUE; -} - -BOOL df_check_fds(freerdp* instance, fd_set* set) -{ - dfInfo* dfi; - dfi = ((dfContext*) instance->context)->dfi; - - if (!FD_ISSET(dfi->read_fds, set)) - return TRUE; - - if (read(dfi->read_fds, &(dfi->event), sizeof(dfi->event)) > 0) - df_event_process(instance, &(dfi->event)); - - return TRUE; -} - -BOOL df_pre_connect(freerdp* instance) -{ - dfInfo* dfi; - BOOL bitmap_cache; - dfContext* context; - rdpSettings* settings; - dfi = (dfInfo*) malloc(sizeof(dfInfo)); - ZeroMemory(dfi, sizeof(dfInfo)); - context = ((dfContext*) instance->context); - context->dfi = dfi; - settings = instance->settings; - bitmap_cache = settings->BitmapCacheEnabled; - settings->OrderSupport[NEG_DSTBLT_INDEX] = TRUE; - settings->OrderSupport[NEG_PATBLT_INDEX] = TRUE; - settings->OrderSupport[NEG_SCRBLT_INDEX] = TRUE; - settings->OrderSupport[NEG_OPAQUE_RECT_INDEX] = TRUE; - settings->OrderSupport[NEG_DRAWNINEGRID_INDEX] = FALSE; - settings->OrderSupport[NEG_MULTIDSTBLT_INDEX] = FALSE; - settings->OrderSupport[NEG_MULTIPATBLT_INDEX] = FALSE; - settings->OrderSupport[NEG_MULTISCRBLT_INDEX] = FALSE; - settings->OrderSupport[NEG_MULTIOPAQUERECT_INDEX] = TRUE; - settings->OrderSupport[NEG_MULTI_DRAWNINEGRID_INDEX] = FALSE; - settings->OrderSupport[NEG_LINETO_INDEX] = TRUE; - settings->OrderSupport[NEG_POLYLINE_INDEX] = TRUE; - settings->OrderSupport[NEG_MEMBLT_INDEX] = bitmap_cache; - settings->OrderSupport[NEG_MEM3BLT_INDEX] = FALSE; - settings->OrderSupport[NEG_MEMBLT_V2_INDEX] = bitmap_cache; - settings->OrderSupport[NEG_MEM3BLT_V2_INDEX] = FALSE; - settings->OrderSupport[NEG_SAVEBITMAP_INDEX] = FALSE; - settings->OrderSupport[NEG_GLYPH_INDEX_INDEX] = FALSE; - settings->OrderSupport[NEG_FAST_INDEX_INDEX] = FALSE; - settings->OrderSupport[NEG_FAST_GLYPH_INDEX] = FALSE; - settings->OrderSupport[NEG_POLYGON_SC_INDEX] = FALSE; - settings->OrderSupport[NEG_POLYGON_CB_INDEX] = FALSE; - settings->OrderSupport[NEG_ELLIPSE_SC_INDEX] = FALSE; - settings->OrderSupport[NEG_ELLIPSE_CB_INDEX] = FALSE; - dfi->clrconv = (CLRCONV*) malloc(sizeof(CLRCONV)); - ZeroMemory(dfi->clrconv, sizeof(CLRCONV)); - dfi->clrconv->alpha = 1; - dfi->clrconv->invert = 0; - dfi->clrconv->rgb555 = 0; - dfi->clrconv->palette = (rdpPalette*) malloc(sizeof(rdpPalette)); - ZeroMemory(dfi->clrconv->palette, sizeof(rdpPalette)); - return (instance->context->cache = cache_new(instance->settings)) != NULL; -} - -BOOL df_post_connect(freerdp* instance) -{ - rdpGdi* gdi; - dfInfo* dfi; - dfContext* context; - context = ((dfContext*) instance->context); - dfi = context->dfi; - - if (!gdi_init(instance, CLRCONV_ALPHA | CLRCONV_INVERT | CLRBUF_16BPP | - CLRBUF_32BPP, NULL)) - return FALSE; - - gdi = instance->context->gdi; - dfi->err = DirectFBCreate(&(dfi->dfb)); - dfi->dsc.flags = DSDESC_CAPS; - dfi->dsc.caps = DSCAPS_PRIMARY; - dfi->err = dfi->dfb->CreateSurface(dfi->dfb, &(dfi->dsc), &(dfi->primary)); - dfi->err = dfi->primary->GetSize(dfi->primary, &(gdi->width), &(gdi->height)); - dfi->dfb->SetVideoMode(dfi->dfb, gdi->width, gdi->height, gdi->dstBpp); - dfi->dfb->CreateInputEventBuffer(dfi->dfb, DICAPS_ALL, DFB_TRUE, - &(dfi->event_buffer)); - dfi->event_buffer->CreateFileDescriptor(dfi->event_buffer, &(dfi->read_fds)); - dfi->dfb->GetDisplayLayer(dfi->dfb, 0, &(dfi->layer)); - dfi->layer->EnableCursor(dfi->layer, 1); - dfi->dsc.flags = DSDESC_CAPS | DSDESC_WIDTH | DSDESC_HEIGHT | - DSDESC_PREALLOCATED | DSDESC_PIXELFORMAT; - dfi->dsc.caps = DSCAPS_SYSTEMONLY; - dfi->dsc.width = gdi->width; - dfi->dsc.height = gdi->height; - - if (gdi->dstBpp == 32 || gdi->dstBpp == 24) - dfi->dsc.pixelformat = DSPF_AiRGB; - else if (gdi->dstBpp == 16 || gdi->dstBpp == 15) - dfi->dsc.pixelformat = DSPF_RGB16; - else if (gdi->dstBpp == 8) - dfi->dsc.pixelformat = DSPF_RGB332; - else - dfi->dsc.pixelformat = DSPF_AiRGB; - - dfi->dsc.preallocated[0].data = gdi->primary_buffer; - dfi->dsc.preallocated[0].pitch = gdi->width * gdi->bytesPerPixel; - dfi->dfb->CreateSurface(dfi->dfb, &(dfi->dsc), &(dfi->surface)); - instance->update->BeginPaint = df_begin_paint; - instance->update->EndPaint = df_end_paint; - df_keyboard_init(); - df_register_graphics(instance->context->graphics); - return TRUE; -} - -BOOL df_verify_certificate(freerdp* instance, char* subject, char* issuer, - char* fingerprint) -{ - char answer; - WLog_INFO(TAG, "Certificate details:"); - WLog_INFO(TAG, "\tSubject: %s", subject); - WLog_INFO(TAG, "\tIssuer: %s", issuer); - WLog_INFO(TAG, "\tThumbprint: %s", fingerprint); - WLog_INFO(TAG, - "The above X.509 certificate could not be verified, possibly because you do not have " - "the CA certificate in your certificate store, or the certificate has expired. " - "Please look at the OpenSSL documentation on how to add a private CA to the store."); - - while (1) - { - WLog_INFO(TAG, "Do you trust the above certificate? (Y/N) "); - answer = fgetc(stdin); - - if (answer == 'y' || answer == 'Y') - { - return TRUE; - } - else if (answer == 'n' || answer == 'N') - { - break; - } - } - - return FALSE; -} - -static int df_receive_channel_data(freerdp* instance, UINT16 channelId, - BYTE* data, int size, int flags, int total_size) -{ - return freerdp_channels_data(instance, channelId, data, size, flags, - total_size); -} - -static void df_process_cb_monitor_ready_event(rdpChannels* channels, - freerdp* instance) -{ - wMessage* event; - RDP_CB_FORMAT_LIST_EVENT* format_list_event; - event = freerdp_event_new(CliprdrChannel_Class, CliprdrChannel_FormatList, NULL, - NULL); - format_list_event = (RDP_CB_FORMAT_LIST_EVENT*) event; - format_list_event->num_formats = 0; - freerdp_channels_send_event(channels, event); -} - -static void df_process_channel_event(rdpChannels* channels, freerdp* instance) -{ - wMessage* event; - event = freerdp_channels_pop_event(channels); - - if (event) - { - switch (GetMessageType(event->id)) - { - case CliprdrChannel_MonitorReady: - df_process_cb_monitor_ready_event(channels, instance); - break; - - default: - WLog_ERR(TAG, "df_process_channel_event: unknown event type %"PRIu32"", - GetMessageType(event->id)); - break; - } - - freerdp_event_free(event); - } -} - -static void df_free(dfInfo* dfi) -{ - dfi->dfb->Release(dfi->dfb); - free(dfi); -} - -int dfreerdp_run(freerdp* instance) -{ - int i; - int fds; - int max_fds; - int rcount; - int wcount; - void* rfds[32]; - void* wfds[32]; - fd_set rfds_set; - fd_set wfds_set; - dfInfo* dfi; - dfContext* context; - rdpChannels* channels; - ZeroMemory(rfds, sizeof(rfds)); - ZeroMemory(wfds, sizeof(wfds)); - - if (!freerdp_connect(instance)) - return 0; - - context = (dfContext*) instance->context; - dfi = context->dfi; - channels = instance->context->channels; - - while (1) - { - rcount = 0; - wcount = 0; - - if (freerdp_get_fds(instance, rfds, &rcount, wfds, &wcount) != TRUE) - { - WLog_ERR(TAG, "Failed to get FreeRDP file descriptor"); - break; - } - - if (freerdp_channels_get_fds(channels, instance, rfds, &rcount, wfds, - &wcount) != TRUE) - { - WLog_ERR(TAG, "Failed to get channel manager file descriptor"); - break; - } - - if (df_get_fds(instance, rfds, &rcount, wfds, &wcount) != TRUE) - { - WLog_ERR(TAG, "Failed to get dfreerdp file descriptor"); - break; - } - - max_fds = 0; - FD_ZERO(&rfds_set); - FD_ZERO(&wfds_set); - - for (i = 0; i < rcount; i++) - { - fds = (int)(long)(rfds[i]); - - if (fds > max_fds) - max_fds = fds; - - FD_SET(fds, &rfds_set); - } - - if (max_fds == 0) - break; - - if (select(max_fds + 1, &rfds_set, &wfds_set, NULL, NULL) == -1) - { - /* these are not really errors */ - if (!((errno == EAGAIN) || - (errno == EWOULDBLOCK) || - (errno == EINPROGRESS) || - (errno == EINTR))) /* signal occurred */ - { - WLog_ERR(TAG, "dfreerdp_run: select failed"); - break; - } - } - - if (freerdp_check_fds(instance) != TRUE) - { - WLog_ERR(TAG, "Failed to check FreeRDP file descriptor"); - break; - } - - if (df_check_fds(instance, &rfds_set) != TRUE) - { - WLog_ERR(TAG, "Failed to check dfreerdp file descriptor"); - break; - } - - if (freerdp_channels_check_fds(channels, instance) != TRUE) - { - WLog_ERR(TAG, "Failed to check channel manager file descriptor"); - break; - } - - df_process_channel_event(channels, instance); - } - - freerdp_disconnect(instance); - df_free(dfi); - gdi_free(instance); - freerdp_free(instance); - return 0; -} - -void* thread_func(void* param) -{ - struct thread_data* data; - data = (struct thread_data*) param; - dfreerdp_run(data->instance); - free(data); - pthread_detach(pthread_self()); - g_thread_count--; - - if (g_thread_count < 1) - ReleaseSemaphore(g_sem, 1, NULL); - - return NULL; -} - -int main(int argc, char* argv[]) -{ - int status; - pthread_t thread; - freerdp* instance; - dfContext* context; - rdpChannels* channels; - struct thread_data* data; - setlocale(LC_ALL, ""); - - if (!(g_sem = CreateSemaphore(NULL, 0, 1, NULL))) - { - WLog_ERR(TAG, "Failed to create semaphore"); - return 1; - } - - instance = freerdp_new(); - instance->PreConnect = df_pre_connect; - instance->PostConnect = df_post_connect; - instance->VerifyCertificate = df_verify_certificate; - instance->ReceiveChannelData = df_receive_channel_data; - instance->ContextSize = sizeof(dfContext); - instance->ContextNew = df_context_new; - instance->ContextFree = df_context_free; - - if (!freerdp_context_new(instance)) - { - WLog_ERR(TAG, "Failed to create FreeRDP context"); - return 1; - } - - context = (dfContext*) instance->context; - channels = instance->context->channels; - DirectFBInit(&argc, &argv); - instance->context->argc = argc; - instance->context->argv = argv; - status = freerdp_client_settings_parse_command_line(instance->settings, argc, - argv, FALSE); - - if (status < 0) - return 0; - - if (!freerdp_client_load_addins(instance->context->channels, - instance->settings)) - return -1; - - data = (struct thread_data*) malloc(sizeof(struct thread_data)); - ZeroMemory(data, sizeof(sizeof(struct thread_data))); - data->instance = instance; - g_thread_count++; - pthread_create(&thread, 0, thread_func, data); - - while (g_thread_count > 0) - { - WaitForSingleObject(g_sem, INFINITE); - } - - return 0; -} diff --git a/client/DirectFB/dfreerdp.h b/client/DirectFB/dfreerdp.h deleted file mode 100644 index 544619bf8..000000000 --- a/client/DirectFB/dfreerdp.h +++ /dev/null @@ -1,70 +0,0 @@ -/** - * FreeRDP: A Remote Desktop Protocol Implementation - * DirectFB Client - * - * Copyright 2011 Marc-Andre Moreau - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef FREERDP_CLIENT_DF_FREERDP_H -#define FREERDP_CLIENT_DF_FREERDP_H - -#include "config.h" -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -typedef struct df_info dfInfo; - -struct df_context -{ - rdpContext _p; - - dfInfo* dfi; - rdpSettings* settings; -}; -typedef struct df_context dfContext; - -struct df_pointer -{ - rdpPointer pointer; - IDirectFBSurface* surface; - UINT32 xhot; - UINT32 yhot; -}; -typedef struct df_pointer dfPointer; - -struct df_info -{ - int read_fds; - DFBResult err; - IDirectFB* dfb; - DFBEvent event; - HCLRCONV clrconv; - DFBRectangle update_rect; - DFBSurfaceDescription dsc; - IDirectFBSurface* primary; - IDirectFBSurface* surface; - IDirectFBDisplayLayer* layer; - IDirectFBEventBuffer* event_buffer; -}; - -#endif /* FREERDP_CLIENT_DF_FREERDP_H */ diff --git a/cmake/FindDirectFB.cmake b/cmake/FindDirectFB.cmake deleted file mode 100644 index 6fe24caef..000000000 --- a/cmake/FindDirectFB.cmake +++ /dev/null @@ -1,49 +0,0 @@ -# - Find DirectFB -# Find the DirectFB libraries -# -# This module defines the following variables: -# DIRECTFB_FOUND - true if DIRECTFB_INCLUDE_DIR & DIRECTFB_LIBRARY are found -# DIRECTFB_LIBRARIES - Set when DIRECTFB_LIBRARY is found -# DIRECTFB_INCLUDE_DIRS - Set when DIRECTFB_INCLUDE_DIR is found -# -# DIRECTFB_INCLUDE_DIR - where to find CUnit.h, etc. -# DIRECTFB_LIBRARY - the cunit library -# - -#============================================================================= -# Copyright 2011 O.S. Systems Software Ltda. -# Copyright 2011 Otavio Salvador -# Copyright 2011 Marc-Andre Moreau -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#============================================================================= - -find_path(DIRECTFB_INCLUDE_DIR NAMES directfb.h - PATH_SUFFIXES directfb - DOC "The directfb include directory" -) - -find_library(DIRECTFB_LIBRARY NAMES directfb - DOC "The DirectFB library" -) - -include(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(DirectFB DEFAULT_MSG DIRECTFB_LIBRARY DIRECTFB_INCLUDE_DIR) - -if(DIRECTFB_FOUND) - set( DIRECTFB_LIBRARIES ${DIRECTFB_LIBRARY} ) - set( DIRECTFB_INCLUDE_DIRS ${DIRECTFB_INCLUDE_DIR} ) -endif() - -mark_as_advanced(DIRECTFB_INCLUDE_DIR DIRECTFB_LIBRARY) - diff --git a/docs/README.directfb b/docs/README.directfb deleted file mode 100644 index db72c0e85..000000000 --- a/docs/README.directfb +++ /dev/null @@ -1,3 +0,0 @@ -The dfreerdp FreeRDP client is currently orphaned and unmaintained so please don't expect it to build and work without problems. - -If you are interested to update and maintain the dfreerdp client please let us know.